prevent bat from going negative
This commit is contained in:
parent
66002a0e1d
commit
45dffd54ad
@ -218,6 +218,7 @@ void calc_data(Tel *t, Bat_state *b, long now) {
|
||||
|
||||
b->previous_ms = now;
|
||||
b->wh_used += (float)t->power.data * (float)dt / 3600000.0f;
|
||||
if (b->wh_used > b->wh_total) b->wh_used = b->wh_total;
|
||||
}
|
||||
|
||||
long now_ms(void) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user