mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-15 04:15:28 +03:00
callback based upload for restoring settings
This commit is contained in:
parent
f9087db785
commit
b9a09b38a0
1 changed files with 79 additions and 66 deletions
|
@ -194,9 +194,11 @@ function configuration_upload() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send over the PID changes
|
// Send over the PID changes
|
||||||
send_message(MSP_codes.MSP_SET_PID, PID_buffer_out);
|
send_message(MSP_codes.MSP_SET_PID, PID_buffer_out, false, function() {
|
||||||
|
rc_tuning();
|
||||||
|
});
|
||||||
|
|
||||||
|
var rc_tuning = function() {
|
||||||
// RC Tuning section
|
// RC Tuning section
|
||||||
var RC_tuning_buffer_out = new Array();
|
var RC_tuning_buffer_out = new Array();
|
||||||
RC_tuning_buffer_out[0] = parseInt(RC_tuning.RC_RATE * 100);
|
RC_tuning_buffer_out[0] = parseInt(RC_tuning.RC_RATE * 100);
|
||||||
|
@ -208,9 +210,12 @@ function configuration_upload() {
|
||||||
RC_tuning_buffer_out[6] = parseInt(RC_tuning.throttle_EXPO * 100);
|
RC_tuning_buffer_out[6] = parseInt(RC_tuning.throttle_EXPO * 100);
|
||||||
|
|
||||||
// Send over the RC_tuning changes
|
// Send over the RC_tuning changes
|
||||||
send_message(MSP_codes.MSP_SET_RC_TUNING, RC_tuning_buffer_out);
|
send_message(MSP_codes.MSP_SET_RC_TUNING, RC_tuning_buffer_out, false, function() {
|
||||||
|
aux();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var aux = function() {
|
||||||
// AUX section
|
// AUX section
|
||||||
var AUX_val_buffer_out = new Array();
|
var AUX_val_buffer_out = new Array();
|
||||||
|
|
||||||
|
@ -221,10 +226,14 @@ function configuration_upload() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send over the AUX changes
|
// Send over the AUX changes
|
||||||
send_message(MSP_codes.MSP_SET_BOX, AUX_val_buffer_out);
|
send_message(MSP_codes.MSP_SET_BOX, AUX_val_buffer_out, false, function() {
|
||||||
|
trim();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// Trim section
|
// Trim section
|
||||||
|
var trim = function() {
|
||||||
var buffer_out = new Array();
|
var buffer_out = new Array();
|
||||||
buffer_out[0] = lowByte(CONFIG.accelerometerTrims[0]);
|
buffer_out[0] = lowByte(CONFIG.accelerometerTrims[0]);
|
||||||
buffer_out[1] = highByte(CONFIG.accelerometerTrims[0]);
|
buffer_out[1] = highByte(CONFIG.accelerometerTrims[0]);
|
||||||
|
@ -232,8 +241,12 @@ function configuration_upload() {
|
||||||
buffer_out[3] = highByte(CONFIG.accelerometerTrims[1]);
|
buffer_out[3] = highByte(CONFIG.accelerometerTrims[1]);
|
||||||
|
|
||||||
// Send over the new trims
|
// Send over the new trims
|
||||||
send_message(MSP_codes.MSP_SET_ACC_TRIM, buffer_out);
|
send_message(MSP_codes.MSP_SET_ACC_TRIM, buffer_out, false, function() {
|
||||||
|
misc();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var misc = function() {
|
||||||
// MISC
|
// MISC
|
||||||
// we also have to fill the unsupported bytes
|
// we also have to fill the unsupported bytes
|
||||||
var buffer_out = new Array();
|
var buffer_out = new Array();
|
||||||
|
@ -261,9 +274,9 @@ function configuration_upload() {
|
||||||
buffer_out[21] = 0; // vbatlevel_crit (unused)
|
buffer_out[21] = 0; // vbatlevel_crit (unused)
|
||||||
|
|
||||||
// Send ove the new MISC
|
// Send ove the new MISC
|
||||||
send_message(MSP_codes.MSP_SET_MISC, buffer_out);
|
send_message(MSP_codes.MSP_SET_MISC, buffer_out, false, function() {
|
||||||
|
|
||||||
|
|
||||||
// Save changes to EEPROM
|
// Save changes to EEPROM
|
||||||
send_message(MSP_codes.MSP_EEPROM_WRITE, MSP_codes.MSP_EEPROM_WRITE);
|
send_message(MSP_codes.MSP_EEPROM_WRITE, MSP_codes.MSP_EEPROM_WRITE);
|
||||||
|
});
|
||||||
|
};
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue