ServiceCode as 2-byte char

This commit is contained in:
proddy
2019-01-04 15:30:45 +01:00
parent 1f530a0430
commit 2d2ee1927d
5 changed files with 34 additions and 36 deletions

View File

@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Scanning known EMS Devices now ignores duplicates (https://github.com/proddy/EMS-ESP-Boiler/pull/30)
- ServiceCode stored as a two byte char
## [1.2.3] 2019-01-03

View File

@@ -481,7 +481,7 @@ void MyESP::_telnetHandle() {
while (SerialAndTelnet.available()) {
char character = SerialAndTelnet.read(); // Get character
// check for ctrl-D
// check for ctrl-D (EOF) or EOT
if ((character == 0xEC) || (character == 0x04)) {
SerialAndTelnet.disconnectClient();
}

View File

@@ -341,7 +341,7 @@ void showInfo() {
_renderIntValue("Burner current power", "%", EMS_Boiler.curBurnPow);
_renderFloatValue("Flame current", "uA", EMS_Boiler.flameCurr);
_renderFloatValue("System pressure", "bar", EMS_Boiler.sysPress);
myDebug(" Current System Service Code: %c%c", EMS_Boiler.serviceCodeChar1, EMS_Boiler.serviceCodeChar2);
myDebug(" Current System Service Code: %s", EMS_Boiler.serviceCodeChar);
// UBAMonitorSlow
_renderFloatValue("Outside temperature", "C", EMS_Boiler.extTemp);
@@ -438,8 +438,7 @@ void publishValues(bool force) {
rootBoiler["sysPress"] = _float_to_char(s, EMS_Boiler.sysPress);
rootBoiler["boilTemp"] = _float_to_char(s, EMS_Boiler.boilTemp);
rootBoiler["pumpMod"] = _int_to_char(s, EMS_Boiler.pumpMod);
snprintf(s, sizeof(s), "%c%c", EMS_Boiler.serviceCodeChar1, EMS_Boiler.serviceCodeChar2);
rootBoiler["ServiceCode"] = s;
rootBoiler["ServiceCode"] = EMS_Boiler.serviceCodeChar;
rlen = rootBoiler.measureLength();
rootBoiler.printTo(data, rlen + 1); // form the json string

View File

@@ -211,8 +211,7 @@ void ems_init(_EMS_MODEL_ID boiler_modelid, _EMS_MODEL_ID thermostat_modelid) {
EMS_Boiler.curBurnPow = EMS_VALUE_INT_NOTSET; // Burner current power
EMS_Boiler.flameCurr = EMS_VALUE_FLOAT_NOTSET; // Flame current in micro amps
EMS_Boiler.sysPress = EMS_VALUE_FLOAT_NOTSET; // System pressure
EMS_Boiler.serviceCodeChar1 = EMS_VALUE_INT_NOTSET; // service codes
EMS_Boiler.serviceCodeChar2 = EMS_VALUE_INT_NOTSET; // service codes
strlcpy(EMS_Boiler.serviceCodeChar, "??", sizeof(EMS_Boiler.serviceCodeChar));
// UBAMonitorSlow
EMS_Boiler.extTemp = EMS_VALUE_FLOAT_NOTSET; // Outside temperature
@@ -934,8 +933,8 @@ void _process_UBAMonitorFast(uint8_t * data, uint8_t length) {
EMS_Boiler.flameCurr = _toFloat(15, data);
// read the service code / installation status as appears on the display
EMS_Boiler.serviceCodeChar1 = data[18]; // ascii character 1
EMS_Boiler.serviceCodeChar2 = data[19]; // ascii character 2
EMS_Boiler.serviceCodeChar[0] = char(data[18]); // ascii character 1
EMS_Boiler.serviceCodeChar[1] = char(data[19]); // ascii character 2
if (data[17] == 0xFF) { // missing value for system pressure
EMS_Boiler.sysPress = 0;

View File

@@ -234,8 +234,7 @@ typedef struct { // UBAParameterWW
uint8_t curBurnPow; // Burner current power
float flameCurr; // Flame current in micro amps
float sysPress; // System pressure
uint8_t serviceCodeChar1; // First Character in status/service code
uint8_t serviceCodeChar2; // Second Character in status/service code
char serviceCodeChar[2]; // 2 character status/service code
// UBAMonitorSlow
float extTemp; // Outside temperature