Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
; https://docs.platformio.org/page/projectconf.html

[platformio]
default_envs = esp32dev, espa-v1, espa-v2
default_envs = esp32dev, espa-v1, espa-v2, esp32-c3-devkitm-1
; data_dir = {$PROJECT_DIR}/data

[env:spa-base]
Expand Down Expand Up @@ -86,4 +86,20 @@ build_flags =
-D TX_PIN=20 ; Spa serial TX
-D EN_PIN=9 ; Enable/config button
-D GP_PIN=21 ; General purpose button (reserved)
-D SPA_SERIAL=Serial1 ; ESP32-C6 only has UART0/UART1, no UART2
-D SPA_SERIAL=Serial1 ; ESP32-C6 only has UART0/UART1, no UART2

[env:esp32-c3-devkitm-1]
extends = env:spa-base
# ESP32-C3 DevKitC-1 for esp32-c3 super mini
# super mini only has one serial rx/tx, so serial debugging is disabled.
framework = arduino
board = esp32-c3-devkitm-1
board_build.mcu = esp32c3
board_build.partitions = partitions/espa_v2_partitions.csv
board_upload.flash_size = 4MB
build_flags =
-D ESP32_C3=1
-D RX_PIN=20
-D TX_PIN=21
-D EN_PIN=0
-D SPA_SERIAL=Serial0 ; ESP32-C3 only has UART0
14 changes: 10 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -646,8 +646,10 @@ void setup() {
pinMode(GP_PIN, INPUT_PULLUP);
#endif

Serial.begin(115200);

#if !defined(ESP32_C3)
Serial.begin(115200);
#endif

#if defined(ESPA_V2)
// ESP32-C6: Wait for USB CDC to connect (with timeout)
unsigned long startWait = millis();
Expand All @@ -657,8 +659,12 @@ void setup() {
delay(100); // Extra settling time for USB
#endif

Serial.setDebugOutput(true);
Debug.setSerialEnabled(true);
#if defined(ESP32_C3) // ESP32-C3 can not support serial output since it only has 1 uart
Debug.setSerialEnabled(false);
#else
Serial.setDebugOutput(true);
Debug.setSerialEnabled(true);
#endif

si.begin(); // Initialize SpaInterface serial communication

Expand Down