mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 08:19:52 +03:00
test code for duplicate issue
This commit is contained in:
22
src/ems.cpp
22
src/ems.cpp
@@ -136,9 +136,9 @@ uint8_t _Other_Types_max = ArraySize(Other_Types); // number of other
|
||||
uint8_t _Thermostat_Types_max = ArraySize(Thermostat_Types); // number of defined thermostat types
|
||||
|
||||
// these structs contain the data we store from the Boiler and Thermostat
|
||||
_EMS_Boiler EMS_Boiler; // for boiler
|
||||
_EMS_Boiler EMS_Boiler; // for boiler
|
||||
_EMS_Thermostat EMS_Thermostat; // for thermostat
|
||||
_EMS_Other EMS_Other; // for other known EMS devices
|
||||
_EMS_Other EMS_Other; // for other known EMS devices
|
||||
|
||||
// CRC lookup table with poly 12 for faster checking
|
||||
const uint8_t ems_crc_table[] = {0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E, 0x20, 0x22,
|
||||
@@ -577,13 +577,25 @@ void _createValidate() {
|
||||
EMS_TxQueue.unshift(new_EMS_TxTelegram); // add back to queue making it first to be picked up next (FIFO)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Entry point TODO: tidy up
|
||||
*/
|
||||
void ems_parseTelegram(uint8_t * telegram, uint8_t length) {
|
||||
_ems_readTelegram(telegram, length);
|
||||
// now clear it just be safe
|
||||
for (uint8_t i = 0; i < EMS_MAXBUFFERSIZE; i++) {
|
||||
telegram[i] = 0x00;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* the main logic that parses the telegram message, triggered by an interrupt in emsuart.cpp
|
||||
* length is only data bytes, excluding the BRK
|
||||
* Read commands are asynchronous as they're handled by the interrupt
|
||||
* When we receive a Poll Request we need to send any Tx packages quickly within a 200ms window
|
||||
*/
|
||||
void ems_parseTelegram(uint8_t * telegram, uint8_t length) {
|
||||
void _ems_readTelegram(uint8_t * telegram, uint8_t length) {
|
||||
// check if we just received a single byte
|
||||
// it could well be a Poll request from the boiler for us, which will have a value of 0x8B (0x0B | 0x80)
|
||||
// or either a return code like 0x01 or 0x04 from the last Write command
|
||||
@@ -991,7 +1003,7 @@ void _process_UBAMonitorFast(uint8_t src, uint8_t * data, uint8_t length) {
|
||||
// read the service code / installation status as appears on the display
|
||||
EMS_Boiler.serviceCodeChar[0] = char(_toByte(18)); // ascii character 1
|
||||
EMS_Boiler.serviceCodeChar[1] = char(_toByte(19)); // ascii character 2
|
||||
EMS_Boiler.serviceCodeChar[2] = '\0'; // null terminate string
|
||||
EMS_Boiler.serviceCodeChar[2] = '\0'; // null terminate string
|
||||
|
||||
// read error code
|
||||
EMS_Boiler.serviceCode = _toShort(20);
|
||||
@@ -1036,7 +1048,7 @@ void _process_RC10StatusMessage(uint8_t src, uint8_t * data, uint8_t length) {
|
||||
*/
|
||||
void _process_RC20StatusMessage(uint8_t src, uint8_t * data, uint8_t length) {
|
||||
EMS_Thermostat.setpoint_roomTemp = _toByte(EMS_TYPE_RC20StatusMessage_setpoint); // is * 2
|
||||
EMS_Thermostat.curr_roomTemp = _toShort(EMS_TYPE_RC20StatusMessage_curr); // is * 10
|
||||
EMS_Thermostat.curr_roomTemp = _toShort(EMS_TYPE_RC20StatusMessage_curr); // is * 10
|
||||
|
||||
EMS_Sys_Status.emsRefreshed = true; // triggers a send the values back via MQTT
|
||||
}
|
||||
|
||||
45
src/ems.h
45
src/ems.h
@@ -174,8 +174,8 @@ typedef struct { // UBAParameterWW
|
||||
|
||||
// UBAMonitorFast
|
||||
uint8_t selFlowTemp; // Selected flow temperature
|
||||
int16_t curFlowTemp; // Current flow temperature
|
||||
int16_t retTemp; // Return temperature
|
||||
int16_t curFlowTemp; // Current flow temperature
|
||||
int16_t retTemp; // Return temperature
|
||||
uint8_t burnGas; // Gas on/off
|
||||
uint8_t fanWork; // Fan on/off
|
||||
uint8_t ignWork; // Ignition on/off
|
||||
@@ -190,15 +190,15 @@ typedef struct { // UBAParameterWW
|
||||
uint16_t serviceCode; // error/service code
|
||||
|
||||
// UBAMonitorSlow
|
||||
int16_t extTemp; // Outside temperature
|
||||
int16_t boilTemp; // Boiler temperature
|
||||
int16_t extTemp; // Outside temperature
|
||||
int16_t boilTemp; // Boiler temperature
|
||||
uint8_t pumpMod; // Pump modulation
|
||||
uint32_t burnStarts; // # burner starts
|
||||
uint32_t burnWorkMin; // Total burner operating time
|
||||
uint32_t heatWorkMin; // Total heat operating time
|
||||
|
||||
// UBAMonitorWWMessage
|
||||
int16_t wWCurTmp; // Warm Water current temperature:
|
||||
int16_t wWCurTmp; // Warm Water current temperature:
|
||||
uint32_t wWStarts; // Warm Water # starts
|
||||
uint32_t wWWorkM; // Warm Water # minutes
|
||||
uint8_t wWOneTime; // Warm Water one time function on/off
|
||||
@@ -227,31 +227,31 @@ typedef struct { // UBAParameterWW
|
||||
*/
|
||||
typedef struct {
|
||||
// SM10 Solar Module - SM10Monitor
|
||||
bool SM10; // set true if there is a SM10 available
|
||||
bool SM10; // set true if there is a SM10 available
|
||||
int16_t SM10collectorTemp; // collector temp from SM10
|
||||
int16_t SM10bottomTemp; // bottom temp from SM10
|
||||
uint8_t SM10pumpModulation; // modulation solar pump
|
||||
uint8_t SM10pump; // pump active
|
||||
uint8_t SM10pumpModulation; // modulation solar pump
|
||||
uint8_t SM10pump; // pump active
|
||||
} _EMS_Other;
|
||||
|
||||
// Thermostat data
|
||||
typedef struct {
|
||||
uint8_t type_id; // the type ID of the thermostat
|
||||
uint8_t model_id; // which Thermostat type
|
||||
uint8_t product_id;
|
||||
bool read_supported;
|
||||
bool write_supported;
|
||||
char version[10];
|
||||
uint8_t type_id; // the type ID of the thermostat
|
||||
uint8_t model_id; // which Thermostat type
|
||||
uint8_t product_id;
|
||||
bool read_supported;
|
||||
bool write_supported;
|
||||
char version[10];
|
||||
int16_t setpoint_roomTemp; // current set temp
|
||||
int16_t curr_roomTemp; // current room temp
|
||||
uint8_t mode; // 0=low, 1=manual, 2=auto
|
||||
bool day_mode; // 0=night, 1=day
|
||||
uint8_t hour;
|
||||
uint8_t minute;
|
||||
uint8_t second;
|
||||
uint8_t day;
|
||||
uint8_t month;
|
||||
uint8_t year;
|
||||
uint8_t mode; // 0=low, 1=manual, 2=auto
|
||||
bool day_mode; // 0=night, 1=day
|
||||
uint8_t hour;
|
||||
uint8_t minute;
|
||||
uint8_t second;
|
||||
uint8_t day;
|
||||
uint8_t month;
|
||||
uint8_t year;
|
||||
} _EMS_Thermostat;
|
||||
|
||||
// call back function signature for processing telegram types
|
||||
@@ -315,6 +315,7 @@ int _ems_findBoilerModel(uint8_t model_id);
|
||||
bool _ems_setModel(uint8_t model_id);
|
||||
void _ems_setThermostatModel(uint8_t thermostat_modelid);
|
||||
void _removeTxQueue();
|
||||
void _ems_readTelegram(uint8_t * telegram, uint8_t length);
|
||||
|
||||
// global so can referenced in other classes
|
||||
extern _EMS_Sys_Status EMS_Sys_Status;
|
||||
|
||||
Reference in New Issue
Block a user