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();
Log.notice(F("DISPATCH: jsonl"));
Serial.println(F("DISPATCH: jsonl"));
while(deserializeJson(jsonl, stream) == DeserializationError::Ok) {
// serializeJson(jsonl, Serial);

View File

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

View File

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

View File

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