OMOTE/Platformio/src/scenes/scene_fireTV.cpp
Klaus Musch 7ba79d5c92
Modular approach - first version for main branch (#60)
* first version of "modular-approach"

* changed keyboard commands for HOME and BACK

* Update README.md

* only some typos in comments

* readability

* comment for what the mqtt keyboard is used

* removed numbering of tab variables. not needed anymore

* changed the default keyboard from "´mqtt keyboard" to "BLE keyboard"

* updated to latest version of keypad library from Github, changes for inverted logic are explicitely marked

* added comment for key repeatModes

* added comment for MQTT keyboard

* setting timout via GUI now works, not only dropdown without functionality

* BLE indicator added; separation of BLE/WiFi activation from activation of devices using it

* report battery level to BLE device

* Dynamic keyboard commands, so you can safely deactivate BLE and/or WiFi and not break the example code

* reorganized files into folders

* moved lv_conf.h into the gui folder

* added devices for appleTV and smarthome

* assets.c broken up and placed them where they are used

* added support for IR RC5

* reorganization of files and folder

* added comment

* renamed assets files

* introduction of gui_registry

* removed unnecessary functions from sleep.h

* use gui_registry.h only once

* some files renamed for better understandability

* minor renaming

* some more renaming

* check if WiFi label was instantiated before using it

* introduction of a scene registry

* save prefs directly after timeout is changed

* renaming of preferencesStorage

* comment added

* only readability

* detailled definition of key layout for the diferrent scenes

* made code compile for "device_smarthome" when WiFi is deactivated

* fixed access violation when no scene was active

* added support for IR DENON commands

* increased lvgl heap from 32K to 48K
2024-02-12 19:57:51 +01:00

79 lines
2.6 KiB
C++

#include <map>
#include "gui_general_and_keys/keys.h"
#include "device_samsungTV/device_samsungTV.h"
#include "device_yamahaAmp/device_yamahaAmp.h"
#include "scenes/sceneRegistry.h"
#include "scenes/scene_allOff.h"
#include "scenes/scene_TV.h"
#include "scenes/scene_fireTV.h"
#include "scenes/scene_chromecast.h"
#include "commandHandler.h"
std::map<char, repeatModes> key_repeatModes_fireTV {
{'<', SHORTorLONG }, {'p', SHORT }, {'>', SHORTorLONG },
{'c', SHORT }, {'i', SHORT },
{'u', SHORT },
{'l', SHORT }, {'k', SHORT }, {'r', SHORT },
{'d', SHORT },
{'s', SHORT },
};
std::map<char, std::string> key_commands_short_fireTV {
{'<', KEYBOARD_REWIND}, {'p', KEYBOARD_PLAYPAUSE}, {'>', KEYBOARD_FASTFORWARD},
{'c', KEYBOARD_HOME}, {'i', KEYBOARD_MENU},
{'u', KEYBOARD_UP},
{'l', KEYBOARD_LEFT}, {'k', KEYBOARD_SELECT}, {'r', KEYBOARD_RIGHT},
{'d', KEYBOARD_DOWN},
{'s', KEYBOARD_BACK},
};
std::map<char, std::string> key_commands_long_fireTV {
{'<', KEYBOARD_REWIND_LONG},
{'>', KEYBOARD_FASTFORWARD_LONG},
};
void scene_start_sequence_fireTV(void) {
executeCommand(SAMSUNG_POWER_ON);
delay(500);
executeCommand(YAMAHA_POWER_ON);
delay(1500);
executeCommand(YAMAHA_INPUT_DTV);
delay(3000);
executeCommand(SAMSUNG_INPUT_HDMI_2);
delay(100);
executeCommand(KEYBOARD_HOME);
delay(500);
executeCommand(KEYBOARD_HOME);
}
void scene_end_sequence_fireTV(void) {
// you cannot power off FireTV, but at least you can stop the currently running app
executeCommand(KEYBOARD_HOME);
delay(500);
executeCommand(KEYBOARD_HOME);
}
std::string scene_name_fireTV = "Fire TV";
void register_scene_fireTV(void){
register_scene(
scene_name_fireTV,
& scene_start_sequence_fireTV,
& scene_end_sequence_fireTV,
& key_repeatModes_fireTV,
& key_commands_short_fireTV,
& key_commands_long_fireTV);
commands[SCENE_FIRETV] = makeCommandData(SCENE, {scene_name_fireTV});
}