Switch to ArduinoLog library

This commit is contained in:
fvanroie 2020-03-25 20:09:34 +01:00
parent 25a6dfbbcc
commit 305ce43eb5
11 changed files with 83 additions and 134 deletions

View File

@ -31,7 +31,6 @@
#include <FS.h> // Include the SPIFFS library #include <FS.h> // Include the SPIFFS library
#endif #endif
//#include "hasp_log.h"
#include "hasp_debug.h" #include "hasp_debug.h"
#include "hasp_config.h" #include "hasp_config.h"
#include "hasp_dispatch.h" #include "hasp_dispatch.h"

View File

@ -8,7 +8,6 @@
#endif #endif
#include "hasp_config.h" #include "hasp_config.h"
//#include "hasp_log.h"
#include "hasp_debug.h" #include "hasp_debug.h"
#include "hasp_http.h" #include "hasp_http.h"
#include "hasp_wifi.h" #include "hasp_wifi.h"

View File

@ -1,14 +1,12 @@
#include <Ticker.h> #include <Ticker.h>
#include "ArduinoLog.h"
#include "lv_conf.h" #include "lv_conf.h"
#include "lvgl.h" #include "lvgl.h"
#include "lv_fs_if.h" #include "lv_fs_if.h"
#include "TFT_eSPI.h" #include "TFT_eSPI.h"
#include "lv_zifont.h" #include "lv_zifont.h"
#include "hasp_log.h"
#include "hasp_tft.h" #include "hasp_tft.h"
#include "hasp_debug.h" #include "hasp_debug.h"
#include "hasp_config.h" #include "hasp_config.h"
@ -16,7 +14,7 @@
#include "hasp_gui.h" #include "hasp_gui.h"
#include "hasp.h" #include "hasp.h"
#if HASP_USE_PNGDECODE != 0 #if HASP_USE_PNGDECODE
#include "png_decoder.h" #include "png_decoder.h"
#endif #endif
@ -95,7 +93,7 @@ void debugLvgl(lv_log_level_t level, const char * file, uint32_t line, const cha
{ {
char buffer[128]; char buffer[128];
snprintf(buffer, sizeof(buffer), PSTR("LVGL: %s@%d->%s"), file, line, dsc); snprintf(buffer, sizeof(buffer), PSTR("LVGL: %s@%d->%s"), file, line, dsc);
debugPrintln(buffer); Log.warning(buffer);
} }
#endif #endif
@ -147,7 +145,7 @@ void tft_espi_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * c
case 2: case 2:
// Send to remote client // Send to remote client
if(webClient->client().write(pixel, i) != i) { if(webClient->client().write(pixel, i) != i) {
errorPrintln(F("GUI: %sPixelbuffer not completely sent")); Log.warning(F("GUI: Pixelbuffer not completely sent"));
lv_disp_flush_ready(disp); /* tell lvgl that flushing is done */ lv_disp_flush_ready(disp); /* tell lvgl that flushing is done */
return; return;
} }
@ -166,7 +164,7 @@ void tft_espi_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * c
case 2: case 2:
// Send to remote client // Send to remote client
if(webClient->client().write(pixel, i) != i) { if(webClient->client().write(pixel, i) != i) {
errorPrintln(F("GUI: %sPixelbuffer not completely sent")); Log.warning(F("GUI: Pixelbuffer not completely sent"));
} }
} }
} }
@ -306,22 +304,15 @@ void guiSetup(JsonObject settings)
lv_disp_buf_init(&disp_buf, guiVdbBuffer1, NULL, guiVDBsize); lv_disp_buf_init(&disp_buf, guiVdbBuffer1, NULL, guiVDBsize);
#endif #endif
char buffer[128]; // char buffer[128];
snprintf_P(buffer, sizeof(buffer), PSTR("LVGL: Version : %u.%u.%u %s"), LVGL_VERSION_MAJOR, LVGL_VERSION_MINOR, Log.verbose(F("LVGL: Version : %u.%u.%u %s"), LVGL_VERSION_MAJOR, LVGL_VERSION_MINOR, LVGL_VERSION_PATCH,
LVGL_VERSION_PATCH, F(LVGL_VERSION_INFO)); PSTR(LVGL_VERSION_INFO));
debugPrintln(buffer); Log.verbose(F("LVGL: Rotation : %d"), guiRotation);
Log.verbose(F("LVGL: MEM size : %d"), LV_MEM_SIZE);
snprintf_P(buffer, sizeof(buffer), PSTR("LVGL: Rotation : %d"), guiRotation); Log.verbose(F("LVGL: VFB size : %d"), (size_t)sizeof(lv_color_t) * guiVDBsize);
debugPrintln(buffer);
snprintf_P(buffer, sizeof(buffer), PSTR("LVGL: MEM size : %d"), LV_MEM_SIZE);
debugPrintln(buffer);
snprintf_P(buffer, sizeof(buffer), PSTR("LVGL: VFB size : %d"), (size_t)sizeof(lv_color_t) * guiVDBsize);
debugPrintln(buffer);
#if LV_USE_LOG != 0 #if LV_USE_LOG != 0
debugPrintln(F("LVGL: NOT Registering lvgl logging handler")); Log.warning(F("LVGL: NOT Registering lvgl logging handler"));
// lv_log_register_print_cb(debugLvgl); /* register print function for debugging */ // lv_log_register_print_cb(debugLvgl); /* register print function for debugging */
#endif #endif
@ -401,8 +392,7 @@ void guiSetup(JsonObject settings)
/* Setup Backlight Control Pin */ /* Setup Backlight Control Pin */
if(guiBacklightPin >= 0) { if(guiBacklightPin >= 0) {
snprintf(buffer, sizeof(buffer), PSTR("LVGL: Backlight: Pin %i"), guiBacklightPin); Log.verbose(F("LVGL: Backlight: Pin %i"), guiBacklightPin);
debugPrintln(buffer);
#if defined(ARDUINO_ARCH_ESP32) #if defined(ARDUINO_ARCH_ESP32)
// configure LED PWM functionalitites // configure LED PWM functionalitites
@ -485,9 +475,7 @@ bool guiGetConfig(const JsonObject & settings)
array.add(calData[i]); array.add(calData[i]);
} }
serializeJson(settings, Serial); configOutput(settings);
Serial.println();
return true; return true;
} }
@ -506,7 +494,7 @@ bool guiSetConfig(const JsonObject & settings)
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>()) {
debugPrintln(F("guiShowPointer set")); Log.trace(F("guiShowPointer set"));
} }
changed |= guiShowPointer != settings[FPSTR(F_GUI_POINTER)].as<bool>(); changed |= guiShowPointer != settings[FPSTR(F_GUI_POINTER)].as<bool>();
@ -525,7 +513,7 @@ bool guiSetConfig(const JsonObject & settings)
} }
if(status) { if(status) {
debugPrintln(F("calData set")); Log.trace(F("calData set"));
guiAutoCalibrate = false; guiAutoCalibrate = false;
} }
@ -607,16 +595,16 @@ void guiSendBmpHeader()
if(guiSnapshot == 1) { if(guiSnapshot == 1) {
size_t len = pFileOut.write(buffer, 122); size_t len = pFileOut.write(buffer, 122);
if(len != sizeof(buffer)) { if(len != sizeof(buffer)) {
errorPrintln(F("GUI: %sData written does not match header size")); Log.warning(F("GUI: Data written does not match header size"));
} else { } else {
debugPrintln(F("GUI: Bitmap header written")); Log.verbose(F("GUI: Bitmap header written"));
} }
} else if(guiSnapshot == 2) { } else if(guiSnapshot == 2) {
if(webClient->client().write(buffer, 122) != 122) { if(webClient->client().write(buffer, 122) != 122) {
errorPrintln(F("GUI: %sData sent does not match header size")); Log.warning(F("GUI: Data sent does not match header size"));
} else { } else {
debugPrintln(F("GUI: Bitmap header sent")); Log.verbose(F("GUI: Bitmap header sent"));
} }
} }
} }
@ -633,11 +621,9 @@ void guiSendBmpHeader()
void guiTakeScreenshot(const char * pFileName) void guiTakeScreenshot(const char * pFileName)
{ {
pFileOut = SPIFFS.open(pFileName, "w"); pFileOut = SPIFFS.open(pFileName, "w");
char buffer[128];
if(pFileOut == NULL) { if(pFileOut == NULL) {
snprintf_P(buffer, sizeof(buffer), PSTR("[Display] error: %s cannot be opened"), pFileName); Log.warning(F("GUI: %s cannot be opened"), pFileName);
debugPrintln(buffer);
return; return;
} }
@ -649,8 +635,7 @@ void guiTakeScreenshot(const char * pFileName)
guiSnapshot = 0; guiSnapshot = 0;
pFileOut.close(); pFileOut.close();
snprintf_P(buffer, sizeof(buffer), PSTR("[Display] data flushed to %s"), pFileName); Log.verbose(F("[Display] data flushed to %s"), pFileName);
debugPrintln(buffer);
} }
#if defined(ARDUINO_ARCH_ESP8266) #if defined(ARDUINO_ARCH_ESP8266)
@ -672,5 +657,5 @@ void guiTakeScreenshot(ESP8266WebServer & client)
lv_refr_now(NULL); /* Will call our disp_drv.disp_flush function */ lv_refr_now(NULL); /* Will call our disp_drv.disp_flush function */
guiSnapshot = 0; guiSnapshot = 0;
debugPrintln(F("GUI: Bitmap data flushed to webclient")); Log.verbose(F("GUI: Bitmap data flushed to webclient"));
} }

View File

@ -8,7 +8,6 @@
#include "hasp_conf.h" #include "hasp_conf.h"
// #include "hasp_log.h"
#include "hasp_gui.h" #include "hasp_gui.h"
#include "hasp_hal.h" #include "hasp_hal.h"
#include "hasp_debug.h" #include "hasp_debug.h"
@ -440,7 +439,6 @@ bool httpSetConfig(const JsonObject & settings)
#include "hasp_conf.h" #include "hasp_conf.h"
//#include "hasp_log.h"
#include "hasp_gui.h" #include "hasp_gui.h"
#include "hasp_hal.h" #include "hasp_hal.h"
#include "hasp_debug.h" #include "hasp_debug.h"

View File

@ -10,7 +10,6 @@
#include "hasp_conf.h" #include "hasp_conf.h"
// #include "hasp_log.h"
#include "hasp_mdns.h" #include "hasp_mdns.h"
#include "hasp_config.h" #include "hasp_config.h"

View File

@ -17,7 +17,6 @@
#include <ESP.h> #include <ESP.h>
#endif #endif
//#include "hasp_log.h"
#include "hasp_hal.h" #include "hasp_hal.h"
#include "hasp_debug.h" #include "hasp_debug.h"
#include "hasp_config.h" #include "hasp_config.h"

View File

@ -1,8 +1,8 @@
#include <Arduino.h> #include <Arduino.h>
#include "ArduinoJson.h"
#include <ArduinoOTA.h> #include <ArduinoOTA.h>
#include "ArduinoJson.h"
#include "ArduinoLog.h"
#include "hasp_log.h"
#include "hasp_debug.h" #include "hasp_debug.h"
#include "hasp_dispatch.h" #include "hasp_dispatch.h"
#include "hasp_ota.h" #include "hasp_ota.h"
@ -20,17 +20,15 @@ int16_t otaPort = 3232;
void otaProgress() void otaProgress()
{ {
debugPrintln(String(F("OTA: ")) + (ArduinoOTA.getCommand() == U_FLASH ? F("Firmware") : F("Filesystem")) + Log.verbose(F("OTA: %s update in progress... %3u%"),
F(" update in progress... ") + otaPrecentageComplete + "%"); (ArduinoOTA.getCommand() == U_FLASH ? PSTR("Firmware") : PSTR("Filesystem")), otaPrecentageComplete);
} }
void otaSetup(JsonObject settings) void otaSetup(JsonObject settings)
{ {
if(!settings[F_OTA_URL].isNull()) { if(!settings[F_OTA_URL].isNull()) {
char buffer[128];
otaUrl = settings[F_OTA_URL].as<String>().c_str(); otaUrl = settings[F_OTA_URL].as<String>().c_str();
sprintf_P(buffer, PSTR("ORA url: %s"), otaUrl.c_str()); Log.verbose(F("ORA url: %s"), otaUrl.c_str());
debugPrintln(buffer);
} }
if(otaPort > 0) { if(otaPort > 0) {
@ -40,8 +38,8 @@ void otaSetup(JsonObject settings)
// NOTE: if updating SPIFFS this would be the place to unmount SPIFFS using SPIFFS.end() // NOTE: if updating SPIFFS this would be the place to unmount SPIFFS using SPIFFS.end()
} }
debugPrintln(F("OTA: Start update")); Log.notice(F("OTA: Start update"));
dispatchCommand("page 0"); dispatchPage("0");
otaPrecentageComplete = 0; otaPrecentageComplete = 0;
// haspSetAttr("p[0].b[1].txt", "\"ESP OTA Update\""); // haspSetAttr("p[0].b[1].txt", "\"ESP OTA Update\"");
}); });
@ -60,17 +58,17 @@ void otaSetup(JsonObject settings)
}); });
ArduinoOTA.onError([](ota_error_t error) { ArduinoOTA.onError([](ota_error_t error) {
otaPrecentageComplete = -1; otaPrecentageComplete = -1;
debugPrintln(String(F("OTA: ERROR code ")) + String(error)); Log.error(F("OTA: ERROR code %u"), error);
if(error == OTA_AUTH_ERROR) if(error == OTA_AUTH_ERROR)
debugPrintln(F("OTA: ERROR - Auth Failed")); Log.error(F("OTA: ERROR - Auth Failed"));
else if(error == OTA_BEGIN_ERROR) else if(error == OTA_BEGIN_ERROR)
debugPrintln(F("OTA: ERROR - Begin Failed")); Log.error(F("OTA: ERROR - Begin Failed"));
else if(error == OTA_CONNECT_ERROR) else if(error == OTA_CONNECT_ERROR)
debugPrintln(F("OTA: ERROR - Connect Failed")); Log.error(F("OTA: ERROR - Connect Failed"));
else if(error == OTA_RECEIVE_ERROR) else if(error == OTA_RECEIVE_ERROR)
debugPrintln(F("OTA: ERROR - Receive Failed")); Log.error(F("OTA: ERROR - Receive Failed"));
else if(error == OTA_END_ERROR) else if(error == OTA_END_ERROR)
debugPrintln(F("OTA: ERROR - End Failed")); Log.error(F("OTA: ERROR - End Failed"));
// haspSetAttr("p[0].b[1].txt", "\"ESP OTA FAILED\""); // haspSetAttr("p[0].b[1].txt", "\"ESP OTA FAILED\"");
delay(5000); delay(5000);
// haspSendCmd("page " + String(nextionActivePage)); // haspSendCmd("page " + String(nextionActivePage));
@ -95,10 +93,10 @@ void otaSetup(JsonObject settings)
ArduinoOTA.setRebootOnSuccess(true); ArduinoOTA.setRebootOnSuccess(true);
ArduinoOTA.begin(); ArduinoOTA.begin();
debugPrintln(F("OTA: Over the Air firmware update ready")); Log.notice(F("OTA: Over the Air firmware update ready"));
debugPrintln(F("OTA: Setup Complete")); Log.verbose(F("OTA: Setup Complete"));
} else { } else {
debugPrintln(F("OTA: Disabled")); Log.notice(F("OTA: Disabled"));
} }
} }

View File

@ -3,7 +3,6 @@
#include "ArduinoLog.h" #include "ArduinoLog.h"
#include "hasp_conf.h" #include "hasp_conf.h"
//#include "hasp_log.h"
#include "hasp_spiffs.h" #include "hasp_spiffs.h"
#if HASP_USE_SPIFFS #if HASP_USE_SPIFFS

View File

@ -3,8 +3,8 @@
#include "Arduino.h" #include "Arduino.h"
#include "ArduinoJson.h" #include "ArduinoJson.h"
#include "ArduinoLog.h"
#include "hasp_log.h"
#include "hasp_debug.h" #include "hasp_debug.h"
#include "hasp_config.h" #include "hasp_config.h"
#include "hasp_dispatch.h" #include "hasp_dispatch.h"
@ -34,9 +34,7 @@ bool telnetExitCommand()
char buffer[128]; char buffer[128];
snprintf_P(buffer, sizeof(buffer), PSTR("exit")); snprintf_P(buffer, sizeof(buffer), PSTR("exit"));
if(strcmp(telnetInputBuffer, buffer) == 0 || telnetLoginAttempt >= 3) { if(strcmp(telnetInputBuffer, buffer) == 0 || telnetLoginAttempt >= 3) {
snprintf_P(buffer, sizeof(buffer), PSTR("TELNET: Closing session from %s"), Log.notice(F("TELNET: Closing session from %s"), telnetClient->remoteIP().toString().c_str());
telnetClient->remoteIP().toString().c_str());
debugPrintln(buffer);
telnetClient->stop(); telnetClient->stop();
telnetLoginState = TELNET_UNAUTHENTICATED; telnetLoginState = TELNET_UNAUTHENTICATED;
telnetInputIndex = 0; // Empty buffer telnetInputIndex = 0; // Empty buffer
@ -53,10 +51,9 @@ void telnetAcceptClient()
telnetClient->stop(); // client disconnected telnetClient->stop(); // client disconnected
} }
*telnetClient = telnetServer->available(); // ready for new client *telnetClient = telnetServer->available(); // ready for new client
Log.notice(F("TELNET: Client connected from %s"), telnetClient->remoteIP().toString().c_str());
char buffer[128]; char buffer[128];
snprintf_P(buffer, sizeof(buffer), PSTR("TELNET: Client connected from %s"),
telnetClient->remoteIP().toString().c_str());
debugPrintln(buffer);
snprintf_P(buffer, sizeof(buffer), PSTR("\r\nUsername: ")); snprintf_P(buffer, sizeof(buffer), PSTR("\r\nUsername: "));
telnetClient->print(buffer); telnetClient->print(buffer);
telnetLoginState = TELNET_UNAUTHENTICATED; telnetLoginState = TELNET_UNAUTHENTICATED;
@ -109,17 +106,14 @@ void telnetProcessInput()
telnetLoginState = TELNET_AUTHENTICATED; telnetLoginState = TELNET_AUTHENTICATED;
telnetLoginAttempt = 0; // Initial attempt telnetLoginAttempt = 0; // Initial attempt
telnetClient->println(debugHaspHeader()); telnetClient->println(debugHaspHeader());
snprintf_P(buffer, sizeof(buffer), PSTR("TELNET: Client login from %s"), Log.notice(F("TELNET: Client login from %s"), telnetClient->remoteIP().toString().c_str());
telnetClient->remoteIP().toString().c_str());
debugPrintln(buffer);
} else { } else {
telnetLoginState = TELNET_UNAUTHENTICATED; telnetLoginState = TELNET_UNAUTHENTICATED;
telnetLoginAttempt++; // Subsequent attempt telnetLoginAttempt++; // Subsequent attempt
snprintf_P(buffer, sizeof(buffer), PSTR("Authorization failed!\r\n")); snprintf_P(buffer, sizeof(buffer), PSTR("Authorization failed!\r\n"));
telnetClient->println(buffer); telnetClient->println(buffer);
snprintf_P(buffer, sizeof(buffer), PSTR("TELNET: %%Incorrect login attempt from %s"), Log.warning(F("TELNET: Incorrect login attempt from %s"),
telnetClient->remoteIP().toString().c_str()); telnetClient->remoteIP().toString().c_str());
errorPrintln(buffer);
if(telnetLoginAttempt >= 3) { if(telnetLoginAttempt >= 3) {
telnetExitCommand(); telnetExitCommand();
} else { } else {
@ -155,9 +149,9 @@ void telnetSetup(const JsonObject & settings)
telnetClient = new WiFiClient; telnetClient = new WiFiClient;
telnetServer->setNoDelay(true); telnetServer->setNoDelay(true);
telnetServer->begin(); telnetServer->begin();
debugPrintln(String(F("TELNET: Debug console enabled at telnet://")) + WiFi.localIP().toString()); Log.notice(F("TELNET: Debug console enabled at telnet://%s"), WiFi.localIP().toString().c_str());
} else { } else {
errorPrintln(F("TELNET: %sFailed to start telnet server")); Log.error(F("TELNET: Failed to start telnet server"));
} }
} }
} }

View File

@ -1,16 +1,13 @@
#include "TFT_eSPI.h" // Graphics and font library for ST7735 driver chip
#include "ArduinoJson.h" #include "ArduinoJson.h"
#include "ArduinoLog.h"
#include "TFT_eSPI.h"
#include "hasp_tft.h"
#if defined(ARDUINO_ARCH_ESP8266) #if defined(ARDUINO_ARCH_ESP8266)
ADC_MODE(ADC_VCC); // tftShowConfig measures the voltage on the pin ADC_MODE(ADC_VCC); // tftShowConfig measures the voltage on the pin
#endif #endif
#include "hasp_log.h"
#include "hasp_tft.h"
#define F_TFT_ROTATION F("rotation")
#define F_TFT_FREQUENCY F("frequency")
int8_t getPinName(int8_t pin); int8_t getPinName(int8_t pin);
void tftSetup(TFT_eSPI & tft, JsonObject settings) void tftSetup(TFT_eSPI & tft, JsonObject settings)
@ -62,61 +59,46 @@ String tftDriverName()
void tftOffsetInfo(uint8_t pin, uint8_t x_offset, uint8_t y_offset) void tftOffsetInfo(uint8_t pin, uint8_t x_offset, uint8_t y_offset)
{ {
char buffer[128];
if(x_offset != 0) { if(x_offset != 0) {
sprintf_P(buffer, PSTR("TFT: R%u x offset = %i"), pin, x_offset); Log.verbose(F("TFT: R%u x offset = %i"), pin, x_offset);
debugPrintln(buffer);
} }
if(y_offset != 0) { if(y_offset != 0) {
sprintf_P(buffer, PSTR("TFT: R%u y offset = %i"), pin, y_offset); Log.verbose(F("TFT: R%u y offset = %i"), pin, y_offset);
debugPrintln(buffer);
} }
} }
void tftPinInfo(String pinfunction, int8_t pin) void tftPinInfo(String pinfunction, int8_t pin)
{ {
if(pin != -1) { if(pin != -1) {
char buffer[128]; Log.verbose(F("TFT: %s = D%i (GPIO %i)"), pinfunction.c_str(), getPinName(pin), pin);
sprintf_P(buffer, PSTR("TFT: %s = D%i (GPIO %i)"), pinfunction.c_str(), getPinName(pin), pin);
debugPrintln(buffer);
} }
} }
void tftShowConfig(TFT_eSPI & tft) void tftShowConfig(TFT_eSPI & tft)
{ {
setup_t tftSetup; setup_t tftSetup;
char buffer[128]; // char buffer[128];
tft.getSetup(tftSetup); tft.getSetup(tftSetup);
sprintf_P(buffer, PSTR("TFT: TFT_eSPI ver = %s"), tftSetup.version.c_str()); Log.verbose(F("TFT: TFT_eSPI ver = %s"), tftSetup.version.c_str());
debugPrintln(buffer); Log.verbose(F("TFT: Processor = ESP%x"), tftSetup.esp);
sprintf_P(buffer, PSTR("TFT: Processor = ESP%x"), tftSetup.esp); Log.verbose(F("TFT: Frequency = %i MHz"), ESP.getCpuFreqMHz());
debugPrintln(buffer);
sprintf_P(buffer, PSTR("TFT: Frequency = %i MHz"), ESP.getCpuFreqMHz());
debugPrintln(buffer);
#if defined(ARDUINO_ARCH_ESP8266) #if defined(ARDUINO_ARCH_ESP8266)
sprintf_P(buffer, PSTR("TFT: Voltage = %2.2f V"), ESP.getVcc() / 918.0); Log.verbose(F("TFT: Voltage = %2.2f V"), ESP.getVcc() / 918.0); // 918 empirically determined
debugPrintln(buffer); // 918 empirically determined
#endif #endif
sprintf_P(buffer, PSTR("TFT: Transactions = %s"), (tftSetup.trans == 1) ? PSTR("Yes") : PSTR("No")); Log.verbose(F("TFT: Transactions = %s"), (tftSetup.trans == 1) ? PSTR("Yes") : PSTR("No"));
debugPrintln(buffer); Log.verbose(F("TFT: Interface = %s"), (tftSetup.serial == 1) ? PSTR("SPI") : PSTR("Parallel"));
sprintf_P(buffer, PSTR("TFT: Interface = %s"), (tftSetup.serial == 1) ? PSTR("SPI") : PSTR("Parallel"));
debugPrintln(buffer);
#if defined(ARDUINO_ARCH_ESP8266) #if defined(ARDUINO_ARCH_ESP8266)
sprintf_P(buffer, PSTR("TFT: SPI overlap = %s"), (tftSetup.overlap == 1) ? PSTR("Yes") : PSTR("No")); Log.verbose(F("TFT: SPI overlap = %s"), (tftSetup.overlap == 1) ? PSTR("Yes") : PSTR("No"));
debugPrintln(buffer);
#endif #endif
if(tftSetup.tft_driver != 0xE9D) // For ePaper displays the size is defined in the sketch if(tftSetup.tft_driver != 0xE9D) // For ePaper displays the size is defined in the sketch
{ {
sprintf_P(buffer, PSTR("TFT: Display driver = %s"), tftDriverName().c_str()); // tftSetup.tft_driver); Log.verbose(F("TFT: Display driver = %s"), tftDriverName().c_str()); // tftSetup.tft_driver);
debugPrintln(buffer); Log.verbose(F("TFT: Display width = %i"), tftSetup.tft_width);
sprintf_P(buffer, PSTR("TFT: Display width = %i"), tftSetup.tft_width); Log.verbose(F("TFT: Display height = %i"), tftSetup.tft_height);
debugPrintln(buffer);
sprintf_P(buffer, PSTR("TFT: Display height = %i"), tftSetup.tft_height);
debugPrintln(buffer);
} else if(tftSetup.tft_driver == 0xE9D) } else if(tftSetup.tft_driver == 0xE9D)
debugPrintln(F("Display driver = ePaper")); Log.verbose(F("Display driver = ePaper"));
// Offsets, not all used yet // Offsets, not all used yet
tftOffsetInfo(0, tftSetup.r0_x_offset, tftSetup.r0_y_offset); tftOffsetInfo(0, tftSetup.r0_x_offset, tftSetup.r0_y_offset);
@ -138,14 +120,14 @@ void tftShowConfig(TFT_eSPI & tft)
#if defined(ARDUINO_ARCH_ESP8266) #if defined(ARDUINO_ARCH_ESP8266)
if(tftSetup.overlap == true) { if(tftSetup.overlap == true) {
debugPrintln(F("Overlap selected, following pins MUST be used:\n")); Log.verbose(F("Overlap selected, following pins MUST be used:"));
debugPrintln(F("MOSI = SD1 (GPIO 8)")); Log.verbose(F("MOSI = SD1 (GPIO 8)"));
debugPrintln(F("MISO = SD0 (GPIO 7)")); Log.verbose(F("MISO = SD0 (GPIO 7)"));
debugPrintln(F("SCK = CLK (GPIO 6)")); Log.verbose(F("SCK = CLK (GPIO 6)"));
debugPrintln(F("TFT_CS = D3 (GPIO 0)")); Log.verbose(F("TFT_CS = D3 (GPIO 0)"));
debugPrintln(F("TFT_DC and TFT_RST pins can be tftSetup defined\n")); Log.verbose(F("TFT_DC and TFT_RST pins can be tftSetup defined"));
} }
#endif #endif
@ -169,25 +151,23 @@ void tftShowConfig(TFT_eSPI & tft)
/* /*
uint16_t fonts = tft.fontsLoaded(); uint16_t fonts = tft.fontsLoaded();
if(fonts & (1 << 1)) debugPrintln(F("Font GLCD loaded\n")); if(fonts & (1 << 1)) Log.verbose(F("Font GLCD loaded\n"));
if(fonts & (1 << 2)) debugPrintln(F("Font 2 loaded\n")); if(fonts & (1 << 2)) Log.verbose(F("Font 2 loaded\n"));
if(fonts & (1 << 4)) debugPrintln(F("Font 4 loaded\n")); if(fonts & (1 << 4)) Log.verbose(F("Font 4 loaded\n"));
if(fonts & (1 << 6)) debugPrintln(F("Font 6 loaded\n")); if(fonts & (1 << 6)) Log.verbose(F("Font 6 loaded\n"));
if(fonts & (1 << 7)) debugPrintln(F("Font 7 loaded\n")); if(fonts & (1 << 7)) Log.verbose(F("Font 7 loaded\n"));
if(fonts & (1 << 9)) if(fonts & (1 << 9))
debugPrintln(F("Font 8N loaded\n")); Log.verbose(F("Font 8N loaded\n"));
else if(fonts & (1 << 8)) else if(fonts & (1 << 8))
debugPrintln(F("Font 8 loaded\n")); Log.verbose(F("Font 8 loaded\n"));
if(fonts & (1 << 15)) debugPrintln(F("Smooth font enabled\n")); if(fonts & (1 << 15)) Log.verbose(F("Smooth font enabled\n"));
*/ */
if(tftSetup.serial == 1) { if(tftSetup.serial == 1) {
sprintf_P(buffer, PSTR("TFT: Display SPI frequency = %2.1f MHz"), tftSetup.tft_spi_freq / 10.0); Log.verbose(F("TFT: Display SPI frequency = %2.1f MHz"), tftSetup.tft_spi_freq / 10.0);
debugPrintln(buffer);
} }
if(tftSetup.pin_tch_cs != -1) { if(tftSetup.pin_tch_cs != -1) {
sprintf_P(buffer, PSTR("TFT: Touch SPI frequency = %2.1f MHz"), tftSetup.tch_spi_freq / 10.0); Log.verbose(F("TFT: Touch SPI frequency = %2.1f MHz"), tftSetup.tch_spi_freq / 10.0);
debugPrintln(buffer);
} }
} }

View File

@ -7,7 +7,6 @@
#include "hasp_wifi.h" #include "hasp_wifi.h"
#include "hasp_http.h" #include "hasp_http.h"
#include "hasp_mdns.h" #include "hasp_mdns.h"
//#include "hasp_log.h"
#include "hasp_debug.h" #include "hasp_debug.h"
#include "hasp_config.h" #include "hasp_config.h"
#include "hasp_dispatch.h" #include "hasp_dispatch.h"