clang formatting

This commit is contained in:
proddy
2020-06-14 14:42:43 +02:00
parent ac8efc4108
commit 1283657fc0
10 changed files with 63 additions and 74 deletions

View File

@@ -162,6 +162,9 @@ void Mixing::process_MMStatusMessage(std::shared_ptr<const Telegram> telegram) {
telegram->read_value(flowSetTemp_, 0); telegram->read_value(flowSetTemp_, 0);
} }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
// Mixing on a MM10 - 0xAA // Mixing on a MM10 - 0xAA
// e.g. Thermostat -> Mixing Module, type 0xAA, telegram: 10 21 AA 00 FF 0C 0A 11 0A 32 xx // e.g. Thermostat -> Mixing Module, type 0xAA, telegram: 10 21 AA 00 FF 0C 0A 11 0A 32 xx
void Mixing::process_MMConfigMessage(std::shared_ptr<const Telegram> telegram) { void Mixing::process_MMConfigMessage(std::shared_ptr<const Telegram> telegram) {
@@ -177,4 +180,6 @@ void Mixing::process_MMSetMessage(std::shared_ptr<const Telegram> telegram) {
// pos 1: position in % // pos 1: position in %
} }
#pragma GCC diagnostic pop
} // namespace emsesp } // namespace emsesp

View File

@@ -29,7 +29,7 @@ class Helpers {
static char * hextoa(char * result, const uint8_t value); static char * hextoa(char * result, const uint8_t value);
static std::string data_to_hex(const uint8_t * data, const uint8_t length); static std::string data_to_hex(const uint8_t * data, const uint8_t length);
static char * render_value(char * result, const float value, const uint8_t format); // format is precision static char * render_value(char * result, const float value, const uint8_t format); // format is the precision
static char * render_value(char * result, const uint8_t value, const uint8_t format); static char * render_value(char * result, const uint8_t value, const uint8_t format);
static char * render_value(char * result, const int8_t value, const uint8_t format); static char * render_value(char * result, const int8_t value, const uint8_t format);
static char * render_value(char * result, const uint16_t value, const uint8_t format); static char * render_value(char * result, const uint16_t value, const uint8_t format);

View File

@@ -37,7 +37,6 @@ class Roomctrl {
static void unknown(uint8_t addr, uint8_t dst, uint8_t type, uint8_t offset); static void unknown(uint8_t addr, uint8_t dst, uint8_t type, uint8_t offset);
static void temperature(uint8_t addr, uint8_t dst); static void temperature(uint8_t addr, uint8_t dst);
static void nack_write(); static void nack_write();
}; };
} // namespace emsesp } // namespace emsesp

View File

@@ -75,7 +75,6 @@ class EMSuart {
static void emsuart_recvTask(void * para); static void emsuart_recvTask(void * para);
static void IRAM_ATTR emsuart_rx_intr_handler(void * para); static void IRAM_ATTR emsuart_rx_intr_handler(void * para);
static void IRAM_ATTR emsuart_tx_timer_intr_handler(); static void IRAM_ATTR emsuart_tx_timer_intr_handler();
}; };
} // namespace emsesp } // namespace emsesp

View File

@@ -31,7 +31,6 @@ os_event_t recvTaskQueue[EMSUART_recvTaskQueueLen]; // our Rx queue
EMSuart::EMSRxBuf_t * pEMSRxBuf; EMSuart::EMSRxBuf_t * pEMSRxBuf;
EMSuart::EMSRxBuf_t * paEMSRxBuf[EMS_MAXBUFFERS]; EMSuart::EMSRxBuf_t * paEMSRxBuf[EMS_MAXBUFFERS];
uint8_t emsRxBufIdx = 0; uint8_t emsRxBufIdx = 0;
uint8_t phantomBreak = 0;
uint8_t tx_mode_ = 0xFF; uint8_t tx_mode_ = 0xFF;
bool drop_next_rx = true; bool drop_next_rx = true;
uint32_t emsRxTime; uint32_t emsRxTime;
@@ -40,7 +39,6 @@ uint8_t emsTxBufIdx;
uint8_t emsTxBufLen; uint8_t emsTxBufLen;
uint32_t emsTxWait; uint32_t emsTxWait;
// //
// Main interrupt handler // Main interrupt handler
// Important: must not use ICACHE_FLASH_ATTR // Important: must not use ICACHE_FLASH_ATTR
@@ -84,11 +82,6 @@ void ICACHE_FLASH_ATTR EMSuart::emsuart_recvTask(os_event_t * events) {
uint8_t length = pCurrent->length; // number of bytes including the BRK at the end uint8_t length = pCurrent->length; // number of bytes including the BRK at the end
pCurrent->length = 0; pCurrent->length = 0;
if (phantomBreak) {
phantomBreak = 0;
length--; // remove phantom break from Rx buffer
}
// it's a poll or status code, single byte and ok to send on, then quit // it's a poll or status code, single byte and ok to send on, then quit
if (length == 2) { if (length == 2) {
EMSESP::incoming_telegram((uint8_t *)pCurrent->buffer, 1); EMSESP::incoming_telegram((uint8_t *)pCurrent->buffer, 1);
@@ -209,7 +202,6 @@ void ICACHE_FLASH_ATTR EMSuart::start(uint8_t tx_mode) {
ETS_UART_INTR_ATTACH(emsuart_rx_intr_handler, nullptr); ETS_UART_INTR_ATTACH(emsuart_rx_intr_handler, nullptr);
ETS_UART_INTR_ENABLE(); ETS_UART_INTR_ENABLE();
drop_next_rx = true; drop_next_rx = true;
// LOG_INFO(F("UART service for Rx/Tx started"));
// for sending with large delay in EMS+ mode we use a timer interrupt // for sending with large delay in EMS+ mode we use a timer interrupt
timer1_attachInterrupt(emsuart_tx_timer_intr_handler); // Add ISR Function timer1_attachInterrupt(emsuart_tx_timer_intr_handler); // Add ISR Function
@@ -244,7 +236,6 @@ void ICACHE_FLASH_ATTR EMSuart::restart() {
* Which is a 11-bit set of zero's (11 cycles) * Which is a 11-bit set of zero's (11 cycles)
*/ */
void ICACHE_FLASH_ATTR EMSuart::tx_brk() { void ICACHE_FLASH_ATTR EMSuart::tx_brk() {
// must make sure Tx FIFO is empty // must make sure Tx FIFO is empty
while (((USS(EMSUART_UART) >> USTXC) & 0xFF)) while (((USS(EMSUART_UART) >> USTXC) & 0xFF))
; ;
@@ -306,7 +297,7 @@ uint16_t ICACHE_FLASH_ATTR EMSuart::transmit(uint8_t * buf, uint8_t len) {
// if ((uuid::get_uptime() - emsRxTime) > EMS_RX_TO_TX_TIMEOUT)) { // send allowed within 20 ms // if ((uuid::get_uptime() - emsRxTime) > EMS_RX_TO_TX_TIMEOUT)) { // send allowed within 20 ms
// return EMS_TX_STATUS_ERR; // return EMS_TX_STATUS_ERR;
// } // }
// reset tx-brk, just in case it is accidently set // reset tx-brk, just in case it is accidentally set
USC0(EMSUART_UART) &= ~(1 << UCBRK); USC0(EMSUART_UART) &= ~(1 << UCBRK);
// timer controlled modes with extra delay // timer controlled modes with extra delay
@@ -322,7 +313,7 @@ uint16_t ICACHE_FLASH_ATTR EMSuart::transmit(uint8_t * buf, uint8_t len) {
} }
// new code from Michael. See https://github.com/proddy/EMS-ESP/issues/380 // new code from Michael. See https://github.com/proddy/EMS-ESP/issues/380
if (tx_mode_ >= EMS_TXMODE_NEW) { if (tx_mode_ >= EMS_TXMODE_NEW) { // tx_mode 4
for (uint8_t i = 0; i < len; i++) { for (uint8_t i = 0; i < len; i++) {
USF(EMSUART_UART) = buf[i]; USF(EMSUART_UART) = buf[i];
} }
@@ -331,7 +322,7 @@ uint16_t ICACHE_FLASH_ATTR EMSuart::transmit(uint8_t * buf, uint8_t len) {
} }
// EMS+ https://github.com/proddy/EMS-ESP/issues/23# // EMS+ https://github.com/proddy/EMS-ESP/issues/23#
if (tx_mode_ == EMS_TXMODE_EMSPLUS) { // With extra tx delay for EMS+ if (tx_mode_ == EMS_TXMODE_EMSPLUS) { // tx_mode 2, with extra tx delay for EMS+
for (uint8_t i = 0; i < len; i++) { for (uint8_t i = 0; i < len; i++) {
USF(EMSUART_UART) = buf[i]; USF(EMSUART_UART) = buf[i];
delayMicroseconds(EMSUART_TX_BRK_WAIT); // 2070 delayMicroseconds(EMSUART_TX_BRK_WAIT); // 2070
@@ -341,7 +332,7 @@ uint16_t ICACHE_FLASH_ATTR EMSuart::transmit(uint8_t * buf, uint8_t len) {
} }
// Junkers logic by @philrich // Junkers logic by @philrich
if (tx_mode_ == EMS_TXMODE_HT3) { if (tx_mode_ == EMS_TXMODE_HT3) { // tx_mode 3
for (uint8_t i = 0; i < len; i++) { for (uint8_t i = 0; i < len; i++) {
USF(EMSUART_UART) = buf[i]; USF(EMSUART_UART) = buf[i];
@@ -383,7 +374,6 @@ uint16_t ICACHE_FLASH_ATTR EMSuart::transmit(uint8_t * buf, uint8_t len) {
// disable rx interrupt // disable rx interrupt
// clear Rx status register, resetting the Rx FIFO and flush it // clear Rx status register, resetting the Rx FIFO and flush it
// noInterrupts();
ETS_UART_INTR_DISABLE(); ETS_UART_INTR_DISABLE();
// USC0(EMSUART_UART) |= (1 << UCRXRST); // reset uart rx fifo // USC0(EMSUART_UART) |= (1 << UCRXRST); // reset uart rx fifo
emsuart_flush_fifos(); emsuart_flush_fifos();
@@ -414,12 +404,8 @@ uint16_t ICACHE_FLASH_ATTR EMSuart::transmit(uint8_t * buf, uint8_t len) {
} }
USC0(EMSUART_UART) &= ~(1 << UCBRK); // clear <BRK> USC0(EMSUART_UART) &= ~(1 << UCBRK); // clear <BRK>
// USC0(EMSUART_UART) &= ~((1 << UCBRK) | (1 << UCLBE)); // disable loopback & clear <BRK>
// USIC(EMSUART_UART) = (1 << UIBD); // clear BRK detect IRQ
// phantomBreak = 1;
} }
// interrupts();
ETS_UART_INTR_ENABLE(); // open up the FIFO again to start receiving ETS_UART_INTR_ENABLE(); // open up the FIFO again to start receiving
return EMS_TX_STATUS_OK; // send the Tx ok status back return EMS_TX_STATUS_OK; // send the Tx ok status back