clang formatting

This commit is contained in:
proddy
2020-06-03 17:27:37 +02:00
parent caba2a9df0
commit 1562c98c3a
9 changed files with 42 additions and 46 deletions

View File

@@ -39,7 +39,6 @@
{208, DeviceType::BOILER, F("Logamax plus/GB192/Condens GC9000"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, {208, DeviceType::BOILER, F("Logamax plus/GB192/Condens GC9000"), DeviceFlags::EMS_DEVICE_FLAG_NONE},
{234, DeviceType::BOILER, F("Logamax Plus GB122"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, {234, DeviceType::BOILER, F("Logamax Plus GB122"), DeviceFlags::EMS_DEVICE_FLAG_NONE},
// Solar Modules - 0x30 // Solar Modules - 0x30
{ 73, DeviceType::SOLAR, F("SM10"), DeviceFlags::EMS_DEVICE_FLAG_SM10}, { 73, DeviceType::SOLAR, F("SM10"), DeviceFlags::EMS_DEVICE_FLAG_SM10},
{101, DeviceType::SOLAR, F("ISM1"), DeviceFlags::EMS_DEVICE_FLAG_SM100}, {101, DeviceType::SOLAR, F("ISM1"), DeviceFlags::EMS_DEVICE_FLAG_SM100},
@@ -58,7 +57,7 @@
{252, DeviceType::HEATPUMP, F("HP Module"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, {252, DeviceType::HEATPUMP, F("HP Module"), DeviceFlags::EMS_DEVICE_FLAG_NONE},
// Switches - 0x11 // Switches - 0x11
{ 71, DeviceType::SWITCH, F("WM10"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x11 { 71, DeviceType::SWITCH, F("WM10"), DeviceFlags::EMS_DEVICE_FLAG_NONE},
// Controllers - 0x09 / 0x10 / 0x50 // Controllers - 0x09 / 0x10 / 0x50
{ 68, DeviceType::CONTROLLER, F("BC10/RFM20"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 { 68, DeviceType::CONTROLLER, F("BC10/RFM20"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09
@@ -75,11 +74,10 @@
{230, DeviceType::CONTROLLER, F("BC Base"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 {230, DeviceType::CONTROLLER, F("BC Base"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09
{241, DeviceType::CONTROLLER, F("Condens 5000i"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 {241, DeviceType::CONTROLLER, F("Condens 5000i"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09
// Connect devices - 0x02 // Connect devices - 0x02
{171, DeviceType::CONNECT, F("OpenTherm Converter"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x02 {171, DeviceType::CONNECT, F("OpenTherm Converter"), DeviceFlags::EMS_DEVICE_FLAG_NONE},
{205, DeviceType::CONNECT, F("Moduline Easy Connect"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x02 {205, DeviceType::CONNECT, F("Moduline Easy Connect"), DeviceFlags::EMS_DEVICE_FLAG_NONE},
{206, DeviceType::CONNECT, F("Easy Connect"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x02 {206, DeviceType::CONNECT, F("Easy Connect"), DeviceFlags::EMS_DEVICE_FLAG_NONE},
// Gateways - 0x48 / 0x18 // Gateways - 0x48 / 0x18
{ 94, DeviceType::GATEWAY, F("RFM20 Remote Base for RC20RF"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x18 { 94, DeviceType::GATEWAY, F("RFM20 Remote Base for RC20RF"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x18

View File

@@ -63,7 +63,6 @@ class Mixing : public EMSdevice {
uint8_t status_ = EMS_VALUE_UINT_NOTSET; uint8_t status_ = EMS_VALUE_UINT_NOTSET;
uint8_t flowSetTemp_ = EMS_VALUE_UINT_NOTSET; uint8_t flowSetTemp_ = EMS_VALUE_UINT_NOTSET;
Type type_ = Type::NONE; Type type_ = Type::NONE;
}; };
} // namespace emsesp } // namespace emsesp

View File

@@ -400,7 +400,7 @@ bool Thermostat::updated_values() {
static uint16_t current_value_ = 0; static uint16_t current_value_ = 0;
for (const auto & hc : heating_circuits_) { for (const auto & hc : heating_circuits_) {
// don't publish if we haven't yet received some data // don't publish if we haven't yet received some data
// if ((hc->setpoint_roomTemp == EMS_VALUE_SHORT_NOTSET) || (hc->curr_roomTemp == EMS_VALUE_SHORT_NOTSET)) { // if ((hc->setpoint_roomTemp == EMS_VALUE_SHORT_NOTSET) || (hc->curr_roomTemp == EMS_VALUE_SHORT_NOTSET)) {
if (hc->setpoint_roomTemp == EMS_VALUE_SHORT_NOTSET) { if (hc->setpoint_roomTemp == EMS_VALUE_SHORT_NOTSET) {
return false; return false;
} }
@@ -469,7 +469,7 @@ void Thermostat::publish_values() {
// go through all the heating circuits // go through all the heating circuits
for (const auto & hc : heating_circuits_) { for (const auto & hc : heating_circuits_) {
// if ((hc->setpoint_roomTemp == EMS_VALUE_SHORT_NOTSET) || (hc->curr_roomTemp == EMS_VALUE_SHORT_NOTSET)) { // if ((hc->setpoint_roomTemp == EMS_VALUE_SHORT_NOTSET) || (hc->curr_roomTemp == EMS_VALUE_SHORT_NOTSET)) {
if (hc->setpoint_roomTemp == EMS_VALUE_SHORT_NOTSET) { if (hc->setpoint_roomTemp == EMS_VALUE_SHORT_NOTSET) {
break; // skip this HC break; // skip this HC
} }
@@ -776,7 +776,7 @@ std::string Thermostat::mode_tostring(uint8_t mode) const {
void Thermostat::show_values(uuid::console::Shell & shell) { void Thermostat::show_values(uuid::console::Shell & shell) {
EMSdevice::show_values(shell); // always call this to show header EMSdevice::show_values(shell); // always call this to show header
char buffer[10]; // for formatting only char buffer[10]; // for formatting only
uint8_t flags = (this->flags() & 0x0F); // specific thermostat characteristics, strip the option bits uint8_t flags = (this->flags() & 0x0F); // specific thermostat characteristics, strip the option bits
if (datetime_.size()) { if (datetime_.size()) {
@@ -828,7 +828,6 @@ void Thermostat::show_values(uuid::console::Shell & shell) {
} }
} }
if (flags == EMS_DEVICE_FLAG_RC35 || flags == EMS_DEVICE_FLAG_RC30_1) { if (flags == EMS_DEVICE_FLAG_RC35 || flags == EMS_DEVICE_FLAG_RC30_1) {
if (ibaCalIntTemperature != EMS_VALUE_INT_NOTSET) { if (ibaCalIntTemperature != EMS_VALUE_INT_NOTSET) {
print_value(shell, 2, F("Offset int. temperature"), F_(degrees), Helpers::render_value(buffer, ibaCalIntTemperature, 2)); print_value(shell, 2, F("Offset int. temperature"), F_(degrees), Helpers::render_value(buffer, ibaCalIntTemperature, 2));
} }
@@ -1053,7 +1052,7 @@ void Thermostat::process_RC35Monitor(std::shared_ptr<const Telegram> telegram) {
std::shared_ptr<Thermostat::HeatingCircuit> hc = heating_circuit(telegram); std::shared_ptr<Thermostat::HeatingCircuit> hc = heating_circuit(telegram);
telegram->read_value8(hc->setpoint_roomTemp, 2); // is * 2, force to single byte, is 0 in summermode telegram->read_value8(hc->setpoint_roomTemp, 2); // is * 2, force to single byte, is 0 in summermode
telegram->read_value(hc->curr_roomTemp, 3); // is * 10 - or 0x7D00 if thermostat is mounted on boiler telegram->read_value(hc->curr_roomTemp, 3); // is * 10 - or 0x7D00 if thermostat is mounted on boiler
telegram->read_value(hc->mode_type, 1, 1); telegram->read_value(hc->mode_type, 1, 1);
telegram->read_value(hc->summer_mode, 1, 0); telegram->read_value(hc->summer_mode, 1, 0);
telegram->read_value(hc->holiday_mode, 0, 5); telegram->read_value(hc->holiday_mode, 0, 5);

View File

@@ -46,22 +46,22 @@ class Thermostat : public EMSdevice {
} }
~HeatingCircuit() = default; ~HeatingCircuit() = default;
int16_t setpoint_roomTemp = EMS_VALUE_SHORT_NOTSET; int16_t setpoint_roomTemp = EMS_VALUE_SHORT_NOTSET;
int16_t curr_roomTemp = EMS_VALUE_SHORT_NOTSET; int16_t curr_roomTemp = EMS_VALUE_SHORT_NOTSET;
uint8_t mode = EMS_VALUE_UINT_NOTSET; uint8_t mode = EMS_VALUE_UINT_NOTSET;
uint8_t mode_type = EMS_VALUE_UINT_NOTSET; uint8_t mode_type = EMS_VALUE_UINT_NOTSET;
uint8_t summer_mode = EMS_VALUE_UINT_NOTSET; uint8_t summer_mode = EMS_VALUE_UINT_NOTSET;
uint8_t holiday_mode = EMS_VALUE_UINT_NOTSET; uint8_t holiday_mode = EMS_VALUE_UINT_NOTSET;
uint8_t daytemp = EMS_VALUE_UINT_NOTSET; uint8_t daytemp = EMS_VALUE_UINT_NOTSET;
uint8_t nighttemp = EMS_VALUE_UINT_NOTSET; uint8_t nighttemp = EMS_VALUE_UINT_NOTSET;
uint8_t holidaytemp = EMS_VALUE_UINT_NOTSET; uint8_t holidaytemp = EMS_VALUE_UINT_NOTSET;
uint8_t heatingtype = EMS_VALUE_UINT_NOTSET; // type of heating: 1 radiator, 2 convectors, 3 floors, 4 room supply uint8_t heatingtype = EMS_VALUE_UINT_NOTSET; // type of heating: 1 radiator, 2 convectors, 3 floors, 4 room supply
uint8_t circuitcalctemp = EMS_VALUE_UINT_NOTSET; uint8_t circuitcalctemp = EMS_VALUE_UINT_NOTSET;
uint8_t summertemp = EMS_VALUE_UINT_NOTSET; uint8_t summertemp = EMS_VALUE_UINT_NOTSET;
uint8_t nofrosttemp = EMS_VALUE_UINT_NOTSET; uint8_t nofrosttemp = EMS_VALUE_UINT_NOTSET;
uint8_t designtemp = EMS_VALUE_UINT_NOTSET; // heatingcurve design temp at MinExtTemp uint8_t designtemp = EMS_VALUE_UINT_NOTSET; // heatingcurve design temp at MinExtTemp
uint8_t offsettemp = 100; // heatingcurve offest temp at roomtemp signed! uint8_t offsettemp = 100; // heatingcurve offest temp at roomtemp signed!
uint16_t remotetemp = EMS_VALUE_SHORT_NOTSET; // for simulating a RC20 remote uint16_t remotetemp = EMS_VALUE_SHORT_NOTSET; // for simulating a RC20 remote
uint8_t hc_num() const { uint8_t hc_num() const {

View File

@@ -49,7 +49,7 @@ void EMSuart::emsuart_recvTask(void * para) {
EMSESP::incoming_telegram(telegram, telegramSize); EMSESP::incoming_telegram(telegram, telegramSize);
vRingbufferReturnItem(buf_handle, (void *)telegram); vRingbufferReturnItem(buf_handle, (void *)telegram);
} }
} }
} }
/* /*
* UART interrupt, on break read the fifo and put the whole telegram to ringbuffer * UART interrupt, on break read the fifo and put the whole telegram to ringbuffer
@@ -60,7 +60,7 @@ void IRAM_ATTR EMSuart::emsuart_rx_intr_handler(void * para) {
if (EMS_UART.int_st.brk_det) { if (EMS_UART.int_st.brk_det) {
EMS_UART.int_clr.brk_det = 1; // clear flag EMS_UART.int_clr.brk_det = 1; // clear flag
length = 0; length = 0;
while (EMS_UART.status.rxfifo_cnt) { while (EMS_UART.status.rxfifo_cnt) {
uint8_t rx = EMS_UART.fifo.rw_byte; // read all bytes from fifo uint8_t rx = EMS_UART.fifo.rw_byte; // read all bytes from fifo
if (length < EMS_MAXBUFFERSIZE) { if (length < EMS_MAXBUFFERSIZE) {
@@ -85,7 +85,7 @@ void EMSuart::start(uint8_t tx_mode) {
restart(); restart();
return; return;
} }
tx_mode_ = tx_mode; tx_mode_ = tx_mode;
uart_config_t uart_config = { uart_config_t uart_config = {
.baud_rate = EMSUART_BAUD, .baud_rate = EMSUART_BAUD,
.data_bits = UART_DATA_8_BITS, .data_bits = UART_DATA_8_BITS,
@@ -96,9 +96,9 @@ void EMSuart::start(uint8_t tx_mode) {
ESP_ERROR_CHECK(uart_param_config(EMSUART_UART, &uart_config)); ESP_ERROR_CHECK(uart_param_config(EMSUART_UART, &uart_config));
ESP_ERROR_CHECK(uart_set_pin(EMSUART_UART, EMSUART_TXPIN, EMSUART_RXPIN, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE)); ESP_ERROR_CHECK(uart_set_pin(EMSUART_UART, EMSUART_TXPIN, EMSUART_RXPIN, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE));
EMS_UART.int_ena.val = 0; // disable all intr. EMS_UART.int_ena.val = 0; // disable all intr.
EMS_UART.int_clr.val = 0xFFFFFFFF; // clear all intr. flags EMS_UART.int_clr.val = 0xFFFFFFFF; // clear all intr. flags
EMS_UART.idle_conf.tx_brk_num = 11; // breaklength 11 bit EMS_UART.idle_conf.tx_brk_num = 11; // breaklength 11 bit
EMS_UART.idle_conf.rx_idle_thrhd = 256; EMS_UART.idle_conf.rx_idle_thrhd = 256;
drop_next_rx = true; drop_next_rx = true;
buf_handle = xRingbufferCreate(128, RINGBUF_TYPE_NOSPLIT); buf_handle = xRingbufferCreate(128, RINGBUF_TYPE_NOSPLIT);
@@ -119,8 +119,8 @@ void EMSuart::stop() {
*/ */
void EMSuart::restart() { void EMSuart::restart() {
if (EMS_UART.int_raw.brk_det) { if (EMS_UART.int_raw.brk_det) {
EMS_UART.int_clr.brk_det = 1; // clear flag EMS_UART.int_clr.brk_det = 1; // clear flag
drop_next_rx = true; // and drop first frame drop_next_rx = true; // and drop first frame
} }
EMS_UART.int_ena.brk_det = 1; // activate only break EMS_UART.int_ena.brk_det = 1; // activate only break
}; };
@@ -139,7 +139,7 @@ void EMSuart::send_poll(uint8_t data) {
* returns code, 1=success * returns code, 1=success
*/ */
EMSUART_STATUS EMSuart::transmit(uint8_t * buf, uint8_t len) { EMSUART_STATUS EMSuart::transmit(uint8_t * buf, uint8_t len) {
if (millis() -emsRxTime > EMS_RX_TO_TX_TIMEOUT) { if (millis() - emsRxTime > EMS_RX_TO_TX_TIMEOUT) {
return EMS_TX_WTD_TIMEOUT; return EMS_TX_WTD_TIMEOUT;
} }
if (len > 0) { if (len > 0) {

View File

@@ -41,7 +41,7 @@
// customize the GPIO pins for RX and TX here // customize the GPIO pins for RX and TX here
#ifdef WEMOS_D1_32 #ifdef WEMOS_D1_32
#define EMSUART_RXPIN 23 // 17 is UART2 RX. Use 23 for D7 on a Wemos D1-32 mini for backwards compatabilty #define EMSUART_RXPIN 23 // 17 is UART2 RX. Use 23 for D7 on a Wemos D1-32 mini for backwards compatabilty
#define EMSUART_TXPIN 5 // 16 is UART2 TX. Use 5 for D8 on a Wemos D1-32 mini for backwards compatabilty #define EMSUART_TXPIN 5 // 16 is UART2 TX. Use 5 for D8 on a Wemos D1-32 mini for backwards compatabilty
#else #else
#define EMSUART_RXPIN 17 // 17 is UART2 RX. Use 23 for D7 on a Wemos D1-32 mini for backwards compatabilty #define EMSUART_RXPIN 17 // 17 is UART2 RX. Use 23 for D7 on a Wemos D1-32 mini for backwards compatabilty
#define EMSUART_TXPIN 16 // 16 is UART2 TX. Use 5 for D8 on a Wemos D1-32 mini for backwards compatabilty #define EMSUART_TXPIN 16 // 16 is UART2 TX. Use 5 for D8 on a Wemos D1-32 mini for backwards compatabilty

View File

@@ -54,7 +54,7 @@ void ICACHE_RAM_ATTR EMSuart::emsuart_rx_intr_handler(void * para) {
drop_next_rx = true; drop_next_rx = true;
} }
} }
USIC(EMSUART_UART) = (1 << UIBD); // INT clear the BREAK detect interrupt USIC(EMSUART_UART) = (1 << UIBD); // INT clear the BREAK detect interrupt
USC0(EMSUART_UART) &= ~(1 << UCBRK); // reset tx-brk USC0(EMSUART_UART) &= ~(1 << UCBRK); // reset tx-brk
if (!drop_next_rx) { if (!drop_next_rx) {
pEMSRxBuf->length = length; pEMSRxBuf->length = length;
@@ -91,7 +91,7 @@ void ICACHE_FLASH_ATTR EMSuart::emsuart_recvTask(os_event_t * events) {
// ignore double BRK at the end, possibly from the Tx loopback // ignore double BRK at the end, possibly from the Tx loopback
// also telegrams with no data value // also telegrams with no data value
// then transmit EMS buffer, excluding the BRK // then transmit EMS buffer, excluding the BRK
if (length > 4) { if (length > 4) {
EMSESP::incoming_telegram((uint8_t *)pCurrent->buffer, length - 1); EMSESP::incoming_telegram((uint8_t *)pCurrent->buffer, length - 1);
} }
} }
@@ -188,7 +188,7 @@ void ICACHE_FLASH_ATTR EMSuart::stop() {
void ICACHE_FLASH_ATTR EMSuart::restart() { void ICACHE_FLASH_ATTR EMSuart::restart() {
if (USIR(EMSUART_UART) & ((1 << UIBD))) { if (USIR(EMSUART_UART) & ((1 << UIBD))) {
USIC(EMSUART_UART) = (1 << UIBD); // INT clear the BREAK detect interrupt USIC(EMSUART_UART) = (1 << UIBD); // INT clear the BREAK detect interrupt
drop_next_rx = true; drop_next_rx = true;
} }
ETS_UART_INTR_ENABLE(); ETS_UART_INTR_ENABLE();
} }
@@ -249,7 +249,7 @@ EMSUART_STATUS ICACHE_FLASH_ATTR EMSuart::transmit(uint8_t * buf, uint8_t len) {
if (len == 0) { if (len == 0) {
return EMS_TX_STATUS_OK; // nothing to send return EMS_TX_STATUS_OK; // nothing to send
} }
if(millis() > (emsRxTime + EMS_RX_TO_TX_TIMEOUT)) { // send allowed within 20 ms if (millis() > (emsRxTime + EMS_RX_TO_TX_TIMEOUT)) { // send allowed within 20 ms
return EMS_TX_WTD_TIMEOUT; return EMS_TX_WTD_TIMEOUT;
} }

View File

@@ -47,7 +47,7 @@
#define EMSUART_TX_LAG 8 #define EMSUART_TX_LAG 8
#define EMSUART_BUSY_WAIT (EMSUART_BIT_TIME / 8) #define EMSUART_BUSY_WAIT (EMSUART_BIT_TIME / 8)
#define EMS_TX_TO_CHARS (2 + 20) #define EMS_TX_TO_CHARS (2 + 20)
#define EMS_TX_TO_COUNT ((EMS_TX_TO_CHARS) * 8) #define EMS_TX_TO_COUNT ((EMS_TX_TO_CHARS)*8)
namespace emsesp { namespace emsesp {