Skip to content

Commit

Permalink
transmit battery voltage
Browse files Browse the repository at this point in the history
  • Loading branch information
jp112sdl committed Jan 27, 2020
1 parent 273f1a7 commit 844177c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions HB-UNI-Sen-TEMP-MAX6675-DT/HB-UNI-Sen-TEMP-MAX6675-DT.ino
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,14 @@ class UList0 : public RegList0<Reg0> {

class MeasureEventMsg : public Message {
public:
void init(uint8_t msgcnt, int tempValues[4], bool batlow) {
Message::init(0x1a, msgcnt, 0x53, (msgcnt % 20 == 1) ? (BIDI | WKMEUP) : BCAST, batlow ? 0x80 : 0x00, 0x41);
for (int i = 0; i < 4; i++) {
void init(uint8_t msgcnt, int tempValues[4], bool batlow, uint8_t batval) {
Message::init(0x18, msgcnt, 0x53, (msgcnt % 20 == 1) ? (BIDI | WKMEUP) : BCAST, batlow ? 0x80 : 0x00, 0x41);
for (uint8_t i = 0; i < 4; i++) {
pload[i * 3] = (tempValues[i] >> 8) & 0xff;
pload[(i * 3) + 1] = (tempValues[i]) & 0xff;
pload[(i * 3) + 2] = 0x42 + i;
}
pload[12] = batval & 0xff;
}
};

Expand Down Expand Up @@ -150,7 +151,7 @@ class UType : public MultiChannelDevice<Hal, WeatherChannel, 4, UList0> {

MeasureEventMsg& msg = (MeasureEventMsg&)dev.message();

msg.init(dev.nextcount(), tempValues, dev.battery().low());
msg.init(dev.nextcount(), tempValues, dev.battery().low(), dev.battery().current());
dev.send(msg, dev.getMasterID());

uint8_t flgs = dev.battery().low() ? 0x80 : 0x00;
Expand Down

0 comments on commit 844177c

Please sign in to comment.