unleashed-firmware/applications/main/infrared/scenes/infrared_scene_universal_ac.c
Georgii Surkov 022fccf0d7
[FL-3783] Asynchronous Infrared remote manipulation (#3503)
* Introduce ConcurrentRunner, load universal and regular remotes concurrently
* Perform all lengthy operations in a ConcurrentRunner
* Fix python formatting
* Clean up code
* Add usage warning
* Remove ConcurrentRunner, use a plain FuriThread instead
* Load remotes asynchronously in RPC mode as well
* Reorder code for clarity
* Clean up, use thread return code to report errors
* Improve wording
* Fix logical error
2024-03-12 02:35:51 +09:00

133 lines
3.6 KiB
C

#include "../infrared_app_i.h"
#include "common/infrared_scene_universal_common.h"
void infrared_scene_universal_ac_on_enter(void* context) {
InfraredApp* infrared = context;
ButtonPanel* button_panel = infrared->button_panel;
InfraredBruteForce* brute_force = infrared->brute_force;
infrared_brute_force_set_db_filename(brute_force, EXT_PATH("infrared/assets/ac.ir"));
button_panel_reserve(button_panel, 2, 3);
uint32_t i = 0;
button_panel_add_item(
button_panel,
i,
0,
0,
6,
15,
&I_off_19x20,
&I_off_hover_19x20,
infrared_scene_universal_common_item_callback,
context);
button_panel_add_icon(button_panel, 10, 37, &I_off_text_12x5);
infrared_brute_force_add_record(brute_force, i++, "Off");
button_panel_add_item(
button_panel,
i,
1,
0,
39,
15,
&I_dry_19x20,
&I_dry_hover_19x20,
infrared_scene_universal_common_item_callback,
context);
button_panel_add_icon(button_panel, 41, 37, &I_dry_text_15x5);
infrared_brute_force_add_record(brute_force, i++, "Dh");
button_panel_add_item(
button_panel,
i,
0,
1,
3,
49,
&I_max_24x23,
&I_max_hover_24x23,
infrared_scene_universal_common_item_callback,
context);
infrared_brute_force_add_record(brute_force, i++, "Cool_hi");
button_panel_add_item(
button_panel,
i,
1,
1,
37,
49,
&I_max_24x23,
&I_max_hover_24x23,
infrared_scene_universal_common_item_callback,
context);
infrared_brute_force_add_record(brute_force, i++, "Heat_hi");
if(furi_hal_rtc_get_locale_units() == FuriHalRtcLocaleUnitsMetric) {
button_panel_add_item(
button_panel,
i,
0,
2,
3,
100,
&I_celsius_24x23,
&I_celsius_hover_24x23,
infrared_scene_universal_common_item_callback,
context);
} else {
button_panel_add_item(
button_panel,
i,
0,
2,
3,
100,
&I_fahren_24x23,
&I_fahren_hover_24x23,
infrared_scene_universal_common_item_callback,
context);
}
infrared_brute_force_add_record(brute_force, i++, "Cool_lo");
if(furi_hal_rtc_get_locale_units() == FuriHalRtcLocaleUnitsMetric) {
button_panel_add_item(
button_panel,
i,
1,
2,
37,
100,
&I_celsius_24x23,
&I_celsius_hover_24x23,
infrared_scene_universal_common_item_callback,
context);
} else {
button_panel_add_item(
button_panel,
i,
1,
2,
37,
100,
&I_fahren_24x23,
&I_fahren_hover_24x23,
infrared_scene_universal_common_item_callback,
context);
}
infrared_brute_force_add_record(brute_force, i++, "Heat_lo");
button_panel_add_icon(button_panel, 0, 60, &I_cool_30x51);
button_panel_add_icon(button_panel, 34, 60, &I_heat_30x51);
button_panel_add_label(button_panel, 4, 10, FontPrimary, "AC remote");
infrared_scene_universal_common_on_enter(context);
}
bool infrared_scene_universal_ac_on_event(void* context, SceneManagerEvent event) {
return infrared_scene_universal_common_on_event(context, event);
}
void infrared_scene_universal_ac_on_exit(void* context) {
infrared_scene_universal_common_on_exit(context);
}