diff --git a/src/espmega_iot_core.cpp b/src/espmega_iot_core.cpp index 91a4c5d..08cde64 100644 --- a/src/espmega_iot_core.cpp +++ b/src/espmega_iot_core.cpp @@ -57,7 +57,7 @@ int lcd_current_page = 1; int lcd_pwmAdj_id = 0; EasyNex panel(Serial); #ifdef ENABLE_EXTERNAL_LCD -EasyNex ESPMega_EXTLCD(Serial2); +EasyNex user_panel(Serial); #endif // Air Conditioner Control @@ -120,7 +120,7 @@ void setup() Serial.begin(115200); #ifdef ENABLE_EXTERNAL_LCD Serial2.begin(115200); - ESPMega_EXTLCD.begin(115200); + user_panel.begin(115200); #endif panel.begin(115200); Serial.println("ESPMega R3 Initializing"); @@ -131,12 +131,6 @@ void setup() lcd_send_stop_bit(); lcd_init(); lcd_begin(); - #ifdef ENABLE_EXTERNAL_LCD - Serial2.print("rest"); - Serial2.write(0xFF); - Serial2.write(0xFF); - Serial2.write(0xFF); - #endif lcd_send_command("boot_state.txt=\"Core Initializing . . .\""); Serial.println("Initializing Infrared . . ."); lcd_send_command("boot_state.txt=\"Infrared Initializing . . .\""); @@ -153,6 +147,12 @@ void setup() Serial.println("Jumping to User Code."); user_init(); lcd_send_command("page dashboard"); + #ifdef ENABLE_EXTERNAL_LCD + Serial2.print("rest"); + Serial2.write(0xFF); + Serial2.write(0xFF); + Serial2.write(0xFF); + #endif } @@ -726,9 +726,6 @@ void lcd_loop() { lcd_thread_controller.run(); panel.NextionListen(); - #ifdef ENABLE_EXTERNAL_LCD - ESPMega_EXTLCD.NextionListen(); - #endif if (panel.currentPageId != lcd_current_page) { lcd_current_page = panel.currentPageId; diff --git a/src/external_lcd.cpp b/src/external_lcd.cpp new file mode 100644 index 0000000..cac60f5 --- /dev/null +++ b/src/external_lcd.cpp @@ -0,0 +1,5 @@ +#include +void ExternalLCD::callTriggerFunction() { + uint8_t touch_hex = Serial2.read(); + external_lcd_callback(touch_hex); +} \ No newline at end of file diff --git a/src/external_lcd.hpp b/src/external_lcd.hpp new file mode 100644 index 0000000..3e16ecd --- /dev/null +++ b/src/external_lcd.hpp @@ -0,0 +1,12 @@ +#include +#ifndef trigger_h +#include "trigger.h" +#endif +#ifndef EXTERNAL_LCD_LOADED +#define EXTERNAL_LCD_LOADED +#include "user_code.hpp" +class ExternalLCD: public EasyNex { + protected: + void callTriggerFunction(); +}; +#endif \ No newline at end of file diff --git a/src/user_code.cpp b/src/user_code.cpp index df02812..5124642 100644 --- a/src/user_code.cpp +++ b/src/user_code.cpp @@ -24,10 +24,6 @@ This code will run after every component is initialized void user_init() { timer1.begin(); - ESPMega_EXTLCD_Serial.print("page home"); - ESPMega_EXTLCD_Serial.write(0xFF); - ESPMega_EXTLCD_Serial.write(0xFF); - ESPMega_EXTLCD_Serial.write(0xFF); } /* diff --git a/user_display/EXTDISP.HMI b/user_display/EXTDISP.HMI deleted file mode 100644 index fb654ec..0000000 Binary files a/user_display/EXTDISP.HMI and /dev/null differ diff --git a/user_display/fonts/sansserif-16-ascii.zi b/user_display/fonts/sansserif-16-ascii.zi deleted file mode 100644 index 6976d1b..0000000 Binary files a/user_display/fonts/sansserif-16-ascii.zi and /dev/null differ diff --git a/user_display/fonts/sansserif-32-ascii.zi b/user_display/fonts/sansserif-32-ascii.zi deleted file mode 100644 index 317e4f8..0000000 Binary files a/user_display/fonts/sansserif-32-ascii.zi and /dev/null differ