auto formatting

This commit is contained in:
proddy
2022-09-20 19:05:11 +05:30
parent 23f65b9eb2
commit eb432d9acb
5 changed files with 17 additions and 18 deletions

View File

@@ -128,11 +128,11 @@ void AnalogSensor::reload() {
} else if (sensor.type() == AnalogType::COUNTER) { } else if (sensor.type() == AnalogType::COUNTER) {
LOG_DEBUG(F("Adding analog I/O Counter sensor on GPIO%d"), sensor.gpio()); LOG_DEBUG(F("Adding analog I/O Counter sensor on GPIO%d"), sensor.gpio());
pinMode(sensor.gpio(), INPUT_PULLUP); pinMode(sensor.gpio(), INPUT_PULLUP);
#ifndef ARDUINO_LOLIN_C3_MINI #ifndef ARDUINO_LOLIN_C3_MINI
if (sensor.gpio() == 25 || sensor.gpio() == 26) { if (sensor.gpio() == 25 || sensor.gpio() == 26) {
dacWrite(sensor.gpio(), 255); dacWrite(sensor.gpio(), 255);
} }
#endif #endif
sensor.polltime_ = 0; sensor.polltime_ = 0;
sensor.poll_ = digitalRead(sensor.gpio()); sensor.poll_ = digitalRead(sensor.gpio());
publish_sensor(sensor); publish_sensor(sensor);
@@ -162,9 +162,9 @@ void AnalogSensor::reload() {
} else if (sensor.offset() < 0) { } else if (sensor.offset() < 0) {
sensor.set_offset(0); sensor.set_offset(0);
} }
#ifndef ARDUINO_LOLIN_C3_MINI #ifndef ARDUINO_LOLIN_C3_MINI
dacWrite(sensor.gpio(), sensor.offset()); dacWrite(sensor.gpio(), sensor.offset());
#endif #endif
sensor.set_value(sensor.offset()); sensor.set_value(sensor.offset());
} else { } else {
digitalWrite(sensor.gpio(), sensor.offset() > 0 ? 1 : 0); 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_offset(v);
sensor.set_value(v); sensor.set_value(v);
pinMode(sensor.gpio(), OUTPUT); pinMode(sensor.gpio(), OUTPUT);
#ifndef ARDUINO_LOLIN_C3_MINI #ifndef ARDUINO_LOLIN_C3_MINI
dacWrite(sensor.gpio(), sensor.offset()); dacWrite(sensor.gpio(), sensor.offset());
#endif #endif
publish_sensor(sensor); publish_sensor(sensor);
return true; return true;
} else if (v == 0 || v == 1) { } else if (v == 0 || v == 1) {

View File

@@ -356,7 +356,7 @@ void System::wifi_tweak() {
#ifdef ARDUINO_LOLIN_C3_MINI #ifdef ARDUINO_LOLIN_C3_MINI
// https://www.wemos.cc/en/latest/c3/c3_mini.html // https://www.wemos.cc/en/latest/c3/c3_mini.html
bool System::is_valid_gpio(uint8_t pin) { 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 false; // bad pin
} }
return true; return true;

View File

@@ -299,7 +299,6 @@ class System {
uint8_t eth_clock_mode_; uint8_t eth_clock_mode_;
uint32_t fstotal_; uint32_t fstotal_;
}; };
} // namespace emsesp } // namespace emsesp

View File

@@ -27,11 +27,11 @@
#define EMS_MAXBUFFERSIZE 33 // max size of the buffer. EMS packets are max 32 bytes, plus extra for BRK #define EMS_MAXBUFFERSIZE 33 // max size of the buffer. EMS packets are max 32 bytes, plus extra for BRK
#ifdef ARDUINO_LOLIN_C3_MINI #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 #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 #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_DEFAULT 1
#define EMS_TXMODE_EMSPLUS 2 #define EMS_TXMODE_EMSPLUS 2

View File

@@ -81,11 +81,11 @@ void WebSettings::read(WebSettings & settings, JsonObject & root) {
StateUpdateResult WebSettings::update(JsonObject & root, WebSettings & settings) { StateUpdateResult WebSettings::update(JsonObject & root, WebSettings & settings) {
// load default GPIO configuration based on board profile // load default GPIO configuration based on board profile
std::vector<int8_t> data; // // led, dallas, rx, tx, button, phy_type, eth_power, eth_phy_addr, eth_clock_mode std::vector<int8_t> data; // // led, dallas, rx, tx, button, phy_type, eth_power, eth_phy_addr, eth_clock_mode
#ifdef ARDUINO_LOLIN_C3_MINI #ifdef ARDUINO_LOLIN_C3_MINI
settings.board_profile = "C3MINI"; settings.board_profile = "C3MINI";
#else #else
settings.board_profile = root["board_profile"] | EMSESP_DEFAULT_BOARD_PROFILE; settings.board_profile = root["board_profile"] | EMSESP_DEFAULT_BOARD_PROFILE;
#endif #endif
if (!System::load_board_profile(data, settings.board_profile.c_str())) { if (!System::load_board_profile(data, settings.board_profile.c_str())) {
settings.board_profile = "CUSTOM"; settings.board_profile = "CUSTOM";
EMSESP::logger().info("No board profile found. Re-setting to %s", settings.board_profile.c_str()); EMSESP::logger().info("No board profile found. Re-setting to %s", settings.board_profile.c_str());