mirror of https://github.com/ArduPilot/ardupilot
Copter: replace if statement with switch statement
This commit is contained in:
parent
a393bd26d7
commit
60137e0f0b
|
@ -41,17 +41,21 @@ void Copter::set_auto_armed(bool b)
|
||||||
void Copter::set_simple_mode(uint8_t b)
|
void Copter::set_simple_mode(uint8_t b)
|
||||||
{
|
{
|
||||||
if(ap.simple_mode != b){
|
if(ap.simple_mode != b){
|
||||||
if(b == 0){
|
switch (b) {
|
||||||
|
case 0:
|
||||||
Log_Write_Event(DATA_SET_SIMPLE_OFF);
|
Log_Write_Event(DATA_SET_SIMPLE_OFF);
|
||||||
GCS_MAVLINK::send_statustext_all(MAV_SEVERITY_INFO, "SIMPLE mode off");
|
GCS_MAVLINK::send_statustext_all(MAV_SEVERITY_INFO, "SIMPLE mode off");
|
||||||
}else if(b == 1){
|
break;
|
||||||
|
case 1:
|
||||||
Log_Write_Event(DATA_SET_SIMPLE_ON);
|
Log_Write_Event(DATA_SET_SIMPLE_ON);
|
||||||
GCS_MAVLINK::send_statustext_all(MAV_SEVERITY_INFO, "SIMPLE mode on");
|
GCS_MAVLINK::send_statustext_all(MAV_SEVERITY_INFO, "SIMPLE mode on");
|
||||||
}else{
|
break;
|
||||||
|
default:
|
||||||
// initialise super simple heading
|
// initialise super simple heading
|
||||||
update_super_simple_bearing(true);
|
update_super_simple_bearing(true);
|
||||||
Log_Write_Event(DATA_SET_SUPERSIMPLE_ON);
|
Log_Write_Event(DATA_SET_SUPERSIMPLE_ON);
|
||||||
GCS_MAVLINK::send_statustext_all(MAV_SEVERITY_INFO, "SUPERSIMPLE mode on");
|
GCS_MAVLINK::send_statustext_all(MAV_SEVERITY_INFO, "SUPERSIMPLE mode on");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
ap.simple_mode = b;
|
ap.simple_mode = b;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue