Browse Source

Update hmRadio.h

changes requested by @aschiffler regarding hmRadio.h
pull/138/head
lumapu 3 years ago
committed by GitHub
parent
commit
e5be85cb27
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      tools/esp8266/hmRadio.h

17
tools/esp8266/hmRadio.h

@ -172,16 +172,17 @@ class HmRadio {
// 4 bytes control data
// Power Limit fix point 10 eg. 30 W --> 0d300 = 0x012c
// -1 = 0xffff --> no limit
if (data[0] == 0xffff){
data[0] &= 0xffff; // ToDo: unlimit value is needed and is inverter specific! --> get it via RF from inverter or via user interface
uint16_t powerLimit = data[0];
uint16_t powerLimitSetting = data[1];
if (powerLimit == 0xffff){
powerLimit &= 0xffff; // ToDo: unlimit value is needed and is inverter specific! --> get it via RF from inverter or via user interface
} else {
data[0] *= 10; // will overwrite the data bc it is a pointer
powerLimit *= 10; // will overwrite the data bc it is a pointer
}
mTxBuf[10 + (++cnt)] = (data[0] >> 8) & 0xff; // power limit
mTxBuf[10 + (++cnt)] = (data[0] ) & 0xff; // power limit
mTxBuf[10 + (++cnt)] = (data[1] >> 8) & 0xff; // setting for persistens handling
mTxBuf[10 + (++cnt)] = (data[1] ) & 0xff; // setting for persistens handling
data[0] /= 10; // UGLY!
mTxBuf[10 + (++cnt)] = (powerLimit >> 8) & 0xff; // power limit
mTxBuf[10 + (++cnt)] = (powerLimit ) & 0xff; // power limit
mTxBuf[10 + (++cnt)] = (powerLimitSetting >> 8) & 0xff; // setting for persistens handling
mTxBuf[10 + (++cnt)] = (powerLimitSetting ) & 0xff; // setting for persistens handling
}
// crc control data
uint16_t crc = crc16(&mTxBuf[10], cnt+1);

Loading…
Cancel
Save