Browse Source

change for loop, get the correct count from list

thanks to homeautomation22
pull/311/head
DanielR92 3 years ago
committed by GitHub
parent
commit
677988c60e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      tools/esp8266/webApi.cpp

2
tools/esp8266/webApi.cpp

@ -280,7 +280,7 @@ void webApi::getLive(JsonObject obj) {
JsonArray ch = obj2.createNestedArray("ch"); JsonArray ch = obj2.createNestedArray("ch");
JsonArray ch0 = ch.createNestedArray(); JsonArray ch0 = ch.createNestedArray();
obj2[F("ch_names")][0] = "AC"; obj2[F("ch_names")][0] = "AC";
for (uint8_t fld = 0; fld < 11; fld++) { for (uint8_t fld = 0; fld < sizeof(list); fld++) {
pos = (iv->getPosByChFld(CH0, list[fld], rec)); pos = (iv->getPosByChFld(CH0, list[fld], rec));
ch0[fld] = (0xff != pos) ? round3(iv->getValue(pos, rec)) : 0.0; ch0[fld] = (0xff != pos) ? round3(iv->getValue(pos, rec)) : 0.0;
obj[F("ch0_fld_units")][fld] = (0xff != pos) ? String(iv->getUnit(pos, rec)) : notAvail; obj[F("ch0_fld_units")][fld] = (0xff != pos) ? String(iv->getUnit(pos, rec)) : notAvail;

Loading…
Cancel
Save