Copter: more Ch7/Ch8 event logging

Additional event logging for SaveWP, Fence, Acro trainer, Save Trim
This commit is contained in:
Randy Mackay 2013-11-01 11:53:16 +09:00
parent babc54ec60
commit 798c4e2278
2 changed files with 18 additions and 0 deletions

View File

@ -186,6 +186,7 @@ static void do_aux_switch_function(int8_t ch_function, uint8_t ch_flag)
aux_switch_wp_index = 0; aux_switch_wp_index = 0;
g.command_total.set_and_save(1); g.command_total.set_and_save(1);
set_mode(RTL); // if by chance we are unable to switch to RTL we just stay in AUTO and hope the GPS failsafe will take-over set_mode(RTL); // if by chance we are unable to switch to RTL we just stay in AUTO and hope the GPS failsafe will take-over
Log_Write_Event(DATA_SAVEWP_CLEAR_MISSION_RTL);
return; return;
} }
@ -224,6 +225,9 @@ static void do_aux_switch_function(int8_t ch_function, uint8_t ch_flag)
// save command // save command
set_cmd_with_index(current_loc, aux_switch_wp_index); set_cmd_with_index(current_loc, aux_switch_wp_index);
// log event
Log_Write_Event(DATA_SAVEWP_ADD_WP);
// Cause the CopterLEDs to blink twice to indicate saved waypoint // Cause the CopterLEDs to blink twice to indicate saved waypoint
copter_leds_nav_blink = 10; copter_leds_nav_blink = 10;
} }
@ -251,8 +255,10 @@ static void do_aux_switch_function(int8_t ch_function, uint8_t ch_flag)
// enable or disable the fence // enable or disable the fence
if (ch_flag == AUX_SWITCH_HIGH) { if (ch_flag == AUX_SWITCH_HIGH) {
fence.enable(true); fence.enable(true);
Log_Write_Event(DATA_FENCE_ENABLE);
}else{ }else{
fence.enable(false); fence.enable(false);
Log_Write_Event(DATA_FENCE_DISABLE);
} }
break; break;
#endif #endif
@ -268,12 +274,15 @@ static void do_aux_switch_function(int8_t ch_function, uint8_t ch_flag)
switch(ch_flag) { switch(ch_flag) {
case AUX_SWITCH_LOW: case AUX_SWITCH_LOW:
g.acro_trainer = ACRO_TRAINER_DISABLED; g.acro_trainer = ACRO_TRAINER_DISABLED;
Log_Write_Event(DATA_ACRO_TRAINER_DISABLED);
break; break;
case AUX_SWITCH_MIDDLE: case AUX_SWITCH_MIDDLE:
g.acro_trainer = ACRO_TRAINER_LEVELING; g.acro_trainer = ACRO_TRAINER_LEVELING;
Log_Write_Event(DATA_ACRO_TRAINER_LEVELING);
break; break;
case AUX_SWITCH_HIGH: case AUX_SWITCH_HIGH:
g.acro_trainer = ACRO_TRAINER_LIMITED; g.acro_trainer = ACRO_TRAINER_LIMITED;
Log_Write_Event(DATA_ACRO_TRAINER_LIMITED);
break; break;
} }
break; break;
@ -337,6 +346,7 @@ static void save_trim()
float roll_trim = ToRad((float)g.rc_1.control_in/100.0f); float roll_trim = ToRad((float)g.rc_1.control_in/100.0f);
float pitch_trim = ToRad((float)g.rc_2.control_in/100.0f); float pitch_trim = ToRad((float)g.rc_2.control_in/100.0f);
ahrs.add_trim(roll_trim, pitch_trim); ahrs.add_trim(roll_trim, pitch_trim);
Log_Write_Event(DATA_SAVE_TRIM);
} }
// auto_trim - slightly adjusts the ahrs.roll_trim and ahrs.pitch_trim towards the current stick positions // auto_trim - slightly adjusts the ahrs.roll_trim and ahrs.pitch_trim towards the current stick positions

View File

@ -346,6 +346,14 @@ enum ap_message {
#define DATA_AUTOTUNE_REACHED_LIMIT 35 #define DATA_AUTOTUNE_REACHED_LIMIT 35
#define DATA_AUTOTUNE_TESTING 36 #define DATA_AUTOTUNE_TESTING 36
#define DATA_AUTOTUNE_SAVEDGAINS 37 #define DATA_AUTOTUNE_SAVEDGAINS 37
#define DATA_SAVE_TRIM 38
#define DATA_SAVEWP_ADD_WP 39
#define DATA_SAVEWP_CLEAR_MISSION_RTL 40
#define DATA_FENCE_ENABLE 41
#define DATA_FENCE_DISABLE 42
#define DATA_ACRO_TRAINER_DISABLED 43
#define DATA_ACRO_TRAINER_LEVELING 44
#define DATA_ACRO_TRAINER_LIMITED 45