mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-12-24 03:33:08 +00:00
b9a766d909
* Added support for running applications from SD card (FAPs - Flipper Application Packages) * Added plugin_dist target for fbt to build FAPs * All apps of type FlipperAppType.EXTERNAL and FlipperAppType.PLUGIN are built as FAPs by default * Updated VSCode configuration for new fbt features - re-deploy stock configuration to use them * Added debugging support for FAPs with fbt debug & VSCode * Added public firmware API with automated versioning Co-authored-by: hedger <hedger@users.noreply.github.com> Co-authored-by: SG <who.just.the.doctor@gmail.com> Co-authored-by: あく <alleteam@gmail.com>
45 lines
1.7 KiB
C
45 lines
1.7 KiB
C
#include "../infrared_i.h"
|
|
|
|
void infrared_scene_learn_on_enter(void* context) {
|
|
Infrared* infrared = context;
|
|
Popup* popup = infrared->popup;
|
|
InfraredWorker* worker = infrared->worker;
|
|
|
|
infrared_worker_rx_set_received_signal_callback(
|
|
worker, infrared_signal_received_callback, context);
|
|
infrared_worker_rx_start(worker);
|
|
infrared_play_notification_message(infrared, InfraredNotificationMessageBlinkStartRead);
|
|
|
|
popup_set_icon(popup, 0, 32, &I_InfraredLearnShort_128x31);
|
|
popup_set_header(popup, NULL, 0, 0, AlignCenter, AlignCenter);
|
|
popup_set_text(
|
|
popup, "Point the remote at IR port\nand push the button", 5, 10, AlignLeft, AlignCenter);
|
|
popup_set_callback(popup, NULL);
|
|
|
|
view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewPopup);
|
|
}
|
|
|
|
bool infrared_scene_learn_on_event(void* context, SceneManagerEvent event) {
|
|
Infrared* infrared = context;
|
|
bool consumed = false;
|
|
|
|
if(event.type == SceneManagerEventTypeCustom) {
|
|
if(event.event == InfraredCustomEventTypeSignalReceived) {
|
|
infrared_play_notification_message(infrared, InfraredNotificationMessageSuccess);
|
|
scene_manager_next_scene(infrared->scene_manager, InfraredSceneLearnSuccess);
|
|
consumed = true;
|
|
}
|
|
}
|
|
|
|
return consumed;
|
|
}
|
|
|
|
void infrared_scene_learn_on_exit(void* context) {
|
|
Infrared* infrared = context;
|
|
Popup* popup = infrared->popup;
|
|
infrared_worker_rx_set_received_signal_callback(infrared->worker, NULL, NULL);
|
|
infrared_worker_rx_stop(infrared->worker);
|
|
infrared_play_notification_message(infrared, InfraredNotificationMessageBlinkStop);
|
|
popup_set_icon(popup, 0, 0, NULL);
|
|
popup_set_text(popup, NULL, 0, 0, AlignCenter, AlignCenter);
|
|
}
|