Skip to content

Commit

Permalink
Merge pull request #233 from G4lile0/beta
Browse files Browse the repository at this point in the history
beta to master sync
  • Loading branch information
G4lile0 authored Mar 16, 2024
2 parents 5c4785b + 4498d78 commit 8507bf9
Show file tree
Hide file tree
Showing 11 changed files with 365 additions and 94 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
111 changes: 57 additions & 54 deletions tinyGS/src/ConfigManager/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,32 +49,37 @@ na SX1281 2.4–2.5Ghz 130 5.5 2000 0.476-202

ConfigManager::ConfigManager()
: IotWebConf2(thingName, &dnsServer, &server, initialApPassword, configVersion), server(80), gsConfigHtmlFormatProvider(*this), boards({
//OLED_add, OLED_SDA, OLED_SCL, OLED_RST, PROG_BUTTON, BOARD_LED, L_SX127X?, L_NSS, L_DI00, L_DI01, L_BUSSY, L_RST, L_MISO, L_MOSI, L_SCK, L_TCXO_V, RX_EN, TX_EN, BOARD
//OLED_add, OLED_SDA, OLED_SCL, OLED_RST, PROG_BUTTON, BOARD_LED, L_SX127X?, L_NSS, L_DI00, L_DI01, L_BUSSY, L_RST, L_MISO, L_MOSI, L_SCK, L_TCXO_V, RX_EN, TX_EN, BOARD
#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
{ 0x3c, 17, 18, 21, 0, 35, RADIO_SX1262, 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, RADIO_SX1278, 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, RADIO_SX1262, 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, RADIO_SX1278, 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
{ 0x3c, 4, 15, 16, 0, 25, 1, 18, 26, 35, UNUSED , 14, 19, 27, 5, 0.0f, UNUSED, UNUSED, "433MHz HELTEC WiFi LoRA 32 V2" }, // SX1278 @4m1g0
{ 0x3c, 4, 15, 16, 0, 25, 2, 18, 26, 35, UNUSED , 14, 19, 27, 5, 0.0f, UNUSED, UNUSED, "863-928MHz HELTEC WiFi LoRA 32 V2" }, // SX1276
{ 0x3c, 4, 15, 16, 0, 2, 1, 18, 26, UNUSED, UNUSED , 14, 19, 27, 5, 0.0f, UNUSED, UNUSED, "433Mhz TTGO LoRa 32 v1" }, // SX1278 @g4lile0
{ 0x3c, 4, 15, 16, 0, 2, 2, 18, 26, UNUSED, UNUSED , 14, 19, 27, 5, 0.0f, UNUSED, UNUSED, "868-915MHz TTGO LoRa 32 v1" }, // SX1276
{ 0x3c, 21, 22, UNUSED, 0, 22, 1, 18, 26, 33, UNUSED , 14, 19, 27, 5, 0.0f, UNUSED, UNUSED, "433MHz TTGO LoRA 32 v2" }, // SX1278 @TCRobotics
{ 0x3c, 21, 22, UNUSED, 0, 22, 2, 18, 26, 33, UNUSED , 14, 19, 27, 5, 0.0f, UNUSED, UNUSED, "868-915MHz TTGO LoRA 32 v2" }, // SX1276
{ 0x3c, 21, 22, UNUSED, 39, 22, 1, 18, 26, 33, 32, 14, 19, 27, 5, 0.0f, UNUSED, UNUSED, "433MHz T-BEAM + OLED" }, // SX1278
{ 0x3c, 21, 22, 16, 39, 22, 2, 18, 26, 33, 32, 14, 19, 27, 5, 0.0f, UNUSED, UNUSED, "868-915MHz T-BEAM + OLED" }, // SX1276
{ 0x3c, 21, 22, 16, 0, 25, 5, 5, UNUSED, 27, 26, 14, 19, 23, 18, 0.0f, UNUSED, UNUSED, "Custom ESP32 Wroom + SX126x (Crystal)" }, // SX1268 @4m1g0, @lillefyr
{ 0x3c, 21, 22, UNUSED, 0, 25, 5, 18, UNUSED, 33, 32, 14, 19, 27, 5, 0.0f, UNUSED, UNUSED, "TTGO LoRa 32 V2 Modified with module SX126x (crystal)" }, // SX1268 @TCRobotics
{ 0x3c, 21, 22, 16, 0, 25, 5, 5, UNUSED, 2, 13, 26, 19, 23, 18, 1.6f, UNUSED, UNUSED, "Custom ESP32 Wroom + SX126x DRF1268T (TCX0) (5, 2, 26, 13)" }, // SX1268 @sdey76
{ 0x3c, 21, 22, 16, 0, 25, 5, 5, UNUSED, 26, 12, 14, 19, 23, 18, 1.6f, UNUSED, UNUSED, "Custom ESP32 Wroom + SX126x DRF1268T (TCX0) (5, 26, 14, 12)" }, // SX1268 @imants
{ 0x3c, 21, 22, UNUSED, 38, 22, 1, 18, 26, 33, UNUSED , 14, 19, 27, 5, 0.0f, UNUSED, UNUSED, "433MHz T-BEAM V1.0 + OLED" }, // SX1278 @fafu
{ 0x3c, 21, 22, 16, 0, 2, 5, 5, UNUSED, 34, 32, 14, 19, 27, 18, 1.6f, UNUSED, UNUSED, "433MHz FOSSA 1W Ground Station" }, // SX1268 @jgromes
{ 0x3c, 21, 22, 16, 0, 2, 2, 5, UNUSED, 34, 32, 14, 19, 27, 18, 1.6f, UNUSED, UNUSED, "868-915MHz FOSSA 1W Ground Station" }, //SX1276 @jgromes
{ 0x3c, 21, 22, UNUSED, 0, 22, 8, 5, 26, 34, 32, 14, 19, 27, 18, 0.0f, UNUSED, UNUSED, "2.4GHz ESP32 + SX1280" }, //SX1280 @g4lile0
{ 0x3c, 21, 22, UNUSED, 38, 22, 2, 18, 26, 33, UNUSED , 14, 19, 27, 5, 0.0f, UNUSED, UNUSED, "868-915MHz T-BEAM V1.0 + OLED" }, // SX1276 @fafu
{ 0x3c, 21, 22, UNUSED, 0, 25, 1, 18, 26, 33, UNUSED , 23, 19, 27, 5, 0.0f, UNUSED, UNUSED, "433MHz LILYGO T3_V1.6.1" }, // SX1278
{ 0x3c, 21, 22, UNUSED, 0, 25, 2, 18, 26, 33, UNUSED , 23, 19, 27, 5, 0.0f, UNUSED, UNUSED, "868-915MHz LILYGO T3_V1.6.1" }, // SX1276
{ 0x3c, 4, 15, 16, 0, 25, RADIO_SX1278, 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, RADIO_SX1276, 18, 26, 12, UNUSED, 14, 19, 27, 5, 0.0f, UNUSED, UNUSED, "863-928MHz HELTEC WiFi LoRA 32 V1" }, // SX1276
{ 0x3c, 4, 15, 16, 0, 25, RADIO_SX1278, 18, 26, 35, UNUSED, 14, 19, 27, 5, 0.0f, UNUSED, UNUSED, "433MHz HELTEC WiFi LoRA 32 V2" }, // SX1278 @4m1g0
{ 0x3c, 4, 15, 16, 0, 25, RADIO_SX1276, 18, 26, 35, UNUSED, 14, 19, 27, 5, 0.0f, UNUSED, UNUSED, "863-928MHz HELTEC WiFi LoRA 32 V2" }, // SX1276
{ 0x3c, 4, 15, 16, 0, 2, RADIO_SX1278, 18, 26, UNUSED, UNUSED, 14, 19, 27, 5, 0.0f, UNUSED, UNUSED, "433Mhz TTGO LoRa 32 v1" }, // SX1278 @g4lile0
{ 0x3c, 4, 15, 16, 0, 2, RADIO_SX1276, 18, 26, UNUSED, UNUSED, 14, 19, 27, 5, 0.0f, UNUSED, UNUSED, "868-915MHz TTGO LoRa 32 v1" }, // SX1276
{ 0x3c, 21, 22, UNUSED, 0, 22, RADIO_SX1278, 18, 26, 33, UNUSED, 14, 19, 27, 5, 0.0f, UNUSED, UNUSED, "433MHz TTGO LoRA 32 v2" }, // SX1278 @TCRobotics
{ 0x3c, 21, 22, 16, 0, 22, RADIO_SX1276, 18, 26, 33, UNUSED, 14, 19, 27, 5, 0.0f, UNUSED, UNUSED, "868-915MHz TTGO LoRA 32 v2" }, // SX1276
{ 0x3c, 21, 22, 16, 39, 22, RADIO_SX1278, 18, 26, 33, 32, 14, 19, 27, 5, 0.0f, UNUSED, UNUSED, "433MHz T-BEAM + OLED" }, // SX1278
{ 0x3c, 21, 22, 16, 39, 22, RADIO_SX1276, 18, 26, 33, 32, 14, 19, 27, 5, 0.0f, UNUSED, UNUSED, "868-915MHz T-BEAM + OLED" }, // SX1276
{ 0x3c, 21, 22, 16, 0, 25, RADIO_SX1268, 5, UNUSED, 27, 26, 14, 19, 23, 18, 0.0f, UNUSED, UNUSED, "Custom ESP32 Wroom + SX126x (Crystal)" }, // SX1268 @4m1g0, @lillefyr
{ 0x3c, 21, 22, UNUSED, 0, 25, RADIO_SX1268, 18, UNUSED, 33, 32, 14, 19, 27, 5, 0.0f, UNUSED, UNUSED, "TTGO LoRa 32 V2 Modified with module SX126x (crystal)" }, // SX1268 @TCRobotics
{ 0x3c, 21, 22, 16, 0, 25, RADIO_SX1268, 5, UNUSED, 2, 13, 26, 19, 23, 18, 1.6f, UNUSED, UNUSED, "Custom ESP32 Wroom + SX126x DRF1268T (TCX0) (5, 2, 26, 13)" }, // SX1268 @sdey76
{ 0x3c, 21, 22, 16, 0, 25, RADIO_SX1268, 5, UNUSED, 26, 12, 14, 19, 23, 18, 1.6f, UNUSED, UNUSED, "Custom ESP32 Wroom + SX126x DRF1268T (TCX0) (5, 26, 14, 12)" }, // SX1268 @imants
{ 0x3c, 21, 22, UNUSED, 38, 22, RADIO_SX1278, 18, 26, 33, UNUSED, 14, 19, 27, 5, 0.0f, UNUSED, UNUSED, "433MHz T-BEAM V1.0 + OLED" }, // SX1278 @fafu
{ 0x3c, 21, 22, 16, 0, 2, RADIO_SX1268, 5, UNUSED, 34, 32, 14, 19, 27, 18, 1.6f, UNUSED, UNUSED, "433MHz FOSSA 1W Ground Station" }, // SX1268 @jgromes
{ 0x3c, 21, 22, 16, 0, 2, RADIO_SX1276, 5, UNUSED, 34, 32, 14, 19, 27, 18, 1.6f, UNUSED, UNUSED, "868-915MHz FOSSA 1W Ground Station" }, //SX1276 @jgromes
{ 0x3c, 21, 22, UNUSED, 0, 22, RADIO_SX1280, 5, 26, 34, 32, 14, 19, 27, 18, 0.0f, UNUSED, UNUSED, "2.4GHz ESP32 + SX1280" }, //SX1280 @g4lile0
{ 0x3c, 21, 22, UNUSED, 38, 22, RADIO_SX1276, 18, 26, 33, UNUSED, 14, 19, 27, 5, 0.0f, UNUSED, UNUSED, "868-915MHz T-BEAM V1.0 + OLED" }, // SX1276 @fafu
{ 0x3c, 21, 22, UNUSED, 0, 25, RADIO_SX1278, 18, 26, 33, UNUSED, 23, 19, 27, 5, 0.0f, UNUSED, UNUSED, "433MHz LILYGO T3_V1.6.1" }, // SX1278
{ 0x3c, 21, 22, UNUSED, 0, 25, RADIO_SX1276, 18, 26, 33, UNUSED, 23, 19, 27, 5, 0.0f, UNUSED, UNUSED, "868-915MHz LILYGO T3_V1.6.1" }, // SX1276
{ 0x3c, 21, 22, UNUSED, 0, 25, RADIO_SX1276, 18, 26, UNUSED, 32, 23, 19, 27, 5, 0.0f, UNUSED, UNUSED, "868-915MHz LILYGO T3_V1.6.1 TCXO" }, // SX1262

#endif
})
{
Expand Down Expand Up @@ -562,41 +567,39 @@ void ConfigManager::boardDetection()
Log::error(PSTR("Automatic board detection running... "));


// If the cpu is a ESP32-PICO-D4 we know it is the Lilygo T3_v1.6.1
// and we cant use GPIO16 to test for an OLED
// If the cpu is a ESP32-PICO-D4 (Lilygo T3_v1.6.1) we have to avoid using pin GPIO16 as this is used for the FLASH_CS
// https://github.com/mpmarks/tinyGS-newboards/commit/e520086f1b43c7cea4cb85d996f0fc379f2d2786

#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);
return;
};
#endif

for (uint8_t ite = 0; ite < ((sizeof(boards) / sizeof(boards[0]))); ite++)
{
Log::error(PSTR("%s \n"), boards[ite].BOARD);
if (boards[ite].OLED__RST != UNUSED) {
pinMode(boards[ite].OLED__RST, OUTPUT);
digitalWrite(boards[ite].OLED__RST, LOW);
delay(50);
digitalWrite(boards[ite].OLED__RST, HIGH);
}
Wire.begin(boards[ite].OLED__SDA, boards[ite].OLED__SCL);
Wire.beginTransmission(boards[ite].OLED__address);
if (!Wire.endTransmission())
{
Log::error(PSTR("Compatible OLED FOUND"));
itoa(ite, board, 10);
return;
}
else
{
Log::error(PSTR("Not Compatible board found, please select it manually on the web config panel"));
}
}
if (strcmp(ESP.getChipModel(), "ESP32-PICO-D4") != 0) {
for (uint8_t ite = 0; ite < ((sizeof(boards) / sizeof(boards[0]))); ite++)
{
Log::error(PSTR("%s \n"), boards[ite].BOARD);
if (boards[ite].OLED__RST != UNUSED) {
pinMode(boards[ite].OLED__RST, OUTPUT);
digitalWrite(boards[ite].OLED__RST, LOW);
delay(25);
digitalWrite(boards[ite].OLED__RST, HIGH);
}
Wire.begin(boards[ite].OLED__SDA, boards[ite].OLED__SCL);
Wire.beginTransmission(boards[ite].OLED__address);
if (!Wire.endTransmission())
{
Log::error(PSTR("Compatible OLED FOUND"));
itoa(ite, board, 10);
return;
}
else
{
Log::error(PSTR("Not Compatible board found, please select it manually on the web config panel"));
}
}
};
#endif
}

void ConfigManager::printConfig()
Expand Down
4 changes: 4 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 All @@ -92,6 +95,7 @@ enum boardNum
TBEAM_OLED_v1_0_HF,
LILYGO_T3_V1_6_1_LF,
LILYGO_T3_V1_6_1_HF,
LILYGO_T3_V1_6_1_HF_TCXO,
#endif
NUM_BOARDS //this line always has to be the last one
};
Expand Down
8 changes: 7 additions & 1 deletion 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 All @@ -51,15 +54,18 @@ const char BOARD_NAMES[][BOARD_NAME_LENGTH] PROGMEM =
"868-915MHzT-BEAM V1.0 + OLED",
"433MHz LILYGO T3_V1.6.1",
"868-915MHz LILYGO T3_V1.6.1" ,
"868-915MHz LILYGO T3_V1.6.1 TCXO" ,
#endif
};

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" };
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" , "21"};
#endif

const char IOTWEBCONF_DASHBOARD_STYLE_INNER[] PROGMEM = "table{margin:20px auto;}h3{text-align:center;}.card{height:12em;margin:10px;text-align:left;font-family:Arial;border:3px groove;border-radius:0.3rem;display:inline-block;padding:10px;min-width:260px;}td{padding:0 10px;}textarea{resize:vertical;width:100%;margin:0;height:318px;padding:5px;overflow:auto;}#c1{width:98%;padding:5px;}#t1{width:98%}.console{display:inline-block;text-align:center;margin:10px 0;width:98%;max-width:1080px;}.G{color:green;}.R{color:red}";
Expand Down
17 changes: 13 additions & 4 deletions tinyGS/src/Display/Display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,20 @@ void displayInit()
ui->setFrames(frames, frameCount);
ui->setOverlays(overlays, overlaysCount);

#if CONFIG_IDF_TARGET_ESP32S3 // Heltec Lora 32 V3 patch to enable Vext that power OLED
if (ConfigManager::getInstance().getBoard()== HELTEC_LORA32_V3 ) {
pinMode (36, OUTPUT);
digitalWrite(36, LOW);
}
#endif

if (board.OLED__RST != UNUSED) {
pinMode(board.OLED__RST, OUTPUT);
digitalWrite(board.OLED__RST, LOW);
delay(50);
digitalWrite(board.OLED__RST, HIGH);
if (!((strcmp(ESP.getChipModel(), "ESP32-PICO-D4") == 0) && (board.OLED__RST == 16))) {
pinMode(board.OLED__RST, OUTPUT);
digitalWrite(board.OLED__RST, LOW);
delay(50);
digitalWrite(board.OLED__RST, HIGH);
}
}

/* ui init() also initialises the underlying display */
Expand Down
Loading

0 comments on commit 8507bf9

Please sign in to comment.