Skip to content

Commit

Permalink
added seed xiao esp32 c3 build
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Struß committed Mar 28, 2023
1 parent c47b7dd commit 601232d
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 7 deletions.
23 changes: 22 additions & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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.2
nrf24/RF24 @ ^1.4.5
Expand Down Expand Up @@ -139,6 +139,27 @@ 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:esp32_c3_devkitm_1]
platform = espressif32
board = esp32-c3-devkitm-1
build_flags = ${env.build_flags}
-DHOYMILES_PIN_CS=2
-DHOYMILES_PIN_MOSI=6
-DHOYMILES_PIN_MISO=5
-DHOYMILES_PIN_SCLK=4
-DHOYMILES_PIN_IRQ=0
-DHOYMILES_PIN_CE=1

[env:lolin32_lite]
; https://www.makershop.de/plattformen/esp8266/wemos-lolin32/
Expand Down
5 changes: 5 additions & 0 deletions src/InverterSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ void InverterSettingsClass::init()
// Initialize inverter communication
MessageOutput.print(F("Initialize Hoymiles interface... "));
if (PinMapping.isValidNrf24Config()) {
// TODO: Evaluate if ESP-S3 has the same issue
#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3
SPIClass* spiClass = new SPIClass(FSPI);
#else
SPIClass* spiClass = new SPIClass(HSPI);
#endif
spiClass->begin(pin.nrf24_clk, pin.nrf24_miso, pin.nrf24_mosi, pin.nrf24_cs);
Hoymiles.setMessageOutput(&MessageOutput);
Hoymiles.init(spiClass, pin.nrf24_en, pin.nrf24_irq);
Expand Down
12 changes: 6 additions & 6 deletions src/PinMapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ bool PinMappingClass::init(const String& deviceMapping)

bool PinMappingClass::isValidNrf24Config()
{
return _pinMapping.nrf24_clk > 0
&& _pinMapping.nrf24_cs > 0
&& _pinMapping.nrf24_en > 0
&& _pinMapping.nrf24_irq > 0
&& _pinMapping.nrf24_miso > 0
&& _pinMapping.nrf24_mosi > 0;
return _pinMapping.nrf24_clk >= 0
&& _pinMapping.nrf24_cs >= 0
&& _pinMapping.nrf24_en >= 0
&& _pinMapping.nrf24_irq >= 0
&& _pinMapping.nrf24_miso >= 0
&& _pinMapping.nrf24_mosi >= 0;
}

bool PinMappingClass::isValidEthConfig()
Expand Down
1 change: 1 addition & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"));

Expand Down
2 changes: 2 additions & 0 deletions webapp/.tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
yarn 1.22.19
nodejs 19.8.1

0 comments on commit 601232d

Please sign in to comment.