some more renaming
This commit is contained in:
parent
b4a9865dcf
commit
f815fe4937
15 changed files with 52 additions and 61 deletions
|
@ -1,6 +1,6 @@
|
|||
#include "commandHandler.h"
|
||||
#include "device_appleTV/device_appleTV.h"
|
||||
|
||||
void init_appleTV_commands() {
|
||||
void register_device_appleTV() {
|
||||
commands[APPLETV_GUI_EVENT_USER_DATA] = makeCommandData(IR_SONY, {}); // payload must be set when calling commandHandler
|
||||
}
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
|
||||
#define APPLETV_GUI_EVENT_USER_DATA "AppleTV_gui_event_user_data"
|
||||
|
||||
void init_appleTV_commands();
|
||||
void register_device_appleTV();
|
||||
|
||||
#endif /*__DEVICE_APPLETV_H__*/
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
BleKeyboard bleKeyboard("OMOTE Keyboard", "CoretechR");
|
||||
|
||||
void init_keyboard_ble_commands() {
|
||||
void register_device_keyboard_ble() {
|
||||
commands[KEYBOARD_BLE_UP] = makeCommandData(BLE_KEYBOARD, {KEYBOARD_BLE_UP});
|
||||
commands[KEYBOARD_BLE_DOWN] = makeCommandData(BLE_KEYBOARD, {KEYBOARD_BLE_DOWN});
|
||||
commands[KEYBOARD_BLE_RIGHT] = makeCommandData(BLE_KEYBOARD, {KEYBOARD_BLE_RIGHT});
|
||||
|
|
|
@ -38,7 +38,7 @@ static_assert(false, "You have to use \"#define ENABLE_BLUETOOTH\" in \"commandH
|
|||
|
||||
extern BleKeyboard bleKeyboard;
|
||||
|
||||
void init_keyboard_ble_commands();
|
||||
void register_device_keyboard_ble();
|
||||
void keyboard_ble_executeCommand(std::string command, std::string additionalPayload = "");
|
||||
void update_keyboard_ble_status();
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#ifdef ENABLE_KEYBOARD_MQTT
|
||||
|
||||
void init_keyboard_mqtt_commands() {
|
||||
void register_device_keyboard_mqtt() {
|
||||
commands[KEYBOARD_MQTT_UP] = makeCommandData(MQTT, {"esp32_keyboard_firetv/cmnd/UP", "PRESS"});
|
||||
commands[KEYBOARD_MQTT_DOWN] = makeCommandData(MQTT, {"esp32_keyboard_firetv/cmnd/DOWN", "PRESS"});
|
||||
commands[KEYBOARD_MQTT_RIGHT] = makeCommandData(MQTT, {"esp32_keyboard_firetv/cmnd/RIGHT", "PRESS"});
|
||||
|
|
|
@ -36,7 +36,7 @@ static_assert(false, "You have to use \"#define ENABLE_WIFI_AND_MQTT\" in \"comm
|
|||
#define KEYBOARD_MQTT_VOLUME_INCREMENT "Keyboard_mqtt_volume_increment"
|
||||
#define KEYBOARD_MQTT_VOLUME_DECREMENT "Keyboard_mqtt_volume_decrement"
|
||||
|
||||
void init_keyboard_mqtt_commands();
|
||||
void register_device_keyboard_mqtt();
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "commandHandler.h"
|
||||
#include "device_samsungTV/device_samsungTV.h"
|
||||
|
||||
void init_samsung_commands() {
|
||||
void register_device_samsung() {
|
||||
// both GC and SAMSUNG work well
|
||||
|
||||
// https://github.com/natcl/studioimaginaire/blob/master/arduino_remote/ircodes.py
|
||||
|
|
|
@ -59,6 +59,6 @@
|
|||
#define SAMSUNG_INPUT_COMPONENT "Samsung_input_component"
|
||||
#define SAMSUNG_INPUT_TV "Samsung_input_tv"
|
||||
|
||||
void init_samsung_commands();
|
||||
void register_device_samsung();
|
||||
|
||||
#endif /*__DEVICE_SAMSUNG_H__*/
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "commandHandler.h"
|
||||
#include "device_smarthome/device_smarthome.h"
|
||||
|
||||
void init_smarthome_mqtt_commands() {
|
||||
void register_device_smarthome() {
|
||||
commands[SMARTHOME_MQTT_BULB1_SET] = makeCommandData(MQTT, {"bulb1_set" }); // payload must be set when calling commandHandler
|
||||
commands[SMARTHOME_MQTT_BULB2_SET] = makeCommandData(MQTT, {"bulb2_set" }); // payload must be set when calling commandHandler
|
||||
commands[SMARTHOME_MQTT_BULB1_BRIGHTNESS_SET] = makeCommandData(MQTT, {"bulb1_setbrightness" }); // payload must be set when calling commandHandler
|
||||
|
|
|
@ -6,6 +6,6 @@
|
|||
#define SMARTHOME_MQTT_BULB1_BRIGHTNESS_SET "Smarthome_mqtt_bulb1_brightness_set"
|
||||
#define SMARTHOME_MQTT_BULB2_BRIGHTNESS_SET "Smarthome_mqtt_bulb2_brightness_set"
|
||||
|
||||
void init_smarthome_mqtt_commands();
|
||||
void register_device_smarthome();
|
||||
|
||||
#endif /*__DEVICE_SMARTHOME_H__*/
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "commandHandler.h"
|
||||
#include "device_yamahaAmp/device_yamahaAmp.h"
|
||||
|
||||
void init_yamaha_commands() {
|
||||
void register_device_yamaha() {
|
||||
commands[YAMAHA_INPUT_DVD] = makeCommandData(IR_NEC, {"0x5EA1837C"});
|
||||
commands[YAMAHA_INPUT_DTV] = makeCommandData(IR_NEC, {"0x5EA12AD5"});
|
||||
commands[YAMAHA_INPUT_VCR] = makeCommandData(IR_NEC, {"0x5EA1F00F"});
|
||||
|
|
|
@ -43,6 +43,6 @@
|
|||
#define YAMAHA_POWER_OFF "Yamaha_power_off"
|
||||
#define YAMAHA_POWER_ON "Yamaha_power_on"
|
||||
|
||||
void init_yamaha_commands();
|
||||
void register_device_yamaha();
|
||||
|
||||
#endif /*__DEVICE_YAMAHA_H__*/
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
IRsend IrSender(IR_LED, true);
|
||||
|
||||
void init_infrared(void) {
|
||||
void init_infraredSender(void) {
|
||||
// IR Pin Definition
|
||||
pinMode(IR_LED, OUTPUT);
|
||||
digitalWrite(IR_LED, HIGH); // HIGH off - LOW on
|
||||
|
|
|
@ -9,6 +9,6 @@
|
|||
// IR declarations
|
||||
extern IRsend IrSender;
|
||||
|
||||
void init_infrared(void);
|
||||
void init_infraredSender(void);
|
||||
|
||||
#endif /*__INFRARED_H__*/
|
||||
|
|
|
@ -3,26 +3,30 @@
|
|||
// OMOTE firmware for ESP32
|
||||
// 2023 Maximilian Kern
|
||||
|
||||
// hardware
|
||||
#include "hardware/battery.h"
|
||||
#include "hardware/sleep.h"
|
||||
#include "hardware/user_led.h"
|
||||
#include "hardware/tft.h"
|
||||
#include "hardware/mqtt.h"
|
||||
#include "hardware/infrared_sender.h"
|
||||
#include "hardware/infrared_receiver.h"
|
||||
#include "hardware/mqtt.h"
|
||||
#include "hardware/sleep.h"
|
||||
#include "hardware/battery.h"
|
||||
#include "hardware/user_led.h"
|
||||
// devices
|
||||
#include "device_samsungTV/device_samsungTV.h"
|
||||
#include "device_yamahaAmp/device_yamahaAmp.h"
|
||||
#include "device_appleTV/device_appleTV.h"
|
||||
#include "device_smarthome/device_smarthome.h"
|
||||
#include "device_appleTV/device_appleTV.h"
|
||||
#include "device_keyboard_mqtt/device_keyboard_mqtt.h"
|
||||
#include "device_keyboard_ble/device_keyboard_ble.h"
|
||||
#include "gui_general_and_keys/keys.h"
|
||||
// gui and keys
|
||||
#include "gui_general_and_keys/guiBase.h"
|
||||
#include "gui_general_and_keys/gui_irReceiver.h"
|
||||
#include "gui_general_and_keys/gui_settings.h"
|
||||
#include "gui_general_and_keys/gui_numpad.h"
|
||||
#include "device_appleTV/gui_appleTV.h"
|
||||
#include "device_smarthome/gui_smarthome.h"
|
||||
#include "gui_general_and_keys/keys.h"
|
||||
// misc
|
||||
#include "preferences_storage.h"
|
||||
#include "commandHandler.h"
|
||||
|
||||
|
@ -34,21 +38,40 @@ void setup() {
|
|||
|
||||
// Restore settings from internal flash memory
|
||||
init_preferences();
|
||||
|
||||
// Button Pin Definition
|
||||
// Button Pin definition
|
||||
init_keys();
|
||||
|
||||
// Power Pin Definition
|
||||
// Power Pin definition
|
||||
init_battery();
|
||||
|
||||
// get wakeup reason
|
||||
init_sleep();
|
||||
|
||||
// Pin definition
|
||||
init_userled();
|
||||
|
||||
// init TFT
|
||||
init_tft();
|
||||
// init WiFi
|
||||
#ifdef ENABLE_WIFI_AND_MQTT
|
||||
init_mqtt();
|
||||
#endif
|
||||
// setup the Inertial Measurement Unit (IMU) for motion detection
|
||||
// needs to be after init_tft()) because of I2C
|
||||
setup_IMU();
|
||||
// setup IR sender
|
||||
init_infraredSender();
|
||||
|
||||
// Here you can register the GUIs you want to display. Will be displayed in the order they are registered.
|
||||
// register commands for the devices
|
||||
register_device_samsung();
|
||||
register_device_yamaha();
|
||||
register_device_smarthome();
|
||||
register_device_appleTV();
|
||||
#ifdef ENABLE_KEYBOARD_MQTT
|
||||
register_device_keyboard_mqtt();
|
||||
#endif
|
||||
#ifdef ENABLE_KEYBOARD_BLE
|
||||
register_device_keyboard_ble();
|
||||
#endif
|
||||
init_deviceIndependantCommands();
|
||||
|
||||
// register the GUIs. They will be displayed in the order they are registered.
|
||||
register_gui_irReceiver();
|
||||
register_gui_settings();
|
||||
register_gui_numpad();
|
||||
|
@ -56,31 +79,6 @@ void setup() {
|
|||
register_gui_smarthome();
|
||||
// init GUI
|
||||
init_gui();
|
||||
|
||||
// init WiFi
|
||||
#ifdef ENABLE_WIFI_AND_MQTT
|
||||
init_mqtt();
|
||||
#endif
|
||||
|
||||
// needs to be here (after init_tft) because of I2C
|
||||
setup_IMU();
|
||||
|
||||
// Setup IR
|
||||
init_infrared();
|
||||
|
||||
// setup command list
|
||||
init_samsung_commands();
|
||||
init_yamaha_commands();
|
||||
init_smarthome_mqtt_commands();
|
||||
init_appleTV_commands();
|
||||
#ifdef ENABLE_KEYBOARD_MQTT
|
||||
init_keyboard_mqtt_commands();
|
||||
#endif
|
||||
#ifdef ENABLE_KEYBOARD_BLE
|
||||
init_keyboard_ble_commands();
|
||||
#endif
|
||||
init_deviceIndependantCommands();
|
||||
|
||||
gui_loop(); // Run the LVGL UI once before the loop takes over
|
||||
|
||||
Serial.print("Setup finished in ");
|
||||
|
@ -132,11 +130,4 @@ void loop() {
|
|||
infraredReceiver_loop();
|
||||
}
|
||||
|
||||
// IR Test
|
||||
//tft.drawString("IR Command: ", 10, 90, 1);
|
||||
//decode_results results;
|
||||
//if (IrReceiver.decode(&results)) {
|
||||
// //tft.drawString(String(results.command) + " ", 80, 90, 1);
|
||||
// IrReceiver.resume(); // Enable receiving of the next value
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue