mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-09 17:29:50 +03:00
RCTemp changes
This commit is contained in:
@@ -619,11 +619,12 @@ void systemCheck() {
|
||||
|
||||
// calls to get data from EMS for the types that aren't sent as broadcasts
|
||||
// number of calls is defined in MAX_MANUAL_CALLS
|
||||
// it's done sequentially with a count since we don't queue sends (there's really no point)
|
||||
void regularUpdates() {
|
||||
uint8_t cycle = (regularUpdatesCount++ % MAX_MANUAL_CALLS);
|
||||
|
||||
if ((cycle == 0) && Boiler_Status.thermostat_enabled) {
|
||||
ems_doReadCommand(EMS_TYPE_RC20Temperature); // to get the thermostat mode which is not broadcasted
|
||||
ems_doReadCommand(EMS_TYPE_RC20Temperature); // to force get the thermostat mode which is not broadcasted
|
||||
} else if (cycle == 1) {
|
||||
ems_doReadCommand(EMS_TYPE_UBAParameterWW); // get Warm Water values
|
||||
}
|
||||
|
||||
40
src/ems.cpp
40
src/ems.cpp
@@ -26,7 +26,7 @@ _EMS_Sys_Status EMS_Sys_Status; // EMS Status
|
||||
_EMS_TxTelegram EMS_TxTelegram; // Empty buffer for sending telegrams
|
||||
|
||||
// and call backs
|
||||
#define MAX_TYPECALLBACK 12 // make sure it matches the #types you have
|
||||
#define MAX_TYPECALLBACK 13 // make sure it matches the #types you have
|
||||
// callbacks per type
|
||||
bool _process_UBAMonitorFast(uint8_t * data, uint8_t length);
|
||||
bool _process_UBAMonitorSlow(uint8_t * data, uint8_t length);
|
||||
@@ -35,6 +35,7 @@ bool _process_UBAParameterWW(uint8_t * data, uint8_t length);
|
||||
bool _process_RC20StatusMessage(uint8_t * data, uint8_t length);
|
||||
bool _process_RC20Time(uint8_t * data, uint8_t length);
|
||||
bool _process_RC20Temperature(uint8_t * data, uint8_t length);
|
||||
bool _process_RCTempMessage(uint8_t * data, uint8_t length);
|
||||
bool _process_Version(uint8_t * data, uint8_t length);
|
||||
|
||||
const _EMS_Types EMS_Types[MAX_TYPECALLBACK] =
|
||||
@@ -50,6 +51,7 @@ const _EMS_Types EMS_Types[MAX_TYPECALLBACK] =
|
||||
{EMS_ID_THERMOSTAT, EMS_TYPE_RC20StatusMessage, "RC20StatusMessage", _process_RC20StatusMessage},
|
||||
{EMS_ID_THERMOSTAT, EMS_TYPE_RC20Time, "RC20Time", _process_RC20Time},
|
||||
{EMS_ID_THERMOSTAT, EMS_TYPE_RC20Temperature, "RC20Temperature", _process_RC20Temperature},
|
||||
{EMS_ID_THERMOSTAT, EMS_TYPE_RCTempMessage, "RCTempMessage", _process_RCTempMessage},
|
||||
{EMS_ID_THERMOSTAT, EMS_TYPE_Version, "Version", _process_Version}};
|
||||
|
||||
// reserve space for the data we collect from the Boiler and Thermostat
|
||||
@@ -203,6 +205,19 @@ uint8_t _crcCalculator(uint8_t * data, uint8_t len) {
|
||||
return crc;
|
||||
}
|
||||
|
||||
// function to turn a telegram int (2 bytes) to a float
|
||||
float _toFloat(uint8_t i, uint8_t * data) {
|
||||
if ((data[i] == 0x80) && (data[i + 1] == 0)) // 0x8000 is used when sensor is missing
|
||||
return (float)-1; // return -1 to indicate that is unknown
|
||||
|
||||
return ((float)(((data[i] << 8) + data[i + 1]))) / 10;
|
||||
}
|
||||
|
||||
// function to turn a telegram long (3 bytes) to a long int
|
||||
uint16_t _toLong(uint8_t i, uint8_t * data) {
|
||||
return (((data[i]) << 16) + ((data[i + 1]) << 8) + (data[i + 2]));
|
||||
}
|
||||
|
||||
// debug print a telegram to telnet console
|
||||
// len is length in bytes including the CRC
|
||||
void _debugPrintTelegram(const char * prefix, uint8_t * data, uint8_t len, const char * color) {
|
||||
@@ -573,6 +588,16 @@ bool _process_RC20Temperature(uint8_t * data, uint8_t length) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* RC20OutdoorTempMessage - type 0xa3 - for external temp settings from the the RC* thermostats
|
||||
*/
|
||||
bool _process_RCTempMessage(uint8_t * data, uint8_t length) {
|
||||
// add support here if you're reading external sensors
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Version - type 0x02 - get the version of the Thermostat firmware
|
||||
* We don't bother storing these values anywhere
|
||||
@@ -759,16 +784,3 @@ void ems_setWarmWaterActivated(bool activated) {
|
||||
EMS_TxTelegram.checkValue = (activated ? 0xFF : 0x00);
|
||||
_buildTxTelegram(EMS_TxTelegram.checkValue);
|
||||
}
|
||||
|
||||
// function to turn a telegram int (2 bytes) to a float
|
||||
float _toFloat(uint8_t i, uint8_t * data) {
|
||||
if ((data[i] == 0x80) && (data[i + 1] == 0)) // 0x8000 is used when sensor is missing
|
||||
return (float)-1; // return -1 to indicate that is unknown
|
||||
|
||||
return ((float)(((data[i] << 8) + data[i + 1]))) / 10;
|
||||
}
|
||||
|
||||
// function to turn a telegram long (3 bytes) to a long int
|
||||
uint16_t _toLong(uint8_t i, uint8_t * data) {
|
||||
return (((data[i]) << 16) + ((data[i + 1]) << 8) + (data[i + 2]));
|
||||
}
|
||||
|
||||
@@ -38,8 +38,8 @@
|
||||
// Thermostat...
|
||||
#define EMS_TYPE_RC20StatusMessage 0x91 // is an automatic thermostat broadcast
|
||||
#define EMS_TYPE_RC20Time 0x06 // is an automatic thermostat broadcast
|
||||
#define EMS_TYPE_RCTempMessage 0xA3 // is an automatic thermostat broadcast
|
||||
#define EMS_TYPE_RC20Temperature 0xA8
|
||||
#define EMS_TYPE_RCOutdoorTempMessage 0xA3
|
||||
#define EMS_TYPE_Version 0x02 // version of the controller
|
||||
|
||||
// Offsets for specific values in a telegram, per type, used for validation
|
||||
@@ -207,10 +207,6 @@ void _initTxBuffer();
|
||||
void _buildTxTelegram(uint8_t data_value);
|
||||
void _debugPrintPackage(const char * prefix, uint8_t * data, uint8_t len, const char * color);
|
||||
|
||||
// helper functions
|
||||
float _toFloat(uint8_t i, uint8_t * data);
|
||||
uint16_t _toLong(uint8_t i, uint8_t * data);
|
||||
|
||||
// global so can referenced in other classes
|
||||
extern _EMS_Sys_Status EMS_Sys_Status;
|
||||
extern _EMS_TxTelegram EMS_TxTelegram;
|
||||
|
||||
Reference in New Issue
Block a user