#pragma once #include #include #include #include #include "espmega_iot_timer.hpp" #include "espmega_iot_external_lcd.hpp" /* Environment Details P0-P2: Fans P3-P6: Lights P7: Air Purifier I0-I2: Fan Switch */ // Pin Definition #define FAN1_PIN 0 #define FAN2_PIN 1 #define FAN3_PIN 2 #define LIGHT1_PIN 3 #define LIGHT2_PIN 4 #define LIGHT3_PIN 5 #define LIGHT4_PIN 6 #define AIR_PURIFIER_PIN 7 #define FAN1_BTN_PIN 0 #define FAN2_BTN_PIN 1 #define FAN3_BTN_PIN 2 #define LIGHT1_BTN_PIN 3 #define LIGHT2_BTN_PIN 4 #define LIGHT3_BTN_PIN 5 #define LIGHT4_BTN_PIN 6 #define AIR_PURIFIER_BTN_PIN 7 // External LCD Configuration #define ENABLE_EXTERNAL_LCD #define TXD2 4 #define RXD2 17 #ifdef ENABLE_EXTERNAL_LCD #define ESPMega_EXTLCD Serial2 #define elcd ESPMega_EXTLCD #endif // User Defined Functions void user_pre_init(); void user_init(); void user_loop(); void virtual_interrupt_user_callback(int pin, int state); void pwm_changed_user_callback(int pin); void ac_changed_user_callback(uint8_t mode, uint8_t temperature, uint8_t fan_speed); void timer_tick_callback(); void lt_btn_cb(void *comp); void fan_btn_cb(void *comp); void puri_btn_cb(void *comp); void temp_up_btn_cb(void *comp); void temp_down_btn_cb(void *comp); void mode_off_btn_cb(void *comp); void mode_fan_btn_cb(void *comp); void mode_cool_btn_cb(void *comp); void fan_auto_btn_cb(void *comp); void fan_1_btn_cb(void *comp); void fan_2_btn_cb(void *comp); void fan_3_btn_cb(void *comp); void cud_light_toggle(); bool cud_light_group_state(); void cud_fan_toggle(); bool cud_fan_group_state(); void ac_lock_callback(String topic, String payload); void elcd_sendstop(); void ac_update_lcd(); void pwm_update_lcd(); // ESPMega IoT Core Build-in Functions extern void pwm_set_state(int id, int state); extern void pwm_set_value(int id, int value); extern void pwm_toggle(int id); extern void pwm_toggle(int id1, int id2); extern void pwm_cycle_value(int id); extern bool pwm_get_state(int id); extern uint16_t pwm_get_value(int id); extern boolean pwm_group_state(int id1, int id2); extern bool input_get_state(int id); extern void ac_set_state(int mode, int temperature, int fan_speed); extern uint8_t ac_get_temperature(); extern uint8_t ac_get_mode(); extern uint8_t ac_get_fan_speed(); extern bool standalone; extern PubSubClient mqtt_client; extern PubSubClientTools mqtt; extern char MQTT_BASE_TOPIC[];