mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-27 13:16:45 +00:00
Move serial input from gui to debug
This commit is contained in:
parent
9ff231532c
commit
b24d8b077a
@ -48,7 +48,7 @@
|
||||
#include "hasp_spiffs.h"
|
||||
|
||||
#if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266)
|
||||
#include "lv_zifont.h"
|
||||
//#include "lv_zifont.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -71,6 +71,8 @@ Syslog * syslog;
|
||||
#endif // USE_SYSLOG
|
||||
|
||||
// Serial Settings
|
||||
uint8_t serialInputIndex = 0; // Empty buffer
|
||||
char serialInputBuffer[1024];
|
||||
uint16_t debugSerialBaud = SERIAL_SPEED / 10; // Multiplied by 10
|
||||
bool debugSerialStarted = false;
|
||||
bool debugAnsiCodes = true;
|
||||
@ -378,7 +380,26 @@ void debugLvgl(lv_log_level_t level, const char * file, uint32_t line, const cha
|
||||
#endif
|
||||
|
||||
void debugLoop()
|
||||
{}
|
||||
{
|
||||
while(Serial.available()) {
|
||||
char ch = Serial.read();
|
||||
Serial.print(ch);
|
||||
if(ch == 13 || ch == 10) {
|
||||
serialInputBuffer[serialInputIndex] = 0;
|
||||
if(serialInputIndex > 0) dispatchCommand(serialInputBuffer);
|
||||
serialInputIndex = 0;
|
||||
} else {
|
||||
if(serialInputIndex < sizeof(serialInputBuffer) - 1) {
|
||||
serialInputBuffer[serialInputIndex++] = ch;
|
||||
}
|
||||
serialInputBuffer[serialInputIndex] = 0;
|
||||
if(strcmp(serialInputBuffer, "jsonl=") == 0) {
|
||||
dispatchJsonl(Serial);
|
||||
serialInputIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*void printLocalTime()
|
||||
{
|
||||
|
@ -76,9 +76,6 @@ static uint8_t guiRotation = TFT_ROTATION;
|
||||
static Ticker tick; /* timer for interrupt handler */
|
||||
#else
|
||||
static Ticker tick(lv_tick_handler,guiTickPeriod);
|
||||
uint8_t serialInputIndex = 0; // Empty buffer
|
||||
char serialInputBuffer[1024];
|
||||
|
||||
#endif
|
||||
static TFT_eSPI tft; // = TFT_eSPI(); /* TFT instance */
|
||||
static uint16_t calData[5] = {0, 65535, 0, 65535, 0};
|
||||
@ -817,26 +814,8 @@ void IRAM_ATTR guiLoop()
|
||||
{
|
||||
#if defined(STM32F4xx)
|
||||
tick.update();
|
||||
|
||||
while(Serial.available()) {
|
||||
char ch = Serial.read();
|
||||
Serial.print(ch);
|
||||
if (ch == 13 ||ch == 10) {
|
||||
serialInputBuffer[serialInputIndex] = 0;
|
||||
if (serialInputIndex>0) dispatchCommand(serialInputBuffer);
|
||||
serialInputIndex=0;
|
||||
}else{
|
||||
if(serialInputIndex < sizeof(serialInputBuffer) - 1) {
|
||||
serialInputBuffer[serialInputIndex++] = ch;
|
||||
}
|
||||
serialInputBuffer[serialInputIndex] = 0;
|
||||
if (strcmp(serialInputBuffer,"jsonl=")==0){
|
||||
dispatchJsonl(Serial);
|
||||
serialInputIndex=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//lv_tick_handler();
|
||||
lv_task_handler(); /* let the GUI do its work */
|
||||
guiCheckSleep();
|
||||
|
@ -109,6 +109,7 @@ void loop()
|
||||
guiLoop();
|
||||
/* Application Loops */
|
||||
// haspLoop();
|
||||
debugLoop();
|
||||
|
||||
#if HASP_USE_GPIO
|
||||
gpioLoop();
|
||||
|
Loading…
x
Reference in New Issue
Block a user