Switch to ArduinoLog library

This commit is contained in:
fvanroie 2020-03-25 17:59:54 +01:00
parent 8f20aa4ecd
commit a991d5530a
6 changed files with 24 additions and 24 deletions

View File

@ -1,7 +1,8 @@
#include "Arduino.h" #include "Arduino.h"
#include "ArduinoLog.h"
#include "lvgl.h" #include "lvgl.h"
#include "hasp.h" #include "hasp.h"
#include "hasp_log.h"
#include "hasp_attr_get.h" #include "hasp_attr_get.h"
#define LVGL7 1 #define LVGL7 1
@ -25,7 +26,7 @@ uint32_t get_cpicker_value(lv_obj_t * obj)
bool haspGetLabelText(lv_obj_t * obj, std::string & strPayload) bool haspGetLabelText(lv_obj_t * obj, std::string & strPayload)
{ {
if(!obj) { if(!obj) {
errorPrintln(F("HASP: %sButton not defined")); Log.warning(F("HASP: Button not defined"));
return false; return false;
} }
@ -40,7 +41,7 @@ bool haspGetLabelText(lv_obj_t * obj, std::string & strPayload)
} }
} else { } else {
warningPrintln(F("HASP: %shaspGetLabelText NULL Pointer encountered")); Log.warning(F("HASP: haspGetLabelText NULL Pointer encountered"));
} }
return false; return false;
@ -211,7 +212,7 @@ bool haspGetObjAttribute(lv_obj_t * obj, String strAttr, std::string & strPayloa
} }
break; break;
default: default:
errorPrintln(F("HASP: %sUnknown property")); Log.warning(F("HASP: Unknown property %s"), strAttr.c_str());
return false; return false;
} }
return false; return false;

View File

@ -1,8 +1,8 @@
#include "Arduino.h" #include "ArduinoLog.h"
#include "lvgl.h" #include "lvgl.h"
#include "lv_conf.h" #include "lv_conf.h"
#include "hasp.h" #include "hasp.h"
#include "hasp_log.h"
#include "hasp_attr_set.h" #include "hasp_attr_set.h"
#define LVGL7 1 #define LVGL7 1
@ -11,7 +11,7 @@ LV_FONT_DECLARE(unscii_8_icon);
void haspAttributeNotFound(String & strAttr) void haspAttributeNotFound(String & strAttr)
{ {
errorPrintln(String(F("HASP: %sUnknown property ")) + strAttr); Log.warning(F("HASP: Unknown property %s"), strAttr.c_str());
} }
void set_cpicker_value(lv_obj_t * obj, uint32_t color) void set_cpicker_value(lv_obj_t * obj, uint32_t color)
@ -22,7 +22,7 @@ void set_cpicker_value(lv_obj_t * obj, uint32_t color)
void haspSetLabelText(lv_obj_t * obj, const char * value) void haspSetLabelText(lv_obj_t * obj, const char * value)
{ {
if(!obj) { if(!obj) {
errorPrintln(F("HASP: %sButton not defined")); Log.warning(F("HASP: Button not defined"));
return; return;
} }
@ -32,12 +32,12 @@ void haspSetLabelText(lv_obj_t * obj, const char * value)
lv_obj_get_type(label, &list); lv_obj_get_type(label, &list);
if(check_obj_type(list.type[0], LV_HASP_LABEL)) { if(check_obj_type(list.type[0], LV_HASP_LABEL)) {
debugPrintln(String(F("HASP: Setting value to ")) + String(value)); Log.verbose(F("HASP: Setting value to %s"), value);
lv_label_set_text(label, value); lv_label_set_text(label, value);
} }
} else { } else {
warningPrintln(F("HASP: %shaspSetLabelText NULL Pointer encountered")); Log.error(F("HASP: haspSetLabelText NULL Pointer encountered"));
} }
} }
@ -507,7 +507,7 @@ void haspSetObjAttribute7(lv_obj_t * obj, String & strAttr, String & strPayload)
void haspSetObjAttribute(lv_obj_t * obj, String strAttr, String strPayload) void haspSetObjAttribute(lv_obj_t * obj, String strAttr, String strPayload)
{ {
if(!obj) { if(!obj) {
errorPrintln(F("HASP: %sUnknown object")); Log.warning(F("HASP: Unknown object"));
return; return;
} }

View File

@ -1,3 +1,5 @@
#include "Arduino.h"
#include "ArduinoLog.h"
#include "AceButton.h" #include "AceButton.h"
#include "hasp_conf.h" #include "hasp_conf.h"
@ -5,7 +7,6 @@
#include "hasp_button.h" #include "hasp_button.h"
#include "hasp_dispatch.h" #include "hasp_dispatch.h"
#include "hasp_log.h"
using namespace ace_button; using namespace ace_button;
AceButton * button[HASP_NUM_INPUTS]; // Connect your button between pin 2 and GND AceButton * button[HASP_NUM_INPUTS]; // Connect your button between pin 2 and GND
@ -35,7 +36,7 @@ void buttonSetup(void)
buttonConfig->setRepeatPressDelay(LV_INDEV_DEF_LONG_PRESS_TIME); buttonConfig->setRepeatPressDelay(LV_INDEV_DEF_LONG_PRESS_TIME);
buttonConfig->setRepeatPressInterval(LV_INDEV_DEF_LONG_PRESS_REP_TIME); buttonConfig->setRepeatPressInterval(LV_INDEV_DEF_LONG_PRESS_REP_TIME);
debugPrintln(F("BTNS: setup(): ready")); Log.verbose(F("BTNS: setup(): ready"));
} }
void buttonLoop(void) void buttonLoop(void)

View File

@ -1,6 +1,6 @@
#include "StringStream.h"
#include "ArduinoJson.h" #include "ArduinoJson.h"
#include "ArduinoLog.h" #include "ArduinoLog.h"
#include "StringStream.h"
#include "hasp_dispatch.h" #include "hasp_dispatch.h"
#include "hasp_config.h" #include "hasp_config.h"
@ -8,7 +8,6 @@
#include "hasp_http.h" #include "hasp_http.h"
#include "hasp_mdns.h" #include "hasp_mdns.h"
#include "hasp_wifi.h" #include "hasp_wifi.h"
#include "hasp_log.h"
#include "hasp_gui.h" #include "hasp_gui.h"
#include "hasp.h" #include "hasp.h"
@ -241,8 +240,7 @@ void dispatchJson(char * payload)
haspCommands.shrinkToFit(); haspCommands.shrinkToFit();
if(jsonError) { // Couldn't parse incoming JSON command if(jsonError) { // Couldn't parse incoming JSON command
errorPrintln(String(F("JSON: %sFailed to parse incoming JSON command with error: ")) + Log.warning(F("JSON: Failed to parse incoming JSON command with error: "), jsonError.c_str());
String(jsonError.c_str()));
return; return;
} }
@ -254,7 +252,6 @@ void dispatchJson(char * payload)
void dispatchJsonl(char * strPayload) void dispatchJsonl(char * strPayload)
{ {
Serial.println("JSONL\n");
DynamicJsonDocument config(256); DynamicJsonDocument config(256);
String output((char *)0); String output((char *)0);

View File

@ -2,12 +2,13 @@
#include "Arduino.h" #include "Arduino.h"
#include "ArduinoJson.h" #include "ArduinoJson.h"
#include "ArduinoLog.h"
//#include "Update.h" //#include "Update.h"
#include "lvgl.h" #include "lvgl.h"
#include "hasp_conf.h" #include "hasp_conf.h"
#include "hasp_log.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

@ -1,5 +1,5 @@
#include "Arduino.h"
#include "ArduinoJson.h" #include "ArduinoJson.h"
#include "ArduinoLog.h"
#if defined(ARDUINO_ARCH_ESP32) #if defined(ARDUINO_ARCH_ESP32)
#include <ESPmDNS.h> #include <ESPmDNS.h>
@ -10,7 +10,7 @@
#include "hasp_conf.h" #include "hasp_conf.h"
#include "hasp_log.h" // #include "hasp_log.h"
#include "hasp_mdns.h" #include "hasp_mdns.h"
#include "hasp_config.h" #include "hasp_config.h"
@ -24,7 +24,7 @@ uint8_t mdnsEnabled = true;
void mdnsSetup(const JsonObject & settings) void mdnsSetup(const JsonObject & settings)
{ {
mdnsSetConfig(settings); mdnsSetConfig(settings);
debugPrintln(F("MDNS: Setup Complete")); Log.verbose(F("MDNS: Setup Complete"));
} }
void mdnsStart() void mdnsStart()
@ -44,7 +44,7 @@ void mdnsStart()
HASP_VERSION_REVISION); HASP_VERSION_REVISION);
MDNS.addServiceTxt(hasp2Node, "tcp", "app_version", buffer); */ MDNS.addServiceTxt(hasp2Node, "tcp", "app_version", buffer); */
if(MDNS.begin(hasp2Node.c_str())) { if(MDNS.begin(hasp2Node.c_str())) {
debugPrintln(F("MDNS: Responder started")); Log.notice(F("MDNS: Responder started"));
MDNS.addService(F("http"), F("tcp"), 80); MDNS.addService(F("http"), F("tcp"), 80);
MDNS.addService(F("telnet"), F("tcp"), 23); MDNS.addService(F("telnet"), F("tcp"), 23);
MDNS.addServiceTxt(hasp2Node, F("tcp"), F("app_name"), F("HASP-lvgl")); MDNS.addServiceTxt(hasp2Node, F("tcp"), F("app_name"), F("HASP-lvgl"));
@ -55,7 +55,7 @@ void mdnsStart()
addServiceTxt("arduino", "tcp", "board", ARDUINO_BOARD); addServiceTxt("arduino", "tcp", "board", ARDUINO_BOARD);
addServiceTxt("arduino", "tcp", "auth_upload", (auth) ? "yes" : "no");*/ addServiceTxt("arduino", "tcp", "auth_upload", (auth) ? "yes" : "no");*/
} else { } else {
errorPrintln(String(F("MDNS: %sResponder failed to start ")) + hasp2Node); Log.error(F("MDNS: Responder failed to start %s"), hasp2Node.c_str());
}; };
} }
} }