|
|
|
@ -40,55 +40,6 @@ void Copter::userhook_50Hz()
@@ -40,55 +40,6 @@ void Copter::userhook_50Hz()
|
|
|
|
|
void Copter::userhook_MediumLoop() |
|
|
|
|
{ |
|
|
|
|
// put your 10Hz code here
|
|
|
|
|
#if CAM_DEBUG |
|
|
|
|
static uint64_t prt_cnt; |
|
|
|
|
|
|
|
|
|
uint16_t rc7_in = RC_Channels::rc_channel(CH_7)->get_radio_in(); |
|
|
|
|
switch (in_debug_mode) |
|
|
|
|
{ |
|
|
|
|
case 0: |
|
|
|
|
if(rc7_in > 1600){ |
|
|
|
|
in_debug_mode = 1; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 1: |
|
|
|
|
if(rc7_in < 1600){ |
|
|
|
|
in_debug_mode = 2; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 2: |
|
|
|
|
if(rc7_in > 1600){ |
|
|
|
|
in_debug_mode = 3; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 3: |
|
|
|
|
if(rc7_in < 1600){ |
|
|
|
|
in_debug_mode = 4; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 4: |
|
|
|
|
if(rc7_in > 1600){ |
|
|
|
|
in_debug_mode = 0; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
default: |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(in_debug_mode == 4 || control_mode==Mode::Number::SPORT){ |
|
|
|
|
prt_cnt++; |
|
|
|
|
if(!motors->armed()){ |
|
|
|
|
arming.arm(AP_Arming::Method::SCRIPTING); |
|
|
|
|
gcs().send_text(MAV_SEVERITY_INFO,"NOTICE: debug mode arm!"); |
|
|
|
|
} |
|
|
|
|
gcs().send_text(MAV_SEVERITY_INFO,"NOTICE: cnt:%lld",prt_cnt); |
|
|
|
|
camera.take_picture(); |
|
|
|
|
}else{ |
|
|
|
|
|
|
|
|
|
prt_cnt = 0; |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
@ -107,20 +58,9 @@ void Copter::userhook_SuperSlowLoop()
@@ -107,20 +58,9 @@ void Copter::userhook_SuperSlowLoop()
|
|
|
|
|
// put your 1Hz code here
|
|
|
|
|
zr_SuperSlowLoop(); |
|
|
|
|
#if CAM_DEBUG |
|
|
|
|
// static uint64_t prt_cnt;
|
|
|
|
|
|
|
|
|
|
// if(in_debug_mode == 2 || control_mode==Mode::Number::ACRO){
|
|
|
|
|
// prt_cnt++;
|
|
|
|
|
// if(!motors->armed()){
|
|
|
|
|
// arming.arm(AP_Arming::Method::SCRIPTING);
|
|
|
|
|
// gcs().send_text(MAV_SEVERITY_INFO,"NOTICE: debug mode arm!");
|
|
|
|
|
// }
|
|
|
|
|
// gcs().send_text(MAV_SEVERITY_INFO,"NOTICE: cnt:%lld",prt_cnt);
|
|
|
|
|
// camera.take_picture();
|
|
|
|
|
// }else{
|
|
|
|
|
|
|
|
|
|
// prt_cnt = 0;
|
|
|
|
|
// }
|
|
|
|
|
if(in_debug_mode == 2 || control_mode==Mode::Number::ACRO){
|
|
|
|
|
camera.take_picture(); |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
} |
|
|
|
@ -146,15 +86,15 @@ void Copter::userhook_auxSwitch1(uint8_t ch_flag)
@@ -146,15 +86,15 @@ void Copter::userhook_auxSwitch1(uint8_t ch_flag)
|
|
|
|
|
case 2: { |
|
|
|
|
// relay.on(2);
|
|
|
|
|
gcs().send_text(MAV_SEVERITY_INFO,"NOTICE: debug mode 2!"); |
|
|
|
|
in_debug_mode = 4; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
case 1: { |
|
|
|
|
// relay.on(2);
|
|
|
|
|
gcs().send_text(MAV_SEVERITY_INFO,"NOTICE: debug mode 1!"); |
|
|
|
|
in_debug_mode = 1; |
|
|
|
|
in_debug_mode = 2; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
// case 1: {
|
|
|
|
|
// // relay.on(2);
|
|
|
|
|
// gcs().send_text(MAV_SEVERITY_INFO,"NOTICE: debug mode 1!");
|
|
|
|
|
// in_debug_mode = 1;
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
case 0: { |
|
|
|
|
// relay.off(2);
|
|
|
|
|
gcs().send_text(MAV_SEVERITY_INFO,"NOTICE: debug mode off!"); |
|
|
|
|