changed some values from ushort to short and notset-value to -32000

This commit is contained in:
MichaelDvP
2020-01-01 13:23:57 +01:00
parent 7a1b1603cd
commit 3005e0553d
4 changed files with 22 additions and 7 deletions

View File

@@ -441,6 +441,8 @@ void showInfo() {
_renderIntValue(" Night temperature", "C", EMS_Thermostat.hc[hc_num - 1].nighttemp, 2); // convert to a single byte * 2
_renderIntValue(" Vacation temperature", "C", EMS_Thermostat.hc[hc_num - 1].holidaytemp, 2); // convert to a single byte * 2
}
if (EMS_Thermostat.hc[hc_num - 1].circuitcalctemp != EMS_VALUE_USHORT_NOTSET)
_renderIntValue(" calculatet flow temperature", "C",EMS_Thermostat.hc[hc_num - 1].circuitcalctemp);
// Render Thermostat Mode
_EMS_THERMOSTAT_MODE thermoMode;
@@ -472,15 +474,19 @@ void showInfo() {
if (ems_getMixingDeviceEnabled()) {
myDebug_P(PSTR("")); // newline
myDebug_P(PSTR("%sMixing module stats:%s"), COLOR_BOLD_ON, COLOR_BOLD_OFF);
_renderUShortValue("Switch temperature", "C", EMS_Boiler.switchTemp);
myDebug_P(PSTR(" Mixing: %s"), ems_getDeviceDescription(EMS_DEVICE_TYPE_MIXING, buffer_type,false));
if (EMS_Boiler.switchTemp != EMS_VALUE_SHORT_NOTSET)
_renderShortValue("Switch temperature", "C", EMS_Boiler.switchTemp);
for (uint8_t hc_num = 1; hc_num <= EMS_THERMOSTAT_MAXHC; hc_num++) {
if (EMS_Mixing.hc[hc_num - 1].active) {
myDebug_P(PSTR(" Mixing Circuit %d"), hc_num);
_renderUShortValue(" Current flow temperature", "C", EMS_Mixing.hc[hc_num - 1].flowTemp);
if (EMS_Mixing.hc[hc_num - 1].flowTemp != EMS_VALUE_SHORT_NOTSET)
_renderShortValue(" Current flow temperature", "C", EMS_Mixing.hc[hc_num - 1].flowTemp);
if (EMS_Mixing.hc[hc_num - 1].flowSetTemp != EMS_VALUE_INT_NOTSET)
_renderIntValue(" Setpoint flow temperature", "C", EMS_Mixing.hc[hc_num - 1].flowSetTemp);
_renderIntValue(" Current pump modulation", "%", EMS_Mixing.hc[hc_num - 1].pumpMod);
if (EMS_Mixing.hc[hc_num - 1].pumpMod != EMS_VALUE_INT_NOTSET)
_renderIntValue(" Current pump modulation", "%", EMS_Mixing.hc[hc_num - 1].pumpMod);
if (EMS_Mixing.hc[hc_num - 1].valveStatus != EMS_VALUE_INT_NOTSET)
_renderIntValue(" Current valve status", "", EMS_Mixing.hc[hc_num - 1].valveStatus);
}

View File

@@ -161,6 +161,7 @@ void ems_init() {
EMS_Boiler.burnStarts = EMS_VALUE_LONG_NOTSET; // # burner restarts
EMS_Boiler.burnWorkMin = EMS_VALUE_LONG_NOTSET; // Total burner operating time
EMS_Boiler.heatWorkMin = EMS_VALUE_LONG_NOTSET; // Total heat operating time
EMS_Boiler.switchTemp = EMS_VALUE_SHORT_NOTSET;
// UBAMonitorWWMessage
EMS_Boiler.wWCurTmp = EMS_VALUE_USHORT_NOTSET; // Warm Water current temperature
@@ -1243,6 +1244,7 @@ void _process_MMStatusMessage(_EMS_RxTelegram * EMS_RxTelegram) {
if (hc != 0) {
return; // invalid type
}
//hc++;
EMS_Mixing.hc[hc].active = true;
_setValue(EMS_RxTelegram, &EMS_Mixing.hc[hc].flowTemp, EMS_OFFSET_MMStatusMessage_flow_temp);
@@ -1767,6 +1769,7 @@ void _process_Version(_EMS_RxTelegram * EMS_RxTelegram) {
EMS_Mixing.device_desc_p = device_desc_p;
EMS_Mixing.device_flags = flags;
EMS_Mixing.detected = true;
strlcpy(EMS_Mixing.version, version, sizeof(EMS_Mixing.version));
ems_doReadCommand(EMS_TYPE_MMPLUSStatusMessage_HC1, device_id); // fetch MM values
}
}
@@ -1979,6 +1982,12 @@ char * ems_getDeviceDescription(_EMS_DEVICE_TYPE device_type, char * buffer, boo
product_id = EMS_HeatPump.product_id;
device_desc_p = EMS_HeatPump.device_desc_p;
version = EMS_HeatPump.version;
} else if (device_type == EMS_DEVICE_TYPE_MIXING) {
enabled = ems_getMixingDeviceEnabled();
device_id = EMS_Mixing.device_id;
product_id = EMS_Mixing.product_id;
device_desc_p = EMS_Mixing.device_desc_p;
version = EMS_Mixing.version;
}
if (!enabled) {

View File

@@ -27,7 +27,7 @@
#define EMS_VALUE_BOOL_ON2 0xFF // boolean true, EMS sometimes uses 0xFF for TRUE
#define EMS_VALUE_BOOL_OFF 0x00 // boolean false
#define EMS_VALUE_INT_NOTSET 0xFF // for 8-bit unsigned ints/bytes
#define EMS_VALUE_SHORT_NOTSET -32768 // for 2-byte signed shorts
#define EMS_VALUE_SHORT_NOTSET -32000 //-32768 // for 2-byte signed shorts
#define EMS_VALUE_USHORT_NOTSET 0x8000 // for 2-byte unsigned shorts
#define EMS_VALUE_LONG_NOTSET 0xFFFFFF // for 3-byte longs
#define EMS_VALUE_BOOL_NOTSET 0xFE // random number that's not 0, 1 or FF
@@ -282,7 +282,7 @@ typedef struct {
uint32_t burnStarts; // # burner starts
uint32_t burnWorkMin; // Total burner operating time
uint32_t heatWorkMin; // Total heat operating time
uint16_t switchTemp; // Switch temperature
int16_t switchTemp; // Switch temperature
// UBAMonitorWWMessage
uint16_t wWCurTmp; // Warm Water current temperature
@@ -322,7 +322,7 @@ typedef struct {
typedef struct {
uint8_t hc; // heating circuit 1, 2, 3 or 4
bool active; // true if there is data for this HC
uint16_t flowTemp;
int16_t flowTemp;
uint8_t pumpMod;
uint8_t valveStatus;
uint8_t flowSetTemp;

View File

@@ -40,7 +40,7 @@ char * _bool_to_char(char * s, uint8_t value) {
// negative values are assumed stored as 1-compliment (https://medium.com/@LeeJulija/how-integers-are-stored-in-memory-using-twos-complement-5ba04d61a56c)
char * _short_to_char(char * s, int16_t value, uint8_t decimals) {
// remove errors or invalid values
if (value == EMS_VALUE_SHORT_NOTSET) {
if (value == EMS_VALUE_SHORT_NOTSET || value == EMS_VALUE_USHORT_NOTSET) {
strlcpy(s, "?", 10);
return (s);
}