OpenSprinkler › Forums › OpenSprinkler Unified Firmware › API – Station Status › Reply To: API – Station Status
DaveC
Its a bug…
When processing ‘jc sbits’ an extra 0 is sent out after the last station status group.
In server.cpp
// print sbits
for(bid=0;bid<os.nboards;bid++)
bfill.emit_p(PSTR(“$D,”), os.station_bits[bid]);
bfill.emit_p(PSTR(“0],\”ps\”:[“));
should be something like:
// print sbits
for(bid=0;bid<os.nboards;bid++) {
bfill.emit_p(PSTR(“$D”), os.station_bits[bid]);
if(bid!=os.nboards-1) bfill.emit_p(PSTR(“,”));
}
bfill.emit_p(PSTR(“],\”ps\”:[“));
This is similar to the way it is handled with ‘js sn’:
for (sid=0;sid<os.nstations;sid++) {
bfill.emit_p(PSTR(“$D”), (os.station_bits[(sid>>3)]>>(sid&0x07))&1);
if(sid!=os.nstations-1) bfill.emit_p(PSTR(“,”));
}
bfill.emit_p(PSTR(“],\”nstations\”:$D}”), os.nstations);