mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-19 14:25:13 +03:00
servo tab uses chaner for MSP data
This commit is contained in:
parent
bea01945d2
commit
d158a9283c
3 changed files with 22 additions and 52 deletions
|
@ -1633,7 +1633,6 @@ var mspHelper = (function (gui) {
|
||||||
nextFunction();
|
nextFunction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function send_next_servo_configuration() {
|
function send_next_servo_configuration() {
|
||||||
|
|
||||||
var buffer = [];
|
var buffer = [];
|
||||||
|
@ -1676,25 +1675,6 @@ var mspHelper = (function (gui) {
|
||||||
}
|
}
|
||||||
MSP.send_message(MSPCodes.MSP_SET_SERVO_CONFIGURATION, buffer, false, nextFunction);
|
MSP.send_message(MSPCodes.MSP_SET_SERVO_CONFIGURATION, buffer, false, nextFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
//FIXME looks like this is not used and not ever implemented
|
|
||||||
//noinspection JSUnusedLocalSymbols
|
|
||||||
function send_channel_forwarding() {
|
|
||||||
|
|
||||||
var buffer = [];
|
|
||||||
|
|
||||||
for (var i = 0; i < SERVO_CONFIG.length; i++) {
|
|
||||||
var out = SERVO_CONFIG[i].indexOfChannelToForward;
|
|
||||||
if (out == undefined) {
|
|
||||||
out = 255; // Cleanflight defines "CHANNEL_FORWARDING_DISABLED" as "(uint8_t)0xFF"
|
|
||||||
}
|
|
||||||
buffer.push(out);
|
|
||||||
}
|
|
||||||
|
|
||||||
nextFunction = onCompleteCallback;
|
|
||||||
|
|
||||||
MSP.send_message(MSPCodes.MSP_SET_CHANNEL_FORWARDING, buffer, false, nextFunction);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
self.sendModeRanges = function (onCompleteCallback) {
|
self.sendModeRanges = function (onCompleteCallback) {
|
||||||
|
@ -2480,5 +2460,9 @@ var mspHelper = (function (gui) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
self.loadServoConfiguration = function (callback) {
|
||||||
|
MSP.send_message(MSPCodes.MSP_SERVO_CONFIGURATIONS, false, false, callback);
|
||||||
|
};
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
})(GUI);
|
})(GUI);
|
||||||
|
|
|
@ -21,7 +21,7 @@ var MSPChainerClass = function () {
|
||||||
self.chainIndex++;
|
self.chainIndex++;
|
||||||
if (self.chain[self.chainIndex]) {
|
if (self.chain[self.chainIndex]) {
|
||||||
self.chain[self.chainIndex](self.returnCallback);
|
self.chain[self.chainIndex](self.returnCallback);
|
||||||
} else {
|
} else if (self.exitPoint) {
|
||||||
self.exitPoint();
|
self.exitPoint();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,28 +9,29 @@ TABS.servos.initialize = function (callback) {
|
||||||
googleAnalytics.sendAppView('Servos');
|
googleAnalytics.sendAppView('Servos');
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_servo_configurations() {
|
var loadChainer = new MSPChainerClass();
|
||||||
MSP.send_message(MSPCodes.MSP_SERVO_CONFIGURATIONS, false, false, get_servo_mix_rules);
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_servo_mix_rules() {
|
loadChainer.setChain([
|
||||||
MSP.send_message(MSPCodes.MSP_SERVO_MIX_RULES, false, false, get_rc_data);
|
mspHelper.loadServoConfiguration,
|
||||||
}
|
mspHelper.loadRcData
|
||||||
|
]);
|
||||||
|
loadChainer.setExitPoint(load_html);
|
||||||
|
loadChainer.execute();
|
||||||
|
|
||||||
function get_rc_data() {
|
var saveChainer = new MSPChainerClass();
|
||||||
MSP.send_message(MSPCodes.MSP_RC, false, false, get_boxnames_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_boxnames_data() {
|
saveChainer.setChain([
|
||||||
MSP.send_message(MSPCodes.MSP_BOXNAMES, false, false, load_html);
|
mspHelper.sendServoConfigurations,
|
||||||
}
|
mspHelper.saveToEeprom
|
||||||
|
]);
|
||||||
|
saveChainer.setExitPoint(function () {
|
||||||
|
GUI.log(chrome.i18n.getMessage('servosEepromSave'));
|
||||||
|
});
|
||||||
|
|
||||||
function load_html() {
|
function load_html() {
|
||||||
$('#content').load("./tabs/servos.html", process_html);
|
$('#content').load("./tabs/servos.html", process_html);
|
||||||
}
|
}
|
||||||
|
|
||||||
get_servo_configurations();
|
|
||||||
|
|
||||||
function update_ui() {
|
function update_ui() {
|
||||||
|
|
||||||
var i,
|
var i,
|
||||||
|
@ -120,23 +121,8 @@ TABS.servos.initialize = function (callback) {
|
||||||
SERVO_CONFIG[info.obj].rate = parseInt($('.direction select', this).val());
|
SERVO_CONFIG[info.obj].rate = parseInt($('.direction select', this).val());
|
||||||
});
|
});
|
||||||
|
|
||||||
//
|
//Save configuration to FC
|
||||||
// send data to FC
|
saveChainer.execute();
|
||||||
//
|
|
||||||
//FIXME investigate why the same frame is sent twice
|
|
||||||
mspHelper.sendServoConfigurations(send_servo_mixer_rules);
|
|
||||||
|
|
||||||
function send_servo_mixer_rules() {
|
|
||||||
mspHelper.sendServoConfigurations(save_to_eeprom);
|
|
||||||
}
|
|
||||||
|
|
||||||
function save_to_eeprom() {
|
|
||||||
if (save_configuration_to_eeprom) {
|
|
||||||
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, function () {
|
|
||||||
GUI.log(chrome.i18n.getMessage('servosEepromSave'));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue