fix for bosch boiler temp #314 and MM10 on HC2 #270

This commit is contained in:
Paul
2020-01-31 11:09:58 +01:00
parent 4f753077df
commit ce97c55822

View File

@@ -355,77 +355,83 @@ int8_t _getDataPosition(_EMS_RxTelegram * EMS_RxTelegram, uint8_t index) {
} }
// unsigned short // unsigned short
void _setValue(_EMS_RxTelegram * EMS_RxTelegram, uint16_t * param_op, uint8_t index) { bool _setValue(_EMS_RxTelegram * EMS_RxTelegram, uint16_t * param_op, uint8_t index) {
int8_t pos = _getDataPosition(EMS_RxTelegram, index); int8_t pos = _getDataPosition(EMS_RxTelegram, index);
if (pos < 0) { if (pos < 0) {
return; return false;
} }
uint16_t value = (EMS_RxTelegram->data[pos] << 8) + EMS_RxTelegram->data[pos + 1]; uint16_t value = (EMS_RxTelegram->data[pos] << 8) + EMS_RxTelegram->data[pos + 1];
// check for undefined/unset values, 0x8000 // check for undefined/unset values, 0x8000
if (value >= EMS_VALUE_USHORT_NOTSET) { if (value >= EMS_VALUE_USHORT_NOTSET) {
return; return false;
} }
*param_op = value; *param_op = value;
return true;
} }
// signed short // signed short
void _setValue(_EMS_RxTelegram * EMS_RxTelegram, int16_t * param_op, uint8_t index) { bool _setValue(_EMS_RxTelegram * EMS_RxTelegram, int16_t * param_op, uint8_t index) {
int8_t pos = _getDataPosition(EMS_RxTelegram, index); int8_t pos = _getDataPosition(EMS_RxTelegram, index);
if (pos < 0) { if (pos < 0) {
return; return false;
} }
int16_t value = (EMS_RxTelegram->data[pos] << 8) + EMS_RxTelegram->data[pos + 1]; int16_t value = (EMS_RxTelegram->data[pos] << 8) + EMS_RxTelegram->data[pos + 1];
// check for undefined/unset values, 0x8000 // check for undefined/unset values, 0x8000
if ((value == EMS_VALUE_SHORT_NOTSET) || (EMS_RxTelegram->data[pos] == 0x7D)) { if ((value == EMS_VALUE_SHORT_NOTSET) || (EMS_RxTelegram->data[pos] == 0x7D)) {
return; return false;
} }
*param_op = value; *param_op = value;
return true;
} }
// Byte // Byte
void _setValue(_EMS_RxTelegram * EMS_RxTelegram, uint8_t * param_op, uint8_t index) { bool _setValue(_EMS_RxTelegram * EMS_RxTelegram, uint8_t * param_op, uint8_t index) {
int8_t pos = _getDataPosition(EMS_RxTelegram, index); int8_t pos = _getDataPosition(EMS_RxTelegram, index);
if (pos < 0) { if (pos < 0) {
return; return false;
} }
*param_op = (uint8_t)EMS_RxTelegram->data[pos]; *param_op = (uint8_t)EMS_RxTelegram->data[pos];
return true;
} }
// convert signed short to single 8 byte, for setpoint thermostat temperatures that don't store their temps in 2 bytes // convert signed short to single 8 byte, for setpoint thermostat temperatures that don't store their temps in 2 bytes
void _setValue8(_EMS_RxTelegram * EMS_RxTelegram, int16_t * param_op, uint8_t index) { bool _setValue8(_EMS_RxTelegram * EMS_RxTelegram, int16_t * param_op, uint8_t index) {
int8_t pos = _getDataPosition(EMS_RxTelegram, index); int8_t pos = _getDataPosition(EMS_RxTelegram, index);
if (pos < 0) { if (pos < 0) {
return; return false;
} }
*param_op = EMS_RxTelegram->data[pos]; *param_op = EMS_RxTelegram->data[pos];
return true;
} }
// Long // Long
void _setValue(_EMS_RxTelegram * EMS_RxTelegram, uint32_t * param_op, uint8_t index) { bool _setValue(_EMS_RxTelegram * EMS_RxTelegram, uint32_t * param_op, uint8_t index) {
int8_t pos = _getDataPosition(EMS_RxTelegram, index); int8_t pos = _getDataPosition(EMS_RxTelegram, index);
if (pos < 0) { if (pos < 0) {
return; return false;
} }
*param_op = (uint32_t)((EMS_RxTelegram->data[pos] << 16) + (EMS_RxTelegram->data[pos + 1] << 8) + (EMS_RxTelegram->data[pos + 2])); *param_op = (uint32_t)((EMS_RxTelegram->data[pos] << 16) + (EMS_RxTelegram->data[pos + 1] << 8) + (EMS_RxTelegram->data[pos + 2]));
return true;
} }
// bit from a byte // bit from a byte
void _setValue(_EMS_RxTelegram * EMS_RxTelegram, uint8_t * param_op, uint8_t index, uint8_t bit) { bool _setValue(_EMS_RxTelegram * EMS_RxTelegram, uint8_t * param_op, uint8_t index, uint8_t bit) {
int8_t pos = _getDataPosition(EMS_RxTelegram, index); int8_t pos = _getDataPosition(EMS_RxTelegram, index);
if (pos < 0) { if (pos < 0) {
return; return false;
} }
*param_op = (uint8_t)(((EMS_RxTelegram->data[pos]) >> (bit)) & 0x01); *param_op = (uint8_t)(((EMS_RxTelegram->data[pos]) >> (bit)) & 0x01);
return true;
} }
void ems_setTxMode(uint8_t mode) { void ems_setTxMode(uint8_t mode) {
@@ -1080,9 +1086,9 @@ void _process_UBAMonitorFast(_EMS_RxTelegram * EMS_RxTelegram) {
_setValue(EMS_RxTelegram, &EMS_Boiler.wWHeat, 7, 6); _setValue(EMS_RxTelegram, &EMS_Boiler.wWHeat, 7, 6);
_setValue(EMS_RxTelegram, &EMS_Boiler.wWCirc, 7, 7); _setValue(EMS_RxTelegram, &EMS_Boiler.wWCirc, 7, 7);
// there may also be an BoilTemp here but can't remember what it is, so commenting out for now // there may also be a BoilTemp in this telgram for Bosch - see https://github.com/proddy/EMS-ESP/issues/206
// we use the one from UBAMonitorSlow // as well as the one from UBAMonitorSlow
// _setValue(EMS_RxTelegram, &EMS_Boiler.boilTemp, 11); // 0x8000 if not available _setValue(EMS_RxTelegram, &EMS_Boiler.boilTemp, 11); // 0x8000 if not available
_setValue(EMS_RxTelegram, &EMS_Boiler.retTemp, 13); _setValue(EMS_RxTelegram, &EMS_Boiler.retTemp, 13);
_setValue(EMS_RxTelegram, &EMS_Boiler.flameCurr, 15); _setValue(EMS_RxTelegram, &EMS_Boiler.flameCurr, 15);
@@ -1302,8 +1308,10 @@ void _process_MMPLUSStatusMessageWW(_EMS_RxTelegram * EMS_RxTelegram) {
} }
// Mixer - 0xAB // Mixer - 0xAB
// https://github.com/proddy/EMS-ESP/issues/270
// We assume MM10 is on HC2 and WM10 is using HC1
void _process_MMStatusMessage(_EMS_RxTelegram * EMS_RxTelegram) { void _process_MMStatusMessage(_EMS_RxTelegram * EMS_RxTelegram) {
uint8_t hc = 0; // fixed, for 0xAB only uint8_t hc = 1; // fixed to HC2
EMS_Mixing.hc[hc].active = true; EMS_Mixing.hc[hc].active = true;
_setValue(EMS_RxTelegram, &EMS_Mixing.hc[hc].flowTemp, EMS_OFFSET_MMStatusMessage_flow_temp); _setValue(EMS_RxTelegram, &EMS_Mixing.hc[hc].flowTemp, EMS_OFFSET_MMStatusMessage_flow_temp);