1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 00:35:39 +03:00

removing obsolete code / cleaning up

This commit is contained in:
cTn 2014-01-13 14:18:46 +01:00
parent 937dcf9742
commit 1f2180be89
2 changed files with 49 additions and 69 deletions

View file

@ -28,50 +28,40 @@ function tab_initialize_auxiliary_configuration() {
); );
} }
// UI Hooks // UI Hooks
$('.tab-auxiliary_configuration .boxes input').change(function() {
// if any of the fields changed, unlock update button
$('a.update').addClass('active');
});
$('.tab-auxiliary_configuration a.update').click(function() { $('.tab-auxiliary_configuration a.update').click(function() {
if ($(this).hasClass('active')) { // catch the input changes
// catch the input changes var main_needle = 0;
var main_needle = 0; var needle = 0;
var needle = 0; $('.tab-auxiliary_configuration .boxes input').each(function() {
$('.tab-auxiliary_configuration .boxes input').each(function() { if ($(this).is(':checked')) {
if ($(this).is(':checked')) { AUX_CONFIG_values[main_needle] = bit_set(AUX_CONFIG_values[main_needle], needle);
AUX_CONFIG_values[main_needle] = bit_set(AUX_CONFIG_values[main_needle], needle); } else {
} else { AUX_CONFIG_values[main_needle] = bit_clear(AUX_CONFIG_values[main_needle], needle);
AUX_CONFIG_values[main_needle] = bit_clear(AUX_CONFIG_values[main_needle], needle);
}
needle++;
if (needle >= 12) { // 4 aux * 3 checkboxes = 12 bits per line
main_needle++;
needle = 0;
}
});
// send over the data
var AUX_val_buffer_out = new Array();
var needle = 0;
for (var i = 0; i < AUX_CONFIG_values.length; i++) {
AUX_val_buffer_out[needle++] = lowByte(AUX_CONFIG_values[i]);
AUX_val_buffer_out[needle++] = highByte(AUX_CONFIG_values[i]);
} }
send_message(MSP_codes.MSP_SET_BOX, AUX_val_buffer_out); needle++;
// Save changes to EEPROM
send_message(MSP_codes.MSP_EEPROM_WRITE, MSP_codes.MSP_EEPROM_WRITE);
// remove the active status if (needle >= 12) { // 4 aux * 3 checkboxes = 12 bits per line
$(this).removeClass('active'); main_needle++;
needle = 0;
}
});
// send over the data
var AUX_val_buffer_out = new Array();
var needle = 0;
for (var i = 0; i < AUX_CONFIG_values.length; i++) {
AUX_val_buffer_out[needle++] = lowByte(AUX_CONFIG_values[i]);
AUX_val_buffer_out[needle++] = highByte(AUX_CONFIG_values[i]);
} }
send_message(MSP_codes.MSP_SET_BOX, AUX_val_buffer_out);
// Save changes to EEPROM
send_message(MSP_codes.MSP_EEPROM_WRITE, MSP_codes.MSP_EEPROM_WRITE);
}); });
// enable data pulling // enable data pulling

View file

@ -99,37 +99,27 @@ function tab_initialize_receiver() {
}).change(); }).change();
$('a.update').click(function() { $('a.update').click(function() {
if ($(this).hasClass('active')) { // catch RC_tuning changes
// catch RC_tuning changes RC_tuning.throttle_MID = parseFloat($('.tunings .throttle input[name="mid"]').val());
RC_tuning.throttle_MID = parseFloat($('.tunings .throttle input[name="mid"]').val()); RC_tuning.throttle_EXPO = parseFloat($('.tunings .throttle input[name="expo"]').val());
RC_tuning.throttle_EXPO = parseFloat($('.tunings .throttle input[name="expo"]').val());
RC_tuning.RC_RATE = parseFloat($('.tunings .rate input[name="rate"]').val());
RC_tuning.RC_RATE = parseFloat($('.tunings .rate input[name="rate"]').val()); RC_tuning.RC_EXPO = parseFloat($('.tunings .rate input[name="expo"]').val());
RC_tuning.RC_EXPO = parseFloat($('.tunings .rate input[name="expo"]').val());
var RC_tuning_buffer_out = new Array();
var RC_tuning_buffer_out = new Array(); RC_tuning_buffer_out[0] = parseInt(RC_tuning.RC_RATE * 100);
RC_tuning_buffer_out[0] = parseInt(RC_tuning.RC_RATE * 100); RC_tuning_buffer_out[1] = parseInt(RC_tuning.RC_EXPO * 100);
RC_tuning_buffer_out[1] = parseInt(RC_tuning.RC_EXPO * 100); RC_tuning_buffer_out[2] = parseInt(RC_tuning.roll_pitch_rate * 100);
RC_tuning_buffer_out[2] = parseInt(RC_tuning.roll_pitch_rate * 100); RC_tuning_buffer_out[3] = parseInt(RC_tuning.yaw_rate * 100);
RC_tuning_buffer_out[3] = parseInt(RC_tuning.yaw_rate * 100); RC_tuning_buffer_out[4] = parseInt(RC_tuning.dynamic_THR_PID * 100);
RC_tuning_buffer_out[4] = parseInt(RC_tuning.dynamic_THR_PID * 100); RC_tuning_buffer_out[5] = parseInt(RC_tuning.throttle_MID * 100);
RC_tuning_buffer_out[5] = parseInt(RC_tuning.throttle_MID * 100); RC_tuning_buffer_out[6] = parseInt(RC_tuning.throttle_EXPO * 100);
RC_tuning_buffer_out[6] = parseInt(RC_tuning.throttle_EXPO * 100);
// Send over the RC_tuning changes
// Send over the RC_tuning changes send_message(MSP_codes.MSP_SET_RC_TUNING, RC_tuning_buffer_out);
send_message(MSP_codes.MSP_SET_RC_TUNING, RC_tuning_buffer_out);
// Save changes to EEPROM // Save changes to EEPROM
send_message(MSP_codes.MSP_EEPROM_WRITE, MSP_codes.MSP_EEPROM_WRITE); send_message(MSP_codes.MSP_EEPROM_WRITE, MSP_codes.MSP_EEPROM_WRITE);
// remove the active status
$(this).removeClass('active');
}
});
$('.tunings input').change(function() {
// if any of the fields changed, unlock update button
$('a.update').addClass('active');
}); });
// enable RC data pulling // enable RC data pulling