mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-12-23 19:23:09 +00:00
31c31db479
* Add new IrdaApp (half ready), add ButtonMenu * Fix NEC's extension * clang-format * Fix leak * Add submenu optional header * IRDA: add Edit button * clang-format * IrdaApp: Fix scene flow * Add IRDA NEC extended protocol * IRDA: Add address/command length Co-authored-by: SG <who.just.the.doctor@gmail.com>
31 lines
926 B
C++
31 lines
926 B
C++
#include "../irda-app.hpp"
|
|
|
|
void IrdaAppSceneLearn::on_enter(IrdaApp* app) {
|
|
auto view_manager = app->get_view_manager();
|
|
auto receiver = app->get_receiver();
|
|
auto event_queue = view_manager->get_event_queue();
|
|
|
|
receiver->capture_once_start(event_queue);
|
|
|
|
auto popup = view_manager->get_popup();
|
|
|
|
popup_set_icon(popup, 0, 32, I_IrdaLearnShort_128x31);
|
|
popup_set_text(
|
|
popup, "Point the remote at IR port\nand push the button", 5, 10, AlignLeft, AlignCenter);
|
|
popup_set_callback(popup, NULL);
|
|
|
|
view_manager->switch_to(IrdaAppViewManager::ViewType::Popup);
|
|
}
|
|
|
|
bool IrdaAppSceneLearn::on_event(IrdaApp* app, IrdaAppEvent* event) {
|
|
bool consumed = false;
|
|
|
|
if(event->type == IrdaAppEvent::Type::IrdaMessageReceived) {
|
|
app->switch_to_next_scene_without_saving(IrdaApp::Scene::LearnSuccess);
|
|
}
|
|
|
|
return consumed;
|
|
}
|
|
|
|
void IrdaAppSceneLearn::on_exit(IrdaApp* app) {
|
|
}
|