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