diff --git a/js/stm32dfu.js b/js/stm32dfu.js index a8465a64..8abddc7a 100644 --- a/js/stm32dfu.js +++ b/js/stm32dfu.js @@ -374,26 +374,8 @@ STM32DFU_protocol.prototype.upload_procedure = function(step) { setTimeout(function() { if (data[4] != self.state.dfuUPLOAD_IDLE) { - self.controlTransfer('out', self.request.DNLOAD, 0, 0, 0, [0x21, address, (address >> 8), (address >> 16), (address >> 24)], function(result) { // problem on this call !! - self.controlTransfer('in', self.request.GETSTATUS, 0, 0, 6, 0, function(data) { - if (data[4] == self.state.dfuDNBUSY) { - var delay = data[1] | (data[2] << 8) | (data[3] << 16); - - setTimeout(function() { - self.controlTransfer('in', self.request.GETSTATUS, 0, 0, 6, 0, function(data) { - if (data[4] == self.state.dfuDNLOAD_IDLE) { - clear_status(); - } else { - console.log(data); - } - }); - }, delay); - } else if (data[4] == self.state.dfuUPLOAD_IDLE) { - read(); - } else { - console.log(data); - } - }); + self.loadAddress(address, function() { + clear_status(); }); } else { clear_status(function() {