Merge remote-tracking branch 'multiwii/master'
commit
685d6e08cb
|
@ -59,6 +59,9 @@
|
|||
"tab9": {
|
||||
"message": "CLI"
|
||||
},
|
||||
"tab10": {
|
||||
"message": "Logging"
|
||||
},
|
||||
|
||||
"serialPortOpened": {
|
||||
"message": "Serial port <span style=\"color: green\">successfully</span> opened with ID: $1"
|
||||
|
@ -114,7 +117,7 @@
|
|||
},
|
||||
|
||||
"defaultWelcomeText": {
|
||||
"message": "This application is a configuration utility for baseflight, a 32 bit fork of the popular open source RC flight control firmware project <a href=\"http://www.multiwii.org/\" title=\"www.multiwii.org\" target=\"_blank\">MultiWii</a>.<br /><br />Application supports hardware that run Baseflight exclusively (acro naze, naze, afromini)<br /><br /><strong>Official Resellers</strong><br />• <a href=\"http://www.abusemark.com/store/\" title=\"www.abusemark.com\" target=\"_blank\">AbuseMark</a> - International (Japan)<br />• <a href=\"http://www.multirotorsuperstore.com/\" title=\"www.multirotorsuperstore.com\" target=\"_blank\">Multirotor Superstore</a> - International (United States)<br /><br />The firmware source code can be downloaded from <a href=\"https://github.com/multiwii/baseflight\" title=\"www.github.com\" target=\"_blank\">here</a><br />The newest binary firmware image is available <a href=\"https://github.com/multiwii/baseflight/blob/master/obj/baseflight.hex\" title=\"www.github.com\" target=\"_blank\">here</a><br />"
|
||||
"message": "This application is a configuration utility for baseflight, a 32 bit fork of the popular open source RC flight control firmware project <a href=\"http://www.multiwii.org/\" title=\"www.multiwii.org\" target=\"_blank\">MultiWii</a>.<br /><br />Application supports hardware that run Baseflight <strong>exclusively</strong> (acro naze, naze, afromini)<br /><br /><strong>Official Resellers & Backers</strong><br />• <a href=\"http://www.abusemark.com/store/\" title=\"www.abusemark.com\" target=\"_blank\">AbuseMark</a> - International (Japan)<br />• <a href=\"http://www.multirotorsuperstore.com/\" title=\"www.multirotorsuperstore.com\" target=\"_blank\">Multirotor Superstore</a> - International (United States)<br /><br />The firmware source code can be downloaded from <a href=\"https://github.com/multiwii/baseflight\" title=\"www.github.com\" target=\"_blank\">here</a><br />The newest binary firmware image is available <a href=\"https://github.com/multiwii/baseflight/blob/master/obj/baseflight.hex\" title=\"www.github.com\" target=\"_blank\">here</a><br />"
|
||||
},
|
||||
"defaultChangelogHead": {
|
||||
"message": "Configurator - Changelog"
|
||||
|
@ -205,11 +208,23 @@
|
|||
"message": "Info"
|
||||
},
|
||||
"initialSetupBattery": {
|
||||
"message": "Battery:"
|
||||
"message": "Battery voltage:"
|
||||
},
|
||||
"initialSetupBatteryValue": {
|
||||
"message": "$1 V"
|
||||
},
|
||||
"initialSetupDrawn": {
|
||||
"message": "Capacity drawn:"
|
||||
},
|
||||
"initialSetupDrawing": {
|
||||
"message": "Current draw:"
|
||||
},
|
||||
"initialSetupBatteryMahValue": {
|
||||
"message": "$1 mAh"
|
||||
},
|
||||
"initialSetupBatteryAValue": {
|
||||
"message": "$1 A"
|
||||
},
|
||||
"initialSetupRSSI": {
|
||||
"message": "RSSI:"
|
||||
},
|
||||
|
@ -435,6 +450,37 @@
|
|||
"message": "Write your command here"
|
||||
},
|
||||
|
||||
"loggingNote": {
|
||||
"message": "Data will be logged in this tab <span style=\"color: red\">only</span>, leaving the tab will <span style=\"color: red\">cancel</span> logging and application will return to its normal <strong>\"configurator\"</strong> state.<br /> You are free to select the global update period, data will be written into the log file every <strong>1</strong> second for performance reasons."
|
||||
},
|
||||
"loggingSamplesSaved": {
|
||||
"message": "Samples Saved:"
|
||||
},
|
||||
"loggingLogSize": {
|
||||
"message": "Log Size:"
|
||||
},
|
||||
"loggingKB": {
|
||||
"message": "$1 kB"
|
||||
},
|
||||
"loggingButtonLogFile": {
|
||||
"message": "Select Log File"
|
||||
},
|
||||
"loggingStart": {
|
||||
"message": "Start Logging"
|
||||
},
|
||||
"loggingStop": {
|
||||
"message": "Stop Logging"
|
||||
},
|
||||
"loggingErrorLogFile": {
|
||||
"message": "Please select log file"
|
||||
},
|
||||
"loggingErrorOneProperty": {
|
||||
"message": "Please select at least one property to log"
|
||||
},
|
||||
"loggingAutomaticallyRetained": {
|
||||
"message": "Automatically loaded previous log file: <strong>$1</strong>"
|
||||
},
|
||||
|
||||
"firmwareFlasherPath": {
|
||||
"message": "Path:"
|
||||
},
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
<span>06.01.2014 - 0.41</span>
|
||||
<p>
|
||||
- Configurator reached 4000+ users on 05.29.2014<br />
|
||||
- Support for new current sensing code (latest firmware)<br />
|
||||
</p>
|
||||
<span>05.27.2014 - 0.40</span>
|
||||
<p>
|
||||
- Added Logging tab (log various MSP data into CSV file)<br />
|
||||
- Bugfix for CLI input area<br />
|
||||
</p>
|
||||
<span>05.08.2014 - 0.39</span>
|
||||
<p>
|
||||
- UI enhancements for sensors tab<br />
|
||||
|
|
|
@ -2,35 +2,35 @@ function configuration_backup() {
|
|||
// request configuration data (one by one)
|
||||
|
||||
function get_ident_data() {
|
||||
send_message(MSP_codes.MSP_IDENT, false, false, get_status_data);
|
||||
MSP.send_message(MSP_codes.MSP_IDENT, false, false, get_status_data);
|
||||
}
|
||||
|
||||
function get_status_data() {
|
||||
send_message(MSP_codes.MSP_STATUS, false, false, get_pid_data);
|
||||
MSP.send_message(MSP_codes.MSP_STATUS, false, false, get_pid_data);
|
||||
}
|
||||
|
||||
function get_pid_data() {
|
||||
send_message(MSP_codes.MSP_PID, false, false, get_rc_tuning_data);
|
||||
MSP.send_message(MSP_codes.MSP_PID, false, false, get_rc_tuning_data);
|
||||
}
|
||||
|
||||
function get_rc_tuning_data() {
|
||||
send_message(MSP_codes.MSP_RC_TUNING, false, false, get_box_names_data);
|
||||
MSP.send_message(MSP_codes.MSP_RC_TUNING, false, false, get_box_names_data);
|
||||
}
|
||||
|
||||
function get_box_names_data() {
|
||||
send_message(MSP_codes.MSP_BOXNAMES, false, false, get_box_data);
|
||||
MSP.send_message(MSP_codes.MSP_BOXNAMES, false, false, get_box_data);
|
||||
}
|
||||
|
||||
function get_box_data() {
|
||||
send_message(MSP_codes.MSP_BOX, false, false, get_acc_trim_data);
|
||||
MSP.send_message(MSP_codes.MSP_BOX, false, false, get_acc_trim_data);
|
||||
}
|
||||
|
||||
function get_acc_trim_data() {
|
||||
send_message(MSP_codes.MSP_ACC_TRIM, false, false, get_misc_data);
|
||||
MSP.send_message(MSP_codes.MSP_ACC_TRIM, false, false, get_misc_data);
|
||||
}
|
||||
|
||||
function get_misc_data() {
|
||||
send_message(MSP_codes.MSP_MISC, false, false, backup);
|
||||
MSP.send_message(MSP_codes.MSP_MISC, false, false, backup);
|
||||
}
|
||||
|
||||
function backup() {
|
||||
|
@ -222,7 +222,7 @@ function configuration_upload() {
|
|||
}
|
||||
|
||||
// Send over the PID changes
|
||||
send_message(MSP_codes.MSP_SET_PID, PID_buffer_out, false, rc_tuning);
|
||||
MSP.send_message(MSP_codes.MSP_SET_PID, PID_buffer_out, false, rc_tuning);
|
||||
|
||||
function rc_tuning() {
|
||||
// RC Tuning section
|
||||
|
@ -236,7 +236,7 @@ function configuration_upload() {
|
|||
RC_tuning_buffer_out[6] = parseInt(RC_tuning.throttle_EXPO * 100);
|
||||
|
||||
// Send over the RC_tuning changes
|
||||
send_message(MSP_codes.MSP_SET_RC_TUNING, RC_tuning_buffer_out, false, aux);
|
||||
MSP.send_message(MSP_codes.MSP_SET_RC_TUNING, RC_tuning_buffer_out, false, aux);
|
||||
}
|
||||
|
||||
function aux() {
|
||||
|
@ -250,7 +250,7 @@ function configuration_upload() {
|
|||
}
|
||||
|
||||
// Send over the AUX changes
|
||||
send_message(MSP_codes.MSP_SET_BOX, AUX_val_buffer_out, false, trim);
|
||||
MSP.send_message(MSP_codes.MSP_SET_BOX, AUX_val_buffer_out, false, trim);
|
||||
}
|
||||
|
||||
// Trim section
|
||||
|
@ -262,7 +262,7 @@ function configuration_upload() {
|
|||
buffer_out[3] = highByte(CONFIG.accelerometerTrims[1]);
|
||||
|
||||
// Send over the new trims
|
||||
send_message(MSP_codes.MSP_SET_ACC_TRIM, buffer_out, false, misc);
|
||||
MSP.send_message(MSP_codes.MSP_SET_ACC_TRIM, buffer_out, false, misc);
|
||||
}
|
||||
|
||||
function misc() {
|
||||
|
@ -293,9 +293,9 @@ function configuration_upload() {
|
|||
buffer_out[21] = 0; // vbatlevel_crit (unused)
|
||||
|
||||
// Send ove the new MISC
|
||||
send_message(MSP_codes.MSP_SET_MISC, buffer_out, false, function() {
|
||||
MSP.send_message(MSP_codes.MSP_SET_MISC, buffer_out, false, function() {
|
||||
// Save changes to EEPROM
|
||||
send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, function() {
|
||||
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, function() {
|
||||
GUI.log(chrome.i18n.getMessage('eeprom_saved_ok'));
|
||||
});
|
||||
});
|
||||
|
|
|
@ -78,7 +78,7 @@ var GPS_DATA = {
|
|||
|
||||
var ANALOG = {
|
||||
voltage: 0,
|
||||
pMeterSum: 0,
|
||||
mAhdrawn: 0,
|
||||
rssi: 0,
|
||||
amperage: 0
|
||||
};
|
||||
|
|
|
@ -249,7 +249,7 @@ GUI_control.prototype.tab_switch_cleanup = function(callback) {
|
|||
buffer_out.push(highByte(MISC.mincommand));
|
||||
}
|
||||
|
||||
send_message(MSP_codes.MSP_SET_MOTOR, buffer_out, false, function() {
|
||||
MSP.send_message(MSP_codes.MSP_SET_MOTOR, buffer_out, false, function() {
|
||||
if (callback) callback();
|
||||
});
|
||||
} else {
|
||||
|
|
22
js/msp.js
22
js/msp.js
|
@ -239,9 +239,9 @@ MSP.process_data = function(code, message_buffer, message_length) {
|
|||
break;
|
||||
case MSP_codes.MSP_ANALOG:
|
||||
ANALOG.voltage = data.getUint8(0) / 10.0;
|
||||
ANALOG.power = data.getUint16(1, 1);
|
||||
ANALOG.mAhdrawn = data.getUint16(1, 1);
|
||||
ANALOG.rssi = data.getUint16(3, 1); // 0-1023
|
||||
ANALOG.amperage = data.getUint16(5, 1);
|
||||
ANALOG.amperage = data.getUint16(5, 1) / 100; // A
|
||||
break;
|
||||
case MSP_codes.MSP_RC_TUNING:
|
||||
RC_tuning.RC_RATE = parseFloat((data.getUint8(0) / 100).toFixed(2));
|
||||
|
@ -386,16 +386,16 @@ MSP.process_data = function(code, message_buffer, message_length) {
|
|||
|
||||
// With new flight software settings in place, we have to re-pull
|
||||
// latest values
|
||||
send_message(MSP_codes.MSP_IDENT);
|
||||
send_message(MSP_codes.MSP_STATUS);
|
||||
send_message(MSP_codes.MSP_PID);
|
||||
send_message(MSP_codes.MSP_RC_TUNING);
|
||||
send_message(MSP_codes.MSP_BOXNAMES);
|
||||
send_message(MSP_codes.MSP_BOX);
|
||||
MSP.send_message(MSP_codes.MSP_IDENT);
|
||||
MSP.send_message(MSP_codes.MSP_STATUS);
|
||||
MSP.send_message(MSP_codes.MSP_PID);
|
||||
MSP.send_message(MSP_codes.MSP_RC_TUNING);
|
||||
MSP.send_message(MSP_codes.MSP_BOXNAMES);
|
||||
MSP.send_message(MSP_codes.MSP_BOX);
|
||||
|
||||
// baseflight specific
|
||||
send_message(MSP_codes.MSP_UID);
|
||||
send_message(MSP_codes.MSP_ACC_TRIM);
|
||||
MSP.send_message(MSP_codes.MSP_UID);
|
||||
MSP.send_message(MSP_codes.MSP_ACC_TRIM);
|
||||
break;
|
||||
case MSP_codes.MSP_SELECT_SETTING:
|
||||
console.log('Profile selected');
|
||||
|
@ -466,7 +466,7 @@ MSP.process_data = function(code, message_buffer, message_length) {
|
|||
}
|
||||
};
|
||||
|
||||
function send_message(code, data, callback_sent, callback_msp) {
|
||||
MSP.send_message = function(code, data, callback_sent, callback_msp) {
|
||||
var bufferOut;
|
||||
var bufView;
|
||||
|
||||
|
|
|
@ -137,9 +137,9 @@ function onOpen(openInfo) {
|
|||
}, 10000);
|
||||
|
||||
// request configuration data
|
||||
send_message(MSP_codes.MSP_UID, false, false, function() {
|
||||
MSP.send_message(MSP_codes.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)]));
|
||||
send_message(MSP_codes.MSP_IDENT, false, false, function() {
|
||||
MSP.send_message(MSP_codes.MSP_IDENT, false, false, function() {
|
||||
GUI.timeout_remove('connecting'); // kill connecting timer
|
||||
|
||||
GUI.log(chrome.i18n.getMessage('firmwareVersion', [CONFIG.version]));
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
<link type="text/css" rel="stylesheet" href="./tabs/motor_outputs.css" media="all" />
|
||||
<link type="text/css" rel="stylesheet" href="./tabs/sensors.css" media="all" />
|
||||
<link type="text/css" rel="stylesheet" href="./tabs/cli.css" media="all" />
|
||||
<link type="text/css" rel="stylesheet" href="./tabs/logging.css" media="all" />
|
||||
<link type="text/css" rel="stylesheet" href="./tabs/firmware_flasher.css" media="all" />
|
||||
|
||||
<script type="text/javascript" src="./js/libraries/google-analytics-bundle.js"></script>
|
||||
|
@ -44,6 +45,7 @@
|
|||
<script type="text/javascript" src="./tabs/motor_outputs.js"></script>
|
||||
<script type="text/javascript" src="./tabs/sensors.js"></script>
|
||||
<script type="text/javascript" src="./tabs/cli.js"></script>
|
||||
<script type="text/javascript" src="./tabs/logging.js"></script>
|
||||
<script type="text/javascript" src="./tabs/firmware_flasher.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -105,6 +107,7 @@
|
|||
<li class="tab_motor_outputs"><a href="#" i18n="tab7"></a></li>
|
||||
<li class="tab_sensors"><a href="#" i18n="tab8"></a></li>
|
||||
<li class="tab_cli"><a href="#" i18n="tab9"></a></li>
|
||||
<li class="tab_logging"><a href="#" i18n="tab10"></a></li>
|
||||
</ul>
|
||||
<div class="clear-both"></div>
|
||||
</div>
|
||||
|
|
3
main.js
3
main.js
|
@ -102,6 +102,9 @@ $(document).ready(function() {
|
|||
case 'tab_cli':
|
||||
tab_initialize_cli();
|
||||
break;
|
||||
case 'tab_logging':
|
||||
tab_initialize_logging();
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"manifest_version": 2,
|
||||
"minimum_chrome_version": "33",
|
||||
"version": "0.39",
|
||||
"version": "0.41",
|
||||
|
||||
"author": "Hydra",
|
||||
"name": "Cleanflight - Configurator",
|
||||
|
@ -26,10 +26,11 @@
|
|||
"storage",
|
||||
"fileSystem",
|
||||
"fileSystem.write",
|
||||
"fileSystem.retainEntries",
|
||||
"notifications"
|
||||
],
|
||||
|
||||
"icons": {
|
||||
"128": "images/icon_128.png"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,10 +2,10 @@ function tab_initialize_auxiliary_configuration() {
|
|||
ga_tracker.sendAppView('Auxiliary Configuration');
|
||||
GUI.active_tab = 'auxiliary_configuration';
|
||||
|
||||
send_message(MSP_codes.MSP_BOXNAMES, false, false, get_box_data);
|
||||
MSP.send_message(MSP_codes.MSP_BOXNAMES, false, false, get_box_data);
|
||||
|
||||
function get_box_data() {
|
||||
send_message(MSP_codes.MSP_BOX, false, false, load_html);
|
||||
MSP.send_message(MSP_codes.MSP_BOX, false, false, load_html);
|
||||
}
|
||||
|
||||
function load_html() {
|
||||
|
@ -94,10 +94,10 @@ function tab_initialize_auxiliary_configuration() {
|
|||
AUX_val_buffer_out[needle++] = highByte(AUX_CONFIG_values[i]);
|
||||
}
|
||||
|
||||
send_message(MSP_codes.MSP_SET_BOX, AUX_val_buffer_out, false, save_to_eeprom);
|
||||
MSP.send_message(MSP_codes.MSP_SET_BOX, AUX_val_buffer_out, false, save_to_eeprom);
|
||||
|
||||
function save_to_eeprom() {
|
||||
send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, function() {
|
||||
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, function() {
|
||||
GUI.log(chrome.i18n.getMessage('auxiliaryEepromSaved'));
|
||||
|
||||
var element = $('a.update');
|
||||
|
@ -112,7 +112,7 @@ function tab_initialize_auxiliary_configuration() {
|
|||
|
||||
// data pulling functions used inside interval timer
|
||||
function get_rc_data() {
|
||||
send_message(MSP_codes.MSP_RC, false, false, update_ui);
|
||||
MSP.send_message(MSP_codes.MSP_RC, false, false, update_ui);
|
||||
}
|
||||
|
||||
function update_ui() {
|
||||
|
@ -139,7 +139,7 @@ function tab_initialize_auxiliary_configuration() {
|
|||
|
||||
// status data pulled via separate timer with static speed
|
||||
GUI.interval_add('status_pull', function() {
|
||||
send_message(MSP_codes.MSP_STATUS);
|
||||
MSP.send_message(MSP_codes.MSP_STATUS);
|
||||
}, 250, true);
|
||||
}
|
||||
}
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
margin-top: 8px;
|
||||
|
||||
height: 20px;
|
||||
height: 22px;
|
||||
line-height: 20px;
|
||||
|
||||
padding-left: 5px;
|
||||
|
|
|
@ -5,5 +5,5 @@
|
|||
<div class="wrapper">
|
||||
</div>
|
||||
</div>
|
||||
<textarea name="commands" i18n_placeholder="cliInputPlaceholder" rows="0" cols="0"></textarea>
|
||||
<textarea name="commands" i18n_placeholder="cliInputPlaceholder" rows="1" cols="0"></textarea>
|
||||
</div>
|
11
tabs/cli.js
11
tabs/cli.js
|
@ -43,18 +43,21 @@ function tab_initialize_cli() {
|
|||
serial.send(bufferOut, function(writeInfo) {});
|
||||
|
||||
var textarea = $('.tab-cli textarea');
|
||||
|
||||
textarea.keypress(function(event) {
|
||||
if (event.which == 13) { // enter
|
||||
var out_string = $('.tab-cli textarea').val();
|
||||
event.preventDefault(); // prevent the adding of new line
|
||||
|
||||
var out_string = textarea.val();
|
||||
var out_arr = out_string.split("\n");
|
||||
cli_history.add(out_string.trim());
|
||||
var timeout_needle = 0;
|
||||
|
||||
var timeout_needle = 0;
|
||||
for (var i = 0; i < out_arr.length; i++) {
|
||||
send_slowly(out_arr, i, timeout_needle++);
|
||||
}
|
||||
|
||||
$('.tab-cli textarea').val('');
|
||||
textarea.val('');
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -69,7 +72,7 @@ function tab_initialize_cli() {
|
|||
});
|
||||
|
||||
// give input element user focus
|
||||
$('.tab-cli textarea').focus();
|
||||
textarea.focus();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
12
tabs/gps.js
12
tabs/gps.js
|
@ -2,7 +2,7 @@ function tab_initialize_gps () {
|
|||
ga_tracker.sendAppView('GPS Page');
|
||||
GUI.active_tab = 'gps';
|
||||
|
||||
send_message(MSP_codes.MSP_RAW_GPS, false, false, load_html);
|
||||
MSP.send_message(MSP_codes.MSP_RAW_GPS, false, false, load_html);
|
||||
|
||||
function load_html() {
|
||||
$('#content').load("./tabs/gps.html", process_html);
|
||||
|
@ -13,16 +13,16 @@ function tab_initialize_gps () {
|
|||
localize();
|
||||
|
||||
function get_raw_gps_data() {
|
||||
send_message(MSP_codes.MSP_RAW_GPS, false, false, get_gpsvinfo_data);
|
||||
MSP.send_message(MSP_codes.MSP_RAW_GPS, false, false, get_gpsvinfo_data);
|
||||
}
|
||||
|
||||
function get_gpsvinfo_data() {
|
||||
send_message(MSP_codes.MSP_GPSSVINFO, false, false, update_ui);
|
||||
MSP.send_message(MSP_codes.MSP_GPSSVINFO, false, false, update_ui);
|
||||
}
|
||||
|
||||
function update_ui() {
|
||||
var lat = GPS_DATA.lat / 100000000;
|
||||
var lon = GPS_DATA.lon / 100000000;
|
||||
var lat = GPS_DATA.lat / 10000000;
|
||||
var lon = GPS_DATA.lon / 10000000;
|
||||
var url = 'https://maps.google.com/?q=' + lat + ',' + lon;
|
||||
|
||||
$('.GPS_info td.fix').html((GPS_DATA.fix) ? chrome.i18n.getMessage('gpsFixTrue') : chrome.i18n.getMessage('gpsFixFalse'));
|
||||
|
@ -50,7 +50,7 @@ function tab_initialize_gps () {
|
|||
|
||||
// status data pulled via separate timer with static speed
|
||||
GUI.interval_add('status_pull', function() {
|
||||
send_message(MSP_codes.MSP_STATUS);
|
||||
MSP.send_message(MSP_codes.MSP_STATUS);
|
||||
}, 250, true);
|
||||
}
|
||||
}
|
|
@ -298,16 +298,16 @@
|
|||
.tab-initial_setup .info dt {
|
||||
float: left;
|
||||
|
||||
width: 50px;
|
||||
width: 100px;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
}
|
||||
.tab-initial_setup .info dd {
|
||||
width: 40px;
|
||||
width: 70px;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
|
||||
margin-left: 50px;
|
||||
margin-left: 100px;
|
||||
}
|
||||
.tab-initial_setup .update {
|
||||
display: block;
|
||||
|
|
|
@ -71,6 +71,17 @@
|
|||
</div>
|
||||
<a class="update" href="#" i18n="initialSetupButtonSave"></a>
|
||||
<div class="clear-both"></div>
|
||||
<div class="info">
|
||||
<span class="head" i18n="initialSetupInfoHead"></span>
|
||||
<div class="fields">
|
||||
<dl>
|
||||
<dt i18n="initialSetupBattery"></dt><dd class="bat-voltage">0 V</dd>
|
||||
<dt i18n="initialSetupDrawn"></dt><dd class="bat-mah-drawn">0 mAh</dd>
|
||||
<dt i18n="initialSetupDrawing"></dt><dd class="bat-mah-drawing">0 A</dd>
|
||||
<dt i18n="initialSetupRSSI"></dt><dd class="rssi">0 %</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
<div class="magnetometer">
|
||||
<span class="head" i18n="initialSetupMagHead"></span>
|
||||
<div class="fields">
|
||||
|
@ -80,14 +91,5 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="clear-both"></div>
|
||||
<div class="info">
|
||||
<span class="head" i18n="initialSetupInfoHead"></span>
|
||||
<div class="fields">
|
||||
<dl>
|
||||
<dt i18n="initialSetupBattery"></dt><dd class="bat-voltage">0 V</dd>
|
||||
<dt i18n="initialSetupRSSI"></dt><dd class="rssi">0 %</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -2,14 +2,14 @@ function tab_initialize_initial_setup() {
|
|||
ga_tracker.sendAppView('Initial Setup');
|
||||
GUI.active_tab = 'initial_setup';
|
||||
|
||||
send_message(MSP_codes.MSP_ACC_TRIM, false, false, load_ident);
|
||||
MSP.send_message(MSP_codes.MSP_ACC_TRIM, false, false, load_ident);
|
||||
|
||||
function load_ident() {
|
||||
send_message(MSP_codes.MSP_IDENT, false, false, load_misc_data);
|
||||
MSP.send_message(MSP_codes.MSP_IDENT, false, false, load_misc_data);
|
||||
}
|
||||
|
||||
function load_misc_data() {
|
||||
send_message(MSP_codes.MSP_MISC, false, false, load_html);
|
||||
MSP.send_message(MSP_codes.MSP_MISC, false, false, load_html);
|
||||
}
|
||||
|
||||
function load_html() {
|
||||
|
@ -114,7 +114,7 @@ function tab_initialize_initial_setup() {
|
|||
// 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('initial_setup_data_pull');
|
||||
send_message(MSP_codes.MSP_ACC_CALIBRATION, false, false, function() {
|
||||
MSP.send_message(MSP_codes.MSP_ACC_CALIBRATION, false, false, function() {
|
||||
GUI.log(chrome.i18n.getMessage('initialSetupAccelCalibStarted'));
|
||||
});
|
||||
|
||||
|
@ -134,7 +134,7 @@ function tab_initialize_initial_setup() {
|
|||
if (!self.hasClass('calibrating')) {
|
||||
self.addClass('calibrating');
|
||||
|
||||
send_message(MSP_codes.MSP_MAG_CALIBRATION, false, false, function() {
|
||||
MSP.send_message(MSP_codes.MSP_MAG_CALIBRATION, false, false, function() {
|
||||
GUI.log(chrome.i18n.getMessage('initialSetupMagCalibStarted'));
|
||||
});
|
||||
|
||||
|
@ -146,7 +146,7 @@ function tab_initialize_initial_setup() {
|
|||
});
|
||||
|
||||
$('a.resetSettings').click(function() {
|
||||
send_message(MSP_codes.MSP_RESET_CONF, false, false, function() {
|
||||
MSP.send_message(MSP_codes.MSP_RESET_CONF, false, false, function() {
|
||||
GUI.log(chrome.i18n.getMessage('initialSetupSettingsRestored'));
|
||||
|
||||
GUI.tab_switch_cleanup(function() {
|
||||
|
@ -167,7 +167,7 @@ function tab_initialize_initial_setup() {
|
|||
buffer_out[3] = highByte(CONFIG.accelerometerTrims[1]);
|
||||
|
||||
// Send over the new trims
|
||||
send_message(MSP_codes.MSP_SET_ACC_TRIM, buffer_out);
|
||||
MSP.send_message(MSP_codes.MSP_SET_ACC_TRIM, buffer_out);
|
||||
|
||||
MISC.vbatmincellvoltage = parseFloat($('input[name="mincellvoltage"]').val()) * 10;
|
||||
MISC.vbatmaxcellvoltage = parseFloat($('input[name="maxcellvoltage"]').val()) * 10;
|
||||
|
@ -206,10 +206,10 @@ function tab_initialize_initial_setup() {
|
|||
buffer_out[21] = 0; // vbatlevel_crit (unused)
|
||||
|
||||
// Send over new misc
|
||||
send_message(MSP_codes.MSP_SET_MISC, buffer_out, false, save_to_eeprom);
|
||||
MSP.send_message(MSP_codes.MSP_SET_MISC, buffer_out, false, save_to_eeprom);
|
||||
|
||||
function save_to_eeprom() {
|
||||
send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, function() {
|
||||
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, function() {
|
||||
GUI.log(chrome.i18n.getMessage('initialSetupEepromSaved'));
|
||||
|
||||
var element = $('a.update');
|
||||
|
@ -234,16 +234,18 @@ function tab_initialize_initial_setup() {
|
|||
|
||||
// data pulling functions used inside interval timer
|
||||
function get_analog_data() {
|
||||
send_message(MSP_codes.MSP_ANALOG, false, false, get_attitude_data);
|
||||
MSP.send_message(MSP_codes.MSP_ANALOG, false, false, get_attitude_data);
|
||||
}
|
||||
|
||||
function get_attitude_data() {
|
||||
send_message(MSP_codes.MSP_ATTITUDE, false, false, update_ui);
|
||||
MSP.send_message(MSP_codes.MSP_ATTITUDE, false, false, update_ui);
|
||||
}
|
||||
|
||||
function update_ui() {
|
||||
// Update voltage indicator
|
||||
$('.bat-voltage').text(chrome.i18n.getMessage('initialSetupBatteryValue', [ANALOG.voltage]));
|
||||
$('.bat-mah-drawn').text(chrome.i18n.getMessage('initialSetupBatteryMahValue', [ANALOG.mAhdrawn]));
|
||||
$('.bat-mah-drawing').text(chrome.i18n.getMessage('initialSetupBatteryAValue', [ANALOG.amperage.toFixed(2)]));
|
||||
$('.rssi').text(chrome.i18n.getMessage('initialSetupRSSIValue', [((ANALOG.rssi / 1023) * 100).toFixed(0)]));
|
||||
|
||||
// Update cube
|
||||
|
@ -258,7 +260,7 @@ function tab_initialize_initial_setup() {
|
|||
|
||||
// status data pulled via separate timer with static speed
|
||||
GUI.interval_add('status_pull', function() {
|
||||
send_message(MSP_codes.MSP_STATUS);
|
||||
MSP.send_message(MSP_codes.MSP_STATUS);
|
||||
}, 250, true);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
.tab-logging {
|
||||
}
|
||||
.tab-logging .note {
|
||||
padding: 5px;
|
||||
border: 1px dashed silver;
|
||||
}
|
||||
.tab-logging .properties {
|
||||
margin-top: 10px;
|
||||
}
|
||||
.tab-logging .properties dt {
|
||||
float: left;
|
||||
width: 120px;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
|
||||
font-weight: bold;
|
||||
}
|
||||
.tab-logging .properties dt input {
|
||||
vertical-align: middle;
|
||||
}
|
||||
.tab-logging .properties dd {
|
||||
display: block;
|
||||
margin-left: 130px;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
color: silver;
|
||||
}
|
||||
.tab-logging .speed {
|
||||
margin-top: 5px;
|
||||
width: 80px;
|
||||
|
||||
border: 1px solid silver;
|
||||
}
|
||||
.tab-logging .info {
|
||||
margin-top: 10px;
|
||||
}
|
||||
.tab-logging .info dt {
|
||||
float: left;
|
||||
width: 120px;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
|
||||
font-weight: bold;
|
||||
}
|
||||
.tab-logging .info dd {
|
||||
display: block;
|
||||
margin-left: 130px;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
}
|
||||
.tab-logging .buttons {
|
||||
margin-top: 10px;
|
||||
}
|
||||
.tab-logging .buttons a {
|
||||
display: block;
|
||||
float: left;
|
||||
|
||||
margin-right: 10px;
|
||||
|
||||
height: 28px;
|
||||
line-height: 28px;
|
||||
|
||||
padding: 0 15px 0 15px;
|
||||
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
|
||||
border: 1px solid silver;
|
||||
background-color: #ececec;
|
||||
}
|
||||
.tab-logging .buttons a:hover {
|
||||
background-color: #dedcdc;
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
<div class="tab-logging">
|
||||
<div class="note" i18n="loggingNote">
|
||||
</div>
|
||||
<div class="properties">
|
||||
<dl>
|
||||
<dt><label><input type="checkbox" name="MSP_RAW_IMU" /> MSP_RAW_IMU</label></dt><dd>9 columns (accel[x, y, z], gyro[x, y, z], mag[x, y, z])</dd>
|
||||
<dt><label><input type="checkbox" name="MSP_ATTITUDE" /> MSP_ATTITUDE</label></dt><dd>3 columns (x, y, z)</dd>
|
||||
<dt><label><input type="checkbox" name="MSP_ALTITUDE" /> MSP_ALTITUDE</label></dt><dd>one column</dd>
|
||||
<dt><label><input type="checkbox" name="MSP_RAW_GPS" /> MSP_RAW_GPS</label></dt><dd>7 columns</dd>
|
||||
<dt><label><input type="checkbox" name="MSP_RC" /> MSP_RC</label></dt><dd>8 columns by default</dd>
|
||||
<dt><label><input type="checkbox" name="MSP_MOTOR" /> MSP_MOTOR</label></dt><dd>8 columns by default</dd>
|
||||
<dt><label><input type="checkbox" name="MSP_DEBUG" /> MSP_DEBUG</label></dt><dd>4 columns</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<select class="speed" name="speed">
|
||||
<option value="10">10 ms</option>
|
||||
<option value="20">20 ms</option>
|
||||
<option value="30">30 ms</option>
|
||||
<option value="40">40 ms</option>
|
||||
<option value="50">50 ms</option>
|
||||
<option value="100" selected="selected">100 ms</option>
|
||||
<option value="250">250 ms</option>
|
||||
<option value="500">500 ms</option>
|
||||
<option value="1000">1000 ms</option>
|
||||
<option value="2000">2000 ms</option>
|
||||
<option value="5000">5000 ms</option>
|
||||
</select>
|
||||
<div class="info">
|
||||
<dl>
|
||||
<dt i18n="loggingSamplesSaved"></dt><dd class="samples">0</dd>
|
||||
<dt i18n="loggingLogSize"></dt><dd class="size">0 kB</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="buttons">
|
||||
<a href="#" class="log_file" i18n="loggingButtonLogFile"></a>
|
||||
<a href="#" class="logging" i18n="loggingStart"></a>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,282 @@
|
|||
function tab_initialize_logging() {
|
||||
ga_tracker.sendAppView('Logging');
|
||||
GUI.active_tab = 'logging';
|
||||
|
||||
var requested_properties = [];
|
||||
|
||||
MSP.send_message(MSP_codes.MSP_RC, false, false, get_motor_data);
|
||||
|
||||
function get_motor_data() {
|
||||
MSP.send_message(MSP_codes.MSP_MOTOR, false, false, load_html);
|
||||
}
|
||||
|
||||
function load_html() {
|
||||
$('#content').load("./tabs/logging.html", process_html);
|
||||
}
|
||||
|
||||
function process_html() {
|
||||
// translate to user-selected language
|
||||
localize();
|
||||
|
||||
// UI hooks
|
||||
$('a.log_file').click(prepare_file);
|
||||
|
||||
$('a.logging').click(function() {
|
||||
if (fileEntry != null) {
|
||||
var clicks = $(this).data('clicks');
|
||||
|
||||
if (!clicks) {
|
||||
// reset some variables before start
|
||||
samples = 0;
|
||||
log_buffer = [];
|
||||
requested_properties = [];
|
||||
|
||||
$('.properties input:checked').each(function() {
|
||||
requested_properties.push($(this).prop('name'));
|
||||
});
|
||||
|
||||
if (requested_properties.length) {
|
||||
// print header for the
|
||||
print_head();
|
||||
|
||||
function poll_data() {
|
||||
// save current
|
||||
crunch_data();
|
||||
|
||||
// request new
|
||||
for (var i = 0; i < requested_properties.length; i++) {
|
||||
MSP.send_message(MSP_codes[requested_properties[i]]);
|
||||
|
||||
/* this approach could be used if we want to utilize request time compensation
|
||||
if (i < requested_properties.length -1) {
|
||||
MSP.send_message(requested_properties[i]);
|
||||
} else {
|
||||
MSP.send_message(requested_properties[i], false, false, poll_data);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
GUI.interval_add('log_data_pull', poll_data, parseInt($('select.speed').val()), true); // refresh rate goes here
|
||||
GUI.interval_add('flush_data', function() {
|
||||
if (log_buffer.length) { // only execute when there is actual data to write
|
||||
if (fileWriter.readyState == 0 || fileWriter.readyState == 2) {
|
||||
append_to_file(log_buffer.join('\n'));
|
||||
|
||||
$('.samples').text(samples += log_buffer.length);
|
||||
$('.size').text(chrome.i18n.getMessage('loggingKB', [(fileWriter.length / 1024).toFixed(2)]));
|
||||
|
||||
log_buffer = [];
|
||||
} else {
|
||||
console.log('IO having trouble keeping up with the data flow');
|
||||
}
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
$('.speed').prop('disabled', true);
|
||||
$(this).text(chrome.i18n.getMessage('loggingStop'));
|
||||
$(this).data("clicks", !clicks);
|
||||
} else {
|
||||
GUI.log(chrome.i18n.getMessage('loggingErrorOneProperty'));
|
||||
}
|
||||
} else {
|
||||
GUI.interval_remove('log_data_pull');
|
||||
GUI.interval_remove('flush_data');
|
||||
|
||||
$('.speed').prop('disabled', false);
|
||||
$(this).text(chrome.i18n.getMessage('loggingStart'));
|
||||
$(this).data("clicks", !clicks);
|
||||
}
|
||||
} else {
|
||||
GUI.log(chrome.i18n.getMessage('loggingErrorLogFile'));
|
||||
}
|
||||
});
|
||||
|
||||
chrome.storage.local.get('logging_file_entry', function(result) {
|
||||
if (result.logging_file_entry) {
|
||||
chrome.fileSystem.restoreEntry(result.logging_file_entry, function(entry) {
|
||||
fileEntry = entry;
|
||||
prepare_writer(true);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var samples = 0;
|
||||
var log_buffer = [];
|
||||
function crunch_data() {
|
||||
var sample = millitime();
|
||||
|
||||
for (var i = 0; i < requested_properties.length; i++) {
|
||||
switch (requested_properties[i]) {
|
||||
case 'MSP_RAW_IMU':
|
||||
sample += ',' + SENSOR_DATA.gyroscope;
|
||||
sample += ',' + SENSOR_DATA.accelerometer;
|
||||
sample += ',' + SENSOR_DATA.magnetometer;
|
||||
break;
|
||||
case 'MSP_ATTITUDE':
|
||||
sample += ',' + SENSOR_DATA.kinematicsX;
|
||||
sample += ',' + SENSOR_DATA.kinematicsY;
|
||||
sample += ',' + SENSOR_DATA.kinematicsZ;
|
||||
break;
|
||||
case 'MSP_ALTITUDE':
|
||||
sample += ',' + SENSOR_DATA.altitude;
|
||||
break;
|
||||
case 'MSP_RAW_GPS':
|
||||
sample += ',' + GPS_DATA.fix;
|
||||
sample += ',' + GPS_DATA.numSat;
|
||||
sample += ',' + (GPS_DATA.lat / 10000000);
|
||||
sample += ',' + (GPS_DATA.lon / 10000000);
|
||||
sample += ',' + GPS_DATA.alt;
|
||||
sample += ',' + GPS_DATA.speed;
|
||||
sample += ',' + GPS_DATA.ground_course;
|
||||
break;
|
||||
case 'MSP_RC':
|
||||
for (var chan = 0; chan < RC.active_channels; chan++) {
|
||||
sample += ',' + RC.channels[chan];
|
||||
}
|
||||
break;
|
||||
case 'MSP_MOTOR':
|
||||
sample += ',' + MOTOR_DATA;
|
||||
break;
|
||||
case 'MSP_DEBUG':
|
||||
sample += ',' + SENSOR_DATA.debug;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
log_buffer.push(sample);
|
||||
}
|
||||
|
||||
function print_head() {
|
||||
var head = "timestamp";
|
||||
|
||||
for (var i = 0; i < requested_properties.length; i++) {
|
||||
switch (requested_properties[i]) {
|
||||
case 'MSP_RAW_IMU':
|
||||
head += ',' + 'gyroscopeX';
|
||||
head += ',' + 'gyroscopeY';
|
||||
head += ',' + 'gyroscopeZ';
|
||||
|
||||
head += ',' + 'accelerometerX';
|
||||
head += ',' + 'accelerometerY';
|
||||
head += ',' + 'accelerometerZ';
|
||||
|
||||
head += ',' + 'magnetometerX';
|
||||
head += ',' + 'magnetometerY';
|
||||
head += ',' + 'magnetometerZ';
|
||||
break;
|
||||
case 'MSP_ATTITUDE':
|
||||
head += ',' + 'kinematicsX';
|
||||
head += ',' + 'kinematicsY';
|
||||
head += ',' + 'kinematicsZ';
|
||||
break;
|
||||
case 'MSP_ALTITUDE':
|
||||
head += ',' + 'altitude';
|
||||
break;
|
||||
case 'MSP_RAW_GPS':
|
||||
head += ',' + 'gpsFix';
|
||||
head += ',' + 'gpsNumSat';
|
||||
head += ',' + 'gpsLat';
|
||||
head += ',' + 'gpsLon';
|
||||
head += ',' + 'gpsAlt';
|
||||
head += ',' + 'gpsSpeed';
|
||||
head += ',' + 'gpsGroundCourse';
|
||||
break;
|
||||
case 'MSP_RC':
|
||||
for (var chan = 0; chan < RC.active_channels; chan++) {
|
||||
head += ',' + 'RC' + chan;
|
||||
}
|
||||
break;
|
||||
case 'MSP_MOTOR':
|
||||
for (var motor = 0; motor < MOTOR_DATA.length; motor++) {
|
||||
head += ',' + 'Motor' + motor;
|
||||
}
|
||||
break;
|
||||
case 'MSP_DEBUG':
|
||||
for (var debug = 0; debug < SENSOR_DATA.debug.length; debug++) {
|
||||
head += ',' + 'Debug' + debug;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
log_buffer.push(head);
|
||||
}
|
||||
|
||||
// IO related methods
|
||||
var fileEntry = null;
|
||||
var fileWriter = null;
|
||||
|
||||
function prepare_file() {
|
||||
// create or load the file
|
||||
chrome.fileSystem.chooseEntry({type: 'saveFile', suggestedName: 'bf_data_log', accepts: [{extensions: ['csv']}]}, function(entry) {
|
||||
if (!entry) {
|
||||
console.log('No file selected');
|
||||
return;
|
||||
}
|
||||
|
||||
fileEntry = entry;
|
||||
|
||||
// echo/console log path specified
|
||||
chrome.fileSystem.getDisplayPath(fileEntry, function(path) {
|
||||
console.log('Log file path: ' + path);
|
||||
});
|
||||
|
||||
// change file entry from read only to read/write
|
||||
chrome.fileSystem.getWritableEntry(fileEntry, function(fileEntryWritable) {
|
||||
// check if file is writable
|
||||
chrome.fileSystem.isWritableEntry(fileEntryWritable, function(isWritable) {
|
||||
if (isWritable) {
|
||||
fileEntry = fileEntryWritable;
|
||||
|
||||
// save entry for next use
|
||||
chrome.storage.local.set({'logging_file_entry': chrome.fileSystem.retainEntry(fileEntry)});
|
||||
|
||||
prepare_writer();
|
||||
} else {
|
||||
console.log('File appears to be read only, sorry.');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function prepare_writer(retaining) {
|
||||
fileEntry.createWriter(function(writer) {
|
||||
fileWriter = writer;
|
||||
|
||||
fileWriter.onerror = function(e) {
|
||||
console.error(e);
|
||||
|
||||
// stop logging if the procedure was/is still running
|
||||
if ($('a.logging').data('clicks')) $('a.logging').click();
|
||||
};
|
||||
|
||||
fileWriter.onwriteend = function() {
|
||||
// console.log('Data written');
|
||||
};
|
||||
|
||||
if (retaining) {
|
||||
chrome.fileSystem.getDisplayPath(fileEntry, function(path) {
|
||||
GUI.log(chrome.i18n.getMessage('loggingAutomaticallyRetained', [path]));
|
||||
});
|
||||
}
|
||||
}, function(e) {
|
||||
// File is not readable or does not exist!
|
||||
console.error(e);
|
||||
|
||||
if (retaining) {
|
||||
fileEntry = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function append_to_file(data) {
|
||||
if (fileWriter.position < fileWriter.length) {
|
||||
fileWriter.seek(fileWriter.length);
|
||||
}
|
||||
|
||||
fileWriter.write(new Blob([data + '\n'], {type: 'text/plain'}));
|
||||
}
|
||||
}
|
|
@ -2,10 +2,10 @@ function tab_initialize_motor_outputs() {
|
|||
ga_tracker.sendAppView('Motor Outputs Page');
|
||||
GUI.active_tab = 'motor_outputs';
|
||||
|
||||
send_message(MSP_codes.MSP_MISC, false, false, get_motor_data);
|
||||
MSP.send_message(MSP_codes.MSP_MISC, false, false, get_motor_data);
|
||||
|
||||
function get_motor_data() {
|
||||
send_message(MSP_codes.MSP_MOTOR, false, false, load_html);
|
||||
MSP.send_message(MSP_codes.MSP_MOTOR, false, false, load_html);
|
||||
}
|
||||
|
||||
function load_html() {
|
||||
|
@ -48,7 +48,7 @@ function tab_initialize_motor_outputs() {
|
|||
buffer_out.push(highByte(val));
|
||||
}
|
||||
|
||||
send_message(MSP_codes.MSP_SET_MOTOR, buffer_out);
|
||||
MSP.send_message(MSP_codes.MSP_SET_MOTOR, buffer_out);
|
||||
});
|
||||
|
||||
$('div.sliders input.master').on('input', function() {
|
||||
|
@ -80,11 +80,11 @@ function tab_initialize_motor_outputs() {
|
|||
|
||||
// data pulling functions used inside interval timer
|
||||
function get_motor_data() {
|
||||
send_message(MSP_codes.MSP_MOTOR, false, false, get_servo_data);
|
||||
MSP.send_message(MSP_codes.MSP_MOTOR, false, false, get_servo_data);
|
||||
}
|
||||
|
||||
function get_servo_data() {
|
||||
send_message(MSP_codes.MSP_SERVO, false, false, update_ui);
|
||||
MSP.send_message(MSP_codes.MSP_SERVO, false, false, update_ui);
|
||||
}
|
||||
|
||||
function update_ui() {
|
||||
|
@ -114,7 +114,7 @@ function tab_initialize_motor_outputs() {
|
|||
|
||||
// status data pulled via separate timer with static speed
|
||||
GUI.interval_add('status_pull', function() {
|
||||
send_message(MSP_codes.MSP_STATUS);
|
||||
MSP.send_message(MSP_codes.MSP_STATUS);
|
||||
}, 250, true);
|
||||
}
|
||||
}
|
|
@ -3,18 +3,18 @@ function tab_initialize_pid_tuning() {
|
|||
GUI.active_tab = 'pid_tuning';
|
||||
|
||||
// requesting MSP_STATUS manually because it contains CONFIG.profile
|
||||
send_message(MSP_codes.MSP_STATUS, false, false, get_pid_names);
|
||||
MSP.send_message(MSP_codes.MSP_STATUS, false, false, get_pid_names);
|
||||
|
||||
function get_pid_names() {
|
||||
send_message(MSP_codes.MSP_PIDNAMES, false, false, get_pid_data);
|
||||
MSP.send_message(MSP_codes.MSP_PIDNAMES, false, false, get_pid_data);
|
||||
}
|
||||
|
||||
function get_pid_data() {
|
||||
send_message(MSP_codes.MSP_PID, false, false, get_rc_tuning_data);
|
||||
MSP.send_message(MSP_codes.MSP_PID, false, false, get_rc_tuning_data);
|
||||
}
|
||||
|
||||
function get_rc_tuning_data() {
|
||||
send_message(MSP_codes.MSP_RC_TUNING, false, false, load_html);
|
||||
MSP.send_message(MSP_codes.MSP_RC_TUNING, false, false, load_html);
|
||||
}
|
||||
|
||||
function load_html() {
|
||||
|
@ -180,7 +180,7 @@ function tab_initialize_pid_tuning() {
|
|||
// UI Hooks
|
||||
$('input[name="profile"]').change(function() {
|
||||
var profile = parseInt($(this).val());
|
||||
send_message(MSP_codes.MSP_SELECT_SETTING, [profile - 1], false, function() {
|
||||
MSP.send_message(MSP_codes.MSP_SELECT_SETTING, [profile - 1], false, function() {
|
||||
GUI.log(chrome.i18n.getMessage('pidTuningLoadedProfile', [profile]));
|
||||
|
||||
GUI.tab_switch_cleanup(tab_initialize_pid_tuning);
|
||||
|
@ -276,7 +276,7 @@ function tab_initialize_pid_tuning() {
|
|||
}
|
||||
|
||||
// Send over the PID changes
|
||||
send_message(MSP_codes.MSP_SET_PID, PID_buffer_out, false, send_rc_tuning_changes);
|
||||
MSP.send_message(MSP_codes.MSP_SET_PID, PID_buffer_out, false, send_rc_tuning_changes);
|
||||
|
||||
function send_rc_tuning_changes() {
|
||||
// catch RC_tuning changes
|
||||
|
@ -294,11 +294,11 @@ function tab_initialize_pid_tuning() {
|
|||
RC_tuning_buffer_out[6] = parseInt(RC_tuning.throttle_EXPO * 100);
|
||||
|
||||
// Send over the RC_tuning changes
|
||||
send_message(MSP_codes.MSP_SET_RC_TUNING, RC_tuning_buffer_out, false, save_to_eeprom);
|
||||
MSP.send_message(MSP_codes.MSP_SET_RC_TUNING, RC_tuning_buffer_out, false, save_to_eeprom);
|
||||
}
|
||||
|
||||
function save_to_eeprom() {
|
||||
send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, function() {
|
||||
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, function() {
|
||||
GUI.log(chrome.i18n.getMessage('pidTuningEepromSaved'));
|
||||
|
||||
var element = $('a.update');
|
||||
|
@ -313,7 +313,7 @@ function tab_initialize_pid_tuning() {
|
|||
|
||||
// status data pulled via separate timer with static speed
|
||||
GUI.interval_add('status_pull', function() {
|
||||
send_message(MSP_codes.MSP_STATUS);
|
||||
MSP.send_message(MSP_codes.MSP_STATUS);
|
||||
}, 250, true);
|
||||
}
|
||||
}
|
|
@ -2,10 +2,10 @@ function tab_initialize_receiver() {
|
|||
ga_tracker.sendAppView('Receiver Page');
|
||||
GUI.active_tab = 'receiver';
|
||||
|
||||
send_message(MSP_codes.MSP_RC_TUNING, false, false, get_rc_data);
|
||||
MSP.send_message(MSP_codes.MSP_RC_TUNING, false, false, get_rc_data);
|
||||
|
||||
function get_rc_data() {
|
||||
send_message(MSP_codes.MSP_RC, false, false, load_html);
|
||||
MSP.send_message(MSP_codes.MSP_RC, false, false, load_html);
|
||||
}
|
||||
|
||||
function load_html() {
|
||||
|
@ -32,26 +32,21 @@ function tab_initialize_receiver() {
|
|||
});
|
||||
|
||||
// generate bars
|
||||
var bar_names = [
|
||||
'Roll',
|
||||
'Pitch',
|
||||
'Yaw',
|
||||
'Throttle',
|
||||
'AUX 1',
|
||||
'AUX 2',
|
||||
'AUX 3',
|
||||
'AUX 4',
|
||||
'AUX 5',
|
||||
'AUX 6',
|
||||
'AUX 7',
|
||||
'AUX 8'
|
||||
];
|
||||
|
||||
var bar_names = ['Roll', 'Pitch', 'Yaw', 'Throttle'];
|
||||
var bar_container = $('.tab-receiver .bars');
|
||||
var aux_index = 1;
|
||||
|
||||
for (var i = 0; i < RC.active_channels; i++) {
|
||||
var name;
|
||||
if (i < bar_names.length) {
|
||||
name = bar_names[i];
|
||||
} else {
|
||||
name = 'AUX ' + aux_index++;
|
||||
}
|
||||
|
||||
bar_container.append('\
|
||||
<ul>\
|
||||
<li class="name">' + bar_names[i] + '</li>\
|
||||
<li class="name">' + name + '</li>\
|
||||
<li class="meter"><meter min="800" max="2200"></meter></li>\
|
||||
<li class="value"></li>\
|
||||
</ul>\
|
||||
|
@ -120,7 +115,7 @@ function tab_initialize_receiver() {
|
|||
}).change();
|
||||
|
||||
$('a.refresh').click(function() {
|
||||
send_message(MSP_codes.MSP_RC_TUNING, false, false, function() {
|
||||
MSP.send_message(MSP_codes.MSP_RC_TUNING, false, false, function() {
|
||||
GUI.log(chrome.i18n.getMessage('receiverDataRefreshed'));
|
||||
|
||||
// fill in data from RC_tuning
|
||||
|
@ -154,10 +149,10 @@ function tab_initialize_receiver() {
|
|||
RC_tuning_buffer_out[6] = parseInt(RC_tuning.throttle_EXPO * 100, 10);
|
||||
|
||||
// Send over the RC_tuning changes
|
||||
send_message(MSP_codes.MSP_SET_RC_TUNING, RC_tuning_buffer_out, false, save_to_eeprom);
|
||||
MSP.send_message(MSP_codes.MSP_SET_RC_TUNING, RC_tuning_buffer_out, false, save_to_eeprom);
|
||||
|
||||
function save_to_eeprom() {
|
||||
send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, function() {
|
||||
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, function() {
|
||||
GUI.log(chrome.i18n.getMessage('receiverEepromSaved'));
|
||||
|
||||
var element = $('a.update');
|
||||
|
@ -177,7 +172,7 @@ function tab_initialize_receiver() {
|
|||
chrome.storage.local.set({'rx_refresh_rate': plot_update_rate});
|
||||
|
||||
function get_rc_data() {
|
||||
send_message(MSP_codes.MSP_RC, false, false, update_ui);
|
||||
MSP.send_message(MSP_codes.MSP_RC, false, false, update_ui);
|
||||
}
|
||||
|
||||
// setup plot
|
||||
|
@ -276,7 +271,7 @@ function tab_initialize_receiver() {
|
|||
|
||||
// status data pulled via separate timer with static speed
|
||||
GUI.interval_add('status_pull', function() {
|
||||
send_message(MSP_codes.MSP_STATUS);
|
||||
MSP.send_message(MSP_codes.MSP_STATUS);
|
||||
}, 250, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -333,19 +333,19 @@ function tab_initialize_sensors() {
|
|||
// data pulling timers
|
||||
if (checkboxes[0] || checkboxes[1] || checkboxes[2]) {
|
||||
GUI.interval_add('IMU_pull', function imu_data_pull() {
|
||||
send_message(MSP_codes.MSP_RAW_IMU, false, false, update_imu_graphs);
|
||||
MSP.send_message(MSP_codes.MSP_RAW_IMU, false, false, update_imu_graphs);
|
||||
}, fastest, true);
|
||||
}
|
||||
|
||||
if (checkboxes[3]) {
|
||||
GUI.interval_add('altitude_pull', function altitude_data_pull() {
|
||||
send_message(MSP_codes.MSP_ALTITUDE, false, false, update_altitude_graph);
|
||||
MSP.send_message(MSP_codes.MSP_ALTITUDE, false, false, update_altitude_graph);
|
||||
}, rates.baro, true);
|
||||
}
|
||||
|
||||
if (checkboxes[4]) {
|
||||
GUI.interval_add('debug_pull', function debug_data_pull() {
|
||||
send_message(MSP_codes.MSP_DEBUG, false, false, update_debug_graphs);
|
||||
MSP.send_message(MSP_codes.MSP_DEBUG, false, false, update_debug_graphs);
|
||||
}, rates.debug, true);
|
||||
}
|
||||
|
||||
|
@ -403,7 +403,7 @@ function tab_initialize_sensors() {
|
|||
|
||||
// status data pulled via separate timer with static speed
|
||||
GUI.interval_add('status_pull', function() {
|
||||
send_message(MSP_codes.MSP_STATUS);
|
||||
MSP.send_message(MSP_codes.MSP_STATUS);
|
||||
}, 250, true);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -9,14 +9,14 @@ function tab_initialize_servos() {
|
|||
ga_tracker.sendAppView('Servos');
|
||||
GUI.active_tab = 'servos';
|
||||
|
||||
send_message(MSP_codes.MSP_IDENT, false, false, get_servo_conf_data);
|
||||
MSP.send_message(MSP_codes.MSP_IDENT, false, false, get_servo_conf_data);
|
||||
|
||||
function get_servo_conf_data() {
|
||||
send_message(MSP_codes.MSP_SERVO_CONF, false, false, get_boxnames_data);
|
||||
MSP.send_message(MSP_codes.MSP_SERVO_CONF, false, false, get_boxnames_data);
|
||||
}
|
||||
|
||||
function get_boxnames_data() {
|
||||
send_message(MSP_codes.MSP_BOXNAMES, false, false, load_html);
|
||||
MSP.send_message(MSP_codes.MSP_BOXNAMES, false, false, load_html);
|
||||
}
|
||||
|
||||
function load_html() {
|
||||
|
@ -175,11 +175,11 @@ function tab_initialize_servos() {
|
|||
buffer_out[needle++] = lowByte(SERVO_CONFIG[i].rate);
|
||||
}
|
||||
|
||||
send_message(MSP_codes.MSP_SET_SERVO_CONF, buffer_out);
|
||||
MSP.send_message(MSP_codes.MSP_SET_SERVO_CONF, buffer_out);
|
||||
|
||||
if (save_to_eeprom) {
|
||||
// Save changes to EEPROM
|
||||
send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, function() {
|
||||
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, function() {
|
||||
GUI.log(chrome.i18n.getMessage('servosEepromSave'));
|
||||
|
||||
var element = $('a.update');
|
||||
|
@ -300,7 +300,7 @@ function tab_initialize_servos() {
|
|||
|
||||
// status data pulled via separate timer with static speed
|
||||
GUI.interval_add('status_pull', function() {
|
||||
send_message(MSP_codes.MSP_STATUS);
|
||||
MSP.send_message(MSP_codes.MSP_STATUS);
|
||||
}, 250, true);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue