mirror of
https://github.com/s00500/ESPUI.git
synced 2024-11-21 22:50:55 +00:00
Cosmetic changes to debug messages
This commit is contained in:
parent
ea4a0df4d0
commit
811e0ede4d
@ -128,7 +128,7 @@ void ESPUIclient::onWsEvent(AwsEventType type, void* arg, uint8_t* data, size_t
|
|||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case WS_EVT_PONG:
|
case WS_EVT_PONG:
|
||||||
{
|
{
|
||||||
#if defined(DEBUG_ESPUI)
|
#if defined(DEBUG_ESPUI)
|
||||||
if (ESPUI.verbosity)
|
if (ESPUI.verbosity)
|
||||||
@ -139,7 +139,7 @@ void ESPUIclient::onWsEvent(AwsEventType type, void* arg, uint8_t* data, size_t
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WS_EVT_ERROR:
|
case WS_EVT_ERROR:
|
||||||
{
|
{
|
||||||
#if defined(DEBUG_ESPUI)
|
#if defined(DEBUG_ESPUI)
|
||||||
if (ESPUI.verbosity)
|
if (ESPUI.verbosity)
|
||||||
@ -165,7 +165,7 @@ void ESPUIclient::onWsEvent(AwsEventType type, void* arg, uint8_t* data, size_t
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WS_EVT_DATA:
|
case WS_EVT_DATA:
|
||||||
{
|
{
|
||||||
// Serial.println(F("ESPUIclient::OnWsEvent:WS_EVT_DATA"));
|
// Serial.println(F("ESPUIclient::OnWsEvent:WS_EVT_DATA"));
|
||||||
String msg = "";
|
String msg = "";
|
||||||
@ -226,13 +226,13 @@ void ESPUIclient::onWsEvent(AwsEventType type, void* arg, uint8_t* data, size_t
|
|||||||
} // end switch
|
} // end switch
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Prepare a chunk of elements as a single JSON string. If the allowed number of elements is greater than the total
|
Prepare a chunk of elements as a single JSON string. If the allowed number of elements is greater than the total
|
||||||
number this will represent the entire UI. More likely, it will represent a small section of the UI to be sent. The
|
number this will represent the entire UI. More likely, it will represent a small section of the UI to be sent. The
|
||||||
client will acknowledge receipt by requesting the next chunk.
|
client will acknowledge receipt by requesting the next chunk.
|
||||||
*/
|
*/
|
||||||
uint32_t ESPUIclient::prepareJSONChunk(uint16_t startindex,
|
uint32_t ESPUIclient::prepareJSONChunk(uint16_t startindex,
|
||||||
DynamicJsonDocument & rootDoc,
|
DynamicJsonDocument & rootDoc,
|
||||||
bool InUpdateMode)
|
bool InUpdateMode)
|
||||||
{
|
{
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
@ -278,8 +278,8 @@ uint32_t ESPUIclient::prepareJSONChunk(uint16_t startindex,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// keep track of the number of elements we have serialised into this
|
// keep track of the number of elements we have serialised into this
|
||||||
// message. Overflow is detected and handled later in this loop
|
// message. Overflow is detected and handled later in this loop
|
||||||
// and needs an index to the last item added.
|
// and needs an index to the last item added.
|
||||||
while (nullptr != control)
|
while (nullptr != control)
|
||||||
{
|
{
|
||||||
@ -303,7 +303,7 @@ uint32_t ESPUIclient::prepareJSONChunk(uint16_t startindex,
|
|||||||
control = control->next;
|
control = control->next;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonObject item = items.createNestedObject();
|
JsonObject item = items.createNestedObject();
|
||||||
elementcount++;
|
elementcount++;
|
||||||
@ -349,15 +349,15 @@ uint32_t ESPUIclient::prepareJSONChunk(uint16_t startindex,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Convert & Transfer Arduino elements to JSON elements. This function sends a chunk of
|
Convert & Transfer Arduino elements to JSON elements. This function sends a chunk of
|
||||||
JSON describing the controls of the UI, starting from the control at index startidx.
|
JSON describing the controls of the UI, starting from the control at index startidx.
|
||||||
If startidx is 0 then a UI_INITIAL_GUI message will be sent, else a UI_EXTEND_GUI.
|
If startidx is 0 then a UI_INITIAL_GUI message will be sent, else a UI_EXTEND_GUI.
|
||||||
Both message types contain a list of serialised UI elements. Only a portion of the UI
|
Both message types contain a list of serialised UI elements. Only a portion of the UI
|
||||||
will be sent in order to avoid websocket buffer overflows. The client will acknowledge
|
will be sent in order to avoid websocket buffer overflows. The client will acknowledge
|
||||||
receipt of a partial message by requesting the next chunk of UI.
|
receipt of a partial message by requesting the next chunk of UI.
|
||||||
|
|
||||||
The protocol is:
|
The protocol is:
|
||||||
SERVER: SendControlsToClient(0):
|
SERVER: SendControlsToClient(0):
|
||||||
"UI_INITIAL_GUI: n serialised UI elements"
|
"UI_INITIAL_GUI: n serialised UI elements"
|
||||||
CLIENT: controls.js:handleEvent()
|
CLIENT: controls.js:handleEvent()
|
||||||
"uiok:n"
|
"uiok:n"
|
||||||
@ -365,10 +365,10 @@ SERVER: SendControlsToClient(n):
|
|||||||
"UI_EXTEND_GUI: n serialised UI elements"
|
"UI_EXTEND_GUI: n serialised UI elements"
|
||||||
CLIENT: controls.js:handleEvent()
|
CLIENT: controls.js:handleEvent()
|
||||||
"uiok:2*n"
|
"uiok:2*n"
|
||||||
etc.
|
etc.
|
||||||
Returns true if all controls have been sent (aka: Done)
|
Returns true if all controls have been sent (aka: Done)
|
||||||
*/
|
*/
|
||||||
bool ESPUIclient::SendControlsToClient(uint16_t startidx,
|
bool ESPUIclient::SendControlsToClient(uint16_t startidx,
|
||||||
ClientUpdateType_t TransferMode)
|
ClientUpdateType_t TransferMode)
|
||||||
{
|
{
|
||||||
bool Response = false;
|
bool Response = false;
|
||||||
@ -446,10 +446,10 @@ bool ESPUIclient::SendJsonDocToWebSocket(DynamicJsonDocument& document)
|
|||||||
#if defined(DEBUG_ESPUI)
|
#if defined(DEBUG_ESPUI)
|
||||||
if (ESPUI.verbosity >= Verbosity::VerboseJSON)
|
if (ESPUI.verbosity >= Verbosity::VerboseJSON)
|
||||||
{
|
{
|
||||||
Serial.println("SendJsonDocToWebSocket: Cannot Send to client. Not sending websocket message");
|
Serial.println(F("ESPUIclient::SendJsonDocToWebSocket: Cannot Send to client. Not sending websocket message"));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// Serial.println("SendJsonDocToWebSocket: Cannot Send to client. Not sending websocket message");
|
// Serial.println("ESPUIclient::SendJsonDocToWebSocket: Cannot Send to client. Not sending websocket message");
|
||||||
Response = false;
|
Response = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -462,17 +462,17 @@ bool ESPUIclient::SendJsonDocToWebSocket(DynamicJsonDocument& document)
|
|||||||
#if defined(DEBUG_ESPUI)
|
#if defined(DEBUG_ESPUI)
|
||||||
if (ESPUI.verbosity >= Verbosity::VerboseJSON)
|
if (ESPUI.verbosity >= Verbosity::VerboseJSON)
|
||||||
{
|
{
|
||||||
Serial.println(String("SendJsonDocToWebSocket: json: '") + json + "'");
|
Serial.println(String(F("ESPUIclient::SendJsonDocToWebSocket: json: '")) + json + "'");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(DEBUG_ESPUI)
|
#if defined(DEBUG_ESPUI)
|
||||||
if (ESPUI.verbosity >= Verbosity::VerboseJSON)
|
if (ESPUI.verbosity >= Verbosity::VerboseJSON)
|
||||||
{
|
{
|
||||||
Serial.println(F("SendJsonDocToWebSocket: client.text"));
|
Serial.println(F("ESPUIclient::SendJsonDocToWebSocket: client.text"));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// Serial.println(F("SendJsonDocToWebSocket: client.text"));
|
// Serial.println(F("ESPUIclient::SendJsonDocToWebSocket: client.text"));
|
||||||
client->text(json);
|
client->text(json);
|
||||||
|
|
||||||
} while (false);
|
} while (false);
|
||||||
|
Loading…
Reference in New Issue
Block a user