infrared_scene_universal_ac.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #include "../infrared_i.h"
  2. #include "common/infrared_scene_universal_common.h"
  3. void infrared_scene_universal_ac_on_enter(void* context) {
  4. infrared_scene_universal_common_on_enter(context);
  5. Infrared* infrared = context;
  6. ButtonPanel* button_panel = infrared->button_panel;
  7. InfraredBruteForce* brute_force = infrared->brute_force;
  8. infrared_brute_force_set_db_filename(brute_force, EXT_PATH("infrared/assets/ac.ir"));
  9. button_panel_reserve(button_panel, 2, 3);
  10. uint32_t i = 0;
  11. button_panel_add_item(
  12. button_panel,
  13. i,
  14. 0,
  15. 0,
  16. 3,
  17. 22,
  18. &I_Off_25x27,
  19. &I_Off_hvr_25x27,
  20. infrared_scene_universal_common_item_callback,
  21. context);
  22. infrared_brute_force_add_record(brute_force, i++, "Off");
  23. button_panel_add_item(
  24. button_panel,
  25. i,
  26. 1,
  27. 0,
  28. 36,
  29. 22,
  30. &I_Dehumidify_25x27,
  31. &I_Dehumidify_hvr_25x27,
  32. infrared_scene_universal_common_item_callback,
  33. context);
  34. infrared_brute_force_add_record(brute_force, i++, "Dh");
  35. button_panel_add_item(
  36. button_panel,
  37. i,
  38. 0,
  39. 1,
  40. 3,
  41. 59,
  42. &I_CoolHi_25x27,
  43. &I_CoolHi_hvr_25x27,
  44. infrared_scene_universal_common_item_callback,
  45. context);
  46. infrared_brute_force_add_record(brute_force, i++, "Cool_hi");
  47. button_panel_add_item(
  48. button_panel,
  49. i,
  50. 1,
  51. 1,
  52. 36,
  53. 59,
  54. &I_HeatHi_25x27,
  55. &I_HeatHi_hvr_25x27,
  56. infrared_scene_universal_common_item_callback,
  57. context);
  58. infrared_brute_force_add_record(brute_force, i++, "Heat_hi");
  59. button_panel_add_item(
  60. button_panel,
  61. i,
  62. 0,
  63. 2,
  64. 3,
  65. 91,
  66. &I_CoolLo_25x27,
  67. &I_CoolLo_hvr_25x27,
  68. infrared_scene_universal_common_item_callback,
  69. context);
  70. infrared_brute_force_add_record(brute_force, i++, "Cool_lo");
  71. button_panel_add_item(
  72. button_panel,
  73. i,
  74. 1,
  75. 2,
  76. 36,
  77. 91,
  78. &I_HeatLo_25x27,
  79. &I_HeatLo_hvr_25x27,
  80. infrared_scene_universal_common_item_callback,
  81. context);
  82. infrared_brute_force_add_record(brute_force, i++, "Heat_lo");
  83. button_panel_add_label(button_panel, 6, 10, FontPrimary, "AC remote");
  84. view_set_orientation(view_stack_get_view(infrared->view_stack), ViewOrientationVertical);
  85. view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewStack);
  86. infrared_show_loading_popup(infrared, true);
  87. bool success = infrared_brute_force_calculate_messages(brute_force);
  88. infrared_show_loading_popup(infrared, false);
  89. if(!success) {
  90. scene_manager_next_scene(infrared->scene_manager, InfraredSceneErrorDatabases);
  91. }
  92. }
  93. bool infrared_scene_universal_ac_on_event(void* context, SceneManagerEvent event) {
  94. return infrared_scene_universal_common_on_event(context, event);
  95. }
  96. void infrared_scene_universal_ac_on_exit(void* context) {
  97. infrared_scene_universal_common_on_exit(context);
  98. }