@ -1084,6 +1093,38 @@ int commander_thread_main(int argc, char *argv[])
@@ -1084,6 +1093,38 @@ int commander_thread_main(int argc, char *argv[])
ioctl(buzzer,TONE_SET_ALARM,0);
}
/* Check battery voltage */
/* write to sys_status */
current_status.voltage_battery=battery_voltage;
/* if battery voltage is getting lower, warn using buzzer, etc. */
if(battery_voltage_valid&&(bat_remain<0.15f/* XXX MAGIC NUMBER */)&&(false==low_battery_voltage_actions_done)){//TODO: add filter, or call emergency after n measurements < VOLTAGE_BATTERY_MINIMAL_MILLIVOLTS
/* Critical, this is rather an emergency, kill signal to sdlog and change state machine */
elseif(battery_voltage_valid&&(bat_remain<0.1f/* XXX MAGIC NUMBER */)&&(false==critical_battery_voltage_actions_done&&true==low_battery_voltage_actions_done)){
/* if battery voltage is getting lower, warn using buzzer, etc. */
if(battery_voltage_valid&&(battery_voltage<VOLTAGE_BATTERY_LOW_VOLTS&&false==low_battery_voltage_actions_done)){//TODO: add filter, or call emergency after n measurements < VOLTAGE_BATTERY_MINIMAL_MILLIVOLTS
@ -542,6 +542,7 @@ static int set_mavlink_interval_limit(struct mavlink_subscriptions *subs, int ma
@@ -542,6 +542,7 @@ static int set_mavlink_interval_limit(struct mavlink_subscriptions *subs, int ma