mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-19 14:25:14 +03:00
bugfixes
This commit is contained in:
parent
eb694f866f
commit
bac9677d15
2 changed files with 18 additions and 20 deletions
|
@ -19,23 +19,25 @@ function read_hex_file(data) {
|
|||
var content = data[i].substr(9, byte_count);
|
||||
var checksum = parseInt(data[i].substr(9 + byte_count, 2), 16); // also converting from hex to decimal (this is a 2's complement value)
|
||||
|
||||
if (byte_count > 0) {
|
||||
var crc = (byte_count / 2) + parseInt(address.substr(0, 2), 16) + parseInt(address.substr(2, 2), 16) + record_type;
|
||||
for (var needle = 0; needle < byte_count; needle += 2) {
|
||||
var num = parseInt(content.substr(needle, 2), 16); // get one byte in hex and convert it to decimal
|
||||
raw_hex.push(num);
|
||||
if (record_type == 0x00) { // data record
|
||||
if (byte_count > 0) {
|
||||
var crc = (byte_count / 2) + parseInt(address.substr(0, 2), 16) + parseInt(address.substr(2, 2), 16) + record_type;
|
||||
for (var needle = 0; needle < byte_count; needle += 2) {
|
||||
var num = parseInt(content.substr(needle, 2), 16); // get one byte in hex and convert it to decimal
|
||||
raw_hex.push(num);
|
||||
|
||||
crc += num;
|
||||
bytes_total++;
|
||||
}
|
||||
|
||||
crc += num;
|
||||
bytes_total++;
|
||||
}
|
||||
|
||||
// change crc to 2's complement (same as checksum)
|
||||
crc = ~crc + 1;
|
||||
crc &= 0xFF;
|
||||
|
||||
// verify
|
||||
if (crc != checksum) {
|
||||
hexfile_valid = false;
|
||||
// change crc to 2's complement (same as checksum)
|
||||
crc = ~crc + 1;
|
||||
crc &= 0xFF;
|
||||
|
||||
// verify
|
||||
if (crc != checksum) {
|
||||
hexfile_valid = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,10 +113,6 @@ STM32_protocol.prototype.initialize = function() {
|
|||
}
|
||||
}, 1000);
|
||||
|
||||
// there seems to be 2 unwanted bytes in the parsed array, we will drop them now (WHY ???)
|
||||
this.hex_to_flash.shift();
|
||||
this.hex_to_flash.shift();
|
||||
|
||||
// first step
|
||||
if ($('input.updating').is(':checked')) {
|
||||
self.upload_procedure(0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue