From 67fadf116106fa3d84d33467a7baf841ebbd73ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Stru=C3=9F?= Date: Mon, 6 Mar 2023 19:13:29 +0100 Subject: [PATCH] added esp32 c3 build --- platformio.ini | 13 ++++++++++++- src/InverterSettings.cpp | 18 ++++++++++++++++-- src/main.cpp | 1 + webapp/.tool-versions | 2 ++ 4 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 webapp/.tool-versions diff --git a/platformio.ini b/platformio.ini index 48f838ba7..a78f50738 100644 --- a/platformio.ini +++ b/platformio.ini @@ -26,7 +26,7 @@ build_unflags = -std=gnu++11 lib_deps = - https://github.com/yubox-node-org/ESPAsyncWebServer + https://github.com/ss89/ESPAsyncWebServer bblanchon/ArduinoJson @ ^6.21.0 https://github.com/bertmelis/espMqttClient.git#v1.4.1 nrf24/RF24 @ ^1.4.5 @@ -139,6 +139,17 @@ build_flags = ${env.build_flags} -DHOYMILES_PIN_CE=4 -DHOYMILES_PIN_CS=5 +[env:seeed_xiao_esp32c3] +; https://wiki.seeedstudio.com/XIAO_ESP32C3_Getting_Started +board = seeed_xiao_esp32c3 +build_flags = ${env.build_flags} + -DHOYMILES_PIN_MISO=9 + -DHOYMILES_PIN_MOSI=10 + -DHOYMILES_PIN_SCLK=8 + -DHOYMILES_PIN_IRQ=3 + -DHOYMILES_PIN_CE=4 + -DHOYMILES_PIN_CS=5 + [env:lolin32_lite] ; https://www.makershop.de/plattformen/esp8266/wemos-lolin32/ diff --git a/src/InverterSettings.cpp b/src/InverterSettings.cpp index ebb354bbf..3a8525971 100644 --- a/src/InverterSettings.cpp +++ b/src/InverterSettings.cpp @@ -17,11 +17,25 @@ void InverterSettingsClass::init() const PinMapping_t& pin = PinMapping.get(); // Initialize inverter communication - MessageOutput.print(F("Initialize Hoymiles interface... ")); + MessageOutput.println(F("Initialize Hoymiles interface... ")); if (PinMapping.isValidNrf24Config()) { - SPIClass* spiClass = new SPIClass(HSPI); + MessageOutput.print(F(" Clk pin: ")); + MessageOutput.println(pin.nrf24_clk); + MessageOutput.print(F(" Miso pin: ")); + MessageOutput.println(pin.nrf24_miso); + MessageOutput.print(F(" Mosi pin: ")); + MessageOutput.println(pin.nrf24_mosi); + MessageOutput.print(F(" CS pin: ")); + MessageOutput.println(pin.nrf24_cs); + MessageOutput.print(F(" EN pin: ")); + MessageOutput.println(pin.nrf24_en); + MessageOutput.print(F(" IRQ pin: ")); + MessageOutput.println(pin.nrf24_irq); + SPIClass* spiClass = new SPIClass(FSPI); + MessageOutput.println(F(" begin SPI... ")); spiClass->begin(pin.nrf24_clk, pin.nrf24_miso, pin.nrf24_mosi, pin.nrf24_cs); Hoymiles.setMessageOutput(&MessageOutput); + MessageOutput.println(F(" init Hoymiles... ")); Hoymiles.init(spiClass, pin.nrf24_en, pin.nrf24_irq); MessageOutput.println(F(" Setting radio PA level... ")); diff --git a/src/main.cpp b/src/main.cpp index 58e663cdb..86418b196 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -26,6 +26,7 @@ void setup() Serial.begin(SERIAL_BAUDRATE); while (!Serial) yield(); + sleep(1); // waiting for vs code terminal to be re-connected MessageOutput.println(); MessageOutput.println(F("Starting OpenDTU")); diff --git a/webapp/.tool-versions b/webapp/.tool-versions new file mode 100644 index 000000000..40930150a --- /dev/null +++ b/webapp/.tool-versions @@ -0,0 +1,2 @@ +yarn 1.22.19 +nodejs 19.8.1