[FL-1369, FL-1397, FL-1420] IRDA + SDcard (#513)
* Add saving to SD-Card (not ready yet) * Add saving to SD-card (done) * Select previous menu item * Fix central button * Fix current_button * Refactoring * Add notifications * [FL-1417] Add IRDA CLI CLI commands: 1) ir_rx Receives all IR-trafic, decodes and prints result to stdout 2) ir_tx <protocol> <address> <command> Transmits IR-signal. Address and command are hex-formatted * Fix BUG with random memory corruption at random time in random place in random universe in random unknown space and time forever amen * Fix submenu set_selected_item * Bring protocol order back * Add TODO sdcard check
This commit is contained in:
@@ -20,13 +20,26 @@ void IrdaAppSceneRemoteList::on_enter(IrdaApp* app) {
|
||||
auto remote_manager = app->get_remote_manager();
|
||||
int i = 0;
|
||||
|
||||
remote_names = remote_manager->get_remote_list();
|
||||
for(auto& a : remote_names) {
|
||||
submenu_add_item(submenu, a.c_str(), i++, submenu_callback, app);
|
||||
bool result = remote_manager->get_remote_list(remote_names);
|
||||
if(!result) {
|
||||
app->switch_to_previous_scene();
|
||||
return;
|
||||
}
|
||||
|
||||
for(auto& name : remote_names) {
|
||||
submenu_add_item(submenu, name.c_str(), i++, submenu_callback, app);
|
||||
}
|
||||
submenu_add_item(
|
||||
submenu, " +", SubmenuIndexPlus, submenu_callback, app);
|
||||
|
||||
if((SubmenuIndex)submenu_item_selected == SubmenuIndexPlus) {
|
||||
submenu_set_selected_item(submenu, submenu_item_selected);
|
||||
} else {
|
||||
int remote_index = remote_manager->find_remote_name(remote_names);
|
||||
submenu_set_selected_item(submenu, (remote_index >= 0) ? remote_index : 0);
|
||||
}
|
||||
|
||||
submenu_item_selected = 0;
|
||||
view_manager->switch_to(IrdaAppViewManager::ViewType::Submenu);
|
||||
}
|
||||
|
||||
@@ -38,11 +51,14 @@ bool IrdaAppSceneRemoteList::on_event(IrdaApp* app, IrdaAppEvent* event) {
|
||||
case SubmenuIndexPlus:
|
||||
app->set_learn_new_remote(true);
|
||||
app->switch_to_next_scene(IrdaApp::Scene::Learn);
|
||||
submenu_item_selected = event->payload.menu_index;
|
||||
break;
|
||||
default:
|
||||
auto remote_manager = app->get_remote_manager();
|
||||
remote_manager->set_current_remote(event->payload.menu_index);
|
||||
app->switch_to_next_scene(IrdaApp::Scene::Remote);
|
||||
bool result = remote_manager->load(remote_names.at(event->payload.menu_index));
|
||||
if(result) {
|
||||
app->switch_to_next_scene(IrdaApp::Scene::Remote);
|
||||
}
|
||||
consumed = true;
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user