Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ESP32-C3 support #225

Merged
merged 2 commits into from
Mar 8, 2024
Merged
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
7 changes: 7 additions & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,11 @@ upload_port = /dev/ttyUSB*
platform = espressif32@ 6.5.0
board = heltec_wifi_lora_32_V3
board_build.mcu = esp32s3
framework = arduino

[env:esp32c3]
platform = espressif32@ 6.5.0
board = seeed_xiao_esp32c3
board_build.mcu = esp32c3
board_build.f_cpu = 160000000L
framework = arduino
5 changes: 5 additions & 0 deletions tinyGS/src/ConfigManager/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ ConfigManager::ConfigManager()
#if CONFIG_IDF_TARGET_ESP32S3
{ 0x3c, 17, 18, 21, 0, 35, 6, 8, UNUSED, 14, 13, 12, 11, 10, 9, 1.6f, UNUSED, UNUSED, "150–960Mhz - HELTEC LORA32 V3 SX1262" }, // SX1262
{ 0x3c, 17, 18, UNUSED, 0, 35, 1, 8, 6, 14, UNUSED, 12, 11, 10, 9, 0.0f, UNUSED, UNUSED, "Custom ESP32-S3 433MHz SX1278" }, // SX1278 @g4lile0
#elif CONFIG_IDF_TARGET_ESP32C3
{ 0x3c, 0, 1, UNUSED, 20, 21, 6, 8, UNUSED, 3, 4, 5, 6, 7, 10, 1.6f, UNUSED, UNUSED, "433MHz HELTEC LORA32 HT-CT62 SX1262" }, // SX1262 @gargomoma
{ 0x3c, 0, 1, UNUSED, 20, 21, 1, 8, 4, UNUSED, UNUSED, 5, 6, 7, 10, 0.0f, UNUSED, UNUSED, "Custom ESP32-C3 433MHz SX1278" }, // SX1278 @gargomoma
#else
{ 0x3c, 4, 15, 16, 0, 25, 1, 18, 26, 12, UNUSED , 14, 19, 27, 5, 0.0f, UNUSED, UNUSED, "433MHz HELTEC WiFi LoRA 32 V1" }, // SX1278 @4m1g0
{ 0x3c, 4, 15, 16, 0, 25, 2, 18, 26, 12, UNUSED , 14, 19, 27, 5, 0.0f, UNUSED, UNUSED, "863-928MHz HELTEC WiFi LoRA 32 V1" }, // SX1276
Expand Down Expand Up @@ -568,6 +571,8 @@ void ConfigManager::boardDetection()

#if CONFIG_IDF_TARGET_ESP32S3
// nothing yet
#elif CONFIG_IDF_TARGET_ESP32C3
// nothing yet
#else
if (strcmp(ESP.getChipModel(), "ESP32-PICO-D4")==0) {
itoa(LILYGO_T3_V1_6_1_LF, board, 10);
Expand Down
3 changes: 3 additions & 0 deletions tinyGS/src/ConfigManager/ConfigManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ enum boardNum
#if CONFIG_IDF_TARGET_ESP32S3
HELTEC_LORA32_V3 = 0,
ESP32S3_SX1278_LF,
#elif CONFIG_IDF_TARGET_ESP32C3
HELTEC_LORA32_HTCT62 = 0,
ESP32C3_SX1278_LF,
#else
HELTEC_V1_LF = 0,
HELTEC_V1_HF,
Expand Down
5 changes: 5 additions & 0 deletions tinyGS/src/ConfigManager/html.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ const char BOARD_NAMES[][BOARD_NAME_LENGTH] PROGMEM =
#if CONFIG_IDF_TARGET_ESP32S3
"433MHz HELTEC LORA32 V3",
"Custom ESP32-S3 433MHz SX1278",
#elif CONFIG_IDF_TARGET_ESP32C3
"433MHz HELTEC LORA32 HT-CT62 SX1262",
"Custom ESP32-C3 433MHz SX1278" ,
#else
"433MHz HELTEC WiFi LoRA 32 V1",
"863-928MHz HELTEC WiFi LoRA 32 V1",
Expand Down Expand Up @@ -58,6 +61,8 @@ constexpr auto BOARD_LENGTH = 3;

#if CONFIG_IDF_TARGET_ESP32S3
const char BOARD_VALUES[][BOARD_LENGTH] PROGMEM = {"0", "1" };
#elif CONFIG_IDF_TARGET_ESP32C3
const char BOARD_VALUES[][BOARD_LENGTH] PROGMEM = {"0", "1" };
#else
const char BOARD_VALUES[][BOARD_LENGTH] PROGMEM = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20" };
#endif
Expand Down
2 changes: 2 additions & 0 deletions tinyGS/src/Radio/Radio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ bool allow_decode=true;
Radio::Radio()
#if CONFIG_IDF_TARGET_ESP32S3
: spi(HSPI)
#elif CONFIG_IDF_TARGET_ESP32C3
: spi(SPI)
#else
: spi(VSPI)
#endif
Expand Down
4 changes: 4 additions & 0 deletions tinyGS/tinyGS.ino
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,11 @@ void wifiConnected()

void setup()
{
#if CONFIG_IDF_TARGET_ESP32C3
setCpuFrequencyMhz(160);
#else
setCpuFrequencyMhz(240);
#endif
Serial.begin(115200);
delay(100);

Expand Down