Add guiEverySecond

This commit is contained in:
fvanroie 2020-11-03 13:17:45 +01:00
parent 7f730f276e
commit 57c1b4f7dd
4 changed files with 22 additions and 8 deletions

View File

@ -260,6 +260,7 @@ void dispatchJsonl(Stream & stream)
uint8_t savedPage = haspGetPage(); uint8_t savedPage = haspGetPage();
Log.notice(F("DISPATCH: jsonl")); Log.notice(F("DISPATCH: jsonl"));
Serial.println(F("DISPATCH: jsonl"));
while(deserializeJson(jsonl, stream) == DeserializationError::Ok) { while(deserializeJson(jsonl, stream) == DeserializationError::Ok) {
// serializeJson(jsonl, Serial); // serializeJson(jsonl, Serial);

View File

@ -40,8 +40,10 @@
/* ---------- Screenshot Variables ---------- */ /* ---------- Screenshot Variables ---------- */
#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)|| defined(STM32F4xx) #if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)|| defined(STM32F4xx)
#if HASP_USE_SPIFFS>0
File pFileOut; File pFileOut;
#endif #endif
#endif
uint8_t guiSnapshot = 0; uint8_t guiSnapshot = 0;
#if defined(STM32F4xx) #if defined(STM32F4xx)
@ -558,14 +560,14 @@ bool IRAM_ATTR my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t *
{ {
//#ifdef TOUCH_CS //#ifdef TOUCH_CS
uint16_t touchX, touchY; uint16_t touchX, touchY;
bool touched;
#if TOUCH_DRIVER == 0 #if TOUCH_DRIVER == 0
bool touched = tft.getTouch(&touchX, &touchY, 600); touched = tft.getTouch(&touchX, &touchY, 600);
#elif TOUCH_DRIVER == 1 #elif TOUCH_DRIVER == 1
// return false; // return false;
bool touched = GT911_getXY(&touchX, &touchY, true); touched = GT911_getXY(&touchX, &touchY, true);
#else #elif TOUCH_DRIVER == 2
bool touched = Touch_getXY(&touchX, &touchY, false); touched = Touch_getXY(&touchX, &touchY, false);
#endif #endif
if(!touched) return false; if(!touched) return false;
@ -826,13 +828,18 @@ void IRAM_ATTR guiLoop()
// lv_tick_handler(); // lv_tick_handler();
lv_task_handler(); /* let the GUI do its work */ lv_task_handler(); /* let the GUI do its work */
guiCheckSleep(); // guiCheckSleep();
#if TOUCH_DRIVER == 1 #if TOUCH_DRIVER == 1
touch.loop(); touch.loop();
#endif #endif
} }
void guiEverySecond()
{
guiCheckSleep();
}
void guiStop() void guiStop()
{} {}
@ -952,7 +959,9 @@ bool guiSetConfig(const JsonObject & settings)
changed |= configSet(guiSleepTime1, settings[FPSTR(F_GUI_IDLEPERIOD1)], PSTR("guiSleepTime1")); changed |= configSet(guiSleepTime1, settings[FPSTR(F_GUI_IDLEPERIOD1)], PSTR("guiSleepTime1"));
changed |= configSet(guiSleepTime2, settings[FPSTR(F_GUI_IDLEPERIOD2)], PSTR("guiSleepTime2")); changed |= configSet(guiSleepTime2, settings[FPSTR(F_GUI_IDLEPERIOD2)], PSTR("guiSleepTime2"));
changed |= configSet(guiRotation, settings[FPSTR(F_GUI_ROTATION)], PSTR("guiRotation")); changed |= configSet(guiRotation, settings[FPSTR(F_GUI_ROTATION)], PSTR("guiRotation"));
Serial.print("Backlight = ");
Serial.println(guiBacklightPin);
if(!settings[FPSTR(F_GUI_POINTER)].isNull()) { if(!settings[FPSTR(F_GUI_POINTER)].isNull()) {
if(guiShowPointer != settings[FPSTR(F_GUI_POINTER)].as<bool>()) { if(guiShowPointer != settings[FPSTR(F_GUI_POINTER)].as<bool>()) {
Log.trace(F("guiShowPointer set")); Log.trace(F("guiShowPointer set"));

View File

@ -21,6 +21,7 @@ void guiTakeScreenshot();
void guiSetup(); void guiSetup();
void guiLoop(void); void guiLoop(void);
void guiStop(void); void guiStop(void);
void guiEverySecond(void);
void guiCalibrate(); void guiCalibrate();
void guiTakeScreenshot(const char * pFileName); void guiTakeScreenshot(const char * pFileName);

View File

@ -15,7 +15,8 @@ unsigned long mainLastLoopTime = 0;
void setup() void setup()
{ {
Serial.begin(115200); /* prepare for possible serial debug */
delay(10);
/**************************** /****************************
* Constant initialzations * Constant initialzations
***************************/ ***************************/
@ -149,6 +150,8 @@ void loop()
/* Timer Loop */ /* Timer Loop */
if(millis() - mainLastLoopTime >= 1000) { if(millis() - mainLastLoopTime >= 1000) {
guiEverySecond();
/* Run Every Second */ /* Run Every Second */
#if HASP_USE_OTA>0 #if HASP_USE_OTA>0
otaEverySecond(); otaEverySecond();