Skip to content

Commit 25b1957

Browse files
committed
minor cleanup
1 parent f2dbc26 commit 25b1957

10 files changed

+29
-137
lines changed

interface/.env.development

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
# Change the IP address to that of your ESP device to enable local development of the UI.
2-
# Remember to also enable CORS in platformio.ini before uploading the code to the device.
2+
# Remember to also enable CORS in platformio.ini before uploading the code to the device
3+
# with -DENABLE_CORS
34

4-
# ESP32 dev
55
REACT_APP_HTTP_ROOT=http://10.10.10.101
66
REACT_APP_WEB_SOCKET_ROOT=ws://10.10.10.101
7-
8-
# ESP8266 dev
9-
#REACT_APP_HTTP_ROOT=http://10.10.10.140
10-
#REACT_APP_WEB_SOCKET_ROOT=ws://10.10.10.140

interface/src/security/SecuritySettingsForm.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class SecuritySettingsForm extends React.Component<SecuritySettingsFormProps> {
3535
/>
3636
<Box bgcolor="primary.main" color="primary.contrastText" p={2} mt={2} mb={2}>
3737
<Typography variant="body1">
38-
The Super User password is used to sign authentication tokens and also the Console's `su` password. If you modify this all users will be signed out.
38+
The Super User password is used to sign authentication tokens and is also the Console's `su` password. If you modify this all users will be signed out.
3939
</Typography>
4040
</Box>
4141
<FormActions>

src/command.cpp

+1-26
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,8 @@ uuid::log::Logger Command::logger_{F_(command), uuid::log::Facility::DAEMON};
2626

2727
std::vector<Command::CmdFunction> Command::cmdfunctions_;
2828

29-
/*
30-
static emsesp::array<Command::CmdFunction> cmdfunctions_(90, 255, 16); // reserve space for 90 commands
31-
32-
emsesp::array<Command::CmdFunction> * Command::commands() {
33-
return &cmdfunctions_;
34-
}
35-
*/
36-
3729
// calls a command
38-
// id may be used to represent a heating circuit for example
30+
// id may be used to represent a heating circuit for example, it's optional
3931
// returns false if error or not found
4032
bool Command::call(const uint8_t device_type, const char * cmd, const char * value, const int8_t id) {
4133
auto cf = find_command(device_type, cmd);
@@ -99,14 +91,6 @@ void Command::add(const uint8_t device_type, const __FlashStringHelper * cmd, cm
9991
return;
10092
}
10193

102-
/*
103-
CmdFunction cf;
104-
cf.cmd_ = cmd;
105-
cf.device_type_ = device_type;
106-
cf.cmdfunction_json_ = nullptr; // empty
107-
cf.cmdfunction_ = cb;
108-
cmdfunctions_.push(cf);
109-
*/
11094
cmdfunctions_.emplace_back(device_type, cmd, cb, nullptr);
11195

11296
// see if we need to subscribe
@@ -122,15 +106,6 @@ void Command::add_with_json(const uint8_t device_type, const __FlashStringHelper
122106
return;
123107
}
124108

125-
/*
126-
CmdFunction cf;
127-
cf.cmd_ = cmd;
128-
cf.device_type_ = device_type;
129-
cf.cmdfunction_json_ = cb;
130-
cf.cmdfunction_ = nullptr; // empty
131-
cmdfunctions_.push(cf);
132-
*/
133-
134109
cmdfunctions_.emplace_back(device_type, cmd, nullptr, cb); // add command
135110
}
136111

src/command.h

+1-5
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
#include <vector>
2727
#include <functional>
2828

29-
// #include "containers.h"
30-
3129
#include "console.h"
3230

3331
#include <uuid/log.h>
@@ -59,10 +57,8 @@ class Command {
5957
return cmdfunctions_;
6058
}
6159

62-
// static emsesp::array<Command::CmdFunction> * commands();
63-
6460
static bool call(const uint8_t device_type, const char * cmd, const char * value, const int8_t id, JsonObject & json);
65-
static bool call(const uint8_t device_type, const char * cmd, const char * value, const int8_t id);
61+
static bool call(const uint8_t device_type, const char * cmd, const char * value, const int8_t id = 0);
6662
static void add(const uint8_t device_type, const __FlashStringHelper * cmd, cmdfunction_p cb);
6763
static void add_with_json(const uint8_t device_type, const __FlashStringHelper * cmd, cmdfunction_json_p cb);
6864
static void show_all(uuid::console::Shell & shell);

src/devices/boiler.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,7 @@ bool Boiler::publish_ha_config() {
227227

228228
char topic[Mqtt::MQTT_TOPIC_MAX_SIZE];
229229
snprintf_P(topic, sizeof(topic), PSTR("homeassistant/sensor/%s/boiler/config"), Mqtt::base().c_str());
230-
Mqtt::publish_ha(topic,
231-
doc.as<JsonObject>()); // publish the config payload with retain flag
230+
Mqtt::publish_ha(topic, doc.as<JsonObject>()); // publish the config payload with retain flag
232231

233232
return true;
234233
}

src/devices/thermostat.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -448,9 +448,9 @@ bool Thermostat::thermostat_ha_cmd(const char * message, uint8_t hc_num) {
448448
return false;
449449
}
450450

451-
// check for mode first
451+
// check for mode first, which is a string
452452
if (!set_mode(message, hc_num)) {
453-
// handle as a numerical temperature value
453+
// otherwise handle as a numerical temperature value and set the setpoint temp
454454
float f = strtof((char *)message, 0);
455455
set_temperature(f, HeatingCircuit::Mode::AUTO, hc_num);
456456
}

src/emsdevice.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ std::string EMSdevice::brand_to_string() const {
124124
return std::string{};
125125
}
126126

127-
// returns the name of the MQTT topic to use for a specific device
127+
// returns the name of the MQTT topic to use for a specific device, without the base
128128
std::string EMSdevice::device_type_2_device_name(const uint8_t device_type) {
129129
switch (device_type) {
130130
case DeviceType::SYSTEM:
@@ -308,6 +308,7 @@ bool EMSdevice::get_toggle_fetch(uint16_t telegram_id) {
308308
}
309309

310310
// list device values, only for EMSESP_DEBUG mode
311+
#if defined(EMSESP_DEBUG)
311312
void EMSdevice::show_device_values_debug(uuid::console::Shell & shell) {
312313
size_t total_s = 0;
313314
uint8_t count = 0;
@@ -324,7 +325,7 @@ void EMSdevice::show_device_values_debug(uuid::console::Shell & shell) {
324325
shell.printfln("Total size of %d elements: %d", count, total_s);
325326
shell.println();
326327
}
327-
328+
#endif
328329

329330
// list all the telegram type IDs for this device
330331
void EMSdevice::show_telegram_handlers(uuid::console::Shell & shell) {

src/emsesp.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ void EMSESP::show_devices(uuid::console::Shell & shell) {
824824
#if defined(EMSESP_DEBUG)
825825
emsdevice->show_mqtt_handlers(shell);
826826
shell.println();
827-
emsdevice->show_device_values_debug(shell);
827+
// emsdevice->show_device_values_debug(shell);
828828
#endif
829829

830830
shell.println();

src/telegram.cpp

+16-65
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,15 @@
2222
namespace emsesp {
2323

2424
// CRC lookup table with poly 12 for faster checking
25-
const uint8_t ems_crc_table[] = {0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E, 0x20, 0x22, 0x24, 0x26,
26-
0x28, 0x2A, 0x2C, 0x2E, 0x30, 0x32, 0x34, 0x36, 0x38, 0x3A, 0x3C, 0x3E, 0x40, 0x42, 0x44, 0x46, 0x48, 0x4A, 0x4C, 0x4E,
27-
0x50, 0x52, 0x54, 0x56, 0x58, 0x5A, 0x5C, 0x5E, 0x60, 0x62, 0x64, 0x66, 0x68, 0x6A, 0x6C, 0x6E, 0x70, 0x72, 0x74, 0x76,
28-
0x78, 0x7A, 0x7C, 0x7E, 0x80, 0x82, 0x84, 0x86, 0x88, 0x8A, 0x8C, 0x8E, 0x90, 0x92, 0x94, 0x96, 0x98, 0x9A, 0x9C, 0x9E,
29-
0xA0, 0xA2, 0xA4, 0xA6, 0xA8, 0xAA, 0xAC, 0xAE, 0xB0, 0xB2, 0xB4, 0xB6, 0xB8, 0xBA, 0xBC, 0xBE, 0xC0, 0xC2, 0xC4, 0xC6,
30-
0xC8, 0xCA, 0xCC, 0xCE, 0xD0, 0xD2, 0xD4, 0xD6, 0xD8, 0xDA, 0xDC, 0xDE, 0xE0, 0xE2, 0xE4, 0xE6, 0xE8, 0xEA, 0xEC, 0xEE,
31-
0xF0, 0xF2, 0xF4, 0xF6, 0xF8, 0xFA, 0xFC, 0xFE, 0x19, 0x1B, 0x1D, 0x1F, 0x11, 0x13, 0x15, 0x17, 0x09, 0x0B, 0x0D, 0x0F,
32-
0x01, 0x03, 0x05, 0x07, 0x39, 0x3B, 0x3D, 0x3F, 0x31, 0x33, 0x35, 0x37, 0x29, 0x2B, 0x2D, 0x2F, 0x21, 0x23, 0x25, 0x27,
33-
0x59, 0x5B, 0x5D, 0x5F, 0x51, 0x53, 0x55, 0x57, 0x49, 0x4B, 0x4D, 0x4F, 0x41, 0x43, 0x45, 0x47, 0x79, 0x7B, 0x7D, 0x7F,
34-
0x71, 0x73, 0x75, 0x77, 0x69, 0x6B, 0x6D, 0x6F, 0x61, 0x63, 0x65, 0x67, 0x99, 0x9B, 0x9D, 0x9F, 0x91, 0x93, 0x95, 0x97,
35-
0x89, 0x8B, 0x8D, 0x8F, 0x81, 0x83, 0x85, 0x87, 0xB9, 0xBB, 0xBD, 0xBF, 0xB1, 0xB3, 0xB5, 0xB7, 0xA9, 0xAB, 0xAD, 0xAF,
36-
0xA1, 0xA3, 0xA5, 0xA7, 0xD9, 0xDB, 0xDD, 0xDF, 0xD1, 0xD3, 0xD5, 0xD7, 0xC9, 0xCB, 0xCD, 0xCF, 0xC1, 0xC3, 0xC5, 0xC7,
37-
0xF9, 0xFB, 0xFD, 0xFF, 0xF1, 0xF3, 0xF5, 0xF7, 0xE9, 0xEB, 0xED, 0xEF, 0xE1, 0xE3, 0xE5, 0xE7};
25+
const uint8_t ems_crc_table[] = {0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E, 0x20, 0x22, 0x24, 0x26, 0x28, 0x2A, 0x2C, 0x2E, 0x30, 0x32, 0x34, 0x36, 0x38,
26+
0x3A, 0x3C, 0x3E, 0x40, 0x42, 0x44, 0x46, 0x48, 0x4A, 0x4C, 0x4E, 0x50, 0x52, 0x54, 0x56, 0x58, 0x5A, 0x5C, 0x5E, 0x60, 0x62, 0x64, 0x66, 0x68, 0x6A, 0x6C, 0x6E, 0x70, 0x72,
27+
0x74, 0x76, 0x78, 0x7A, 0x7C, 0x7E, 0x80, 0x82, 0x84, 0x86, 0x88, 0x8A, 0x8C, 0x8E, 0x90, 0x92, 0x94, 0x96, 0x98, 0x9A, 0x9C, 0x9E, 0xA0, 0xA2, 0xA4, 0xA6, 0xA8, 0xAA, 0xAC,
28+
0xAE, 0xB0, 0xB2, 0xB4, 0xB6, 0xB8, 0xBA, 0xBC, 0xBE, 0xC0, 0xC2, 0xC4, 0xC6, 0xC8, 0xCA, 0xCC, 0xCE, 0xD0, 0xD2, 0xD4, 0xD6, 0xD8, 0xDA, 0xDC, 0xDE, 0xE0, 0xE2, 0xE4, 0xE6,
29+
0xE8, 0xEA, 0xEC, 0xEE, 0xF0, 0xF2, 0xF4, 0xF6, 0xF8, 0xFA, 0xFC, 0xFE, 0x19, 0x1B, 0x1D, 0x1F, 0x11, 0x13, 0x15, 0x17, 0x09, 0x0B, 0x0D, 0x0F, 0x01, 0x03, 0x05, 0x07, 0x39,
30+
0x3B, 0x3D, 0x3F, 0x31, 0x33, 0x35, 0x37, 0x29, 0x2B, 0x2D, 0x2F, 0x21, 0x23, 0x25, 0x27, 0x59, 0x5B, 0x5D, 0x5F, 0x51, 0x53, 0x55, 0x57, 0x49, 0x4B, 0x4D, 0x4F, 0x41, 0x43,
31+
0x45, 0x47, 0x79, 0x7B, 0x7D, 0x7F, 0x71, 0x73, 0x75, 0x77, 0x69, 0x6B, 0x6D, 0x6F, 0x61, 0x63, 0x65, 0x67, 0x99, 0x9B, 0x9D, 0x9F, 0x91, 0x93, 0x95, 0x97, 0x89, 0x8B, 0x8D,
32+
0x8F, 0x81, 0x83, 0x85, 0x87, 0xB9, 0xBB, 0xBD, 0xBF, 0xB1, 0xB3, 0xB5, 0xB7, 0xA9, 0xAB, 0xAD, 0xAF, 0xA1, 0xA3, 0xA5, 0xA7, 0xD9, 0xDB, 0xDD, 0xDF, 0xD1, 0xD3, 0xD5, 0xD7,
33+
0xC9, 0xCB, 0xCD, 0xCF, 0xC1, 0xC3, 0xC5, 0xC7, 0xF9, 0xFB, 0xFD, 0xFF, 0xF1, 0xF3, 0xF5, 0xF7, 0xE9, 0xEB, 0xED, 0xEF, 0xE1, 0xE3, 0xE5, 0xE7};
3834

3935
uint32_t EMSbus::last_bus_activity_ = 0; // timestamp of last time a valid Rx came in
4036
bool EMSbus::bus_connected_ = false; // start assuming the bus hasn't been connected
@@ -59,13 +55,7 @@ uint8_t EMSbus::calculate_crc(const uint8_t * data, const uint8_t length) {
5955

6056
// creates a telegram object
6157
// stores header in separate member objects and the rest in the message_data block
62-
Telegram::Telegram(const uint8_t operation,
63-
const uint8_t src,
64-
const uint8_t dest,
65-
const uint16_t type_id,
66-
const uint8_t offset,
67-
const uint8_t * data,
68-
const uint8_t message_length)
58+
Telegram::Telegram(const uint8_t operation, const uint8_t src, const uint8_t dest, const uint16_t type_id, const uint8_t offset, const uint8_t * data, const uint8_t message_length)
6959
: operation(operation)
7060
, src(src)
7161
, dest(dest)
@@ -202,8 +192,7 @@ void RxService::add(uint8_t * data, uint8_t length) {
202192
// if we're watching and "raw" print out actual telegram as bytes to the console
203193
if (EMSESP::watch() == EMSESP::Watch::WATCH_RAW) {
204194
uint16_t trace_watch_id = EMSESP::watch_id();
205-
if ((trace_watch_id == WATCH_ID_NONE) || (type_id == trace_watch_id)
206-
|| ((trace_watch_id < 0x80) && ((src == trace_watch_id) || (dest == trace_watch_id)))) {
195+
if ((trace_watch_id == WATCH_ID_NONE) || (type_id == trace_watch_id) || ((trace_watch_id < 0x80) && ((src == trace_watch_id) || (dest == trace_watch_id)))) {
207196
LOG_NOTICE(F("Rx: %s"), Helpers::data_to_hex(data, length).c_str());
208197
} else if (EMSESP::trace_raw()) {
209198
LOG_TRACE(F("Rx: %s"), Helpers::data_to_hex(data, length).c_str());
@@ -234,13 +223,6 @@ void RxService::add(uint8_t * data, uint8_t length) {
234223
}
235224

236225
rx_telegrams_.emplace_back(rx_telegram_id_++, std::move(telegram)); // add to queue
237-
238-
/*
239-
QueuedRxTelegram qrxt;
240-
qrxt.telegram_ = std::make_shared<Telegram>(operation, src, dest, type_id, offset, message_data, message_length);
241-
qrxt.id_ = rx_telegram_id_++;
242-
rx_telegrams_.push(qrxt);
243-
*/
244226
}
245227

246228
// start and initialize Tx
@@ -285,15 +267,11 @@ void TxService::send() {
285267
}
286268
delayed_send_ = 0;
287269

288-
// auto telegram = tx_telegrams_.pop(); // get the Telegram, also removes from queue
289-
290270
// if we're in read-only mode (tx_mode 0) forget the Tx call
291271
if (tx_mode() != 0) {
292-
// send_telegram(telegram);
293272
send_telegram(tx_telegrams_.front());
294273
}
295274

296-
// auto telegram = tx_telegrams_.pop();
297275
tx_telegrams_.pop_front(); // remove the telegram from the queue
298276
}
299277

@@ -371,10 +349,7 @@ void TxService::send_telegram(const QueuedTxTelegram & tx_telegram) {
371349

372350
length++; // add one since we want to now include the CRC
373351

374-
LOG_DEBUG(F("Sending %s Tx [#%d], telegram: %s"),
375-
(telegram->operation == Telegram::Operation::TX_WRITE) ? F("write") : F("read"),
376-
tx_telegram.id_,
377-
Helpers::data_to_hex(telegram_raw, length).c_str());
352+
LOG_DEBUG(F("Sending %s Tx [#%d], telegram: %s"), (telegram->operation == Telegram::Operation::TX_WRITE) ? F("write") : F("read"), tx_telegram.id_, Helpers::data_to_hex(telegram_raw, length).c_str());
378353

379354
set_post_send_query(tx_telegram.validateid_);
380355
// send the telegram to the UART Tx
@@ -414,14 +389,7 @@ void TxService::send_telegram(const uint8_t * data, const uint8_t length) {
414389
}
415390
*/
416391

417-
void TxService::add(const uint8_t operation,
418-
const uint8_t dest,
419-
const uint16_t type_id,
420-
const uint8_t offset,
421-
uint8_t * message_data,
422-
const uint8_t message_length,
423-
const uint16_t validateid,
424-
const bool front) {
392+
void TxService::add(const uint8_t operation, const uint8_t dest, const uint16_t type_id, const uint8_t offset, uint8_t * message_data, const uint8_t message_length, const uint16_t validateid, const bool front) {
425393
auto telegram = std::make_shared<Telegram>(operation, ems_bus_id(), dest, type_id, offset, message_data, message_length);
426394

427395
#ifdef EMSESP_DEBUG
@@ -490,7 +458,7 @@ void TxService::add(uint8_t operation, const uint8_t * data, const uint8_t lengt
490458
if (dest & 0x80) {
491459
operation = Telegram::Operation::TX_READ;
492460
} else {
493-
operation = Telegram::Operation::TX_WRITE;
461+
operation = Telegram::Operation::TX_WRITE;
494462
validate_id = type_id;
495463
}
496464
EMSESP::set_read_id(type_id);
@@ -507,13 +475,6 @@ void TxService::add(uint8_t operation, const uint8_t * data, const uint8_t lengt
507475
LOG_DEBUG(F("[DEBUG] New Tx [#%d] telegram, length %d"), tx_telegram_id_, message_length);
508476
#endif
509477

510-
/*
511-
QueuedTxTelegram qtxt;
512-
qtxt.id_ = tx_telegram_id_++;
513-
qtxt.retry_ = false;
514-
qtxt.telegram_ = std::make_shared<Telegram>(operation, ems_bus_id(), dest, type_id, offset, message_data, message_length);
515-
*/
516-
517478
if (front) {
518479
// tx_telegrams_.push_front(qtxt); // add to front of queue
519480
tx_telegrams_.emplace_front(tx_telegram_id_++, std::move(telegram), false, validate_id); // add to front of queue
@@ -580,9 +541,7 @@ void TxService::retry_tx(const uint8_t operation, const uint8_t * data, const ui
580541
reset_retry_count(); // give up
581542
increment_telegram_fail_count(); // another Tx fail
582543

583-
LOG_ERROR(F("Last Tx %s operation failed after %d retries. Ignoring request."),
584-
(operation == Telegram::Operation::TX_WRITE) ? F("Write") : F("Read"),
585-
MAXIMUM_TX_RETRIES);
544+
LOG_ERROR(F("Last Tx %s operation failed after %d retries. Ignoring request."), (operation == Telegram::Operation::TX_WRITE) ? F("Write") : F("Read"), MAXIMUM_TX_RETRIES);
586545
return;
587546
}
588547

@@ -600,14 +559,6 @@ void TxService::retry_tx(const uint8_t operation, const uint8_t * data, const ui
600559
}
601560

602561
tx_telegrams_.emplace_front(tx_telegram_id_++, std::move(telegram_last_), true, get_post_send_query());
603-
604-
/*
605-
QueuedTxTelegram qtxt;
606-
qtxt.id_ = tx_telegram_id_++;
607-
qtxt.retry_ = true; // this time it is a retry
608-
qtxt.telegram_ = telegram_last_;
609-
tx_telegrams_.push_front(qtxt); // add to front of queue
610-
*/
611562
}
612563

613564
uint16_t TxService::read_next_tx() {
@@ -635,7 +586,7 @@ uint16_t TxService::post_send_query() {
635586
uint8_t dest = (this->telegram_last_->dest & 0x7F);
636587
// when set a value with large offset before and validate on same type, we have to add offset 0, 26, 52, ...
637588
uint8_t offset = (this->telegram_last_->type_id == post_typeid) ? ((this->telegram_last_->offset / 26) * 26) : 0;
638-
uint8_t message_data[1] = {EMS_MAX_TELEGRAM_LENGTH}; // request all data, 32 bytes
589+
uint8_t message_data[1] = {EMS_MAX_TELEGRAM_LENGTH}; // request all data, 32 bytes
639590
this->add(Telegram::Operation::TX_READ, dest, post_typeid, offset, message_data, 1, 0, true); // add to top/front of queue
640591
// read_request(telegram_last_post_send_query_, dest, 0); // no offset
641592
LOG_DEBUG(F("Sending post validate read, type ID 0x%02X to dest 0x%02X"), post_typeid, dest);

src/telegram.h

+1-27
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131

3232
#include <uuid/log.h>
3333

34-
// #include "containers.h"
3534
#include "helpers.h"
3635

3736
#define MAX_RX_TELEGRAMS 10 // size of Rx queue
@@ -239,17 +238,6 @@ class RxService : public EMSbus {
239238
return rx_telegrams_;
240239
}
241240

242-
/*
243-
struct QueuedRxTelegram {
244-
uint16_t id_;
245-
std::shared_ptr<const Telegram> telegram_;
246-
};
247-
248-
const emsesp::queue<QueuedRxTelegram> queue() const {
249-
return rx_telegrams_;
250-
}
251-
*/
252-
253241
private:
254242
static constexpr uint8_t EMS_BUS_QUALITY_RX_THRESHOLD = 5; // % threshold before reporting quality issues
255243

@@ -258,7 +246,6 @@ class RxService : public EMSbus {
258246
uint32_t telegram_error_count_ = 0; // # Rx CRC errors
259247
std::shared_ptr<const Telegram> rx_telegram; // the incoming Rx telegram
260248
std::deque<QueuedRxTelegram> rx_telegrams_; // the Rx Queue
261-
// emsesp::queue<QueuedRxTelegram> rx_telegrams_ = emsesp::queue<QueuedRxTelegram>(MAX_RX_TELEGRAMS); // the Rx Queue
262249
};
263250

264251
class TxService : public EMSbus {
@@ -271,7 +258,7 @@ class TxService : public EMSbus {
271258

272259
void start();
273260
void send();
274-
void add(const uint8_t operation, const uint8_t dest, const uint16_t type_id, const uint8_t offset, uint8_t * message_data, const uint8_t message_length, const uint16_t validateid, const bool front = false);
261+
void add(const uint8_t operation, const uint8_t dest, const uint16_t type_id, const uint8_t offset, uint8_t * message_data, const uint8_t message_length, const uint16_t validateid, const bool front = false);
275262
void add(const uint8_t operation, const uint8_t * data, const uint8_t length, const uint16_t validateid, const bool front = false);
276263
void read_request(const uint16_t type_id, const uint8_t dest, const uint8_t offset = 0);
277264
void send_raw(const char * telegram_data);
@@ -359,18 +346,6 @@ class TxService : public EMSbus {
359346
return tx_telegrams_;
360347
}
361348

362-
/*
363-
struct QueuedTxTelegram {
364-
uint16_t id_;
365-
std::shared_ptr<const Telegram> telegram_;
366-
bool retry_; // true if its a retry
367-
};
368-
369-
const emsesp::queue<QueuedTxTelegram> queue() const {
370-
return tx_telegrams_;
371-
}
372-
*/
373-
374349
#if defined(EMSESP_DEBUG)
375350
static constexpr uint8_t MAXIMUM_TX_RETRIES = 0; // when compiled with EMSESP_DEBUG don't retry
376351
#else
@@ -380,7 +355,6 @@ class TxService : public EMSbus {
380355

381356
private:
382357
std::deque<QueuedTxTelegram> tx_telegrams_; // the Tx queue
383-
// emsesp::queue<QueuedTxTelegram> tx_telegrams_ = emsesp::queue<QueuedTxTelegram>(MAX_TX_TELEGRAMS); // the Tx Queue
384358

385359
uint32_t telegram_read_count_ = 0; // # Tx successful reads
386360
uint32_t telegram_write_count_ = 0; // # Tx successful writes

0 commit comments

Comments
 (0)