Skip to content

Commit

Permalink
debug message cleanup
Browse files Browse the repository at this point in the history
changed some non-critical USER_PRINT debug messages into DEBUG_PRINT
  • Loading branch information
softhack007 committed Jul 14, 2023
1 parent 423d372 commit 5f55f91
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
4 changes: 2 additions & 2 deletions wled00/cfg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
//WLEDMM add USER_PRINT
// String temp;
// serializeJson(doc, temp);
USER_PRINTF("deserializeConfig\n");
DEBUG_PRINTF("deserializeConfig\n");

bool needsSave = false;
//int rev_major = doc["rev"][0]; // 1
Expand Down Expand Up @@ -1065,7 +1065,7 @@ void serializeConfig() {
usermods.addToConfig(usermods_settings);

//WLEDMM add USER_PRINT
USER_PRINTF("serializeConfig\n");
DEBUG_PRINTF("serializeConfig\n");

File f = WLED_FS.open("/cfg.json", "w");
if (f) serializeJson(doc, f);
Expand Down
4 changes: 4 additions & 0 deletions wled00/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,13 @@ bool deserializeSegment(JsonObject elem, byte it, byte presetId)
{
const bool iAmGroot = !inDeepCall; // WLEDMM will only be true if this is the toplevel of the recursion.
//WLEDMM add USER_PRINT
#ifdef WLED_DEBUG
if (elem.size()!=1 || elem["stop"] != 0) { // not for {"stop":0}
String temp;
serializeJson(elem, temp);
USER_PRINTF("deserializeSegment %s\n", temp.c_str());
}
#endif

byte id = elem["id"] | it;
if (id >= strip.getMaxSegments()) return false;
Expand Down Expand Up @@ -374,9 +376,11 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId)
{
const bool iAmGroot = !inDeepCall; // WLEDMM will only be true if this is the toplevel of the recursion.
//WLEDMM add USER_PRINT
#ifdef WLED_DEBUG
String temp;
serializeJson(root, temp);
USER_PRINTF("deserializeState %s\n", temp.c_str());
#endif

bool stateResponse = root[F("v")] | false;

Expand Down
3 changes: 3 additions & 0 deletions wled00/wled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,9 @@ void WLED::setup()
USER_FLUSH(); delay(100);
USER_PRINTLN();
USER_PRINT(F("---WLED "));
#ifdef WLEDMM_FASTPATH
USER_PRINT("=FASTPATH= ");
#endif
USER_PRINT(versionString);
USER_PRINT(" ");
USER_PRINT(VERSION);
Expand Down
16 changes: 8 additions & 8 deletions wled00/ws.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ static volatile unsigned long wsLastLiveTime = 0; // WLEDMM
//uint8_t* wsFrameBuffer = nullptr;

#if !defined(ARDUINO_ARCH_ESP32) || defined(WLEDMM_FASTPATH) // WLEDMM
#define WS_LIVE_INTERVAL 160
#define WS_LIVE_INTERVAL 120
#else
#define WS_LIVE_INTERVAL 80
#endif
Expand All @@ -19,14 +19,14 @@ void wsEvent(AsyncWebSocket * server, AsyncWebSocketClient * client, AwsEventTyp
{
if(type == WS_EVT_CONNECT){
//client connected
USER_PRINTLN(F("WS client connected."));
DEBUG_PRINTLN(F("WS client connected."));
sendDataWs(client);
} else if(type == WS_EVT_DISCONNECT){
//client disconnected
if (client->id() == wsLiveClientId) wsLiveClientId = 0;
USER_PRINTLN(F("WS client disconnected."));
DEBUG_PRINTLN(F("WS client disconnected."));
} else if(type == WS_EVT_DATA){
USER_PRINTLN(F("WS event data."));
DEBUG_PRINTLN(F("WS event data."));
// data packet
AwsFrameInfo * info = (AwsFrameInfo*)arg;
if(info->final && info->index == 0 && info->len == len){
Expand Down Expand Up @@ -91,7 +91,7 @@ void wsEvent(AsyncWebSocket * server, AsyncWebSocketClient * client, AwsEventTyp
}
} else if(type == WS_EVT_ERROR){
//error was received from the other end
DEBUG_PRINTLN(F("WS error."));
USER_PRINTLN(F("WS error."));

} else if(type == WS_EVT_PONG){
//pong message was received (in response to a ping request maybe)
Expand All @@ -102,7 +102,7 @@ void wsEvent(AsyncWebSocket * server, AsyncWebSocketClient * client, AwsEventTyp

void sendDataWs(AsyncWebSocketClient * client)
{
USER_PRINTF("sendDataWs\n");
DEBUG_PRINTF("sendDataWs\n");
if (!ws.count()) return;
AsyncWebSocketMessageBuffer * buffer;

Expand Down Expand Up @@ -147,7 +147,7 @@ void sendDataWs(AsyncWebSocketClient * client)
#endif
if (!buffer || heap1-heap2<len) {
releaseJSONBufferLock();
DEBUG_PRINTLN(F("WS buffer allocation failed."));
USER_PRINTLN(F("WS buffer allocation failed."));
ws.closeAll(1013); //code 1013 = temporary overload, try again later
ws.cleanupClients(0); //disconnect all clients to release memory
ws._cleanBuffers();
Expand Down Expand Up @@ -212,7 +212,7 @@ static bool sendLiveLedsWs(uint32_t wsClient) // WLEDMM added "static"
if (wsBuf == nullptr) { // 8266 does not support exceptions
#endif
wsBuf = nullptr;
DEBUG_PRINTLN(F("WS buffer allocation failed."));
USER_PRINTLN(F("WS buffer allocation failed."));
//ws.closeAll(1013); //code 1013 = temporary overload, try again later
//ws.cleanupClients(0); //disconnect all clients to release memory
ws._cleanBuffers();
Expand Down

0 comments on commit 5f55f91

Please sign in to comment.