improvement of webui-function

This commit is contained in:
Marcel Peterkau 2024-06-02 23:37:04 +02:00
parent 73c486be73
commit 48774a42f4

View File

@ -594,7 +594,6 @@ void Websocket_RefreshClientData_DTCs(uint32_t client_id)
*/
void Websocket_RefreshClientData_Status(uint32_t client_id, bool send_mapping)
{
if (send_mapping)
{
const char mapping[] = "MAPPING_STATUS:"
@ -613,25 +612,27 @@ void Websocket_RefreshClientData_Status(uint32_t client_id, bool send_mapping)
Debug_pushMessage("send MAPPING_STATUS WS-Client Data\n");
}
String temp = "STATUS:";
char dataString[200] = {0}; // Maximal 200 Zeichen für den Data-String
temp.concat(String(globals.battery_level) + ";");
temp.concat(String(globals.systemStatustxt) + ";");
temp.concat(String(PersistenceData.activeFaction) + ";");
temp.concat(String(PersistenceData.faction_1_timer) + ";");
temp.concat(String(PersistenceData.faction_2_timer) + ";");
temp.concat(String(PersistenceData.faction_3_timer) + ";");
sprintf(dataString, "STATUS:%d;%s;%d;%ld;%ld;%ld;",
globals.battery_level,
globals.systemStatustxt,
PersistenceData.activeFaction,
PersistenceData.faction_1_timer,
PersistenceData.faction_2_timer,
PersistenceData.faction_3_timer);
if (client_id > 0)
{
webSocket.text(client_id, temp);
webSocket.text(client_id, dataString);
}
else
{
webSocket.textAll(temp);
webSocket.textAll(dataString);
}
}
/**
* @brief Refreshes client data related to static configuration parameters on WebSocket clients.
*
@ -645,6 +646,7 @@ void Websocket_RefreshClientData_Status(uint32_t client_id, bool send_mapping)
void Websocket_RefreshClientData_Static(uint32_t client_id, bool send_mapping)
{
Debug_pushMessage("send STATIC WS-Client Data\n");
if (send_mapping)
{
const char mapping[] = "MAPPING_STATIC:"
@ -664,6 +666,8 @@ void Websocket_RefreshClientData_Static(uint32_t client_id, bool send_mapping)
webSocket.text(client_id, mapping);
else
webSocket.textAll(mapping);
Debug_pushMessage("send MAPPING_STATIC WS-Client Data\n");
}
char dataString[200]; // Maximal 200 Zeichen für den Data-String