From 21b0f447b68e8010cbb4b0a4045946f1f7e94e92 Mon Sep 17 00:00:00 2001 From: cTn Date: Sun, 8 Jun 2014 21:33:42 +0200 Subject: [PATCH] initial work on full erase --- js/stm32dfu.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/js/stm32dfu.js b/js/stm32dfu.js index 689380ef..e38cfdac 100644 --- a/js/stm32dfu.js +++ b/js/stm32dfu.js @@ -189,7 +189,22 @@ STM32DFU_protocol.prototype.upload_procedure = function(step) { }); break; case 3: - self.upload_procedure(99); + // full erase + self.controlTransfer('out', self.request.DNLOAD, 0, 0, 0, [0x41], function() { + self.controlTransfer('in', self.request.GETSTATUS, 0, 0, 6, 0, function(data) { + if (data[4] == self.state.dfuDNBUSY) { // completely normal + // calculate waiting delay from combining data 1 2 3 (3 bytes), wait then continue + + self.upload_procedure(99); + } else { + // throw some error + } + }); + }); + break; + case 4: + break; + case 5: break; case 99: // cleanup