some buttons are now websocket-handled
This commit is contained in:
@@ -32,6 +32,8 @@ void Websocket_HandleMessage(void *arg, uint8_t *data, size_t len);
|
||||
void Websocket_RefreshClientData_DTCs(uint32_t client_id);
|
||||
void Websocket_RefreshClientData_Status(uint32_t client_id, bool send_mapping = false);
|
||||
void Websocket_RefreshClientData_Static(uint32_t client_id, bool send_mapping = false);
|
||||
void Websocket_HandleButtons(uint8_t *data);
|
||||
void Websocket_HandleSettings(uint8_t *data);
|
||||
|
||||
/**
|
||||
* @brief Initializes the web-based user interface (WebUI) for the ChainLube application.
|
||||
@@ -180,8 +182,6 @@ void WebserverPOST_Callback(AsyncWebServerRequest *request)
|
||||
globals.requestEEAction = EE_CFG_SAVE;
|
||||
// end: POST Form Oiltank
|
||||
// begin: POST Form Maintenance
|
||||
if (p->name() == "purgepulse")
|
||||
LubeConfig.BleedingPulses = p->value().toInt();
|
||||
if (p->name() == "maintsave")
|
||||
globals.requestEEAction = EE_CFG_SAVE;
|
||||
if (p->name() == "resettank")
|
||||
@@ -204,15 +204,6 @@ void WebserverPOST_Callback(AsyncWebServerRequest *request)
|
||||
globals.requestEEAction = globals.requestEEAction == EE_PDS_FORMAT ? EE_FORMAT_ALL : EE_CFG_FORMAT;
|
||||
}
|
||||
}
|
||||
if (p->name() == "purgenow")
|
||||
{
|
||||
globals.systemStatus = sysStat_Purge;
|
||||
globals.purgePulses = LubeConfig.BleedingPulses;
|
||||
}
|
||||
if (p->name() == "reboot")
|
||||
{
|
||||
globals.systemStatus = sysStat_Shutdown;
|
||||
}
|
||||
// end: POST Form Maintenance
|
||||
// begin: POST Form LED Settings
|
||||
if (p->name() == "ledmaxbrightness")
|
||||
@@ -234,12 +225,6 @@ void WebserverPOST_Callback(AsyncWebServerRequest *request)
|
||||
globals.requestEEAction = EE_CFG_SAVE;
|
||||
}
|
||||
// end: POST Form LED SEttings
|
||||
// begin: POST Form Measure Pulses
|
||||
if (p->name() == "measurereset")
|
||||
globals.measuredPulses = 0;
|
||||
if (p->name() == "measurestartstop")
|
||||
globals.measurementActive = !globals.measurementActive;
|
||||
// end: POST Form Measure Pulses
|
||||
}
|
||||
}
|
||||
|
||||
@@ -530,23 +515,59 @@ void Websocket_HandleMessage(void *arg, uint8_t *data, size_t len)
|
||||
{
|
||||
data[len] = 0;
|
||||
|
||||
Debug_pushMessage("Got WebSocket Message: %s \n", (char *)data);
|
||||
|
||||
if (strcmp((char *)data, "start") == 0)
|
||||
if (strncmp((char *)data, "btn-", strlen("btn-")) == 0)
|
||||
{
|
||||
SetDebugportStatus(dbg_Webui, enabled);
|
||||
Websocket_HandleButtons(data + strlen("btn-"));
|
||||
}
|
||||
else if (strcmp((char *)data, "stop") == 0)
|
||||
if (strncmp((char *)data, "set-", strlen("set-")) == 0)
|
||||
{
|
||||
SetDebugportStatus(dbg_Webui, disabled);
|
||||
Websocket_HandleSettings(data + strlen("set-"));
|
||||
}
|
||||
else if (strcmp((char *)data, "foo") == 0)
|
||||
else
|
||||
{
|
||||
Debug_pushMessage("Got WebSocket Message 'foo' from client\n");
|
||||
Debug_pushMessage("Got unknown Websocket-Message '%s' from client\n", (char *)data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Websocket_HandleButtons(uint8_t *data)
|
||||
{
|
||||
if (strcmp((char *)data, "debugstart") == 0)
|
||||
{
|
||||
SetDebugportStatus(dbg_Webui, enabled);
|
||||
}
|
||||
else if (strcmp((char *)data, "debugstop") == 0)
|
||||
{
|
||||
SetDebugportStatus(dbg_Webui, disabled);
|
||||
}
|
||||
else if (strcmp((char *)data, "measurereset") == 0)
|
||||
{
|
||||
globals.measuredPulses = 0;
|
||||
}
|
||||
else if (strcmp((char *)data, "measurestartstop") == 0)
|
||||
{
|
||||
globals.measurementActive = !globals.measurementActive;
|
||||
}
|
||||
else if (strcmp((char *)data, "purgenow") == 0)
|
||||
{
|
||||
globals.systemStatus = sysStat_Purge;
|
||||
globals.purgePulses = LubeConfig.BleedingPulses;
|
||||
}
|
||||
else if (strcmp((char *)data, "reboot") == 0)
|
||||
{
|
||||
globals.systemStatus = sysStat_Shutdown;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug_pushMessage("Got unknown Button-id '%s' from ws-client\n", (char *)data);
|
||||
}
|
||||
}
|
||||
|
||||
void Websocket_HandleSettings(uint8_t *data)
|
||||
{
|
||||
Debug_pushMessage("Got Settings-id and value '%s' from ws-client\n", (char *)data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pushes live debug messages to all WebSocket clients.
|
||||
*
|
||||
|
Reference in New Issue
Block a user