Skip to content

Commit

Permalink
2.1: force mode fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
pvtom committed Sep 24, 2023
1 parent 34d0876 commit 7211154
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions s10m.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,28 +321,28 @@ int main(int argc, char **argv) {
if ((regs[70] == 0) && (regs[83] == 0)) {
if (strcmp(bstate, "EMPTY")) {
publish("battery/state", "EMPTY");
strcpy(bstate, "EMPTY");
if (!force) strcpy(bstate, "EMPTY");
}
} else if ((regs[70] == 0) && (regs[83] == 100)) {
if (strcmp(bstate, "FULL")) {
publish("battery/state", "FULL");
strcpy(bstate, "FULL");
if (!force) strcpy(bstate, "FULL");
}
} else if (regs[70] == 0) {
if (strcmp(bstate, "PENDING")) {
publish("battery/state", "PENDING");
strcpy(bstate, "PENDING");
if (!force) strcpy(bstate, "PENDING");
}
} else {
if (strcmp(bstate, "CHARGING")) {
publish("battery/state", "CHARGING");
strcpy(bstate, "CHARGING");
if (!force) strcpy(bstate, "CHARGING");
}
}
} else {
if (strcmp(bstate, "DISCHARGING")) {
publish("battery/state", "DISCHARGING");
strcpy(bstate, "DISCHARGING");
if (!force) strcpy(bstate, "DISCHARGING");
}
}
}
Expand All @@ -368,12 +368,12 @@ int main(int argc, char **argv) {
if (regs[75] < 0) {
if (strcmp(gstate, "IN")) {
publish("grid/state", "IN");
strcpy(gstate, "IN");
if (!force) strcpy(gstate, "IN");
}
} else {
if (strcmp(gstate, "OUT")) {
publish("grid/state", "OUT");
strcpy(gstate, "OUT");
if (!force) strcpy(gstate, "OUT");
}
}
}
Expand Down

0 comments on commit 7211154

Please sign in to comment.