1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-17 05:15:25 +03:00

lowering MSP_STATUS pull speed to 250ms

This commit is contained in:
cTn 2014-03-30 11:51:16 +02:00
parent 1a2be85155
commit 8d6702c15e
10 changed files with 52 additions and 40 deletions

View file

@ -192,36 +192,41 @@ GUI_control.prototype.tab_switch_cleanup = function(callback) {
switch (this.active_tab) { switch (this.active_tab) {
case 'initial_setup': case 'initial_setup':
GUI.interval_remove('initial_setup_data_pull'); GUI.interval_remove('initial_setup_data_pull');
GUI.interval_remove('status_pull');
if (callback) callback(); if (callback) callback();
break; break;
case 'pid_tuning': case 'pid_tuning':
GUI.interval_remove('pid_data_poll'); GUI.interval_remove('status_pull');
if (callback) callback(); if (callback) callback();
break; break;
case 'receiver': case 'receiver':
GUI.interval_remove('receiver_poll'); GUI.interval_remove('receiver_pull');
GUI.interval_remove('status_pull');
if (callback) callback(); if (callback) callback();
break; break;
case 'auxiliary_configuration': case 'auxiliary_configuration':
GUI.interval_remove('aux_data_poll'); GUI.interval_remove('aux_data_pull');
GUI.interval_remove('status_pull');
if (callback) callback(); if (callback) callback();
break; break;
case 'servos': case 'servos':
GUI.interval_remove('servos_data_poll'); GUI.interval_remove('status_pull');
if (callback) callback(); if (callback) callback();
break; break;
case 'gps': case 'gps':
GUI.interval_remove('gps_pull'); GUI.interval_remove('gps_pull');
GUI.interval_remove('status_pull');
if (callback) callback(); if (callback) callback();
break; break;
case 'motor_outputs': case 'motor_outputs':
GUI.interval_remove('motor_poll'); GUI.interval_remove('motor_pull');
GUI.interval_remove('status_pull');
// only enforce mincommand if necessary // only enforce mincommand if necessary
if (MOTOR_DATA != undefined) { if (MOTOR_DATA != undefined) {

View file

@ -173,7 +173,7 @@ MSP.process_data = function(code, message_buffer, message_length) {
CONFIG.profile = data.getUint8(10); CONFIG.profile = data.getUint8(10);
sensor_status(CONFIG.activeSensors); sensor_status(CONFIG.activeSensors);
$('span.cycle-time').html(CONFIG.cycleTime); $('span.cycle-time').text(CONFIG.cycleTime);
break; break;
case MSP_codes.MSP_RAW_IMU: case MSP_codes.MSP_RAW_IMU:
// 512 for mpu6050, 256 for mma // 512 for mpu6050, 256 for mma

View file

@ -108,10 +108,6 @@ function tab_initialize_auxiliary_configuration() {
}); });
// data pulling functions used inside interval timer // data pulling functions used inside interval timer
function get_status_data() {
send_message(MSP_codes.MSP_STATUS, MSP_codes.MSP_STATUS, false, get_rc_data);
}
function get_rc_data() { function get_rc_data() {
send_message(MSP_codes.MSP_RC, MSP_codes.MSP_RC, false, update_ui); send_message(MSP_codes.MSP_RC, MSP_codes.MSP_RC, false, update_ui);
} }
@ -136,6 +132,11 @@ function tab_initialize_auxiliary_configuration() {
} }
// enable data pulling // enable data pulling
GUI.interval_add('aux_data_poll', get_status_data, 50, true); GUI.interval_add('aux_data_pull', get_rc_data, 50, true);
// status data pulled via separate timer with static speed
GUI.interval_add('status_pull', function() {
send_message(MSP_codes.MSP_STATUS, MSP_codes.MSP_STATUS);
}, 250, true);
} }
} }

View file

@ -9,10 +9,6 @@ function tab_initialize_gps () {
} }
function process_html() { function process_html() {
function get_status_data() {
send_message(MSP_codes.MSP_STATUS, MSP_codes.MSP_STATUS, false, get_raw_gps_data);
}
function get_raw_gps_data() { function get_raw_gps_data() {
send_message(MSP_codes.MSP_RAW_GPS, MSP_codes.MSP_RAW_GPS, false, get_gpsvinfo_data); send_message(MSP_codes.MSP_RAW_GPS, MSP_codes.MSP_RAW_GPS, false, get_gpsvinfo_data);
} }
@ -42,6 +38,11 @@ function tab_initialize_gps () {
} }
// enable data pulling // enable data pulling
GUI.interval_add('gps_pull', get_status_data, 75, true); GUI.interval_add('gps_pull', get_raw_gps_data, 75, true);
// status data pulled via separate timer with static speed
GUI.interval_add('status_pull', function() {
send_message(MSP_codes.MSP_STATUS, MSP_codes.MSP_STATUS);
}, 250, true);
} }
} }

View file

@ -226,10 +226,6 @@ function tab_initialize_initial_setup() {
$('#content .restore').click(configuration_restore); $('#content .restore').click(configuration_restore);
// data pulling functions used inside interval timer // data pulling functions used inside interval timer
function get_status_data() {
send_message(MSP_codes.MSP_STATUS, MSP_codes.MSP_STATUS, false, get_analog_data);
}
function get_analog_data() { function get_analog_data() {
send_message(MSP_codes.MSP_ANALOG, MSP_codes.MSP_ANALOG, false, get_attitude_data); send_message(MSP_codes.MSP_ANALOG, MSP_codes.MSP_ANALOG, false, get_attitude_data);
} }
@ -256,6 +252,11 @@ function tab_initialize_initial_setup() {
*/ */
} }
GUI.interval_add('initial_setup_data_pull', get_status_data, 50, true); GUI.interval_add('initial_setup_data_pull', get_analog_data, 50, true);
// status data pulled via separate timer with static speed
GUI.interval_add('status_pull', function() {
send_message(MSP_codes.MSP_STATUS, MSP_codes.MSP_STATUS);
}, 250, true);
} }
} }

View file

@ -76,10 +76,6 @@ function tab_initialize_motor_outputs() {
}); });
// data pulling functions used inside interval timer // data pulling functions used inside interval timer
function get_status_data() {
send_message(MSP_codes.MSP_STATUS, MSP_codes.MSP_STATUS, false, get_motor_data);
}
function get_motor_data() { function get_motor_data() {
send_message(MSP_codes.MSP_MOTOR, MSP_codes.MSP_MOTOR, false, get_servo_data); send_message(MSP_codes.MSP_MOTOR, MSP_codes.MSP_MOTOR, false, get_servo_data);
} }
@ -111,6 +107,11 @@ function tab_initialize_motor_outputs() {
} }
// enable Motor data pulling // enable Motor data pulling
GUI.interval_add('motor_poll', get_status_data, 50, true); GUI.interval_add('motor_pull', get_motor_data, 50, true);
// status data pulled via separate timer with static speed
GUI.interval_add('status_pull', function() {
send_message(MSP_codes.MSP_STATUS, MSP_codes.MSP_STATUS);
}, 250, true);
} }
} }

View file

@ -288,9 +288,9 @@ function tab_initialize_pid_tuning() {
} }
}); });
// enable data pulling // status data pulled via separate timer with static speed
GUI.interval_add('pid_data_poll', function() { GUI.interval_add('status_pull', function() {
send_message(MSP_codes.MSP_STATUS, MSP_codes.MSP_STATUS); send_message(MSP_codes.MSP_STATUS, MSP_codes.MSP_STATUS);
}, 50); }, 250, true);
} }
} }

View file

@ -136,10 +136,6 @@ function tab_initialize_receiver() {
// save update rate // save update rate
chrome.storage.local.set({'rx_refresh_rate': plot_update_rate}); chrome.storage.local.set({'rx_refresh_rate': plot_update_rate});
function get_status_data() {
send_message(MSP_codes.MSP_STATUS, MSP_codes.MSP_STATUS, false, get_rc_data);
}
function get_rc_data() { function get_rc_data() {
send_message(MSP_codes.MSP_RC, MSP_codes.MSP_RC, false, update_ui); send_message(MSP_codes.MSP_RC, MSP_codes.MSP_RC, false, update_ui);
} }
@ -343,10 +339,15 @@ function tab_initialize_receiver() {
} }
// timer initialization // timer initialization
GUI.interval_remove('receiver_poll'); GUI.interval_remove('receiver_pull');
// enable RC data pulling // enable RC data pulling
GUI.interval_add('receiver_poll', get_status_data, plot_update_rate, true); GUI.interval_add('receiver_pull', get_rc_data, plot_update_rate, true);
}); });
// status data pulled via separate timer with static speed
GUI.interval_add('status_pull', function() {
send_message(MSP_codes.MSP_STATUS, MSP_codes.MSP_STATUS);
}, 250, true);
} }
} }

View file

@ -219,9 +219,11 @@ function tab_initialize_sensors() {
GUI.interval_kill_all(); GUI.interval_kill_all();
// data pulling timers // data pulling timers
GUI.interval_add('status_pull', function status_data_pull() {
// status data pulled via separate timer with static speed
GUI.interval_add('status_pull', function() {
send_message(MSP_codes.MSP_STATUS, MSP_codes.MSP_STATUS); send_message(MSP_codes.MSP_STATUS, MSP_codes.MSP_STATUS);
}, 50); }, 250, true);
GUI.interval_add('IMU_pull', function imu_data_pull() { GUI.interval_add('IMU_pull', function imu_data_pull() {
send_message(MSP_codes.MSP_RAW_IMU, MSP_codes.MSP_RAW_IMU, false, update_imu_graphs); send_message(MSP_codes.MSP_RAW_IMU, MSP_codes.MSP_RAW_IMU, false, update_imu_graphs);

View file

@ -296,9 +296,9 @@ function tab_initialize_servos() {
} }
}); });
// enable data pulling // status data pulled via separate timer with static speed
GUI.interval_add('servos_data_poll', function() { GUI.interval_add('status_pull', function() {
send_message(MSP_codes.MSP_STATUS, MSP_codes.MSP_STATUS); send_message(MSP_codes.MSP_STATUS, MSP_codes.MSP_STATUS);
}, 50); }, 250, true);
} }
} }