From 3068f6805e1dfc4d94381bcbf4e0f17d42581c23 Mon Sep 17 00:00:00 2001 From: James Date: Sat, 27 Apr 2024 11:40:16 +0100 Subject: [PATCH] fixes --- ESPBMS.ino | 28 ++++++++++++++-------------- victron.ino | 12 ++++++------ 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/ESPBMS.ino b/ESPBMS.ino index 5e92a7c..5044fa3 100644 --- a/ESPBMS.ino +++ b/ESPBMS.ino @@ -135,7 +135,7 @@ void loop() { currentName[sizeof(currentName) - 1] = '\0'; // Ensure null-termination // Convert to lowercase and replace spaces with dots for (char* p = currentName; *p; ++p) { - *p = *p == ' ' ? '.' : tolower(*p); + *p = *p == ' ' ? '.' : *p; } unsigned long start=millis(); @@ -317,14 +317,14 @@ bool processBasicInfo(byte *data, unsigned int dataLen){ uint16_t BalanceCodeHigh = (two_ints_into16(data[14], data[15])); uint8_t MosfetStatus = ((byte)data[20]); - Serial.printf(">>>rc.%s.Voltage %f\r\n",currentName, (float)Volts / 1000); - Serial.printf(">>>rc.%s.Amps %f\r\n",currentName, (float)Amps / 1000); - Serial.printf(">>>rc.%s.watts %f\r\n",currentName, (float)Watts); - Serial.printf(">>>rc.%s.Capacity_Remain_Ah %f\r\n",currentName, (float)CapacityRemainAh / 1000); - Serial.printf(">>>rc.%s.Capacity_Remain_Wh %f\r\n",currentName, ((float)(CapacityRemainAh) / 1000) * ((float)(Volts) / 1000)); - Serial.printf(">>>rc.%s.Capacity_Remain_Percent %d\r\n",currentName, CapacityRemainPercent); - Serial.printf(">>>rc.%s.Temp1 %f\r\n",currentName, (float)Temp1 / 10); - Serial.printf(">>>rc.%s.Temp2 %f\r\n",currentName, (float)Temp2 / 10); + Serial.printf(">>>RC.%s.Voltage %f\r\n",currentName, (float)Volts / 1000); + Serial.printf(">>>RC.%s.Amps %f\r\n",currentName, (float)Amps / 1000); + Serial.printf(">>>RC.%s.watts %f\r\n",currentName, (float)Watts); + Serial.printf(">>>RC.%s.Capacity_Remain_Ah %f\r\n",currentName, (float)CapacityRemainAh / 1000); + Serial.printf(">>>RC.%s.Capacity_Remain_Wh %f\r\n",currentName, ((float)(CapacityRemainAh) / 1000) * ((float)(Volts) / 1000)); + Serial.printf(">>>RC.%s.Capacity_Remain_Percent %d\r\n",currentName, CapacityRemainPercent); + Serial.printf(">>>RC.%s.Temp1 %f\r\n",currentName, (float)Temp1 / 10); + Serial.printf(">>>RC.%s.Temp2 %f\r\n",currentName, (float)Temp2 / 10); /* Serial.printf("%s Balance Code Low: 0x%x\r\n",currentName, BalanceCodeLow); Serial.printf("%s Balance Code High: 0x%x\r\n",currentName, BalanceCodeHigh); @@ -358,13 +358,13 @@ bool processCellInfo(byte *data, unsigned int dataLen) _cellMin = CellVolt; } - Serial.printf(">>>rc.%s.Cell.%d.Voltage %f\r\n",currentName, i+1,(float)CellVolt/1000); + Serial.printf(">>>RC.%s.Cell.%d.Voltage %f\r\n",currentName, i+1,(float)CellVolt/1000); } - Serial.printf(">>>rc.%s.Max_Cell_Voltage %f\r\n",currentName, (float)_cellMax / 1000); - Serial.printf(">>>rc.%s.Min_Cell_Voltage %f\r\n",currentName, (float)_cellMin / 1000); - Serial.printf(">>>rc.%s.Difference_Cell_Voltage %f\r\n",currentName, (float)(_cellMax - _cellMin) / 1000); - Serial.printf(">>>rc.%s.Average_Cell_Voltage %f\r\n",currentName, (float)(_cellSum / NumOfCells) / 1000); + Serial.printf(">>>RC.%s.Max_Cell_Voltage %f\r\n",currentName, (float)_cellMax / 1000); + Serial.printf(">>>RC.%s.Min_Cell_Voltage %f\r\n",currentName, (float)_cellMin / 1000); + Serial.printf(">>>RC.%s.Difference_Cell_Voltage %f\r\n",currentName, (float)(_cellMax - _cellMin) / 1000); + Serial.printf(">>>RC.%s.Average_Cell_Voltage %f\r\n",currentName, (float)(_cellSum / NumOfCells) / 1000); gotCellInfo=true; diff --git a/victron.ino b/victron.ino index f5014f3..92c190a 100644 --- a/victron.ino +++ b/victron.ino @@ -185,11 +185,11 @@ void decodeVictron(BLEAdvertisedDevice advertisedDevice) { return; } - Serial.printf(">>>MPPT.1.Battery_Volts %f\r\n",batteryVoltage); - Serial.printf(">>>MPPT.1.Battery_Amps %f\r\n",batteryCurrent); - Serial.printf(">>>MPPT.1.Solar_Watts %f\r\n",inputPower); - Serial.printf(">>>MPPT.1.Output_Current %f\r\n",outputCurrent); - Serial.printf(">>>MPPT.1.Yield %f\r\n",todayYield); - Serial.printf(">>>MPPT.1.State %d\r\n",deviceState); + Serial.printf(">>>RC.MPPT.1.Battery_Volts %f\r\n",batteryVoltage); + Serial.printf(">>>RC.MPPT.1.Battery_Amps %f\r\n",batteryCurrent); + Serial.printf(">>>RC.MPPT.1.Solar_Watts %f\r\n",inputPower); + Serial.printf(">>>RC.MPPT.1.Output_Current %f\r\n",outputCurrent); + Serial.printf(">>>RC.MPPT.1.Yield %f\r\n",todayYield); + Serial.printf(">>>RC.MPPT.1.State %d\r\n",deviceState); } }