Skip to content

Commit

Permalink
Update hmRadio.h
Browse files Browse the repository at this point in the history
changes requested by @aschiffler regarding hmRadio.h
lumapu authored Aug 11, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent ef520b6 commit e5be85c
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions tools/esp8266/hmRadio.h
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit e5be85c

Please sign in to comment.