Skip to content

Commit

Permalink
some corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
softwarecrash committed Mar 25, 2024
1 parent 0fa10d8 commit 1c9ddad
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/VeDirectFrameHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ VeDirectFrameHandler::VeDirectFrameHandler() : // mStop(false), // don't know wh
*/
void VeDirectFrameHandler::rxData(uint8_t inbyte)
{
// Serial.write(inbyte);
Serial.write(inbyte);
// if (mStop) return;
if ((inbyte == ':') && (mState != CHECKSUM))
{
Expand Down
33 changes: 18 additions & 15 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ void handleWebSocketMessage(void *arg, uint8_t *data, size_t len)
}
}

void onEvent(AsyncWebSocket *server, AsyncWebSocketClient *client, AwsEventType type,
void *arg, uint8_t *data, size_t len)
void onEvent(AsyncWebSocket *server, AsyncWebSocketClient *client, AwsEventType type, void *arg, uint8_t *data, size_t len)
{
switch (type)
{
Expand All @@ -130,6 +129,8 @@ void onEvent(AsyncWebSocket *server, AsyncWebSocketClient *client, AwsEventType
break;
case WS_EVT_PONG:
case WS_EVT_ERROR:
wsClient = nullptr;
ws.cleanupClients();
break;
}
}
Expand Down Expand Up @@ -176,7 +177,7 @@ void ReadVEData()
while (veSerial.available())
{
myve.rxData(veSerial.read());
esp_yield();
//esp_yield();
}
// if (veSerial.available())
//{
Expand Down Expand Up @@ -460,7 +461,7 @@ void loop()
void prozessData()
{
dataProzessing = true;
DEBUG_WEBLN("VE callback triggered... prozessing data");
DEBUG_WEBLN("VE callback triggered... prozessing data");
getJsonData();
notifyClients();
dataProzessing = false;
Expand All @@ -476,21 +477,22 @@ bool getJsonData()
jsonESP["ESP_VCC"] = (ESP.getVcc() / 1000.0) + 0.3;
jsonESP["Wifi_RSSI"] = WiFi.RSSI();

if (DebugMode){
if (DebugMode)
{
jsonESP["Flash_Size"] = ESP.getFlashChipSize();
jsonESP["Sketch_Size"] = ESP.getSketchSize();
jsonESP["Free_Sketch_Space"] = ESP.getFreeSketchSpace();
jsonESP["Real_Flash_Size"] = ESP.getFlashChipRealSize();
jsonESP["Free_Heap"] = ESP.getFreeHeap();
jsonESP["HEAP_Fragmentation"] = ESP.getHeapFragmentation();
// jsonESP["WS_Clients"] = ws.getClients();
// jsonESP["WS_Clients"] = ws.getClients();
jsonESP["Free_BlockSize"] = ESP.getMaxFreeBlockSize();

Serial.println();
Serial.println("VE received data: ");
Serial.println(myve.veEnd);
// const char *descriptor;
// const char *Vevalue;
// const char *descriptor;
// const char *Vevalue;
DEBUG_WEBLN();
DEBUG_WEBLN("VE received data: ");
DEBUG_WEBLN(myve.veEnd);
Expand All @@ -511,12 +513,13 @@ bool getJsonData()
rawVal += "\":\"";
rawVal += myve.veValue[i];
rawVal += "\"},";
if (DebugMode) {
Serial.print("[");
Serial.print(myve.veName[i]);
Serial.print(":");
Serial.print(myve.veValue[i]);
Serial.print("]");
if (DebugMode)
{
Serial.print("[");
Serial.print(myve.veName[i]);
Serial.print(":");
Serial.print(myve.veValue[i]);
Serial.print("]");
}
// search for every Vevalue in the list and replace it with clear name
for (size_t j = 0; j < sizeof(VePrettyData) / sizeof(VePrettyData[0]); j++)
Expand Down Expand Up @@ -617,7 +620,7 @@ bool getJsonData()

if (DebugMode == true)
{
// Json["RAW"] = rawVal;
// Json["RAW"] = rawVal;
Serial.println();
DEBUG_WEBLN(rawVal);
}
Expand Down

0 comments on commit 1c9ddad

Please sign in to comment.