mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-15 04:15:28 +03:00
implemented jump into app code
This commit is contained in:
parent
dce248e404
commit
be9cd9f606
1 changed files with 50 additions and 1 deletions
|
@ -447,7 +447,56 @@ STM32DFU_protocol.prototype.upload_procedure = function(step) {
|
||||||
load_read_address();
|
load_read_address();
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
self.upload_procedure(99);
|
// jump to application code
|
||||||
|
function clear_before_leave() {
|
||||||
|
self.controlTransfer('out', self.request.CLRSTATUS, 0, 0, 0, 0, function() {
|
||||||
|
self.controlTransfer('out', self.request.CLRSTATUS, 0, 0, 0, 0, function() {
|
||||||
|
self.controlTransfer('in', self.request.GETSTATUS, 0, 0, 6, 0, function(data) {
|
||||||
|
if (data[4] == self.state.dfuIDLE) {
|
||||||
|
load_starting_address();
|
||||||
|
} else {
|
||||||
|
// throw some error
|
||||||
|
console.log(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var address = self.hex.data[0].address;
|
||||||
|
|
||||||
|
function load_starting_address() {
|
||||||
|
self.controlTransfer('out', self.request.DNLOAD, 0, 0, 0, [0x21, address, (address >> 8), (address >> 16), (address >> 24)], function() {
|
||||||
|
self.controlTransfer('in', self.request.GETSTATUS, 0, 0, 6, 0, function(data) {
|
||||||
|
if (data[4] == self.state.dfuDNBUSY || data[4] == self.state.dfuUPLOAD_IDLE) { // completely normal
|
||||||
|
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 || data[4] == self.state.dfuUPLOAD_IDLE) {
|
||||||
|
leave();
|
||||||
|
} else {
|
||||||
|
console.log(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, delay);
|
||||||
|
} else {
|
||||||
|
console.log(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function leave() {
|
||||||
|
self.controlTransfer('out', self.request.DNLOAD, 0, 0, 0, 0, function() {
|
||||||
|
self.controlTransfer('in', self.request.GETSTATUS, 0, 0, 6, 0, function(data) {
|
||||||
|
self.upload_procedure(99);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// start
|
||||||
|
clear_before_leave();
|
||||||
break;
|
break;
|
||||||
case 99:
|
case 99:
|
||||||
// cleanup
|
// cleanup
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue