mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-14 03:49:53 +03:00
MSP refactoring
This commit is contained in:
parent
3311093cb1
commit
18a00dedf8
26 changed files with 2431 additions and 2426 deletions
|
@ -13,35 +13,35 @@ function configuration_backup(callback) {
|
|||
};
|
||||
|
||||
var profileSpecificData = [
|
||||
MSP_codes.MSP_PID,
|
||||
MSP_codes.MSP_RC_TUNING,
|
||||
MSP_codes.MSP_ACC_TRIM,
|
||||
MSP_codes.MSP_SERVO_CONFIGURATIONS,
|
||||
MSP_codes.MSP_MODE_RANGES,
|
||||
MSP_codes.MSP_ADJUSTMENT_RANGES
|
||||
MSPCodes.MSP_PID,
|
||||
MSPCodes.MSP_RC_TUNING,
|
||||
MSPCodes.MSP_ACC_TRIM,
|
||||
MSPCodes.MSP_SERVO_CONFIGURATIONS,
|
||||
MSPCodes.MSP_MODE_RANGES,
|
||||
MSPCodes.MSP_ADJUSTMENT_RANGES
|
||||
];
|
||||
|
||||
function update_profile_specific_data_list() {
|
||||
if (semver.lt(CONFIG.apiVersion, "1.12.0")) {
|
||||
profileSpecificData.push(MSP_codes.MSP_CHANNEL_FORWARDING);
|
||||
profileSpecificData.push(MSPCodes.MSP_CHANNEL_FORWARDING);
|
||||
} else {
|
||||
profileSpecificData.push(MSP_codes.MSP_SERVO_MIX_RULES);
|
||||
profileSpecificData.push(MSPCodes.MSP_SERVO_MIX_RULES);
|
||||
}
|
||||
if (semver.gte(CONFIG.apiVersion, "1.15.0")) {
|
||||
profileSpecificData.push(MSP_codes.MSP_RC_DEADBAND);
|
||||
profileSpecificData.push(MSPCodes.MSP_RC_DEADBAND);
|
||||
}
|
||||
}
|
||||
|
||||
update_profile_specific_data_list();
|
||||
|
||||
MSP.send_message(MSP_codes.MSP_STATUS, false, false, function () {
|
||||
MSP.send_message(MSPCodes.MSP_STATUS, false, false, function () {
|
||||
activeProfile = CONFIG.profile;
|
||||
select_profile();
|
||||
});
|
||||
|
||||
function select_profile() {
|
||||
if (activeProfile > 0) {
|
||||
MSP.send_message(MSP_codes.MSP_SELECT_SETTING, [0], false, fetch_specific_data);
|
||||
MSP.send_message(MSPCodes.MSP_SELECT_SETTING, [0], false, fetch_specific_data);
|
||||
} else {
|
||||
fetch_specific_data();
|
||||
}
|
||||
|
@ -76,11 +76,11 @@ function configuration_backup(callback) {
|
|||
codeKey = 0;
|
||||
fetchingProfile++;
|
||||
|
||||
MSP.send_message(MSP_codes.MSP_SELECT_SETTING, [fetchingProfile], false, fetch_specific_data_item);
|
||||
MSP.send_message(MSPCodes.MSP_SELECT_SETTING, [fetchingProfile], false, fetch_specific_data_item);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
MSP.send_message(MSP_codes.MSP_SELECT_SETTING, [activeProfile], false, fetch_unique_data);
|
||||
MSP.send_message(MSPCodes.MSP_SELECT_SETTING, [activeProfile], false, fetch_unique_data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,30 +89,30 @@ function configuration_backup(callback) {
|
|||
}
|
||||
|
||||
var uniqueData = [
|
||||
MSP_codes.MSP_MISC,
|
||||
MSP_codes.MSP_RX_MAP,
|
||||
MSP_codes.MSP_BF_CONFIG,
|
||||
MSP_codes.MSP_CF_SERIAL_CONFIG,
|
||||
MSP_codes.MSP_LED_STRIP_CONFIG,
|
||||
MSP_codes.MSP_LED_COLORS
|
||||
MSPCodes.MSP_MISC,
|
||||
MSPCodes.MSP_RX_MAP,
|
||||
MSPCodes.MSP_BF_CONFIG,
|
||||
MSPCodes.MSP_CF_SERIAL_CONFIG,
|
||||
MSPCodes.MSP_LED_STRIP_CONFIG,
|
||||
MSPCodes.MSP_LED_COLORS
|
||||
];
|
||||
|
||||
function update_unique_data_list() {
|
||||
if (semver.gte(CONFIG.apiVersion, "1.8.0")) {
|
||||
uniqueData.push(MSP_codes.MSP_LOOP_TIME);
|
||||
uniqueData.push(MSP_codes.MSP_ARMING_CONFIG);
|
||||
uniqueData.push(MSPCodes.MSP_LOOP_TIME);
|
||||
uniqueData.push(MSPCodes.MSP_ARMING_CONFIG);
|
||||
}
|
||||
if (semver.gte(CONFIG.apiVersion, "1.14.0")) {
|
||||
uniqueData.push(MSP_codes.MSP_3D);
|
||||
uniqueData.push(MSPCodes.MSP_3D);
|
||||
}
|
||||
if (semver.gte(CONFIG.apiVersion, "1.15.0")) {
|
||||
uniqueData.push(MSP_codes.MSP_SENSOR_ALIGNMENT);
|
||||
uniqueData.push(MSP_codes.MSP_RX_CONFIG);
|
||||
uniqueData.push(MSP_codes.MSP_FAILSAFE_CONFIG);
|
||||
uniqueData.push(MSP_codes.MSP_RXFAIL_CONFIG);
|
||||
uniqueData.push(MSPCodes.MSP_SENSOR_ALIGNMENT);
|
||||
uniqueData.push(MSPCodes.MSP_RX_CONFIG);
|
||||
uniqueData.push(MSPCodes.MSP_FAILSAFE_CONFIG);
|
||||
uniqueData.push(MSPCodes.MSP_RXFAIL_CONFIG);
|
||||
}
|
||||
if (semver.gte(CONFIG.apiVersion, "1.19.0")) {
|
||||
uniqueData.push(MSP_codes.MSP_LED_STRIP_MODECOLOR);
|
||||
uniqueData.push(MSPCodes.MSP_LED_STRIP_MODECOLOR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -620,23 +620,23 @@ function configuration_restore(callback) {
|
|||
profilesN = 3;
|
||||
|
||||
var profileSpecificData = [
|
||||
MSP_codes.MSP_SET_PID,
|
||||
MSP_codes.MSP_SET_RC_TUNING,
|
||||
MSP_codes.MSP_SET_ACC_TRIM
|
||||
MSPCodes.MSP_SET_PID,
|
||||
MSPCodes.MSP_SET_RC_TUNING,
|
||||
MSPCodes.MSP_SET_ACC_TRIM
|
||||
];
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.15.0")) {
|
||||
profileSpecificData.push(MSP_codes.MSP_SET_RC_DEADBAND);
|
||||
profileSpecificData.push(MSPCodes.MSP_SET_RC_DEADBAND);
|
||||
}
|
||||
|
||||
MSP.send_message(MSP_codes.MSP_STATUS, false, false, function () {
|
||||
MSP.send_message(MSPCodes.MSP_STATUS, false, false, function () {
|
||||
activeProfile = CONFIG.profile;
|
||||
select_profile();
|
||||
});
|
||||
|
||||
function select_profile() {
|
||||
if (activeProfile > 0) {
|
||||
MSP.send_message(MSP_codes.MSP_SELECT_SETTING, [0], false, upload_specific_data);
|
||||
MSP.send_message(MSPCodes.MSP_SELECT_SETTING, [0], false, upload_specific_data);
|
||||
} else {
|
||||
upload_specific_data();
|
||||
}
|
||||
|
@ -659,7 +659,7 @@ function configuration_restore(callback) {
|
|||
}
|
||||
|
||||
function upload_using_specific_commands() {
|
||||
MSP.send_message(profileSpecificData[codeKey], MSP.crunch(profileSpecificData[codeKey]), false, function () {
|
||||
MSP.send_message(profileSpecificData[codeKey], mspHelper.crunch(profileSpecificData[codeKey]), false, function () {
|
||||
codeKey++;
|
||||
|
||||
if (codeKey < profileSpecificData.length) {
|
||||
|
@ -671,12 +671,12 @@ function configuration_restore(callback) {
|
|||
if (savingProfile < profilesN) {
|
||||
load_objects(savingProfile);
|
||||
|
||||
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, function () {
|
||||
MSP.send_message(MSP_codes.MSP_SELECT_SETTING, [savingProfile], false, upload_using_specific_commands);
|
||||
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, function () {
|
||||
MSP.send_message(MSPCodes.MSP_SELECT_SETTING, [savingProfile], false, upload_using_specific_commands);
|
||||
});
|
||||
} else {
|
||||
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, function () {
|
||||
MSP.send_message(MSP_codes.MSP_SELECT_SETTING, [activeProfile], false, upload_unique_data);
|
||||
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, function () {
|
||||
MSP.send_message(MSPCodes.MSP_SELECT_SETTING, [activeProfile], false, upload_unique_data);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -684,19 +684,19 @@ function configuration_restore(callback) {
|
|||
}
|
||||
|
||||
function upload_servo_mix_rules() {
|
||||
MSP.sendServoMixRules(upload_servo_configuration);
|
||||
mspHelper.sendServoMixRules(upload_servo_configuration);
|
||||
}
|
||||
|
||||
function upload_servo_configuration() {
|
||||
MSP.sendServoConfigurations(upload_mode_ranges);
|
||||
mspHelper.sendServoConfigurations(upload_mode_ranges);
|
||||
}
|
||||
|
||||
function upload_mode_ranges() {
|
||||
MSP.sendModeRanges(upload_adjustment_ranges);
|
||||
mspHelper.sendModeRanges(upload_adjustment_ranges);
|
||||
}
|
||||
|
||||
function upload_adjustment_ranges() {
|
||||
MSP.sendAdjustmentRanges(upload_using_specific_commands);
|
||||
mspHelper.sendAdjustmentRanges(upload_using_specific_commands);
|
||||
}
|
||||
// start uploading
|
||||
load_objects(0);
|
||||
|
@ -707,24 +707,24 @@ function configuration_restore(callback) {
|
|||
var codeKey = 0;
|
||||
|
||||
var uniqueData = [
|
||||
MSP_codes.MSP_SET_MISC,
|
||||
MSP_codes.MSP_SET_RX_MAP,
|
||||
MSP_codes.MSP_SET_BF_CONFIG,
|
||||
MSP_codes.MSP_SET_CF_SERIAL_CONFIG
|
||||
MSPCodes.MSP_SET_MISC,
|
||||
MSPCodes.MSP_SET_RX_MAP,
|
||||
MSPCodes.MSP_SET_BF_CONFIG,
|
||||
MSPCodes.MSP_SET_CF_SERIAL_CONFIG
|
||||
];
|
||||
|
||||
function update_unique_data_list() {
|
||||
if (semver.gte(CONFIG.apiVersion, "1.8.0")) {
|
||||
uniqueData.push(MSP_codes.MSP_SET_LOOP_TIME);
|
||||
uniqueData.push(MSP_codes.MSP_SET_ARMING_CONFIG);
|
||||
uniqueData.push(MSPCodes.MSP_SET_LOOP_TIME);
|
||||
uniqueData.push(MSPCodes.MSP_SET_ARMING_CONFIG);
|
||||
}
|
||||
if (semver.gte(CONFIG.apiVersion, "1.14.0")) {
|
||||
uniqueData.push(MSP_codes.MSP_SET_3D);
|
||||
uniqueData.push(MSPCodes.MSP_SET_3D);
|
||||
}
|
||||
if (semver.gte(CONFIG.apiVersion, "1.15.0")) {
|
||||
uniqueData.push(MSP_codes.MSP_SET_SENSOR_ALIGNMENT);
|
||||
uniqueData.push(MSP_codes.MSP_SET_RX_CONFIG);
|
||||
uniqueData.push(MSP_codes.MSP_SET_FAILSAFE_CONFIG);
|
||||
uniqueData.push(MSPCodes.MSP_SET_SENSOR_ALIGNMENT);
|
||||
uniqueData.push(MSPCodes.MSP_SET_RX_CONFIG);
|
||||
uniqueData.push(MSPCodes.MSP_SET_FAILSAFE_CONFIG);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -747,7 +747,7 @@ function configuration_restore(callback) {
|
|||
|
||||
function send_unique_data_item() {
|
||||
if (codeKey < uniqueData.length) {
|
||||
MSP.send_message(uniqueData[codeKey], MSP.crunch(uniqueData[codeKey]), false, function () {
|
||||
MSP.send_message(uniqueData[codeKey], mspHelper.crunch(uniqueData[codeKey]), false, function () {
|
||||
codeKey++;
|
||||
send_unique_data_item();
|
||||
});
|
||||
|
@ -765,37 +765,37 @@ function configuration_restore(callback) {
|
|||
}
|
||||
|
||||
function send_led_strip_config() {
|
||||
MSP.sendLedStripConfig(send_led_strip_colors);
|
||||
mspHelper.sendLedStripConfig(send_led_strip_colors);
|
||||
}
|
||||
|
||||
function send_led_strip_colors() {
|
||||
MSP.sendLedStripColors(send_led_strip_mode_colors);
|
||||
mspHelper.sendLedStripColors(send_led_strip_mode_colors);
|
||||
}
|
||||
|
||||
function send_led_strip_mode_colors() {
|
||||
if (semver.gte(CONFIG.apiVersion, "1.19.0"))
|
||||
MSP.sendLedStripModeColors(send_rxfail_config);
|
||||
mspHelper.sendLedStripModeColors(send_rxfail_config);
|
||||
else
|
||||
send_rxfail_config();
|
||||
}
|
||||
|
||||
function send_rxfail_config() {
|
||||
if (semver.gte(CONFIG.apiVersion, "1.15.0")) {
|
||||
MSP.sendRxFailConfig(save_to_eeprom);
|
||||
mspHelper.sendRxFailConfig(save_to_eeprom);
|
||||
} else {
|
||||
save_to_eeprom();
|
||||
}
|
||||
}
|
||||
|
||||
function save_to_eeprom() {
|
||||
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, reboot);
|
||||
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, reboot);
|
||||
}
|
||||
|
||||
function reboot() {
|
||||
GUI.log(chrome.i18n.getMessage('eeprom_saved_ok'));
|
||||
|
||||
GUI.tab_switch_cleanup(function() {
|
||||
MSP.send_message(MSP_codes.MSP_SET_REBOOT, false, false, reinitialize);
|
||||
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, reinitialize);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -803,7 +803,7 @@ function configuration_restore(callback) {
|
|||
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
||||
|
||||
GUI.timeout_add('waiting_for_bootup', function waiting_for_bootup() {
|
||||
MSP.send_message(MSP_codes.MSP_IDENT, false, false, function () {
|
||||
MSP.send_message(MSPCodes.MSP_IDENT, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('deviceReady'));
|
||||
|
||||
if (callback) callback();
|
||||
|
|
128
js/msp/MSPCodes.js
Normal file
128
js/msp/MSPCodes.js
Normal file
|
@ -0,0 +1,128 @@
|
|||
'use strict';
|
||||
|
||||
var MSPCodes = {
|
||||
MSP_API_VERSION: 1,
|
||||
MSP_FC_VARIANT: 2,
|
||||
MSP_FC_VERSION: 3,
|
||||
MSP_BOARD_INFO: 4,
|
||||
MSP_BUILD_INFO: 5,
|
||||
|
||||
MSP_INAV_PID: 6,
|
||||
MSP_SET_INAV_PID: 7,
|
||||
|
||||
// MSP commands for Cleanflight original features
|
||||
MSP_CHANNEL_FORWARDING: 32,
|
||||
MSP_SET_CHANNEL_FORWARDING: 33,
|
||||
MSP_MODE_RANGES: 34,
|
||||
MSP_SET_MODE_RANGE: 35,
|
||||
MSP_RX_CONFIG: 44,
|
||||
MSP_SET_RX_CONFIG: 45,
|
||||
MSP_LED_COLORS: 46,
|
||||
MSP_SET_LED_COLORS: 47,
|
||||
MSP_LED_STRIP_CONFIG: 48,
|
||||
MSP_SET_LED_STRIP_CONFIG: 49,
|
||||
MSP_ADJUSTMENT_RANGES: 52,
|
||||
MSP_SET_ADJUSTMENT_RANGE: 53,
|
||||
MSP_CF_SERIAL_CONFIG: 54,
|
||||
MSP_SET_CF_SERIAL_CONFIG: 55,
|
||||
MSP_SONAR: 58,
|
||||
MSP_PID_CONTROLLER: 59,
|
||||
MSP_SET_PID_CONTROLLER: 60,
|
||||
MSP_ARMING_CONFIG: 61,
|
||||
MSP_SET_ARMING_CONFIG: 62,
|
||||
MSP_DATAFLASH_SUMMARY: 70,
|
||||
MSP_DATAFLASH_READ: 71,
|
||||
MSP_DATAFLASH_ERASE: 72,
|
||||
MSP_LOOP_TIME: 73,
|
||||
MSP_SET_LOOP_TIME: 74,
|
||||
MSP_FAILSAFE_CONFIG: 75,
|
||||
MSP_SET_FAILSAFE_CONFIG: 76,
|
||||
MSP_RXFAIL_CONFIG: 77,
|
||||
MSP_SET_RXFAIL_CONFIG: 78,
|
||||
MSP_SDCARD_SUMMARY: 79,
|
||||
MSP_BLACKBOX_CONFIG: 80,
|
||||
MSP_SET_BLACKBOX_CONFIG: 81,
|
||||
MSP_TRANSPONDER_CONFIG: 82,
|
||||
MSP_SET_TRANSPONDER_CONFIG: 83,
|
||||
MSP_OSD_CONFIG: 84,
|
||||
|
||||
MSP_ADVANCED_CONFIG: 90,
|
||||
MSP_SET_ADVANCED_CONFIG: 91,
|
||||
MSP_FILTER_CONFIG: 92,
|
||||
MSP_SET_FILTER_CONFIG: 93,
|
||||
MSP_PID_ADVANCED: 94,
|
||||
MSP_SET_PID_ADVANCED: 95,
|
||||
|
||||
// Multiwii MSP commands
|
||||
MSP_IDENT: 100,
|
||||
MSP_STATUS: 101,
|
||||
MSP_RAW_IMU: 102,
|
||||
MSP_SERVO: 103,
|
||||
MSP_MOTOR: 104,
|
||||
MSP_RC: 105,
|
||||
MSP_RAW_GPS: 106,
|
||||
MSP_COMP_GPS: 107,
|
||||
MSP_ATTITUDE: 108,
|
||||
MSP_ALTITUDE: 109,
|
||||
MSP_ANALOG: 110,
|
||||
MSP_RC_TUNING: 111,
|
||||
MSP_PID: 112,
|
||||
MSP_BOX: 113,
|
||||
MSP_MISC: 114,
|
||||
MSP_MOTOR_PINS: 115,
|
||||
MSP_BOXNAMES: 116,
|
||||
MSP_PIDNAMES: 117,
|
||||
MSP_WP: 118,
|
||||
MSP_BOXIDS: 119,
|
||||
MSP_SERVO_CONFIGURATIONS: 120,
|
||||
MSP_3D: 124,
|
||||
MSP_RC_DEADBAND: 125,
|
||||
MSP_SENSOR_ALIGNMENT: 126,
|
||||
MSP_LED_STRIP_MODECOLOR:127,
|
||||
MSP_STATUS_EX: 150,
|
||||
|
||||
MSP_SET_RAW_RC: 200,
|
||||
MSP_SET_RAW_GPS: 201,
|
||||
MSP_SET_PID: 202,
|
||||
MSP_SET_BOX: 203,
|
||||
MSP_SET_RC_TUNING: 204,
|
||||
MSP_ACC_CALIBRATION: 205,
|
||||
MSP_MAG_CALIBRATION: 206,
|
||||
MSP_SET_MISC: 207,
|
||||
MSP_RESET_CONF: 208,
|
||||
MSP_SET_WP: 209,
|
||||
MSP_SELECT_SETTING: 210,
|
||||
MSP_SET_HEAD: 211,
|
||||
MSP_SET_SERVO_CONFIGURATION: 212,
|
||||
MSP_SET_MOTOR: 214,
|
||||
MSP_SET_3D: 217,
|
||||
MSP_SET_RC_DEADBAND: 218,
|
||||
MSP_SET_RESET_CURR_PID: 219,
|
||||
MSP_SET_SENSOR_ALIGNMENT: 220,
|
||||
MSP_SET_LED_STRIP_MODECOLOR:221,
|
||||
|
||||
// MSP_BIND: 240,
|
||||
|
||||
MSP_SERVO_MIX_RULES: 241,
|
||||
MSP_SET_SERVO_MIX_RULE: 242,
|
||||
|
||||
MSP_EEPROM_WRITE: 250,
|
||||
|
||||
MSP_DEBUGMSG: 253,
|
||||
MSP_DEBUG: 254,
|
||||
|
||||
// Additional baseflight commands that are not compatible with MultiWii
|
||||
MSP_UID: 160, // Unique device ID
|
||||
MSP_ACC_TRIM: 240, // get acc angle trim values
|
||||
MSP_SET_ACC_TRIM: 239, // set acc angle trim values
|
||||
MSP_GPS_SV_INFO: 164, // get Signal Strength
|
||||
MSP_GPSSTATISTICS: 166, // GPS statistics
|
||||
|
||||
// Additional private MSP for baseflight configurator (yes thats us \o/)
|
||||
MSP_RX_MAP: 64, // get channel map (also returns number of channels total)
|
||||
MSP_SET_RX_MAP: 65, // set rc map, numchannels to set comes from MSP_RX_MAP
|
||||
MSP_BF_CONFIG: 66, // baseflight-specific settings that aren't covered elsewhere
|
||||
MSP_SET_BF_CONFIG: 67, // baseflight-specific settings save
|
||||
MSP_SET_REBOOT: 68, // reboot settings
|
||||
MSP_BF_BUILD_INFO: 69 // build date as well as some space for future expansion
|
||||
};
|
1739
js/msp/MSPHelper.js
Normal file
1739
js/msp/MSPHelper.js
Normal file
File diff suppressed because it is too large
Load diff
|
@ -187,31 +187,31 @@ function onOpen(openInfo) {
|
|||
FC.resetState();
|
||||
|
||||
// request configuration data
|
||||
MSP.send_message(MSP_codes.MSP_API_VERSION, false, false, function () {
|
||||
MSP.send_message(MSPCodes.MSP_API_VERSION, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('apiVersionReceived', [CONFIG.apiVersion]));
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, CONFIGURATOR.apiVersionAccepted)) {
|
||||
|
||||
MSP.send_message(MSP_codes.MSP_FC_VARIANT, false, false, function () {
|
||||
MSP.send_message(MSPCodes.MSP_FC_VARIANT, false, false, function () {
|
||||
|
||||
MSP.send_message(MSP_codes.MSP_FC_VERSION, false, false, function () {
|
||||
MSP.send_message(MSPCodes.MSP_FC_VERSION, false, false, function () {
|
||||
|
||||
googleAnalytics.sendEvent('Firmware', 'Variant', CONFIG.flightControllerIdentifier + ',' + CONFIG.flightControllerVersion);
|
||||
GUI.log(chrome.i18n.getMessage('fcInfoReceived', [CONFIG.flightControllerIdentifier, CONFIG.flightControllerVersion]));
|
||||
|
||||
if (CONFIG.flightControllerIdentifier == 'INAV') {
|
||||
|
||||
MSP.send_message(MSP_codes.MSP_BUILD_INFO, false, false, function () {
|
||||
MSP.send_message(MSPCodes.MSP_BUILD_INFO, false, false, function () {
|
||||
|
||||
googleAnalytics.sendEvent('Firmware', 'Using', CONFIG.buildInfo);
|
||||
GUI.log(chrome.i18n.getMessage('buildInfoReceived', [CONFIG.buildInfo]));
|
||||
|
||||
MSP.send_message(MSP_codes.MSP_BOARD_INFO, false, false, function () {
|
||||
MSP.send_message(MSPCodes.MSP_BOARD_INFO, false, false, function () {
|
||||
|
||||
googleAnalytics.sendEvent('Board', 'Using', CONFIG.boardIdentifier + ',' + CONFIG.boardVersion);
|
||||
GUI.log(chrome.i18n.getMessage('boardInfoReceived', [CONFIG.boardIdentifier, CONFIG.boardVersion]));
|
||||
|
||||
MSP.send_message(MSP_codes.MSP_UID, false, false, function () {
|
||||
MSP.send_message(MSPCodes.MSP_UID, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('uniqueDeviceIdReceived', [CONFIG.uid[0].toString(16) + CONFIG.uid[1].toString(16) + CONFIG.uid[2].toString(16)]));
|
||||
|
||||
// continue as usually
|
||||
|
@ -269,12 +269,12 @@ function onConnect() {
|
|||
$('#tabs ul.mode-connected').show();
|
||||
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "1.2.0")) {
|
||||
MSP.send_message(MSP_codes.MSP_STATUS_EX, false, false);
|
||||
MSP.send_message(MSPCodes.MSP_STATUS_EX, false, false);
|
||||
} else {
|
||||
MSP.send_message(MSP_codes.MSP_STATUS, false, false);
|
||||
MSP.send_message(MSPCodes.MSP_STATUS, false, false);
|
||||
}
|
||||
|
||||
MSP.send_message(MSP_codes.MSP_DATAFLASH_SUMMARY, false, false);
|
||||
MSP.send_message(MSPCodes.MSP_DATAFLASH_SUMMARY, false, false);
|
||||
|
||||
$('#sensor-status').show();
|
||||
$('#portsinput').hide();
|
||||
|
@ -451,12 +451,12 @@ function update_live_status() {
|
|||
});
|
||||
|
||||
if (GUI.active_tab != 'cli') {
|
||||
MSP.send_message(MSP_codes.MSP_BOXNAMES, false, false);
|
||||
MSP.send_message(MSPCodes.MSP_BOXNAMES, false, false);
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "1.2.0"))
|
||||
MSP.send_message(MSP_codes.MSP_STATUS_EX, false, false);
|
||||
MSP.send_message(MSPCodes.MSP_STATUS_EX, false, false);
|
||||
else
|
||||
MSP.send_message(MSP_codes.MSP_STATUS, false, false);
|
||||
MSP.send_message(MSP_codes.MSP_ANALOG, false, false);
|
||||
MSP.send_message(MSPCodes.MSP_STATUS, false, false);
|
||||
MSP.send_message(MSPCodes.MSP_ANALOG, false, false);
|
||||
}
|
||||
|
||||
var active = ((Date.now() - MSP.analog_last_received_timestamp) < 300);
|
||||
|
|
|
@ -48,6 +48,8 @@
|
|||
<script type="text/javascript" src="./js/libraries/jquery.ba-throttle-debounce.min.js"></script>
|
||||
<script type="text/javascript" src="./js/libraries/inflection.min.js"></script>
|
||||
<script type="text/javascript" src="./js/injected_methods.js"></script>
|
||||
<script type="text/javascript" src="./js/msp/MSPCodes.js"></script>
|
||||
<script type="text/javascript" src="./js/msp/MSPHelper.js"></script>
|
||||
<script type="text/javascript" src="./js/port_handler.js"></script>
|
||||
<script type="text/javascript" src="./js/port_usage.js"></script>
|
||||
<script type="text/javascript" src="./js/serial.js"></script>
|
||||
|
|
2
main.js
2
main.js
|
@ -354,7 +354,7 @@ $(document).ready(function () {
|
|||
|
||||
profile_e.change(function () {
|
||||
var profile = parseInt($(this).val());
|
||||
MSP.send_message(MSP_codes.MSP_SELECT_SETTING, [profile], false, function () {
|
||||
MSP.send_message(MSPCodes.MSP_SELECT_SETTING, [profile], false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('pidTuningLoadedProfile', [profile + 1]));
|
||||
updateActivatedTab();
|
||||
});
|
||||
|
|
|
@ -9,22 +9,22 @@ TABS.adjustments.initialize = function (callback) {
|
|||
googleAnalytics.sendAppView('Adjustments');
|
||||
|
||||
function get_adjustment_ranges() {
|
||||
MSP.send_message(MSP_codes.MSP_ADJUSTMENT_RANGES, false, false, get_box_ids);
|
||||
MSP.send_message(MSPCodes.MSP_ADJUSTMENT_RANGES, false, false, get_box_ids);
|
||||
}
|
||||
|
||||
function get_box_ids() {
|
||||
MSP.send_message(MSP_codes.MSP_BOXIDS, false, false, get_rc_data);
|
||||
MSP.send_message(MSPCodes.MSP_BOXIDS, false, false, get_rc_data);
|
||||
}
|
||||
|
||||
function get_rc_data() {
|
||||
MSP.send_message(MSP_codes.MSP_RC, false, false, load_html);
|
||||
MSP.send_message(MSPCodes.MSP_RC, false, false, load_html);
|
||||
}
|
||||
|
||||
function load_html() {
|
||||
$('#content').load("./tabs/adjustments.html", process_html);
|
||||
}
|
||||
|
||||
MSP.send_message(MSP_codes.MSP_BOXNAMES, false, false, get_adjustment_ranges);
|
||||
MSP.send_message(MSPCodes.MSP_BOXNAMES, false, false, get_adjustment_ranges);
|
||||
|
||||
function addAdjustment(adjustmentIndex, adjustmentRange, auxChannelCount) {
|
||||
|
||||
|
@ -230,10 +230,10 @@ TABS.adjustments.initialize = function (callback) {
|
|||
//
|
||||
// send data to FC
|
||||
//
|
||||
MSP.sendAdjustmentRanges(save_to_eeprom);
|
||||
mspHelper.sendAdjustmentRanges(save_to_eeprom);
|
||||
|
||||
function save_to_eeprom() {
|
||||
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, function () {
|
||||
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('adjustmentsEepromSaved'));
|
||||
});
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ TABS.adjustments.initialize = function (callback) {
|
|||
|
||||
// data pulling functions used inside interval timer
|
||||
function get_rc_data() {
|
||||
MSP.send_message(MSP_codes.MSP_RC, false, false, update_ui);
|
||||
MSP.send_message(MSPCodes.MSP_RC, false, false, update_ui);
|
||||
}
|
||||
|
||||
function update_ui() {
|
||||
|
@ -279,7 +279,7 @@ TABS.adjustments.initialize = function (callback) {
|
|||
|
||||
// status data pulled via separate timer with static speed
|
||||
GUI.interval_add('status_pull', function () {
|
||||
MSP.send_message(MSP_codes.MSP_STATUS);
|
||||
MSP.send_message(MSPCodes.MSP_STATUS);
|
||||
}, 250, true);
|
||||
|
||||
GUI.content_ready(callback);
|
||||
|
|
|
@ -8,22 +8,22 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
googleAnalytics.sendAppView('Auxiliary');
|
||||
|
||||
function get_mode_ranges() {
|
||||
MSP.send_message(MSP_codes.MSP_MODE_RANGES, false, false, get_box_ids);
|
||||
MSP.send_message(MSPCodes.MSP_MODE_RANGES, false, false, get_box_ids);
|
||||
}
|
||||
|
||||
function get_box_ids() {
|
||||
MSP.send_message(MSP_codes.MSP_BOXIDS, false, false, get_rc_data);
|
||||
MSP.send_message(MSPCodes.MSP_BOXIDS, false, false, get_rc_data);
|
||||
}
|
||||
|
||||
function get_rc_data() {
|
||||
MSP.send_message(MSP_codes.MSP_RC, false, false, load_html);
|
||||
MSP.send_message(MSPCodes.MSP_RC, false, false, load_html);
|
||||
}
|
||||
|
||||
function load_html() {
|
||||
$('#content').load("./tabs/auxiliary.html", process_html);
|
||||
}
|
||||
|
||||
MSP.send_message(MSP_codes.MSP_BOXNAMES, false, false, get_mode_ranges);
|
||||
MSP.send_message(MSPCodes.MSP_BOXNAMES, false, false, get_mode_ranges);
|
||||
|
||||
function createMode(modeIndex, modeId) {
|
||||
var modeTemplate = $('#tab-auxiliary-templates .mode');
|
||||
|
@ -216,7 +216,7 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
//
|
||||
// send data to FC
|
||||
//
|
||||
MSP.sendModeRanges(save_to_eeprom);
|
||||
mspHelper.sendModeRanges(save_to_eeprom);
|
||||
|
||||
/*
|
||||
* Send some data to analytics
|
||||
|
@ -227,7 +227,7 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function save_to_eeprom() {
|
||||
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, function () {
|
||||
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('auxiliaryEepromSaved'));
|
||||
});
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
|
||||
// data pulling functions used inside interval timer
|
||||
function get_rc_data() {
|
||||
MSP.send_message(MSP_codes.MSP_RC, false, false, update_ui);
|
||||
MSP.send_message(MSPCodes.MSP_RC, false, false, update_ui);
|
||||
}
|
||||
|
||||
function update_ui() {
|
||||
|
@ -292,7 +292,7 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
|
||||
// status data pulled via separate timer with static speed
|
||||
GUI.interval_add('status_pull', function () {
|
||||
MSP.send_message(MSP_codes.MSP_STATUS);
|
||||
MSP.send_message(MSPCodes.MSP_STATUS);
|
||||
}, 250, true);
|
||||
|
||||
GUI.content_ready(callback);
|
||||
|
|
|
@ -172,7 +172,7 @@ TABS.cli.read = function (readInfo) {
|
|||
} else {
|
||||
|
||||
GUI.timeout_add('waiting_for_bootup', function waiting_for_bootup() {
|
||||
MSP.send_message(MSP_codes.MSP_IDENT, false, false, function () {
|
||||
MSP.send_message(MSPCodes.MSP_IDENT, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('deviceReady'));
|
||||
if (!GUI.tab_switch_in_progress) {
|
||||
$('#tabs ul.mode-connected .tab_setup a').click();
|
||||
|
|
|
@ -11,30 +11,30 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
}
|
||||
|
||||
function load_config() {
|
||||
MSP.send_message(MSP_codes.MSP_BF_CONFIG, false, false, load_serial_config);
|
||||
MSP.send_message(MSPCodes.MSP_BF_CONFIG, false, false, load_serial_config);
|
||||
}
|
||||
|
||||
function load_serial_config() {
|
||||
var next_callback = load_rc_map;
|
||||
if (semver.lt(CONFIG.apiVersion, "1.6.0")) {
|
||||
MSP.send_message(MSP_codes.MSP_CF_SERIAL_CONFIG, false, false, next_callback);
|
||||
MSP.send_message(MSPCodes.MSP_CF_SERIAL_CONFIG, false, false, next_callback);
|
||||
} else {
|
||||
next_callback();
|
||||
}
|
||||
}
|
||||
|
||||
function load_rc_map() {
|
||||
MSP.send_message(MSP_codes.MSP_RX_MAP, false, false, load_misc);
|
||||
MSP.send_message(MSPCodes.MSP_RX_MAP, false, false, load_misc);
|
||||
}
|
||||
|
||||
function load_misc() {
|
||||
MSP.send_message(MSP_codes.MSP_MISC, false, false, load_arming_config);
|
||||
MSP.send_message(MSPCodes.MSP_MISC, false, false, load_arming_config);
|
||||
}
|
||||
|
||||
function load_arming_config() {
|
||||
var next_callback = load_loop_time;
|
||||
if (semver.gte(CONFIG.apiVersion, "1.8.0")) {
|
||||
MSP.send_message(MSP_codes.MSP_ARMING_CONFIG, false, false, next_callback);
|
||||
MSP.send_message(MSPCodes.MSP_ARMING_CONFIG, false, false, next_callback);
|
||||
} else {
|
||||
next_callback();
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
function load_loop_time() {
|
||||
var next_callback = load_rx_config;
|
||||
if (semver.gte(CONFIG.apiVersion, "1.8.0")) {
|
||||
MSP.send_message(MSP_codes.MSP_LOOP_TIME, false, false, next_callback);
|
||||
MSP.send_message(MSPCodes.MSP_LOOP_TIME, false, false, next_callback);
|
||||
} else {
|
||||
next_callback();
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
function load_rx_config() {
|
||||
var next_callback = load_3d;
|
||||
if (semver.gte(CONFIG.apiVersion, "1.21.0")) {
|
||||
MSP.send_message(MSP_codes.MSP_RX_CONFIG, false, false, next_callback);
|
||||
MSP.send_message(MSPCodes.MSP_RX_CONFIG, false, false, next_callback);
|
||||
} else {
|
||||
next_callback();
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
function load_3d() {
|
||||
var next_callback = load_sensor_alignment;
|
||||
if (semver.gte(CONFIG.apiVersion, "1.14.0")) {
|
||||
MSP.send_message(MSP_codes.MSP_3D, false, false, next_callback);
|
||||
MSP.send_message(MSPCodes.MSP_3D, false, false, next_callback);
|
||||
} else {
|
||||
next_callback();
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
function load_sensor_alignment() {
|
||||
var next_callback = loadAdvancedConfig;
|
||||
if (semver.gte(CONFIG.apiVersion, "1.15.0")) {
|
||||
MSP.send_message(MSP_codes.MSP_SENSOR_ALIGNMENT, false, false, next_callback);
|
||||
MSP.send_message(MSPCodes.MSP_SENSOR_ALIGNMENT, false, false, next_callback);
|
||||
} else {
|
||||
next_callback();
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
function loadAdvancedConfig() {
|
||||
var next_callback = loadINAVPidConfig;
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "1.3.0")) {
|
||||
MSP.send_message(MSP_codes.MSP_ADVANCED_CONFIG, false, false, next_callback);
|
||||
MSP.send_message(MSPCodes.MSP_ADVANCED_CONFIG, false, false, next_callback);
|
||||
} else {
|
||||
next_callback();
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
function loadINAVPidConfig() {
|
||||
var next_callback = load_html;
|
||||
if (semver.gt(CONFIG.flightControllerVersion, "1.3.0")) {
|
||||
MSP.send_message(MSP_codes.MSP_INAV_PID, false, false, next_callback);
|
||||
MSP.send_message(MSPCodes.MSP_INAV_PID, false, false, next_callback);
|
||||
} else {
|
||||
next_callback();
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
|
||||
//Update Analog/Battery Data
|
||||
function load_analog() {
|
||||
MSP.send_message(MSP_codes.MSP_ANALOG, false, false, function () {
|
||||
MSP.send_message(MSPCodes.MSP_ANALOG, false, false, function () {
|
||||
$('input[name="batteryvoltage"]').val([ANALOG.voltage.toFixed(1)]);
|
||||
$('input[name="batterycurrent"]').val([ANALOG.amperage.toFixed(2)]);
|
||||
});
|
||||
|
@ -106,7 +106,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
$('#content').load("./tabs/configuration.html", process_html);
|
||||
}
|
||||
|
||||
MSP.send_message(MSP_codes.MSP_IDENT, false, false, load_config);
|
||||
MSP.send_message(MSPCodes.MSP_IDENT, false, false, load_config);
|
||||
|
||||
function process_html() {
|
||||
|
||||
|
@ -708,20 +708,20 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
|
||||
function save_serial_config() {
|
||||
if (semver.lt(CONFIG.apiVersion, "1.6.0")) {
|
||||
MSP.send_message(MSP_codes.MSP_SET_CF_SERIAL_CONFIG, MSP.crunch(MSP_codes.MSP_SET_CF_SERIAL_CONFIG), false, save_misc);
|
||||
MSP.send_message(MSPCodes.MSP_SET_CF_SERIAL_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_CF_SERIAL_CONFIG), false, save_misc);
|
||||
} else {
|
||||
save_misc();
|
||||
}
|
||||
}
|
||||
|
||||
function save_misc() {
|
||||
MSP.send_message(MSP_codes.MSP_SET_MISC, MSP.crunch(MSP_codes.MSP_SET_MISC), false, save_3d);
|
||||
MSP.send_message(MSPCodes.MSP_SET_MISC, mspHelper.crunch(MSPCodes.MSP_SET_MISC), false, save_3d);
|
||||
}
|
||||
|
||||
function save_3d() {
|
||||
var next_callback = save_sensor_alignment;
|
||||
if(semver.gte(CONFIG.apiVersion, "1.14.0")) {
|
||||
MSP.send_message(MSP_codes.MSP_SET_3D, MSP.crunch(MSP_codes.MSP_SET_3D), false, next_callback);
|
||||
MSP.send_message(MSPCodes.MSP_SET_3D, mspHelper.crunch(MSPCodes.MSP_SET_3D), false, next_callback);
|
||||
} else {
|
||||
next_callback();
|
||||
}
|
||||
|
@ -730,29 +730,29 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
function save_sensor_alignment() {
|
||||
var next_callback = save_acc_trim;
|
||||
if(semver.gte(CONFIG.apiVersion, "1.15.0")) {
|
||||
MSP.send_message(MSP_codes.MSP_SET_SENSOR_ALIGNMENT, MSP.crunch(MSP_codes.MSP_SET_SENSOR_ALIGNMENT), false, next_callback);
|
||||
MSP.send_message(MSPCodes.MSP_SET_SENSOR_ALIGNMENT, mspHelper.crunch(MSPCodes.MSP_SET_SENSOR_ALIGNMENT), false, next_callback);
|
||||
} else {
|
||||
next_callback();
|
||||
}
|
||||
}
|
||||
|
||||
function save_acc_trim() {
|
||||
MSP.send_message(MSP_codes.MSP_SET_ACC_TRIM, MSP.crunch(MSP_codes.MSP_SET_ACC_TRIM), false
|
||||
MSP.send_message(MSPCodes.MSP_SET_ACC_TRIM, mspHelper.crunch(MSPCodes.MSP_SET_ACC_TRIM), false
|
||||
, semver.gte(CONFIG.apiVersion, "1.8.0") ? save_arming_config : save_to_eeprom);
|
||||
}
|
||||
|
||||
function save_arming_config() {
|
||||
MSP.send_message(MSP_codes.MSP_SET_ARMING_CONFIG, MSP.crunch(MSP_codes.MSP_SET_ARMING_CONFIG), false, save_looptime_config);
|
||||
MSP.send_message(MSPCodes.MSP_SET_ARMING_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_ARMING_CONFIG), false, save_looptime_config);
|
||||
}
|
||||
|
||||
function save_looptime_config() {
|
||||
MSP.send_message(MSP_codes.MSP_SET_LOOP_TIME, MSP.crunch(MSP_codes.MSP_SET_LOOP_TIME), false, save_rx_config);
|
||||
MSP.send_message(MSPCodes.MSP_SET_LOOP_TIME, mspHelper.crunch(MSPCodes.MSP_SET_LOOP_TIME), false, save_rx_config);
|
||||
}
|
||||
|
||||
function save_rx_config() {
|
||||
var next_callback = saveAdvancedConfig;
|
||||
if(semver.gte(CONFIG.apiVersion, "1.21.0")) {
|
||||
MSP.send_message(MSP_codes.MSP_SET_RX_CONFIG, MSP.crunch(MSP_codes.MSP_SET_RX_CONFIG), false, next_callback);
|
||||
MSP.send_message(MSPCodes.MSP_SET_RX_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_RX_CONFIG), false, next_callback);
|
||||
} else {
|
||||
next_callback();
|
||||
}
|
||||
|
@ -761,7 +761,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
function saveAdvancedConfig() {
|
||||
var next_callback = saveINAVPidConfig;
|
||||
if(semver.gte(CONFIG.flightControllerVersion, "1.3.0")) {
|
||||
MSP.send_message(MSP_codes.MSP_SET_ADVANCED_CONFIG, MSP.crunch(MSP_codes.MSP_SET_ADVANCED_CONFIG), false, next_callback);
|
||||
MSP.send_message(MSPCodes.MSP_SET_ADVANCED_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_ADVANCED_CONFIG), false, next_callback);
|
||||
} else {
|
||||
next_callback();
|
||||
}
|
||||
|
@ -770,21 +770,21 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
function saveINAVPidConfig() {
|
||||
var next_callback = save_to_eeprom;
|
||||
if(semver.gt(CONFIG.flightControllerVersion, "1.3.0")) {
|
||||
MSP.send_message(MSP_codes.MSP_SET_INAV_PID, MSP.crunch(MSP_codes.MSP_SET_INAV_PID), false, next_callback);
|
||||
MSP.send_message(MSPCodes.MSP_SET_INAV_PID, mspHelper.crunch(MSPCodes.MSP_SET_INAV_PID), false, next_callback);
|
||||
} else {
|
||||
next_callback();
|
||||
}
|
||||
}
|
||||
|
||||
function save_to_eeprom() {
|
||||
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, reboot);
|
||||
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, reboot);
|
||||
}
|
||||
|
||||
function reboot() {
|
||||
GUI.log(chrome.i18n.getMessage('configurationEepromSaved'));
|
||||
|
||||
GUI.tab_switch_cleanup(function() {
|
||||
MSP.send_message(MSP_codes.MSP_SET_REBOOT, false, false, reinitialize);
|
||||
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, reinitialize);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -799,7 +799,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
} else {
|
||||
|
||||
GUI.timeout_add('waiting_for_bootup', function waiting_for_bootup() {
|
||||
MSP.send_message(MSP_codes.MSP_IDENT, false, false, function () {
|
||||
MSP.send_message(MSPCodes.MSP_IDENT, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('deviceReady'));
|
||||
TABS.configuration.initialize(false, $('#content').scrollTop());
|
||||
});
|
||||
|
@ -807,12 +807,12 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
}
|
||||
}
|
||||
|
||||
MSP.send_message(MSP_codes.MSP_SET_BF_CONFIG, MSP.crunch(MSP_codes.MSP_SET_BF_CONFIG), false, save_serial_config);
|
||||
MSP.send_message(MSPCodes.MSP_SET_BF_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_BF_CONFIG), false, save_serial_config);
|
||||
});
|
||||
|
||||
// status data pulled via separate timer with static speed
|
||||
GUI.interval_add('status_pull', function status_pull() {
|
||||
MSP.send_message(MSP_codes.MSP_STATUS);
|
||||
MSP.send_message(MSPCodes.MSP_STATUS);
|
||||
}, 250, true);
|
||||
GUI.interval_add('config_load_analog', load_analog, 250, true); // 4 fps
|
||||
GUI.content_ready(callback);
|
||||
|
|
|
@ -11,40 +11,40 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
|
|||
}
|
||||
|
||||
function load_rx_config() {
|
||||
MSP.send_message(MSP_codes.MSP_RX_CONFIG, false, false, load_failssafe_config);
|
||||
MSP.send_message(MSPCodes.MSP_RX_CONFIG, false, false, load_failssafe_config);
|
||||
}
|
||||
|
||||
function load_failssafe_config() {
|
||||
MSP.send_message(MSP_codes.MSP_FAILSAFE_CONFIG, false, false, load_rxfail_config);
|
||||
MSP.send_message(MSPCodes.MSP_FAILSAFE_CONFIG, false, false, load_rxfail_config);
|
||||
}
|
||||
|
||||
function load_rxfail_config() {
|
||||
MSP.send_message(MSP_codes.MSP_RXFAIL_CONFIG, false, false, get_box_names);
|
||||
MSP.send_message(MSPCodes.MSP_RXFAIL_CONFIG, false, false, get_box_names);
|
||||
}
|
||||
|
||||
function get_box_names() {
|
||||
MSP.send_message(MSP_codes.MSP_BOXNAMES, false, false, get_mode_ranges);
|
||||
MSP.send_message(MSPCodes.MSP_BOXNAMES, false, false, get_mode_ranges);
|
||||
}
|
||||
|
||||
function get_mode_ranges() {
|
||||
MSP.send_message(MSP_codes.MSP_MODE_RANGES, false, false, get_box_ids);
|
||||
MSP.send_message(MSPCodes.MSP_MODE_RANGES, false, false, get_box_ids);
|
||||
}
|
||||
|
||||
function get_box_ids() {
|
||||
MSP.send_message(MSP_codes.MSP_BOXIDS, false, false, get_rc_data);
|
||||
MSP.send_message(MSPCodes.MSP_BOXIDS, false, false, get_rc_data);
|
||||
}
|
||||
|
||||
function get_rc_data() {
|
||||
MSP.send_message(MSP_codes.MSP_RC, false, false, load_config);
|
||||
MSP.send_message(MSPCodes.MSP_RC, false, false, load_config);
|
||||
}
|
||||
|
||||
// BEGIN Support for pre API version 1.15.0
|
||||
function load_config() {
|
||||
MSP.send_message(MSP_codes.MSP_BF_CONFIG, false, false, load_misc);
|
||||
MSP.send_message(MSPCodes.MSP_BF_CONFIG, false, false, load_misc);
|
||||
}
|
||||
|
||||
function load_misc() {
|
||||
MSP.send_message(MSP_codes.MSP_MISC, false, false, load_html);
|
||||
MSP.send_message(MSPCodes.MSP_MISC, false, false, load_html);
|
||||
}
|
||||
// END (Support for pre API version 1.15.0
|
||||
|
||||
|
@ -58,9 +58,9 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
|
|||
//apiVersionGte1_15_0 = false;
|
||||
|
||||
if(apiVersionGte1_15_0) {
|
||||
MSP.send_message(MSP_codes.MSP_IDENT, false, false, load_rx_config);
|
||||
MSP.send_message(MSPCodes.MSP_IDENT, false, false, load_rx_config);
|
||||
} else {
|
||||
MSP.send_message(MSP_codes.MSP_IDENT, false, false, load_config);
|
||||
MSP.send_message(MSPCodes.MSP_IDENT, false, false, load_config);
|
||||
}
|
||||
|
||||
function process_html() {
|
||||
|
@ -317,32 +317,32 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
|
|||
}
|
||||
|
||||
function save_failssafe_config() {
|
||||
MSP.send_message(MSP_codes.MSP_SET_FAILSAFE_CONFIG, MSP.crunch(MSP_codes.MSP_SET_FAILSAFE_CONFIG), false, save_rxfail_config);
|
||||
MSP.send_message(MSPCodes.MSP_SET_FAILSAFE_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_FAILSAFE_CONFIG), false, save_rxfail_config);
|
||||
}
|
||||
|
||||
function save_rxfail_config() {
|
||||
MSP.sendRxFailConfig(save_bf_config);
|
||||
mspHelper.sendRxFailConfig(save_bf_config);
|
||||
}
|
||||
|
||||
function save_bf_config() {
|
||||
MSP.send_message(MSP_codes.MSP_SET_BF_CONFIG, MSP.crunch(MSP_codes.MSP_SET_BF_CONFIG), false, save_to_eeprom);
|
||||
MSP.send_message(MSPCodes.MSP_SET_BF_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_BF_CONFIG), false, save_to_eeprom);
|
||||
}
|
||||
|
||||
// BEGIN pre API 1.15.0 save functions
|
||||
function save_misc() {
|
||||
MSP.send_message(MSP_codes.MSP_SET_MISC, MSP.crunch(MSP_codes.MSP_SET_MISC), false, save_to_eeprom);
|
||||
MSP.send_message(MSPCodes.MSP_SET_MISC, mspHelper.crunch(MSPCodes.MSP_SET_MISC), false, save_to_eeprom);
|
||||
}
|
||||
// END pre API 1.15.0 save functions
|
||||
|
||||
function save_to_eeprom() {
|
||||
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, reboot);
|
||||
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, reboot);
|
||||
}
|
||||
|
||||
function reboot() {
|
||||
GUI.log(chrome.i18n.getMessage('configurationEepromSaved'));
|
||||
|
||||
GUI.tab_switch_cleanup(function() {
|
||||
MSP.send_message(MSP_codes.MSP_SET_REBOOT, false, false, reinitialize);
|
||||
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, reinitialize);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -357,7 +357,7 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
|
|||
} else {
|
||||
|
||||
GUI.timeout_add('waiting_for_bootup', function waiting_for_bootup() {
|
||||
MSP.send_message(MSP_codes.MSP_IDENT, false, false, function () {
|
||||
MSP.send_message(MSPCodes.MSP_IDENT, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('deviceReady'));
|
||||
TABS.failsafe.initialize(false, $('#content').scrollTop());
|
||||
});
|
||||
|
@ -366,15 +366,15 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
|
|||
}
|
||||
|
||||
if(apiVersionGte1_15_0) {
|
||||
MSP.send_message(MSP_codes.MSP_SET_RX_CONFIG, MSP.crunch(MSP_codes.MSP_SET_RX_CONFIG), false, save_failssafe_config);
|
||||
MSP.send_message(MSPCodes.MSP_SET_RX_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_RX_CONFIG), false, save_failssafe_config);
|
||||
} else {
|
||||
MSP.send_message(MSP_codes.MSP_SET_BF_CONFIG, MSP.crunch(MSP_codes.MSP_SET_BF_CONFIG), false, save_misc);
|
||||
MSP.send_message(MSPCodes.MSP_SET_BF_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_BF_CONFIG), false, save_misc);
|
||||
}
|
||||
});
|
||||
|
||||
// status data pulled via separate timer with static speed
|
||||
GUI.interval_add('status_pull', function status_pull() {
|
||||
MSP.send_message(MSP_codes.MSP_STATUS);
|
||||
MSP.send_message(MSPCodes.MSP_STATUS);
|
||||
}, 250, true);
|
||||
|
||||
GUI.content_ready(callback);
|
||||
|
|
10
tabs/gps.js
10
tabs/gps.js
|
@ -13,7 +13,7 @@ TABS.gps.initialize = function (callback) {
|
|||
$('#content').load("./tabs/gps.html", process_html);
|
||||
}
|
||||
|
||||
MSP.send_message(MSP_codes.MSP_STATUS, false, false, load_html);
|
||||
MSP.send_message(MSPCodes.MSP_STATUS, false, false, load_html);
|
||||
|
||||
function set_online(){
|
||||
$('#connect').hide();
|
||||
|
@ -32,15 +32,15 @@ TABS.gps.initialize = function (callback) {
|
|||
localize();
|
||||
|
||||
function get_raw_gps_data() {
|
||||
MSP.send_message(MSP_codes.MSP_RAW_GPS, false, false, get_comp_gps_data);
|
||||
MSP.send_message(MSPCodes.MSP_RAW_GPS, false, false, get_comp_gps_data);
|
||||
}
|
||||
|
||||
function get_comp_gps_data() {
|
||||
MSP.send_message(MSP_codes.MSP_COMP_GPS, false, false, get_gpsstatistics_data);
|
||||
MSP.send_message(MSPCodes.MSP_COMP_GPS, false, false, get_gpsstatistics_data);
|
||||
}
|
||||
|
||||
function get_gpsstatistics_data() {
|
||||
MSP.send_message(MSP_codes.MSP_GPSSTATISTICS, false, false, update_ui);
|
||||
MSP.send_message(MSPCodes.MSP_GPSSTATISTICS, false, false, update_ui);
|
||||
}
|
||||
|
||||
function update_ui() {
|
||||
|
@ -113,7 +113,7 @@ TABS.gps.initialize = function (callback) {
|
|||
|
||||
// status data pulled via separate timer with static speed
|
||||
GUI.interval_add('status_pull', function status_pull() {
|
||||
MSP.send_message(MSP_codes.MSP_STATUS);
|
||||
MSP.send_message(MSPCodes.MSP_STATUS);
|
||||
}, 250, true);
|
||||
|
||||
|
||||
|
|
|
@ -29,16 +29,16 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
|
|||
}
|
||||
|
||||
function load_led_config() {
|
||||
MSP.send_message(MSP_codes.MSP_LED_STRIP_CONFIG, false, false, load_led_colors);
|
||||
MSP.send_message(MSPCodes.MSP_LED_STRIP_CONFIG, false, false, load_led_colors);
|
||||
}
|
||||
|
||||
function load_led_colors() {
|
||||
MSP.send_message(MSP_codes.MSP_LED_COLORS, false, false, load_led_mode_colors);
|
||||
MSP.send_message(MSPCodes.MSP_LED_COLORS, false, false, load_led_mode_colors);
|
||||
}
|
||||
|
||||
function load_led_mode_colors() {
|
||||
if (semver.gte(CONFIG.apiVersion, "1.19.0"))
|
||||
MSP.send_message(MSP_codes.MSP_LED_STRIP_MODECOLOR, false, false, load_html);
|
||||
MSP.send_message(MSPCodes.MSP_LED_STRIP_MODECOLOR, false, false, load_html);
|
||||
else
|
||||
load_html();
|
||||
}
|
||||
|
@ -542,21 +542,21 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
|
|||
|
||||
$('a.save').click(function () {
|
||||
|
||||
MSP.sendLedStripConfig(send_led_strip_colors);
|
||||
mspHelper.sendLedStripConfig(send_led_strip_colors);
|
||||
|
||||
function send_led_strip_colors() {
|
||||
MSP.sendLedStripColors(send_led_strip_mode_colors);
|
||||
mspHelper.sendLedStripColors(send_led_strip_mode_colors);
|
||||
}
|
||||
|
||||
function send_led_strip_mode_colors() {
|
||||
if (semver.gte(CONFIG.apiVersion, "1.19.0"))
|
||||
MSP.sendLedStripModeColors(save_to_eeprom);
|
||||
mspHelper.sendLedStripModeColors(save_to_eeprom);
|
||||
else
|
||||
save_to_eeprom();
|
||||
}
|
||||
|
||||
function save_to_eeprom() {
|
||||
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, function() {
|
||||
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, function() {
|
||||
GUI.log(chrome.i18n.getMessage('ledStripEepromSaved'));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -16,14 +16,14 @@ TABS.logging.initialize = function (callback) {
|
|||
|
||||
if (CONFIGURATOR.connectionValid) {
|
||||
var get_motor_data = function () {
|
||||
MSP.send_message(MSP_codes.MSP_MOTOR, false, false, load_html);
|
||||
MSP.send_message(MSPCodes.MSP_MOTOR, false, false, load_html);
|
||||
}
|
||||
|
||||
var load_html = function () {
|
||||
$('#content').load("./tabs/logging.html", process_html);
|
||||
}
|
||||
|
||||
MSP.send_message(MSP_codes.MSP_RC, false, false, get_motor_data);
|
||||
MSP.send_message(MSPCodes.MSP_RC, false, false, get_motor_data);
|
||||
}
|
||||
|
||||
function process_html() {
|
||||
|
@ -61,7 +61,7 @@ TABS.logging.initialize = function (callback) {
|
|||
|
||||
// request new
|
||||
for (var i = 0; i < requested_properties.length; i++, requests++) {
|
||||
MSP.send_message(MSP_codes[requested_properties[i]]);
|
||||
MSP.send_message(MSPCodes[requested_properties[i]]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,22 +12,22 @@ TABS.modes.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function get_box_data() {
|
||||
MSP.send_message(MSP_codes.MSP_BOX, false, false, get_box_ids);
|
||||
MSP.send_message(MSPCodes.MSP_BOX, false, false, get_box_ids);
|
||||
}
|
||||
|
||||
function get_box_ids() {
|
||||
MSP.send_message(MSP_codes.MSP_BOXIDS, false, false, get_rc_data);
|
||||
MSP.send_message(MSPCodes.MSP_BOXIDS, false, false, get_rc_data);
|
||||
}
|
||||
|
||||
function get_rc_data() {
|
||||
MSP.send_message(MSP_codes.MSP_RC, false, false, load_html);
|
||||
MSP.send_message(MSPCodes.MSP_RC, false, false, load_html);
|
||||
}
|
||||
|
||||
function load_html() {
|
||||
$('#content').load("./tabs/modes.html", process_html);
|
||||
}
|
||||
|
||||
MSP.send_message(MSP_codes.MSP_BOXNAMES, false, false, get_box_data);
|
||||
MSP.send_message(MSPCodes.MSP_BOXNAMES, false, false, get_box_data);
|
||||
|
||||
function process_html() {
|
||||
// generate heads according to RC count
|
||||
|
@ -87,12 +87,12 @@ TABS.modes.initialize = function (callback) {
|
|||
});
|
||||
|
||||
function save_to_eeprom() {
|
||||
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, function () {
|
||||
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('auxiliaryEepromSaved'));
|
||||
});
|
||||
}
|
||||
|
||||
MSP.send_message(MSP_codes.MSP_SET_BOX, MSP.crunch(MSP_codes.MSP_SET_BOX), false, save_to_eeprom);
|
||||
MSP.send_message(MSPCodes.MSP_SET_BOX, mspHelper.crunch(MSPCodes.MSP_SET_BOX), false, save_to_eeprom);
|
||||
});
|
||||
|
||||
// val = channel value
|
||||
|
@ -116,7 +116,7 @@ TABS.modes.initialize = function (callback) {
|
|||
|
||||
// data pulling functions used inside interval timer
|
||||
function get_rc_data() {
|
||||
MSP.send_message(MSP_codes.MSP_RC, false, false, update_ui);
|
||||
MSP.send_message(MSPCodes.MSP_RC, false, false, update_ui);
|
||||
}
|
||||
|
||||
function update_ui() {
|
||||
|
@ -146,7 +146,7 @@ TABS.modes.initialize = function (callback) {
|
|||
|
||||
// status data pulled via separate timer with static speed
|
||||
GUI.interval_add('status_pull', function status_pull() {
|
||||
MSP.send_message(MSP_codes.MSP_STATUS);
|
||||
MSP.send_message(MSPCodes.MSP_STATUS);
|
||||
}, 250, true);
|
||||
|
||||
GUI.content_ready(callback);
|
||||
|
|
|
@ -18,18 +18,18 @@ TABS.motors.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function get_arm_status() {
|
||||
MSP.send_message(MSP_codes.MSP_STATUS, false, false, load_config);
|
||||
MSP.send_message(MSPCodes.MSP_STATUS, false, false, load_config);
|
||||
}
|
||||
|
||||
function load_config() {
|
||||
MSP.send_message(MSP_codes.MSP_BF_CONFIG, false, false, load_3d);
|
||||
MSP.send_message(MSPCodes.MSP_BF_CONFIG, false, false, load_3d);
|
||||
}
|
||||
|
||||
function load_3d() {
|
||||
var next_callback = get_motor_data;
|
||||
if (semver.gte(CONFIG.apiVersion, "1.14.0")) {
|
||||
self.feature3DSupported = true;
|
||||
MSP.send_message(MSP_codes.MSP_3D, false, false, next_callback);
|
||||
MSP.send_message(MSPCodes.MSP_3D, false, false, next_callback);
|
||||
} else {
|
||||
next_callback();
|
||||
}
|
||||
|
@ -38,14 +38,14 @@ TABS.motors.initialize = function (callback) {
|
|||
|
||||
function get_motor_data() {
|
||||
update_arm_status();
|
||||
MSP.send_message(MSP_codes.MSP_MOTOR, false, false, load_html);
|
||||
MSP.send_message(MSPCodes.MSP_MOTOR, false, false, load_html);
|
||||
}
|
||||
|
||||
function load_html() {
|
||||
$('#content').load("./tabs/motors.html", process_html);
|
||||
}
|
||||
|
||||
MSP.send_message(MSP_codes.MSP_MISC, false, false, get_arm_status);
|
||||
MSP.send_message(MSPCodes.MSP_MISC, false, false, get_arm_status);
|
||||
|
||||
function update_arm_status() {
|
||||
self.armed = bit_check(CONFIG.mode, 0);
|
||||
|
@ -246,7 +246,7 @@ TABS.motors.initialize = function (callback) {
|
|||
GUI.interval_kill_all(['motor_and_status_pull']);
|
||||
|
||||
GUI.interval_add('IMU_pull', function imu_data_pull() {
|
||||
MSP.send_message(MSP_codes.MSP_RAW_IMU, false, false, update_accel_graph);
|
||||
MSP.send_message(MSPCodes.MSP_RAW_IMU, false, false, update_accel_graph);
|
||||
}, rate, true);
|
||||
|
||||
function update_accel_graph() {
|
||||
|
@ -366,7 +366,7 @@ TABS.motors.initialize = function (callback) {
|
|||
buffer_delay = setTimeout(function () {
|
||||
buffer = buffering_set_motor.pop();
|
||||
|
||||
MSP.send_message(MSP_codes.MSP_SET_MOTOR, buffer);
|
||||
MSP.send_message(MSPCodes.MSP_SET_MOTOR, buffer);
|
||||
|
||||
buffering_set_motor = [];
|
||||
buffer_delay = false;
|
||||
|
@ -456,15 +456,15 @@ TABS.motors.initialize = function (callback) {
|
|||
|
||||
function get_status() {
|
||||
// status needed for arming flag
|
||||
MSP.send_message(MSP_codes.MSP_STATUS, false, false, get_motor_data);
|
||||
MSP.send_message(MSPCodes.MSP_STATUS, false, false, get_motor_data);
|
||||
}
|
||||
|
||||
function get_motor_data() {
|
||||
MSP.send_message(MSP_codes.MSP_MOTOR, false, false, get_servo_data);
|
||||
MSP.send_message(MSPCodes.MSP_MOTOR, false, false, get_servo_data);
|
||||
}
|
||||
|
||||
function get_servo_data() {
|
||||
MSP.send_message(MSP_codes.MSP_SERVO, false, false, update_ui);
|
||||
MSP.send_message(MSPCodes.MSP_SERVO, false, false, update_ui);
|
||||
}
|
||||
|
||||
var full_block_scale = MISC.maxthrottle - MISC.mincommand;
|
||||
|
|
|
@ -17,11 +17,11 @@ TABS.onboard_logging.initialize = function (callback) {
|
|||
}
|
||||
|
||||
if (CONFIGURATOR.connectionValid) {
|
||||
MSP.send_message(MSP_codes.MSP_BF_CONFIG, false, false, function() {
|
||||
MSP.send_message(MSP_codes.MSP_DATAFLASH_SUMMARY, false, false, function() {
|
||||
MSP.send_message(MSPCodes.MSP_BF_CONFIG, false, false, function() {
|
||||
MSP.send_message(MSPCodes.MSP_DATAFLASH_SUMMARY, false, false, function() {
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "1.2.0")) {
|
||||
MSP.send_message(MSP_codes.MSP_SDCARD_SUMMARY, false, false, function() {
|
||||
MSP.send_message(MSP_codes.MSP_BLACKBOX_CONFIG, false, false, load_html);
|
||||
MSP.send_message(MSPCodes.MSP_SDCARD_SUMMARY, false, false, function() {
|
||||
MSP.send_message(MSPCodes.MSP_BLACKBOX_CONFIG, false, false, load_html);
|
||||
});
|
||||
} else {
|
||||
load_html();
|
||||
|
@ -38,14 +38,14 @@ TABS.onboard_logging.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function save_to_eeprom() {
|
||||
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, reboot);
|
||||
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, reboot);
|
||||
}
|
||||
|
||||
function reboot() {
|
||||
GUI.log(chrome.i18n.getMessage('configurationEepromSaved'));
|
||||
|
||||
GUI.tab_switch_cleanup(function() {
|
||||
MSP.send_message(MSP_codes.MSP_SET_REBOOT, false, false, reinitialize);
|
||||
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, reinitialize);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ TABS.onboard_logging.initialize = function (callback) {
|
|||
} else {
|
||||
|
||||
GUI.timeout_add('waiting_for_bootup', function waiting_for_bootup() {
|
||||
MSP.send_message(MSP_codes.MSP_IDENT, false, false, function () {
|
||||
MSP.send_message(MSPCodes.MSP_IDENT, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('deviceReady'));
|
||||
TABS.onboard_logging.initialize(false, $('#content').scrollTop());
|
||||
});
|
||||
|
@ -122,7 +122,7 @@ TABS.onboard_logging.initialize = function (callback) {
|
|||
BLACKBOX.blackboxRateDenom = parseInt(rate[1], 10);
|
||||
BLACKBOX.blackboxDevice = parseInt($(".blackboxDevice select").val(), 10);
|
||||
|
||||
MSP.sendBlackboxConfiguration(save_to_eeprom);
|
||||
mspHelper.sendBlackboxConfiguration(save_to_eeprom);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -271,7 +271,7 @@ TABS.onboard_logging.initialize = function (callback) {
|
|||
sdcardTimer = setTimeout(function() {
|
||||
sdcardTimer = false;
|
||||
if (CONFIGURATOR.connectionValid) {
|
||||
MSP.send_message(MSP_codes.MSP_SDCARD_SUMMARY, false, false, function() {
|
||||
MSP.send_message(MSPCodes.MSP_SDCARD_SUMMARY, false, false, function() {
|
||||
update_html();
|
||||
});
|
||||
}
|
||||
|
@ -311,7 +311,7 @@ TABS.onboard_logging.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function flash_update_summary(onDone) {
|
||||
MSP.send_message(MSP_codes.MSP_DATAFLASH_SUMMARY, false, false, function() {
|
||||
MSP.send_message(MSPCodes.MSP_DATAFLASH_SUMMARY, false, false, function() {
|
||||
update_html();
|
||||
|
||||
if (onDone) {
|
||||
|
@ -352,7 +352,7 @@ TABS.onboard_logging.initialize = function (callback) {
|
|||
mark_saving_dialog_done();
|
||||
}
|
||||
} else {
|
||||
MSP.dataflashRead(nextAddress, onChunkRead);
|
||||
mspHelper.dataflashRead(nextAddress, onChunkRead);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -363,12 +363,12 @@ TABS.onboard_logging.initialize = function (callback) {
|
|||
}
|
||||
} else {
|
||||
// There was an error with the received block (address didn't match the one we asked for), retry
|
||||
MSP.dataflashRead(nextAddress, onChunkRead);
|
||||
mspHelper.dataflashRead(nextAddress, onChunkRead);
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch the initial block
|
||||
MSP.dataflashRead(nextAddress, onChunkRead);
|
||||
mspHelper.dataflashRead(nextAddress, onChunkRead);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -437,7 +437,7 @@ TABS.onboard_logging.initialize = function (callback) {
|
|||
function flash_erase() {
|
||||
$(".dataflash-confirm-erase").addClass('erasing');
|
||||
|
||||
MSP.send_message(MSP_codes.MSP_DATAFLASH_ERASE, false, false, poll_for_erase_completion);
|
||||
MSP.send_message(MSPCodes.MSP_DATAFLASH_ERASE, false, false, poll_for_erase_completion);
|
||||
}
|
||||
|
||||
function flash_erase_cancel() {
|
||||
|
|
|
@ -22,12 +22,8 @@ SYM.METRE = 0xC;
|
|||
SYM.FEET = 0xF;
|
||||
SYM.GPS_SAT = 0x1F;
|
||||
|
||||
|
||||
var FONT = FONT || {};
|
||||
|
||||
//FIXME This is hack!
|
||||
var MSPCodes = MSP_codes;
|
||||
|
||||
FONT.initData = function () {
|
||||
if (FONT.data) {
|
||||
return;
|
||||
|
|
|
@ -13,21 +13,21 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function get_pid_names() {
|
||||
MSP.send_message(MSP_codes.MSP_PIDNAMES, false, false, get_pid_data);
|
||||
MSP.send_message(MSPCodes.MSP_PIDNAMES, false, false, get_pid_data);
|
||||
}
|
||||
|
||||
function get_pid_data() {
|
||||
MSP.send_message(MSP_codes.MSP_PID, false, false, get_rc_tuning_data);
|
||||
MSP.send_message(MSPCodes.MSP_PID, false, false, get_rc_tuning_data);
|
||||
}
|
||||
|
||||
function get_rc_tuning_data() {
|
||||
MSP.send_message(MSP_codes.MSP_RC_TUNING, false, false, loadINAVPidConfig);
|
||||
MSP.send_message(MSPCodes.MSP_RC_TUNING, false, false, loadINAVPidConfig);
|
||||
}
|
||||
|
||||
function loadINAVPidConfig() {
|
||||
var next_callback = loadPidAdvanced;
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "1.4.0")) {
|
||||
MSP.send_message(MSP_codes.MSP_INAV_PID, false, false, next_callback);
|
||||
MSP.send_message(MSPCodes.MSP_INAV_PID, false, false, next_callback);
|
||||
} else {
|
||||
next_callback();
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
function loadPidAdvanced() {
|
||||
var next_callback = loadFilterConfig;
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "1.4.0")) {
|
||||
MSP.send_message(MSP_codes.MSP_PID_ADVANCED, false, false, next_callback);
|
||||
MSP.send_message(MSPCodes.MSP_PID_ADVANCED, false, false, next_callback);
|
||||
} else {
|
||||
next_callback();
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
function loadFilterConfig() {
|
||||
var next_callback = load_html;
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "1.4.0")) {
|
||||
MSP.send_message(MSP_codes.MSP_FILTER_CONFIG, false, false, next_callback);
|
||||
MSP.send_message(MSPCodes.MSP_FILTER_CONFIG, false, false, next_callback);
|
||||
} else {
|
||||
next_callback();
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
}
|
||||
|
||||
// requesting MSP_STATUS manually because it contains CONFIG.profile
|
||||
MSP.send_message(MSP_codes.MSP_STATUS, false, false, get_pid_names);
|
||||
MSP.send_message(MSPCodes.MSP_STATUS, false, false, get_pid_names);
|
||||
|
||||
var sectionClasses = [
|
||||
'ROLL', // 0
|
||||
|
@ -165,7 +165,7 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
});
|
||||
|
||||
$('#resetPIDs').on('click', function(){
|
||||
MSP.send_message(MSP_codes.MSP_SET_RESET_CURR_PID, false, false, false);
|
||||
MSP.send_message(MSPCodes.MSP_SET_RESET_CURR_PID, false, false, false);
|
||||
updateActivatedTab();
|
||||
});
|
||||
|
||||
|
@ -277,17 +277,17 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
form_to_pid_and_rc();
|
||||
|
||||
function send_pids() {
|
||||
MSP.send_message(MSP_codes.MSP_SET_PID, MSP.crunch(MSP_codes.MSP_SET_PID), false, send_rc_tuning_changes);
|
||||
MSP.send_message(MSPCodes.MSP_SET_PID, mspHelper.crunch(MSPCodes.MSP_SET_PID), false, send_rc_tuning_changes);
|
||||
}
|
||||
|
||||
function send_rc_tuning_changes() {
|
||||
MSP.send_message(MSP_codes.MSP_SET_RC_TUNING, MSP.crunch(MSP_codes.MSP_SET_RC_TUNING), false, saveINAVPidConfig);
|
||||
MSP.send_message(MSPCodes.MSP_SET_RC_TUNING, mspHelper.crunch(MSPCodes.MSP_SET_RC_TUNING), false, saveINAVPidConfig);
|
||||
}
|
||||
|
||||
function saveINAVPidConfig() {
|
||||
var next_callback = savePidAdvanced;
|
||||
if(semver.gte(CONFIG.flightControllerVersion, "1.4.0")) {
|
||||
MSP.send_message(MSP_codes.MSP_SET_INAV_PID, MSP.crunch(MSP_codes.MSP_SET_INAV_PID), false, next_callback);
|
||||
MSP.send_message(MSPCodes.MSP_SET_INAV_PID, mspHelper.crunch(MSPCodes.MSP_SET_INAV_PID), false, next_callback);
|
||||
} else {
|
||||
next_callback();
|
||||
}
|
||||
|
@ -296,7 +296,7 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
function savePidAdvanced() {
|
||||
var next_callback = saveFilterConfig;
|
||||
if(semver.gte(CONFIG.flightControllerVersion, "1.4.0")) {
|
||||
MSP.send_message(MSP_codes.MSP_SET_PID_ADVANCED, MSP.crunch(MSP_codes.MSP_SET_PID_ADVANCED), false, next_callback);
|
||||
MSP.send_message(MSPCodes.MSP_SET_PID_ADVANCED, mspHelper.crunch(MSPCodes.MSP_SET_PID_ADVANCED), false, next_callback);
|
||||
} else {
|
||||
next_callback();
|
||||
}
|
||||
|
@ -305,14 +305,14 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
function saveFilterConfig() {
|
||||
var next_callback = save_to_eeprom;
|
||||
if(semver.gte(CONFIG.flightControllerVersion, "1.4.0")) {
|
||||
MSP.send_message(MSP_codes.MSP_SET_FILTER_CONFIG, MSP.crunch(MSP_codes.MSP_SET_FILTER_CONFIG), false, next_callback);
|
||||
MSP.send_message(MSPCodes.MSP_SET_FILTER_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_FILTER_CONFIG), false, next_callback);
|
||||
} else {
|
||||
next_callback();
|
||||
}
|
||||
}
|
||||
|
||||
function save_to_eeprom() {
|
||||
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, function () {
|
||||
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('pidTuningEepromSaved'));
|
||||
});
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
|
||||
// status data pulled via separate timer with static speed
|
||||
GUI.interval_add('status_pull', function status_pull() {
|
||||
MSP.send_message(MSP_codes.MSP_STATUS);
|
||||
MSP.send_message(MSPCodes.MSP_STATUS);
|
||||
}, 250, true);
|
||||
|
||||
GUI.content_ready(callback);
|
||||
|
|
|
@ -84,7 +84,7 @@ TABS.ports.initialize = function (callback, scrollPosition) {
|
|||
load_configuration_from_fc();
|
||||
|
||||
function load_configuration_from_fc() {
|
||||
MSP.send_message(MSP_codes.MSP_CF_SERIAL_CONFIG, false, false, on_configuration_loaded_handler);
|
||||
MSP.send_message(MSPCodes.MSP_CF_SERIAL_CONFIG, false, false, on_configuration_loaded_handler);
|
||||
|
||||
function on_configuration_loaded_handler() {
|
||||
$('#content').load("./tabs/ports.html", on_tab_loaded_handler);
|
||||
|
@ -221,7 +221,7 @@ TABS.ports.initialize = function (callback, scrollPosition) {
|
|||
|
||||
// status data pulled via separate timer with static speed
|
||||
GUI.interval_add('status_pull', function status_pull() {
|
||||
MSP.send_message(MSP_codes.MSP_STATUS);
|
||||
MSP.send_message(MSPCodes.MSP_STATUS);
|
||||
}, 250, true);
|
||||
|
||||
GUI.content_ready(callback);
|
||||
|
@ -258,17 +258,17 @@ TABS.ports.initialize = function (callback, scrollPosition) {
|
|||
SERIAL_CONFIG.ports.push(serialPort);
|
||||
});
|
||||
|
||||
MSP.send_message(MSP_codes.MSP_SET_CF_SERIAL_CONFIG, MSP.crunch(MSP_codes.MSP_SET_CF_SERIAL_CONFIG), false, save_to_eeprom);
|
||||
MSP.send_message(MSPCodes.MSP_SET_CF_SERIAL_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_CF_SERIAL_CONFIG), false, save_to_eeprom);
|
||||
|
||||
function save_to_eeprom() {
|
||||
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, on_saved_handler);
|
||||
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, on_saved_handler);
|
||||
}
|
||||
|
||||
function on_saved_handler() {
|
||||
GUI.log(chrome.i18n.getMessage('configurationEepromSaved'));
|
||||
|
||||
GUI.tab_switch_cleanup(function() {
|
||||
MSP.send_message(MSP_codes.MSP_SET_REBOOT, false, false, on_reboot_success_handler);
|
||||
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, on_reboot_success_handler);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -282,7 +282,7 @@ TABS.ports.initialize = function (callback, scrollPosition) {
|
|||
},2500);
|
||||
} else {
|
||||
GUI.timeout_add('waiting_for_bootup', function waiting_for_bootup() {
|
||||
MSP.send_message(MSP_codes.MSP_IDENT, false, false, function () {
|
||||
MSP.send_message(MSPCodes.MSP_IDENT, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('deviceReady'));
|
||||
TABS.ports.initialize(false, $('#content').scrollTop());
|
||||
});
|
||||
|
|
|
@ -13,26 +13,26 @@ TABS.receiver.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function get_misc_data() {
|
||||
MSP.send_message(MSP_codes.MSP_MISC, false, false, get_rc_data);
|
||||
MSP.send_message(MSPCodes.MSP_MISC, false, false, get_rc_data);
|
||||
}
|
||||
|
||||
function get_rc_data() {
|
||||
MSP.send_message(MSP_codes.MSP_RC, false, false, get_rc_map);
|
||||
MSP.send_message(MSPCodes.MSP_RC, false, false, get_rc_map);
|
||||
}
|
||||
|
||||
function get_rc_map() {
|
||||
MSP.send_message(MSP_codes.MSP_RX_MAP, false, false, load_config);
|
||||
MSP.send_message(MSPCodes.MSP_RX_MAP, false, false, load_config);
|
||||
}
|
||||
|
||||
// Fetch features so we can check if RX_MSP is enabled:
|
||||
function load_config() {
|
||||
MSP.send_message(MSP_codes.MSP_BF_CONFIG, false, false, load_rc_configs);
|
||||
MSP.send_message(MSPCodes.MSP_BF_CONFIG, false, false, load_rc_configs);
|
||||
}
|
||||
|
||||
function load_rc_configs() {
|
||||
var next_callback = load_html;
|
||||
if (semver.gte(CONFIG.apiVersion, "1.15.0")) {
|
||||
MSP.send_message(MSP_codes.MSP_RC_DEADBAND, false, false, next_callback);
|
||||
MSP.send_message(MSPCodes.MSP_RC_DEADBAND, false, false, next_callback);
|
||||
} else {
|
||||
next_callback();
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ TABS.receiver.initialize = function (callback) {
|
|||
$('#content').load("./tabs/receiver.html", process_html);
|
||||
}
|
||||
|
||||
MSP.send_message(MSP_codes.MSP_RC_TUNING, false, false, get_misc_data);
|
||||
MSP.send_message(MSPCodes.MSP_RC_TUNING, false, false, get_misc_data);
|
||||
|
||||
function process_html() {
|
||||
// translate to user-selected language
|
||||
|
@ -283,7 +283,7 @@ TABS.receiver.initialize = function (callback) {
|
|||
}).trigger('input');
|
||||
|
||||
$('a.refresh').click(function () {
|
||||
MSP.send_message(MSP_codes.MSP_RC_TUNING, false, false, function () {
|
||||
MSP.send_message(MSPCodes.MSP_RC_TUNING, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('receiverDataRefreshed'));
|
||||
|
||||
// fill in data from RC_tuning
|
||||
|
@ -325,29 +325,29 @@ TABS.receiver.initialize = function (callback) {
|
|||
MISC.rssi_channel = parseInt($('select[name="rssi_channel"]').val());
|
||||
|
||||
function save_rc_map() {
|
||||
MSP.send_message(MSP_codes.MSP_SET_RX_MAP, MSP.crunch(MSP_codes.MSP_SET_RX_MAP), false, save_misc);
|
||||
MSP.send_message(MSPCodes.MSP_SET_RX_MAP, mspHelper.crunch(MSPCodes.MSP_SET_RX_MAP), false, save_misc);
|
||||
}
|
||||
|
||||
function save_misc() {
|
||||
MSP.send_message(MSP_codes.MSP_SET_MISC, MSP.crunch(MSP_codes.MSP_SET_MISC), false, save_rc_configs);
|
||||
MSP.send_message(MSPCodes.MSP_SET_MISC, mspHelper.crunch(MSPCodes.MSP_SET_MISC), false, save_rc_configs);
|
||||
}
|
||||
|
||||
function save_rc_configs() {
|
||||
var next_callback = save_to_eeprom;
|
||||
if (semver.gte(CONFIG.apiVersion, "1.15.0")) {
|
||||
MSP.send_message(MSP_codes.MSP_SET_RC_DEADBAND, MSP.crunch(MSP_codes.MSP_SET_RC_DEADBAND), false, next_callback);
|
||||
MSP.send_message(MSPCodes.MSP_SET_RC_DEADBAND, mspHelper.crunch(MSPCodes.MSP_SET_RC_DEADBAND), false, next_callback);
|
||||
} else {
|
||||
next_callback();
|
||||
}
|
||||
}
|
||||
|
||||
function save_to_eeprom() {
|
||||
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, function () {
|
||||
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('receiverEepromSaved'));
|
||||
});
|
||||
}
|
||||
|
||||
MSP.send_message(MSP_codes.MSP_SET_RC_TUNING, MSP.crunch(MSP_codes.MSP_SET_RC_TUNING), false, save_rc_map);
|
||||
MSP.send_message(MSPCodes.MSP_SET_RC_TUNING, mspHelper.crunch(MSPCodes.MSP_SET_RC_TUNING), false, save_rc_map);
|
||||
});
|
||||
|
||||
$("a.sticks").click(function() {
|
||||
|
@ -367,7 +367,7 @@ TABS.receiver.initialize = function (callback) {
|
|||
// Give the window a callback it can use to send the channels (otherwise it can't see those objects)
|
||||
createdWindow.contentWindow.setRawRx = function(channels) {
|
||||
if (CONFIGURATOR.connectionValid && GUI.active_tab != 'cli') {
|
||||
MSP.setRawRx(channels);
|
||||
mspHelper.setRawRx(channels);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -386,7 +386,7 @@ TABS.receiver.initialize = function (callback) {
|
|||
chrome.storage.local.set({'rx_refresh_rate': plot_update_rate});
|
||||
|
||||
function get_rc_data() {
|
||||
MSP.send_message(MSP_codes.MSP_RC, false, false, update_ui);
|
||||
MSP.send_message(MSPCodes.MSP_RC, false, false, update_ui);
|
||||
}
|
||||
|
||||
// setup plot
|
||||
|
@ -485,7 +485,7 @@ TABS.receiver.initialize = function (callback) {
|
|||
|
||||
// status data pulled via separate timer with static speed
|
||||
GUI.interval_add('status_pull', function status_pull() {
|
||||
MSP.send_message(MSP_codes.MSP_STATUS);
|
||||
MSP.send_message(MSPCodes.MSP_STATUS);
|
||||
}, 250, true);
|
||||
|
||||
GUI.content_ready(callback);
|
||||
|
|
|
@ -361,25 +361,25 @@ TABS.sensors.initialize = function (callback) {
|
|||
// data pulling timers
|
||||
if (checkboxes[0] || checkboxes[1] || checkboxes[2]) {
|
||||
GUI.interval_add('IMU_pull', function imu_data_pull() {
|
||||
MSP.send_message(MSP_codes.MSP_RAW_IMU, false, false, update_imu_graphs);
|
||||
MSP.send_message(MSPCodes.MSP_RAW_IMU, false, false, update_imu_graphs);
|
||||
}, fastest, true);
|
||||
}
|
||||
|
||||
if (checkboxes[3]) {
|
||||
GUI.interval_add('altitude_pull', function altitude_data_pull() {
|
||||
MSP.send_message(MSP_codes.MSP_ALTITUDE, false, false, update_altitude_graph);
|
||||
MSP.send_message(MSPCodes.MSP_ALTITUDE, false, false, update_altitude_graph);
|
||||
}, rates.baro, true);
|
||||
}
|
||||
|
||||
if (checkboxes[4]) {
|
||||
GUI.interval_add('sonar_pull', function sonar_data_pull() {
|
||||
MSP.send_message(MSP_codes.MSP_SONAR, false, false, update_sonar_graphs);
|
||||
MSP.send_message(MSPCodes.MSP_SONAR, false, false, update_sonar_graphs);
|
||||
}, rates.sonar, true);
|
||||
}
|
||||
|
||||
if (checkboxes[5]) {
|
||||
GUI.interval_add('debug_pull', function debug_data_pull() {
|
||||
MSP.send_message(MSP_codes.MSP_DEBUG, false, false, update_debug_graphs);
|
||||
MSP.send_message(MSPCodes.MSP_DEBUG, false, false, update_debug_graphs);
|
||||
}, rates.debug, true);
|
||||
}
|
||||
|
||||
|
@ -445,7 +445,7 @@ TABS.sensors.initialize = function (callback) {
|
|||
|
||||
// status data pulled via separate timer with static speed
|
||||
GUI.interval_add('status_pull', function status_pull() {
|
||||
MSP.send_message(MSP_codes.MSP_STATUS);
|
||||
MSP.send_message(MSPCodes.MSP_STATUS);
|
||||
}, 250, true);
|
||||
|
||||
GUI.content_ready(callback);
|
||||
|
|
|
@ -10,36 +10,36 @@ TABS.servos.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function get_servo_configurations() {
|
||||
MSP.send_message(MSP_codes.MSP_SERVO_CONFIGURATIONS, false, false, get_servo_mix_rules);
|
||||
MSP.send_message(MSPCodes.MSP_SERVO_CONFIGURATIONS, false, false, get_servo_mix_rules);
|
||||
}
|
||||
|
||||
function get_servo_mix_rules() {
|
||||
MSP.send_message(MSP_codes.MSP_SERVO_MIX_RULES, false, false, get_channel_forwarding);
|
||||
MSP.send_message(MSPCodes.MSP_SERVO_MIX_RULES, false, false, get_channel_forwarding);
|
||||
}
|
||||
|
||||
function get_channel_forwarding() {
|
||||
var nextFunction = get_rc_data;
|
||||
|
||||
if (semver.lt(CONFIG.apiVersion, "1.12.0")) {
|
||||
MSP.send_message(MSP_codes.MSP_CHANNEL_FORWARDING, false, false, nextFunction);
|
||||
MSP.send_message(MSPCodes.MSP_CHANNEL_FORWARDING, false, false, nextFunction);
|
||||
} else {
|
||||
nextFunction();
|
||||
}
|
||||
}
|
||||
|
||||
function get_rc_data() {
|
||||
MSP.send_message(MSP_codes.MSP_RC, false, false, get_boxnames_data);
|
||||
MSP.send_message(MSPCodes.MSP_RC, false, false, get_boxnames_data);
|
||||
}
|
||||
|
||||
function get_boxnames_data() {
|
||||
MSP.send_message(MSP_codes.MSP_BOXNAMES, false, false, load_html);
|
||||
MSP.send_message(MSPCodes.MSP_BOXNAMES, false, false, load_html);
|
||||
}
|
||||
|
||||
function load_html() {
|
||||
$('#content').load("./tabs/servos.html", process_html);
|
||||
}
|
||||
|
||||
MSP.send_message(MSP_codes.MSP_IDENT, false, false, get_servo_configurations);
|
||||
MSP.send_message(MSPCodes.MSP_IDENT, false, false, get_servo_configurations);
|
||||
|
||||
function update_ui() {
|
||||
|
||||
|
@ -143,15 +143,16 @@ TABS.servos.initialize = function (callback) {
|
|||
//
|
||||
// send data to FC
|
||||
//
|
||||
MSP.sendServoConfigurations(send_servo_mixer_rules);
|
||||
//FIXME investigate why the same frame is sent twice
|
||||
mspHelper.sendServoConfigurations(send_servo_mixer_rules);
|
||||
|
||||
function send_servo_mixer_rules() {
|
||||
MSP.sendServoConfigurations(save_to_eeprom);
|
||||
mspHelper.sendServoConfigurations(save_to_eeprom);
|
||||
}
|
||||
|
||||
function save_to_eeprom() {
|
||||
if (save_configuration_to_eeprom) {
|
||||
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, function () {
|
||||
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('servosEepromSave'));
|
||||
});
|
||||
}
|
||||
|
@ -189,7 +190,7 @@ TABS.servos.initialize = function (callback) {
|
|||
|
||||
// status data pulled via separate timer with static speed
|
||||
GUI.interval_add('status_pull', function () {
|
||||
MSP.send_message(MSP_codes.MSP_STATUS);
|
||||
MSP.send_message(MSPCodes.MSP_STATUS);
|
||||
}, 250, true);
|
||||
|
||||
GUI.content_ready(callback);
|
||||
|
|
|
@ -13,22 +13,22 @@ TABS.setup.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function load_ident() {
|
||||
MSP.send_message(MSP_codes.MSP_IDENT, false, false, load_config);
|
||||
MSP.send_message(MSPCodes.MSP_IDENT, false, false, load_config);
|
||||
}
|
||||
|
||||
function load_config() {
|
||||
MSP.send_message(MSP_codes.MSP_BF_CONFIG, false, false, load_misc_data);
|
||||
MSP.send_message(MSPCodes.MSP_BF_CONFIG, false, false, load_misc_data);
|
||||
}
|
||||
|
||||
function load_misc_data() {
|
||||
MSP.send_message(MSP_codes.MSP_MISC, false, false, load_html);
|
||||
MSP.send_message(MSPCodes.MSP_MISC, false, false, load_html);
|
||||
}
|
||||
|
||||
function load_html() {
|
||||
$('#content').load("./tabs/setup.html", process_html);
|
||||
}
|
||||
|
||||
MSP.send_message(MSP_codes.MSP_STATUS, false, false, load_ident);
|
||||
MSP.send_message(MSPCodes.MSP_STATUS, false, false, load_ident);
|
||||
|
||||
function process_html() {
|
||||
// translate to user-selected language
|
||||
|
@ -73,7 +73,7 @@ TABS.setup.initialize = function (callback) {
|
|||
// During this period MCU won't be able to process any serial commands because its locked in a for/while loop
|
||||
// until this operation finishes, sending more commands through data_poll() will result in serial buffer overflow
|
||||
GUI.interval_pause('setup_data_pull');
|
||||
MSP.send_message(MSP_codes.MSP_ACC_CALIBRATION, false, false, function () {
|
||||
MSP.send_message(MSPCodes.MSP_ACC_CALIBRATION, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('initialSetupAccelCalibStarted'));
|
||||
$('#accel_calib_running').show();
|
||||
$('#accel_calib_rest').hide();
|
||||
|
@ -97,7 +97,7 @@ TABS.setup.initialize = function (callback) {
|
|||
if (!self.hasClass('calibrating') && !self.hasClass('disabled')) {
|
||||
self.addClass('calibrating');
|
||||
|
||||
MSP.send_message(MSP_codes.MSP_MAG_CALIBRATION, false, false, function () {
|
||||
MSP.send_message(MSPCodes.MSP_MAG_CALIBRATION, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('initialSetupMagCalibStarted'));
|
||||
$('#mag_calib_running').show();
|
||||
$('#mag_calib_rest').hide();
|
||||
|
@ -113,7 +113,7 @@ TABS.setup.initialize = function (callback) {
|
|||
});
|
||||
|
||||
$('a.resetSettings').click(function () {
|
||||
MSP.send_message(MSP_codes.MSP_RESET_CONF, false, false, function () {
|
||||
MSP.send_message(MSPCodes.MSP_RESET_CONF, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('initialSetupSettingsRestored'));
|
||||
|
||||
GUI.tab_switch_cleanup(function () {
|
||||
|
@ -170,9 +170,9 @@ TABS.setup.initialize = function (callback) {
|
|||
heading_e = $('dd.heading');
|
||||
|
||||
function get_slow_data() {
|
||||
MSP.send_message(MSP_codes.MSP_STATUS);
|
||||
MSP.send_message(MSPCodes.MSP_STATUS);
|
||||
|
||||
MSP.send_message(MSP_codes.MSP_ANALOG, false, false, function () {
|
||||
MSP.send_message(MSPCodes.MSP_ANALOG, false, false, function () {
|
||||
bat_voltage_e.text(chrome.i18n.getMessage('initialSetupBatteryValue', [ANALOG.voltage]));
|
||||
bat_mah_drawn_e.text(chrome.i18n.getMessage('initialSetupBatteryMahValue', [ANALOG.mAhdrawn]));
|
||||
bat_mah_drawing_e.text(chrome.i18n.getMessage('initialSetupBatteryAValue', [ANALOG.amperage.toFixed(2)]));
|
||||
|
@ -180,7 +180,7 @@ TABS.setup.initialize = function (callback) {
|
|||
});
|
||||
|
||||
if (have_sensor(CONFIG.activeSensors, 'gps')) {
|
||||
MSP.send_message(MSP_codes.MSP_RAW_GPS, false, false, function () {
|
||||
MSP.send_message(MSPCodes.MSP_RAW_GPS, false, false, function () {
|
||||
var gpsFixType = chrome.i18n.getMessage('gpsFixNone');
|
||||
if (GPS_DATA.fix >= 2)
|
||||
gpsFixType = chrome.i18n.getMessage('gpsFix3D');
|
||||
|
@ -195,7 +195,7 @@ TABS.setup.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function get_fast_data() {
|
||||
MSP.send_message(MSP_codes.MSP_ATTITUDE, false, false, function () {
|
||||
MSP.send_message(MSPCodes.MSP_ATTITUDE, false, false, function () {
|
||||
roll_e.text(chrome.i18n.getMessage('initialSetupAttitude', [SENSOR_DATA.kinematics[0]]));
|
||||
pitch_e.text(chrome.i18n.getMessage('initialSetupAttitude', [SENSOR_DATA.kinematics[1]]));
|
||||
heading_e.text(chrome.i18n.getMessage('initialSetupAttitude', [SENSOR_DATA.kinematics[2]]));
|
||||
|
|
|
@ -25,7 +25,7 @@ TABS.transponder.initialize = function (callback, scrollPosition) {
|
|||
}
|
||||
|
||||
// get the transponder data and a flag to see if transponder support is enabled on the FC
|
||||
MSP.send_message(MSP_codes.MSP_TRANSPONDER_CONFIG, false, false, load_html);
|
||||
MSP.send_message(MSPCodes.MSP_TRANSPONDER_CONFIG, false, false, load_html);
|
||||
|
||||
// Convert a hex string to a byte array
|
||||
function hexToBytes(hex) {
|
||||
|
@ -80,10 +80,10 @@ TABS.transponder.initialize = function (callback, scrollPosition) {
|
|||
// send data to FC
|
||||
//
|
||||
function save_transponder_config() {
|
||||
MSP.send_message(MSP_codes.MSP_SET_TRANSPONDER_CONFIG, MSP.crunch(MSP_codes.MSP_SET_TRANSPONDER_CONFIG), false, save_to_eeprom);
|
||||
MSP.send_message(MSPCodes.MSP_SET_TRANSPONDER_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_TRANSPONDER_CONFIG), false, save_to_eeprom);
|
||||
}
|
||||
function save_to_eeprom() {
|
||||
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, function () {
|
||||
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('transponderEepromSaved'));
|
||||
});
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ TABS.transponder.initialize = function (callback, scrollPosition) {
|
|||
}
|
||||
// status data pulled via separate timer with static speed
|
||||
GUI.interval_add('status_pull', function status_pull() {
|
||||
MSP.send_message(MSP_codes.MSP_STATUS);
|
||||
MSP.send_message(MSPCodes.MSP_STATUS);
|
||||
}, 250, true);
|
||||
|
||||
GUI.content_ready(callback);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue