Skip to content

Commit 770630f

Browse files
committed
v2.8: slightly reduce lower eSmart voltage limits and add verbose fault messages
1 parent 4446489 commit 770630f

2 files changed

Lines changed: 96 additions & 9 deletions

File tree

platformio.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ default_envs = esp32cam_ota
1515

1616
[program]
1717
name = LiFePO_Island
18-
version = 2.7
18+
version = 2.8
1919
instance = 1
2020
hostname = ${program.name}-${program.instance}
2121

src/main.cpp

Lines changed: 95 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,9 +1024,97 @@ void handle_jbdCells() {
10241024
}
10251025

10261026

1027-
char web_msg[80] = ""; // main web page displays and then clears this
1028-
bool changeIp = false; // if true, ip changes after display of root url
1029-
IPAddress ip; // the ip to change to (use DHCP if 0)
1027+
// Copy verbose error status string into msg
1028+
// Return length of message (ends in ' ...' if cut due to msg_size too small)
1029+
size_t decode_error( char *msg, size_t msg_size ) {
1030+
char *endp = msg + msg_size;
1031+
char *cursor = msg; // cursor position in msg
1032+
1033+
if (es3ChgSts.wFault) {
1034+
if (es3ChgSts.wFault &0b0000000001 && endp > cursor) {
1035+
cursor += snprintf(cursor, endp - cursor, "CHG: %s<br/>\n", "Battery over voltage");
1036+
}
1037+
if (es3ChgSts.wFault &0b0000000010 && endp > cursor) {
1038+
cursor += snprintf(cursor, endp - cursor, "CHG: %s<br/>\n", "PV over voltage");
1039+
}
1040+
if (es3ChgSts.wFault &0b0000000100 && endp > cursor) {
1041+
cursor += snprintf(cursor, endp - cursor, "CHG: %s<br/>\n", "Charge over current");
1042+
}
1043+
if (es3ChgSts.wFault &0b0000001000 && endp > cursor) {
1044+
cursor += snprintf(cursor, endp - cursor, "CHG: %s<br/>\n", "Discharge over current");
1045+
}
1046+
if (es3ChgSts.wFault &0b0000010000 && endp > cursor) {
1047+
cursor += snprintf(cursor, endp - cursor, "CHG: %s<br/>\n", "Battery temperature alarm");
1048+
}
1049+
if (es3ChgSts.wFault &0b0000100000 && endp > cursor) {
1050+
cursor += snprintf(cursor, endp - cursor, "CHG: %s<br/>\n", "Internal temperature alarm");
1051+
}
1052+
if (es3ChgSts.wFault &0b0001000000 && endp > cursor) {
1053+
cursor += snprintf(cursor, endp - cursor, "CHG: %s<br/>\n", "PV low voltage");
1054+
}
1055+
if (es3ChgSts.wFault &0b0010000000 && endp > cursor) {
1056+
cursor += snprintf(cursor, endp - cursor, "CHG: %s<br/>\n", "Battery low voltage");
1057+
}
1058+
if (es3ChgSts.wFault &0b0100000000 && endp > cursor) {
1059+
cursor += snprintf(cursor, endp - cursor, "CHG: %s<br/>\n", "Trip zero protection trigger");
1060+
}
1061+
if (es3ChgSts.wFault &0b1000000000 && endp > cursor) {
1062+
cursor += snprintf(cursor, endp - cursor, "CHG: %s<br/>\n", "In the control of manual switchgear");
1063+
}
1064+
}
1065+
1066+
if (jbdStatus.fault) {
1067+
if (jbdStatus.fault &0b0000000000001 && endp > cursor) {
1068+
cursor += snprintf(cursor, endp - cursor, "BMS: %s<br/>\n", "Cell block over voltage");
1069+
}
1070+
if (jbdStatus.fault &0b0000000000010 && endp > cursor) {
1071+
cursor += snprintf(cursor, endp - cursor, "BMS: %s<br/>\n", "Cell block under voltage");
1072+
}
1073+
if (jbdStatus.fault &0b0000000000100 && endp > cursor) {
1074+
cursor += snprintf(cursor, endp - cursor, "BMS: %s<br/>\n", "Battery over voltage");
1075+
}
1076+
if (jbdStatus.fault &0b0000000001000 && endp > cursor) {
1077+
cursor += snprintf(cursor, endp - cursor, "BMS: %s<br/>\n", "Battery under voltage");
1078+
}
1079+
if (jbdStatus.fault &0b0000000010000 && endp > cursor) {
1080+
cursor += snprintf(cursor, endp - cursor, "BMS: %s<br/>\n", "Charging over temperature");
1081+
}
1082+
if (jbdStatus.fault &0b0000000100000 && endp > cursor) {
1083+
cursor += snprintf(cursor, endp - cursor, "BMS: %s<br/>\n", "Charging low temperature");
1084+
}
1085+
if (jbdStatus.fault &0b0000001000000 && endp > cursor) {
1086+
cursor += snprintf(cursor, endp - cursor, "BMS: %s<br/>\n", "Discharging over temperature");
1087+
}
1088+
if (jbdStatus.fault &0b0000010000000 && endp > cursor) {
1089+
cursor += snprintf(cursor, endp - cursor, "BMS: %s<br/>\n", "Discharging low temperature");
1090+
}
1091+
if (jbdStatus.fault &0b0000100000000 && endp > cursor) {
1092+
cursor += snprintf(cursor, endp - cursor, "BMS: %s<br/>\n", "Charging over current");
1093+
}
1094+
if (jbdStatus.fault &0b0001000000000 && endp > cursor) {
1095+
cursor += snprintf(cursor, endp - cursor, "BMS: %s<br/>\n", "Discharging over current");
1096+
}
1097+
if (jbdStatus.fault &0b0010000000000 && endp > cursor) {
1098+
cursor += snprintf(cursor, endp - cursor, "BMS: %s<br/>\n", "Short circuit");
1099+
}
1100+
if (jbdStatus.fault &0b0100000000000 && endp > cursor) {
1101+
cursor += snprintf(cursor, endp - cursor, "BMS: %s<br/>\n", "Frontend IC error");
1102+
}
1103+
if (jbdStatus.fault &0b1000000000000 && endp > cursor) {
1104+
cursor += snprintf(cursor, endp - cursor, "BMS: %s<br/>\n", "MOS software lockout");
1105+
}
1106+
}
1107+
1108+
if (cursor >= endp) {
1109+
snprintf(endp - 5, 5, " ...");
1110+
}
1111+
1112+
return cursor - msg;
1113+
}
1114+
1115+
char web_msg[256] = ""; // main web page displays and then clears this
1116+
bool changeIp = false; // if true, ip changes after display of root url
1117+
IPAddress ip; // the ip to change to (use DHCP if 0)
10301118

10311119
// Standard web page
10321120
const char *main_page() {
@@ -1099,15 +1187,14 @@ const char *main_page() {
10991187
" <p><small>... by <a href=\"https://github.com/joba-1/LiFePO_Island\">Joachim Banzhaf</a>, " __DATE__ " " __TIME__ "</small></p>\n"
11001188
" </body>\n"
11011189
"</html>\n";
1102-
static char page[sizeof(fmt) + 500] = "";
1190+
static char page[sizeof(fmt) + 700] = "";
11031191
static char curr_time[30], influx_time[30];
11041192
time_t now;
11051193
time(&now);
11061194
strftime(curr_time, sizeof(curr_time), "%FT%T", localtime(&now));
11071195
strftime(influx_time, sizeof(influx_time), "%FT%T", localtime(&post_time));
1108-
if( !*web_msg && (es3ChgSts.wFault || jbdStatus.fault || influx_status < 200 || influx_status >= 300 ) ) {
1109-
snprintf(web_msg, sizeof(web_msg), "WARNING: %s %s %s", es3ChgSts.wFault ? "Charger" : "",
1110-
jbdStatus.fault ? "BMS" : "", (influx_status < 200 || influx_status >= 300) ? "Database" : "");
1196+
if (!*web_msg && (es3ChgSts.wFault || jbdStatus.fault)) {
1197+
decode_error(web_msg, sizeof(web_msg));
11111198
}
11121199
snprintf(page, sizeof(page), fmt, (char *)es3Information.wModel, jbdHardware.id,
11131200
(char *)es3Information.wModel, jbdHardware.id,
@@ -1612,7 +1699,7 @@ void setup_LiFePO() {
16121699
uint16_t s_cells = 4; // 4, 8, 12, 16
16131700
uint16_t p_cells = 1; // 1 - 4
16141701
uint16_t maxCellDeciVolt = 36; // ~95% LiFePO capacity
1615-
uint16_t minCellDeciVolt = 31; // ~15% LiFePO capacity
1702+
uint16_t minCellDeciVolt = 30; // ~15% LiFePO capacity
16161703
uint16_t capacityAh = 272; // my LiFePO capacity
16171704
uint16_t maxDeviceCurr = 400; // max deciAmps of my eSmart3
16181705

0 commit comments

Comments
 (0)