Skip to content

Commit ace1df7

Browse files
Remove explicit mass erase to prevent DFU timeouts (v1.0.6)
1 parent b0261fd commit ace1df7

File tree

2 files changed

+6
-27
lines changed

2 files changed

+6
-27
lines changed

web-flasher/dfu.js

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -253,31 +253,10 @@ class DFUDevice {
253253

254254
// Set address to flash start
255255
await this.setAddress(this.startAddress);
256-
progressCallback({ stage: 'erase', percent: 5, message: 'Erasing flash...' });
257-
258-
// Mass erase (0x41 at address 0x08000000)
259-
await this.erase(this.startAddress);
260-
progressCallback({ stage: 'erase', percent: 10, message: 'Flash erased' });
261-
262-
// Wait a moment for the device to stabilize after mass erase
263-
await new Promise(resolve => setTimeout(resolve, 500));
264-
265-
// Check status to ensure we are still connected and ready
266-
try {
267-
const status = await this.getStatus();
268-
if (status.state === DFU_STATE.DFU_ERROR) {
269-
await this.clearStatus();
270-
}
271-
} catch (e) {
272-
console.warn('Status check failed between erase and write:', e);
273-
}
274-
275-
progressCallback({ stage: 'write', percent: 10, message: 'Preparing to write...' });
276-
277-
// Set address again for writing
278-
await this.setAddress(this.startAddress);
256+
257+
progressCallback({ stage: 'write', percent: 5, message: 'Writing firmware...' });
279258

280-
// Download firmware in chunks
259+
// Download firmware in chunks (implicit erase by bootloader)
281260
const totalBlocks = Math.ceil(firmwareData.byteLength / this.transferSize);
282261
let blockNum = 2; // Start at block 2 (0 and 1 used for commands)
283262

web-flasher/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,13 @@ <h4>Activity Log</h4>
125125
<p>Built with ❤️ using WebUSB API |
126126
<a href="https://github.com/willbearfruits/KarplusStrongMachine" target="_blank">View on GitHub</a> |
127127
<a href="README.md">Documentation</a> |
128-
<span class="version">Web Flasher v1.0.5</span>
128+
<span class="version">Web Flasher v1.0.6</span>
129129
</p>
130130
<p class="small">Requires Chrome/Chromium browser with WebUSB support</p>
131131
</footer>
132132
</div>
133133

134-
<script type="module" src="dfu.js?v=1.0.5"></script>
135-
<script type="module" src="flasher.js?v=1.0.5"></script>
134+
<script type="module" src="dfu.js?v=1.0.6"></script>
135+
<script type="module" src="flasher.js?v=1.0.6"></script>
136136
</body>
137137
</html>

0 commit comments

Comments
 (0)