From ed48b4f15eb8347cdf40c90c1e456d3227d6062a Mon Sep 17 00:00:00 2001 From: Kyle Stonacek Date: Wed, 4 Mar 2026 17:35:35 +1300 Subject: [PATCH] support for ESP32-C3 supermini --- platformio.ini | 20 ++++++++++++++++++-- src/main.cpp | 14 ++++++++++---- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/platformio.ini b/platformio.ini index 904dfe6..00eb70f 100644 --- a/platformio.ini +++ b/platformio.ini @@ -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] @@ -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 \ No newline at end of file + -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 \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 2835140..e9538a7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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(); @@ -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