Compare commits

..

8 Commits

7 changed files with 15 additions and 25 deletions

View File

@ -57,7 +57,7 @@ int lcd_current_page = 1;
int lcd_pwmAdj_id = 0; int lcd_pwmAdj_id = 0;
EasyNex panel(Serial); EasyNex panel(Serial);
#ifdef ENABLE_EXTERNAL_LCD #ifdef ENABLE_EXTERNAL_LCD
EasyNex user_panel(Serial); EasyNex ESPMega_EXTLCD(Serial2);
#endif #endif
// Air Conditioner Control // Air Conditioner Control
@ -120,7 +120,7 @@ void setup()
Serial.begin(115200); Serial.begin(115200);
#ifdef ENABLE_EXTERNAL_LCD #ifdef ENABLE_EXTERNAL_LCD
Serial2.begin(115200); Serial2.begin(115200);
user_panel.begin(115200); ESPMega_EXTLCD.begin(115200);
#endif #endif
panel.begin(115200); panel.begin(115200);
Serial.println("ESPMega R3 Initializing"); Serial.println("ESPMega R3 Initializing");
@ -131,6 +131,12 @@ void setup()
lcd_send_stop_bit(); lcd_send_stop_bit();
lcd_init(); lcd_init();
lcd_begin(); 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 . . .\""); lcd_send_command("boot_state.txt=\"Core Initializing . . .\"");
Serial.println("Initializing Infrared . . ."); Serial.println("Initializing Infrared . . .");
lcd_send_command("boot_state.txt=\"Infrared Initializing . . .\""); lcd_send_command("boot_state.txt=\"Infrared Initializing . . .\"");
@ -147,12 +153,6 @@ void setup()
Serial.println("Jumping to User Code."); Serial.println("Jumping to User Code.");
user_init(); user_init();
lcd_send_command("page dashboard"); lcd_send_command("page dashboard");
#ifdef ENABLE_EXTERNAL_LCD
Serial2.print("rest");
Serial2.write(0xFF);
Serial2.write(0xFF);
Serial2.write(0xFF);
#endif
} }
@ -726,6 +726,9 @@ void lcd_loop()
{ {
lcd_thread_controller.run(); lcd_thread_controller.run();
panel.NextionListen(); panel.NextionListen();
#ifdef ENABLE_EXTERNAL_LCD
ESPMega_EXTLCD.NextionListen();
#endif
if (panel.currentPageId != lcd_current_page) if (panel.currentPageId != lcd_current_page)
{ {
lcd_current_page = panel.currentPageId; lcd_current_page = panel.currentPageId;

View File

@ -1,5 +0,0 @@
#include <external_lcd.hpp>
void ExternalLCD::callTriggerFunction() {
uint8_t touch_hex = Serial2.read();
external_lcd_callback(touch_hex);
}

View File

@ -1,12 +0,0 @@
#include <EasyNextionLibrary.h>
#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

View File

@ -24,6 +24,10 @@ This code will run after every component is initialized
void user_init() void user_init()
{ {
timer1.begin(); timer1.begin();
ESPMega_EXTLCD_Serial.print("page home");
ESPMega_EXTLCD_Serial.write(0xFF);
ESPMega_EXTLCD_Serial.write(0xFF);
ESPMega_EXTLCD_Serial.write(0xFF);
} }
/* /*

BIN
user_display/EXTDISP.HMI Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.