mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-20 06:45:16 +03:00
servos tab bugfix
This commit is contained in:
parent
2579b7d394
commit
47ef16b575
2 changed files with 111 additions and 109 deletions
1
main.js
1
main.js
|
@ -71,7 +71,6 @@ $(document).ready(function() {
|
||||||
break;
|
break;
|
||||||
case 'tab_servos':
|
case 'tab_servos':
|
||||||
tab_initialize_servos();
|
tab_initialize_servos();
|
||||||
$('#content').load("./tabs/servos.html", tab_initialize_servos);
|
|
||||||
break;
|
break;
|
||||||
case 'tab_gps':
|
case 'tab_gps':
|
||||||
tab_initialize_gps();
|
tab_initialize_gps();
|
||||||
|
|
219
tabs/servos.js
219
tabs/servos.js
|
@ -7,125 +7,128 @@
|
||||||
|
|
||||||
function tab_initialize_servos() {
|
function tab_initialize_servos() {
|
||||||
ga_tracker.sendAppView('Servos');
|
ga_tracker.sendAppView('Servos');
|
||||||
GUI.active_tab = 'servos';
|
|
||||||
|
|
||||||
var model = $('div.tab-servos strong.model');
|
|
||||||
var supported_models = [1, 4, 5, 8, 14, 20, 21];
|
|
||||||
|
|
||||||
// request current Servos Config
|
$('#content').load("./tabs/servos.html", function() {
|
||||||
send_message(MSP_codes.MSP_IDENT, MSP_codes.MSP_IDENT, false, function() {
|
GUI.active_tab = 'servos';
|
||||||
send_message(MSP_codes.MSP_SERVO_CONF, MSP_codes.MSP_SERVO_CONF, false, function() {
|
|
||||||
send_message(MSP_codes.MSP_BOXNAMES, MSP_codes.MSP_BOXNAMES, false, function() {
|
var model = $('div.tab-servos strong.model');
|
||||||
// drop previous table
|
var supported_models = [1, 4, 5, 8, 14, 20, 21];
|
||||||
$('div.tab-servos table.fields tr:not(:first)').remove();
|
|
||||||
|
// request current Servos Config
|
||||||
switch (CONFIG.multiType) {
|
send_message(MSP_codes.MSP_IDENT, MSP_codes.MSP_IDENT, false, function() {
|
||||||
case 1: // TRI
|
send_message(MSP_codes.MSP_SERVO_CONF, MSP_codes.MSP_SERVO_CONF, false, function() {
|
||||||
// looking ok so far
|
send_message(MSP_codes.MSP_BOXNAMES, MSP_codes.MSP_BOXNAMES, false, function() {
|
||||||
model.html('TRI');
|
// drop previous table
|
||||||
|
$('div.tab-servos table.fields tr:not(:first)').remove();
|
||||||
process_directions('YAW', 5, 0);
|
|
||||||
|
switch (CONFIG.multiType) {
|
||||||
process_servos('Yaw Servo', '', 5, false);
|
case 1: // TRI
|
||||||
break;
|
// looking ok so far
|
||||||
case 4: // BI
|
model.html('TRI');
|
||||||
// looking ok so far
|
|
||||||
model.html('BI');
|
process_directions('YAW', 5, 0);
|
||||||
|
|
||||||
process_directions('L YAW', 4, 1);
|
process_servos('Yaw Servo', '', 5, false);
|
||||||
process_directions('R YAW', 5, 1);
|
break;
|
||||||
process_directions('L NICK', 4, 0);
|
case 4: // BI
|
||||||
process_directions('R NICK', 5, 0);
|
// looking ok so far
|
||||||
|
model.html('BI');
|
||||||
process_servos('Left Servo', '', 4, false);
|
|
||||||
process_servos('Right Servo', '', 5, false);
|
process_directions('L YAW', 4, 1);
|
||||||
break;
|
process_directions('R YAW', 5, 1);
|
||||||
case 5: // Gimbal
|
process_directions('L NICK', 4, 0);
|
||||||
// needs to be verified
|
process_directions('R NICK', 5, 0);
|
||||||
model.html('Gimbal');
|
|
||||||
|
process_servos('Left Servo', '', 4, false);
|
||||||
// rate
|
process_servos('Right Servo', '', 5, false);
|
||||||
process_servos('Pitch Servo', '', 0, 2);
|
break;
|
||||||
process_servos('Roll Servo', '', 1, 2);
|
case 5: // Gimbal
|
||||||
break;
|
|
||||||
case 8: // Flying Wing
|
|
||||||
// looking ok so far
|
|
||||||
model.html('Flying Wing');
|
|
||||||
|
|
||||||
process_directions('L ROLL', 3, 1);
|
|
||||||
process_directions('R ROLL', 4, 1);
|
|
||||||
process_directions('L NICK', 3, 0);
|
|
||||||
process_directions('R NICK', 4, 0);
|
|
||||||
|
|
||||||
process_servos('Left Wing', '', 3, false);
|
|
||||||
process_servos('Right Wing', '', 4, false);
|
|
||||||
break;
|
|
||||||
case 14: // Airplane
|
|
||||||
model.html('Airplane');
|
|
||||||
|
|
||||||
// rate
|
|
||||||
process_servos('Wing 1', '', 3, 2);
|
|
||||||
process_servos('Wing 2', '', 4, 2);
|
|
||||||
process_servos('Rudd', '', 5, 2);
|
|
||||||
process_servos('Elev', '', 6, 2);
|
|
||||||
break;
|
|
||||||
case 20: // Dualcopter
|
|
||||||
// looking ok so far
|
|
||||||
model.html('Dualcopter');
|
|
||||||
|
|
||||||
process_directions('PITCH', 4, 0);
|
|
||||||
process_directions('ROLL', 5, 0);
|
|
||||||
|
|
||||||
process_servos('Roll', '', 5, false);
|
|
||||||
process_servos('Nick', '', 4, false);
|
|
||||||
break;
|
|
||||||
case 21: // Singlecopter
|
|
||||||
// looking ok so far
|
|
||||||
model.html('Singlecopter');
|
|
||||||
|
|
||||||
process_servos('Right', 'R YAW', 3, true);
|
|
||||||
process_servos('Left', 'L YAW', 4, true);
|
|
||||||
process_servos('Front', 'F YAW', 5, true);
|
|
||||||
process_servos('Rear', 'YAW', 6, true);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
model.html('Doesn\'t support servos');
|
|
||||||
|
|
||||||
// implementation of feature servo_tilt
|
|
||||||
if (AUX_CONFIG.indexOf('CAMSTAB') > -1 || AUX_CONFIG.indexOf('CAMTRIG') > -1) {
|
|
||||||
// Gimbal on
|
|
||||||
// needs to be verified
|
// needs to be verified
|
||||||
model.html('Gimbal / Tilt Servos');
|
model.html('Gimbal');
|
||||||
|
|
||||||
// rate
|
// rate
|
||||||
process_servos('Pitch Servo', '', 0, 2);
|
process_servos('Pitch Servo', '', 0, 2);
|
||||||
process_servos('Roll Servo', '', 1, 2);
|
process_servos('Roll Servo', '', 1, 2);
|
||||||
}
|
break;
|
||||||
}
|
case 8: // Flying Wing
|
||||||
|
// looking ok so far
|
||||||
// UI hooks for dynamically generated elements
|
model.html('Flying Wing');
|
||||||
$('table.directions select, table.directions input, table.fields select, table.fields input').change(function() {
|
|
||||||
if ($('div.live input').is(':checked')) {
|
process_directions('L ROLL', 3, 1);
|
||||||
// apply small delay as there seems to be some funky update business going wrong
|
process_directions('R ROLL', 4, 1);
|
||||||
GUI.timeout_add('servos_update', servos_update, 10);
|
process_directions('L NICK', 3, 0);
|
||||||
|
process_directions('R NICK', 4, 0);
|
||||||
|
|
||||||
|
process_servos('Left Wing', '', 3, false);
|
||||||
|
process_servos('Right Wing', '', 4, false);
|
||||||
|
break;
|
||||||
|
case 14: // Airplane
|
||||||
|
model.html('Airplane');
|
||||||
|
|
||||||
|
// rate
|
||||||
|
process_servos('Wing 1', '', 3, 2);
|
||||||
|
process_servos('Wing 2', '', 4, 2);
|
||||||
|
process_servos('Rudd', '', 5, 2);
|
||||||
|
process_servos('Elev', '', 6, 2);
|
||||||
|
break;
|
||||||
|
case 20: // Dualcopter
|
||||||
|
// looking ok so far
|
||||||
|
model.html('Dualcopter');
|
||||||
|
|
||||||
|
process_directions('PITCH', 4, 0);
|
||||||
|
process_directions('ROLL', 5, 0);
|
||||||
|
|
||||||
|
process_servos('Roll', '', 5, false);
|
||||||
|
process_servos('Nick', '', 4, false);
|
||||||
|
break;
|
||||||
|
case 21: // Singlecopter
|
||||||
|
// looking ok so far
|
||||||
|
model.html('Singlecopter');
|
||||||
|
|
||||||
|
process_servos('Right', 'R YAW', 3, true);
|
||||||
|
process_servos('Left', 'L YAW', 4, true);
|
||||||
|
process_servos('Front', 'F YAW', 5, true);
|
||||||
|
process_servos('Rear', 'YAW', 6, true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
model.html('Doesn\'t support servos');
|
||||||
|
|
||||||
|
// implementation of feature servo_tilt
|
||||||
|
if (AUX_CONFIG.indexOf('CAMSTAB') > -1 || AUX_CONFIG.indexOf('CAMTRIG') > -1) {
|
||||||
|
// Gimbal on
|
||||||
|
// needs to be verified
|
||||||
|
model.html('Gimbal / Tilt Servos');
|
||||||
|
|
||||||
|
// rate
|
||||||
|
process_servos('Pitch Servo', '', 0, 2);
|
||||||
|
process_servos('Roll Servo', '', 1, 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UI hooks for dynamically generated elements
|
||||||
|
$('table.directions select, table.directions input, table.fields select, table.fields input').change(function() {
|
||||||
|
if ($('div.live input').is(':checked')) {
|
||||||
|
// apply small delay as there seems to be some funky update business going wrong
|
||||||
|
GUI.timeout_add('servos_update', servos_update, 10);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('a.update').click(function() {
|
||||||
|
// standard check for supported_models + custom implementation for feature servo_tilt
|
||||||
|
if (supported_models.indexOf(CONFIG.multiType) != -1 || AUX_CONFIG.indexOf('CAMSTAB') > -1 || AUX_CONFIG.indexOf('CAMTRIG') > -1) {
|
||||||
|
servos_update(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// enable data pulling
|
||||||
|
GUI.interval_add('servos_data_poll', function() {
|
||||||
|
send_message(MSP_codes.MSP_STATUS, MSP_codes.MSP_STATUS);
|
||||||
|
}, 50);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('a.update').click(function() {
|
|
||||||
// standard check for supported_models + custom implementation for feature servo_tilt
|
|
||||||
if (supported_models.indexOf(CONFIG.multiType) != -1 || AUX_CONFIG.indexOf('CAMSTAB') > -1 || AUX_CONFIG.indexOf('CAMTRIG') > -1) {
|
|
||||||
servos_update(true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// enable data pulling
|
|
||||||
GUI.interval_add('servos_data_poll', function() {
|
|
||||||
send_message(MSP_codes.MSP_STATUS, MSP_codes.MSP_STATUS);
|
|
||||||
}, 50);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function servos_update(save_to_eeprom) {
|
function servos_update(save_to_eeprom) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue