From eb432d9acb6655ecde412f2ecdba5547298f1dc5 Mon Sep 17 00:00:00 2001 From: proddy Date: Tue, 20 Sep 2022 19:05:11 +0530 Subject: [PATCH] auto formatting --- src/analogsensor.cpp | 16 ++++++++-------- src/system.cpp | 2 +- src/system.h | 1 - src/uart/emsuart_esp32.h | 6 +++--- src/web/WebSettingsService.cpp | 10 +++++----- 5 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/analogsensor.cpp b/src/analogsensor.cpp index 413db6513..e75d75d88 100644 --- a/src/analogsensor.cpp +++ b/src/analogsensor.cpp @@ -128,11 +128,11 @@ void AnalogSensor::reload() { } else if (sensor.type() == AnalogType::COUNTER) { LOG_DEBUG(F("Adding analog I/O Counter sensor on GPIO%d"), sensor.gpio()); pinMode(sensor.gpio(), INPUT_PULLUP); - #ifndef ARDUINO_LOLIN_C3_MINI +#ifndef ARDUINO_LOLIN_C3_MINI if (sensor.gpio() == 25 || sensor.gpio() == 26) { dacWrite(sensor.gpio(), 255); } - #endif +#endif sensor.polltime_ = 0; sensor.poll_ = digitalRead(sensor.gpio()); publish_sensor(sensor); @@ -162,9 +162,9 @@ void AnalogSensor::reload() { } else if (sensor.offset() < 0) { sensor.set_offset(0); } - #ifndef ARDUINO_LOLIN_C3_MINI - dacWrite(sensor.gpio(), sensor.offset()); - #endif +#ifndef ARDUINO_LOLIN_C3_MINI + dacWrite(sensor.gpio(), sensor.offset()); +#endif sensor.set_value(sensor.offset()); } else { digitalWrite(sensor.gpio(), sensor.offset() > 0 ? 1 : 0); @@ -576,9 +576,9 @@ bool AnalogSensor::command_setvalue(const char * value, const int8_t gpio) { sensor.set_offset(v); sensor.set_value(v); pinMode(sensor.gpio(), OUTPUT); - #ifndef ARDUINO_LOLIN_C3_MINI - dacWrite(sensor.gpio(), sensor.offset()); - #endif +#ifndef ARDUINO_LOLIN_C3_MINI + dacWrite(sensor.gpio(), sensor.offset()); +#endif publish_sensor(sensor); return true; } else if (v == 0 || v == 1) { diff --git a/src/system.cpp b/src/system.cpp index ec91d3672..366cb9b07 100644 --- a/src/system.cpp +++ b/src/system.cpp @@ -356,7 +356,7 @@ void System::wifi_tweak() { #ifdef ARDUINO_LOLIN_C3_MINI // https://www.wemos.cc/en/latest/c3/c3_mini.html bool System::is_valid_gpio(uint8_t pin) { - if ((pin >= 11 && pin <= 19) || (pin > 21)) { + if ((pin >= 11 && pin <= 19) || (pin > 21)) { return false; // bad pin } return true; diff --git a/src/system.h b/src/system.h index e0a0340b8..9639d0b8d 100644 --- a/src/system.h +++ b/src/system.h @@ -299,7 +299,6 @@ class System { uint8_t eth_clock_mode_; uint32_t fstotal_; - }; } // namespace emsesp diff --git a/src/uart/emsuart_esp32.h b/src/uart/emsuart_esp32.h index 9dcea414d..a882d6727 100644 --- a/src/uart/emsuart_esp32.h +++ b/src/uart/emsuart_esp32.h @@ -27,11 +27,11 @@ #define EMS_MAXBUFFERSIZE 33 // max size of the buffer. EMS packets are max 32 bytes, plus extra for BRK #ifdef ARDUINO_LOLIN_C3_MINI - #define EMSUART_NUM UART_NUM_1 // on C3 mini we're using UART1 +#define EMSUART_NUM UART_NUM_1 // on C3 mini we're using UART1 #else - #define EMSUART_NUM UART_NUM_2 // on the ESP32 we're using UART2 +#define EMSUART_NUM UART_NUM_2 // on the ESP32 we're using UART2 #endif -#define EMSUART_BAUD 9600 // uart baud rate for the EMS circuit +#define EMSUART_BAUD 9600 // uart baud rate for the EMS circuit #define EMS_TXMODE_DEFAULT 1 #define EMS_TXMODE_EMSPLUS 2 diff --git a/src/web/WebSettingsService.cpp b/src/web/WebSettingsService.cpp index cb97f36d6..e445b2489 100644 --- a/src/web/WebSettingsService.cpp +++ b/src/web/WebSettingsService.cpp @@ -81,11 +81,11 @@ void WebSettings::read(WebSettings & settings, JsonObject & root) { StateUpdateResult WebSettings::update(JsonObject & root, WebSettings & settings) { // load default GPIO configuration based on board profile std::vector data; // // led, dallas, rx, tx, button, phy_type, eth_power, eth_phy_addr, eth_clock_mode - #ifdef ARDUINO_LOLIN_C3_MINI - settings.board_profile = "C3MINI"; - #else - settings.board_profile = root["board_profile"] | EMSESP_DEFAULT_BOARD_PROFILE; - #endif +#ifdef ARDUINO_LOLIN_C3_MINI + settings.board_profile = "C3MINI"; +#else + settings.board_profile = root["board_profile"] | EMSESP_DEFAULT_BOARD_PROFILE; +#endif if (!System::load_board_profile(data, settings.board_profile.c_str())) { settings.board_profile = "CUSTOM"; EMSESP::logger().info("No board profile found. Re-setting to %s", settings.board_profile.c_str());