Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next Version #228

Merged
merged 69 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
b48ee34
Update frontend (make web)
SciLor Oct 26, 2024
f68cf31
fix possible memory leaks
SciLor Oct 30, 2024
c3207f1
Merge branch 'develop' of https://github.com/toniebox-reverse-enginee…
SciLor Oct 30, 2024
df0a7a8
Update frontend (make web)
SciLor Nov 2, 2024
a08ea18
Update frontend (make web)
SciLor Nov 4, 2024
162382c
fix compiler warnings for __XC32 and freeBSD
SciLor Nov 4, 2024
b395dbf
Detect machine arch using uname
mfechner Nov 4, 2024
42d4d15
Merge pull request #241 from mfechner/mfechner-patch-1
SciLor Nov 4, 2024
9f2bb00
Allow overwrite of versions retrieved by git command
mfechner Nov 5, 2024
a79123d
Merge pull request #243 from mfechner/mfechner-patch-2
SciLor Nov 5, 2024
72db896
Link libraries explicitly
Nov 4, 2024
d40f27d
upgrade ubuntu to latest
SciLor Nov 5, 2024
3a19e47
Merge branch 'develop' of https://github.com/toniebox-reverse-enginee…
SciLor Nov 5, 2024
6d8708e
try to fix PRIuTIME
SciLor Nov 5, 2024
302e7e1
revert ubuntu from 24.04 to 22.04
SciLor Nov 5, 2024
371e198
Update frontend (make web)
SciLor Nov 7, 2024
f489239
more logs for migration
SciLor Nov 9, 2024
6b8bba4
change debug level for buffer null terminator warnings
SciLor Nov 9, 2024
01f661a
unused content
SciLor Nov 9, 2024
682d494
add custom_img volume
SciLor Nov 9, 2024
fbceba1
Merge branch 'develop' of https://github.com/toniebox-reverse-enginee…
SciLor Nov 9, 2024
21ad3d1
had hde to file api for json
SciLor Nov 9, 2024
fcb9550
fix logic error in migrate
SciLor Nov 9, 2024
3d1afb9
gh-247 Update tonieboxes.json
henryk86 Nov 10, 2024
0a95c00
fix wrong type
SciLor Nov 10, 2024
6229c0f
Update frontend (make web)
SciLor Nov 11, 2024
8fc3de6
add /api/getFile/ca.der + /api/getFile/c2.der API
SciLor Nov 11, 2024
fabe8cf
Update frontend (make web)
SciLor Nov 12, 2024
98ff82b
Merge pull request #250 from henryk86/develop
SciLor Nov 12, 2024
629b4b7
Update frontend (make web)
SciLor Nov 12, 2024
7363c2b
fix encoding test
SciLor Nov 13, 2024
c0646c8
retain option for last will
SciLor Nov 13, 2024
69126ea
Update frontend (make web)
SciLor Nov 13, 2024
e3266ca
Update frontend (make web)
SciLor Nov 13, 2024
2d11e9e
possible fix for wrong memchr / strchar socketReceive
SciLor Nov 13, 2024
3b18467
Update frontend (make web)
SciLor Nov 13, 2024
32765b8
Update frontend (make web)
SciLor Nov 14, 2024
579c4e2
Update frontend (make web)
SciLor Nov 14, 2024
9a94cf6
revert huffer does not contain
SciLor Nov 14, 2024
9930675
Merge branch 'develop' of https://github.com/toniebox-reverse-enginee…
SciLor Nov 14, 2024
aaf73d1
fix memory leaks
Nov 16, 2024
62661a5
fix 2 more leaks
Nov 16, 2024
f60cf83
allow cache URLs to be not defined yet
g3gg0 Nov 19, 2024
ab91b5b
process tonieboxes file and cache images
g3gg0 Nov 19, 2024
516cd3a
Update frontend (make web)
SciLor Nov 20, 2024
5817bb7
Merge pull request #242 from pepe82sh/FixNoSanitizers
SciLor Nov 20, 2024
7178316
Merge pull request #259 from rigomate/fixleaks
SciLor Nov 20, 2024
9a1bcbf
Update frontend (make web)
SciLor Nov 26, 2024
34b0c15
reduce buffer null warnings (attempt)
SciLor Nov 28, 2024
9f7d8ce
Merge branch 'develop' of https://github.com/toniebox-reverse-enginee…
SciLor Nov 28, 2024
8755c80
Don't disable mqtt by default on error
SciLor Nov 28, 2024
f095ee7
fix INT32_MAX getting out of bounds due to float conversion
g3gg0 Dec 8, 2024
c276e2f
Update docker-compose.yaml
Strubbl Dec 13, 2024
4a40078
remove dev from security mit
SciLor Dec 18, 2024
1d8d4f7
add filenames to readTrackPosition errors
SciLor Dec 18, 2024
a8791fa
Merge branch 'develop' of https://github.com/toniebox-reverse-enginee…
SciLor Dec 18, 2024
90519d8
add valid to fileIndexV2 API
SciLor Dec 18, 2024
a72d431
lower loglevel HA
SciLor Dec 18, 2024
67bc91e
Add TAF checks
SciLor Dec 18, 2024
afe6a66
added revvox esp32 flasher
g3gg0 Dec 18, 2024
939283e
added script to check and verifiy all server and client certificates
marco79cgn Dec 21, 2024
fac6888
Merge pull request #276 from marco79cgn/master
SciLor Dec 21, 2024
473c770
Update docker-compose.yaml
henryk86 Dec 23, 2024
aba13f4
Merge pull request #278 from henryk86/develop
SciLor Dec 25, 2024
b0e3c8d
Merge pull request #273 from Strubbl/patch-1
SciLor Dec 25, 2024
99b4a94
Update frontend (make web)
SciLor Dec 25, 2024
c28092b
the script checks and verifiies all server and client certificates (#…
marco79cgn Dec 29, 2024
018d8dc
unhide tags on RTNL messages
SciLor Jan 1, 2025
39b2f89
Update frontend (make web)
SciLor Jan 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
391 changes: 391 additions & 0 deletions contrib/data/www/web/esp32_tool.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,391 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ESP32 flash checker</title>
<style>
/* Dark Mode Styling */
body {
background-color: #121212;
color: #ffffff;
font-family: Arial, sans-serif;
}

h1 {
color: #f5f5f5;
text-align: center;
}

label {
color: #f5f5f5;
}

button {
background-color: #1f1f1f;
color: #ffffff;
border: 2px solid #333;
border-radius: 8px;
padding: 10px 15px;
cursor: pointer;
margin: 5px;
transition: background-color 0.3s, transform 0.3s;
}

button:disabled {
background-color: #555;
color: #999;
cursor: not-allowed;
}

button:hover:not(:disabled) {
background-color: #333;
transform: translateY(-2px);
}

button:active:not(:disabled) {
transform: translateY(0);
}

select {
background-color: #1f1f1f;
color: #ffffff;
border: 2px solid #333;
border-radius: 8px;
padding: 8px;
margin: 10px;
}

pre {
background-color: #1f1f1f;
color: #00ff00;
padding: 10px;
border: 1px solid #333;
border-radius: 8px;
overflow: auto;
margin-top: 20px;
}

#graphicsCanvas {
border: 1px solid #000;
}
</style>
</head>


<body>
<h1>ESP32 flash checker</h1>
<button id="connectButton">Open Serial Port</button>
<br>
<button id="syncButton" disabled="disabled" hidden="">Sync</button>
<br>
<button id="testButton" disabled="disabled" hidden="">Test reliability</button>
<button id="readMacButton" disabled="disabled" hidden="">Read MAC</button>
<button id="downloadStubButton" disabled="disabled" hidden="">Download Stub</button>
<button id="blankCheckButton" disabled="disabled" hidden="">Blank Check Flash</button>
<button id="readFlashButton" disabled="disabled" hidden="">Read Flash</button>
<pre id="output">Open serial port and this tool will automatically check flash</pre>

<div id="overlay"
style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); z-index: 1000;">
</div>
<div id="progressContainer"
style="display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 75%; background: #ccc; padding: 10px; border-radius: 8px; z-index: 1100;">
<div id="progressBar" style="width: 0%; height: 20px; background: #4caf50;"></div>
<div id="progressText" style="text-align: center; margin-top: 5px; color: #000000;"></div>
<div style="display: flex; flex-direction: column; align-items: center; justify-content: center;">
<canvas id="graphicsCanvas" hidden="" width="400" height="100"></canvas>
</div>
</div>

<script src="revvox_flasher.js"></script>

<script>
var currentAddress = 0;
const flasher = new RevvoxFlasher();

flasher.logDebug = logDebug;
flasher.logError = logError;
flasher.disconnected = () => {
document.getElementById('connectButton').disabled = false;
document.getElementById('syncButton').disabled = true;
document.getElementById('testButton').disabled = true;
document.getElementById('readMacButton').disabled = true;
document.getElementById('downloadStubButton').disabled = true;
document.getElementById('readFlashButton').disabled = true;
document.getElementById('blankCheckButton').disabled = true;
}

/**
* Updates the bar plot with averaged percentage values for memory blocks.
* @param {number} xPosition - The x-coordinate for the memory block bar (0 to 800).
* @param {number} percent - The current percentage value for the memory block.
*/
var lastMemoryBarPosition = { posX: -1, totalPercent: 0, count: 0 };

function updateMemoryBlockProgress(xPosition, percent) {
const ctx = graphicsCanvas.getContext('2d');
const barWidth = 1;
var posX = Math.floor(xPosition * graphicsCanvas.width / 100);

graphicsCanvas.removeAttribute("hidden");

if (lastMemoryBarPosition.posX != posX) {
if (lastMemoryBarPosition.posX == -1 || posX == 0) {
ctx.fillStyle = 'grey';
ctx.fillRect(0, 0, graphicsCanvas.width, graphicsCanvas.height);
}
lastMemoryBarPosition = { posX: posX, totalPercent: 0, count: 0 };
}

lastMemoryBarPosition.totalPercent += percent;
lastMemoryBarPosition.count += 1;

const averagePercent = lastMemoryBarPosition.totalPercent / lastMemoryBarPosition.count;
const barHeight = (averagePercent / 100) * graphicsCanvas.height;

ctx.clearRect(posX, 0, barWidth, graphicsCanvas.height);
ctx.fillStyle = 'blue';
ctx.fillRect(posX, graphicsCanvas.height - barHeight, barWidth, barHeight);

return averagePercent;
}

function logError(message) {
graphicsCanvas.setAttribute("hidden", "");

overlay.style.display = 'block';
progressBar.style.display = 'none';
progressContainer.style.display = 'block';

progressText.innerHTML = `<h1 style="color: red;">${message}</h1><br>`;

output.textContent += "\n";
output.textContent += "ERROR:\n";
output.textContent += message;
output.textContent += "\n";
}

function logDebug(message) {
output.textContent += `[Debug] ${message}\n`;
}

async function reliabilityTest() {

/* show progress bar */
overlay.style.display = 'block';
progressContainer.style.display = 'block';
progressBar.style.display = 'block';
progressText.innerHTML = `Reliability test`;

const cbr = (pct) => {
progressBar.style.width = `${pct}%`;
}
const ret = await flasher.testReliability(cbr);

/* hide progress bar */
overlay.style.display = 'none';
progressContainer.style.display = 'none';

return ret;
}

async function blankCheck() {

const blankUpdate = (currentAddress, startAddress, endAddress, blockSize, erasedBytes, erasedBytesTotal) => {
const progressPct = Math.min(100, (currentAddress / (endAddress - startAddress)) * 100);
const erasedPct = erasedBytesTotal * 100 / (currentAddress - startAddress);
const blockPct = (erasedBytes * 100 / blockSize);
const blockxPos = currentAddress * 100 / endAddress;

updateMemoryBlockProgress(blockxPos, blockPct);
progressBar.style.width = `${progressPct}%`;
if (currentAddress > 0) {
if (erasedPct >= 99) {
progressText.innerHTML = `<h1 style="color: red;">Your flash is empty</h1><br>`;
} else if (erasedPct > 90) {
progressText.innerHTML = `<h1 style="color: orange;">Your flash is partially erased</h1><br>`;
} else {
progressText.innerHTML = `<h1 style="color: green;">Your flash is fine</h1><br>`;
}
progressText.innerHTML += `Out of ${currentAddress} bytes, ${erasedBytesTotal} bytes were 0xFF, this is ${erasedPct.toFixed(2)}%`;
}
}

overlay.style.display = 'block';
progressContainer.style.display = 'block';

await flasher.blankCheck(blankUpdate);

overlay.style.display = 'none';
progressContainer.style.display = 'none';
}

document.getElementById('connectButton').addEventListener('contextmenu', async (event) => {
event.preventDefault();
const buttons = document.querySelectorAll("button[hidden]");
buttons.forEach((button) => {
button.removeAttribute("hidden");
});
flasher.devMode = true;
});

document.getElementById('connectButton').addEventListener('click', async () => {
output.textContent = ``;

try {
await flasher.openPort();
} catch (error) {

switch (error.name) {
case 'NotFoundError':
return;
case 'NetworkError':
logError('The selected port is not accessible or already in use.');
break;
case 'InvalidStateError':
logError('The port is in an invalid state and cannot be opened.');
break;
case 'SecurityError':
logError('Access to the serial port was denied due to security restrictions.');
break;
default:
logError(`An unexpected error occurred: ${error.message}`);
break;
}
return;
}
currentAddress = 0;

document.getElementById('connectButton').disabled = true;
document.getElementById('syncButton').disabled = false;

output.textContent += 'Serial port connected.\n';

if (!flasher.devMode) {
try {
await flasher.sync();
} catch (error) {
logError(`Synchronizing failed with error. ${error}`);
return;
}
output.textContent += `Device identified as ${flasher.chip.name}\n`;
document.getElementById('syncButton').disabled = true;
document.getElementById('testButton').disabled = false;
document.getElementById('readMacButton').disabled = false;
document.getElementById('downloadStubButton').disabled = false;

try {
if (!await reliabilityTest()) {
return;
}
} catch (error) {
logError(`Reliability check failed with error. ${error}`);
return;
}

try {
if (!await flasher.downloadStub()) {
return;
}
document.getElementById('readFlashButton').disabled = false;
document.getElementById('blankCheckButton').disabled = false;
} catch (error) {
logError(`Stub loading failed with error. ${error}`);
return;
}

try {
await blankCheck();
} catch (error) {
logError(`Blank check failed with error. ${error}`);
return;
}
}
});

document.getElementById('syncButton').addEventListener('click', async () => {
try {
await flasher.sync();
} catch (error) {
logError(`Synchronizing failed with error. ${error}`);
return;
}

output.textContent += `Device identified as ${flasher.chip.name}\n`;
document.getElementById('syncButton').disabled = true;
document.getElementById('testButton').disabled = false;
document.getElementById('readMacButton').disabled = false;
document.getElementById('downloadStubButton').disabled = false;
});

document.getElementById('testButton').addEventListener('click', async () => {
await reliabilityTest();
});

document.getElementById('readMacButton').addEventListener('click', async () => {
const mac = await flasher.readMac();
output.textContent += `MAC ${mac}\n`;
});

document.getElementById('downloadStubButton').addEventListener('click', async () => {
try {
await flasher.downloadStub();
} catch (error) {
logError(`Synchronizing failed with error. ${error}`);
return;
}
document.getElementById('readFlashButton').disabled = false;
document.getElementById('blankCheckButton').disabled = false;
});

document.getElementById('blankCheckButton').addEventListener('click', async () => {
await blankCheck();
});

document.getElementById('readFlashButton').addEventListener('click', async () => {

var rawData = await flasher.readFlash(currentAddress, 0x100);

const output = document.getElementById('output');
const bytes = new Uint8Array(rawData);
let hexdump = '';

if (currentAddress == 0) {
hexdump += `\nDumping flash content\n`;
hexdump += `-----------------------------------------------------------------------------\n`;
}

for (let row = 0; row < bytes.length; row += 16) {
const addressPart = (currentAddress + row).toString(16).padStart(8, '0');
const hexPart = Array.from(bytes.slice(row, row + 16))
.map(byte => byte.toString(16).padStart(2, '0'))
.join(' ');

const asciiPart = Array.from(bytes.slice(row, row + 16))
.map(byte => {
if (byte >= 0x20 && byte <= 0x7e) {
return String.fromCharCode(byte); // Printable characters
} else {
return '.'; // Non-printable characters
}
})
.join('');

hexdump += `${addressPart} ${hexPart.padEnd(48)} | ${asciiPart}\n`;
}

output.textContent += `${hexdump}`;

currentAddress += rawData.length;
});


</script>


</body>

</html>
Loading
Loading