Skip to content

Commit

Permalink
Merge pull request #225 from gargomoma/beta
Browse files Browse the repository at this point in the history
Add ESP32-C3 support
  • Loading branch information
G4lile0 authored Mar 8, 2024
2 parents 5c4785b + 746e3b3 commit 2a6ef1e
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 0 deletions.
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

0 comments on commit 2a6ef1e

Please sign in to comment.