AP_Camera: if exiting a RunCam submenu reset the submenu index to the top

This commit is contained in:
Andy Piper 2020-03-29 18:09:22 +01:00 committed by Andrew Tridgell
parent 1222aa2c43
commit e3d22b9d27
1 changed files with 2 additions and 0 deletions

View File

@ -549,6 +549,7 @@ void AP_RunCam::handle_2_key_simulation_process(Event ev)
// in a sub-menu and save-and-exit was selected
if (_in_menu > 1 && get_top_menu_length() > 0 && _sub_menu_pos == (get_sub_menu_length(_top_menu_pos) - 1)) {
simulate_camera_button(ControlOperation::RCDEVICE_PROTOCOL_SIMULATE_WIFI_BTN, _button_delay_ms);
_sub_menu_pos = 0;
_in_menu--;
// in the top-menu and save-and-exit was selected
} else if (_in_menu == 1 && get_top_menu_length() > 0 && _top_menu_pos == (get_top_menu_length() - 1)) {
@ -580,6 +581,7 @@ void AP_RunCam::handle_2_key_simulation_process(Event ev)
// the only exception is if someone hits save and exit on the root menu - then we are lost.
if (_in_menu > 0) {
_in_menu--;
_sub_menu_pos = 0;
simulate_camera_button(ControlOperation::RCDEVICE_PROTOCOL_CHANGE_MODE, _mode_delay_ms); // move up/out a menu
}
// no longer in the menu so trigger the OSD re-enablement