diff --git a/interface/src/project/types.ts b/interface/src/project/types.ts index aa7230ed6..db1ae49a4 100644 --- a/interface/src/project/types.ts +++ b/interface/src/project/types.ts @@ -252,7 +252,8 @@ export const BOARD_PROFILES: BoardProfiles = { OLIMEX: 'Olimex ESP32-EVB', OLIMEXPOE: 'Olimex ESP32-POE', C3MINI: 'Wemos C3 Mini', - S2MINI: 'Wemos S2 Mini' + S2MINI: 'Wemos S2 Mini', + S3MINI: 'Liligo S3' }; export interface BoardProfileName { diff --git a/lib/framework/UploadFileService.cpp b/lib/framework/UploadFileService.cpp index b876a195b..40e26b342 100644 --- a/lib/framework/UploadFileService.cpp +++ b/lib/framework/UploadFileService.cpp @@ -70,6 +70,11 @@ void UploadFileService::handleUpload(AsyncWebServerRequest * request, const Stri handleError(request, 503); // service unavailable return; } +#elif CONFIG_IDF_TARGET_ESP32S3 + if (len > 12 && (data[0] != 0xE9 || data[12] != 3)) { + handleError(request, 503); // service unavailable + return; + } #endif // it's firmware - initialize the ArduinoOTA updater if (Update.begin(fsize)) { diff --git a/mock-api/server.js b/mock-api/server.js index d8f33fcf9..93af73526 100644 --- a/mock-api/server.js +++ b/mock-api/server.js @@ -1188,6 +1188,17 @@ rest_server.post(EMSESP_BOARDPROFILE_ENDPOINT, (req, res) => { data.eth_power = 0 data.eth_phy_addr = 0 data.eth_clock_mode = 0 + } else if (board_profile == 'S3MINI') { + // Liligo S3 mini + data.led_gpio = 17 + data.dallas_gpio = 18 + data.rx_gpio = 8 + data.tx_gpio = 5 + data.pbutton_gpio = 0 + data.phy_type = 0 + data.eth_power = 0 + data.eth_phy_addr = 0 + data.eth_clock_mode = 0 } console.log('boardProfile POST. Sending back, profile: ' + board_profile + ', ' + 'data: ' + JSON.stringify(data)) diff --git a/platformio.ini b/platformio.ini index 87989d63a..c9d28f52f 100644 --- a/platformio.ini +++ b/platformio.ini @@ -118,3 +118,15 @@ board_upload.flash_size = 4MB board_build.partitions = esp32_partition_4M.csv build_flags = ${common.build_flags} build_unflags = ${common.unbuild_flags} + +[env:esp32s3] +extra_scripts = + pre:scripts/build_interface.py + scripts/rename_fw.py +board = lolin_s3 +platform = espressif32@5.2.0 +board_upload.flash_size = 16MB +board_build.partitions = esp32_partition_16M.csv +build_flags = ${common.build_flags} +build_unflags = ${common.unbuild_flags} +upload_protocol = esptool diff --git a/src/console.cpp b/src/console.cpp index 3720f89f7..97931863b 100644 --- a/src/console.cpp +++ b/src/console.cpp @@ -694,7 +694,7 @@ void Console::load_system_commands(unsigned int context) { std::vector data; // led, dallas, rx, tx, button, phy_type, eth_power, eth_phy_addr, eth_clock_mode std::string board_profile = Helpers::toUpper(arguments.front()); if (!EMSESP::system_.load_board_profile(data, board_profile)) { - shell.println("Invalid board profile (S32, E32, MH-ET, NODEMCU, OLIMEX, OLIMEXPOE, C3MINI, S2MINI, CUSTOM)"); + shell.println("Invalid board profile (S32, E32, MH-ET, NODEMCU, OLIMEX, OLIMEXPOE, C3MINI, S2MINI, S3MINI, CUSTOM)"); return; } EMSESP::webSettingsService.update( diff --git a/src/default_settings.h b/src/default_settings.h index 4366eb4c7..83e426435 100644 --- a/src/default_settings.h +++ b/src/default_settings.h @@ -236,6 +236,8 @@ enum { #define EMSESP_PLATFORM "ESP32-C3"; #elif CONFIG_IDF_TARGET_ESP32S2 #define EMSESP_PLATFORM "ESP32-S2"; +#elif CONFIG_IDF_TARGET_ESP32S3 +#define EMSESP_PLATFORM "ESP32-S3"; #elif CONFIG_IDF_TARGET_ESP32 || EMSESP_STANDALONE #define EMSESP_PLATFORM "ESP32"; #else diff --git a/src/system.cpp b/src/system.cpp index 5e51fc49f..21a904d49 100644 --- a/src/system.cpp +++ b/src/system.cpp @@ -33,6 +33,8 @@ #include "../esp32s2/rom/rtc.h" #elif CONFIG_IDF_TARGET_ESP32C3 #include "../esp32c3/rom/rtc.h" +#elif CONFIG_IDF_TARGET_ESP32S3 +#include "../esp32s3/rom/rtc.h" #else #error Target CONFIG_IDF_TARGET is not supported #endif @@ -369,6 +371,8 @@ bool System::is_valid_gpio(uint8_t pin) { #elif CONFIG_IDF_TARGET_ESP32C3 // https://www.wemos.cc/en/latest/c3/c3_mini.html if ((pin >= 11 && pin <= 19) || (pin > 21)) { +#elif CONFIG_IDF_TARGET_ESP32S3 + if ((pin >= 19 && pin <= 20) || (pin >= 22 && pin <= 37) || (pin >= 39 && pin <= 42) || (pin > 48)) { #endif return false; // bad pin } @@ -1418,7 +1422,9 @@ bool System::load_board_profile(std::vector & data, const std::string & } else if (board_profile == "C3MINI") { data = {7, 1, 4, 5, 9, PHY_type::PHY_TYPE_NONE, 0, 0, 0}; // Lolin C3 Mini } else if (board_profile == "S2MINI") { - data = {15, 7, 11, 12, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0}; //Lolin S2 Mini + data = {15, 7, 11, 12, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0}; // Lolin S2 Mini + } else if (board_profile == "S3MINI") { + data = {17, 18, 8, 5, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0}; // Liligo S3 } else if (board_profile == "CUSTOM") { // send back current values data = {(int8_t)EMSESP::system_.led_gpio_, diff --git a/src/web/WebSettingsService.cpp b/src/web/WebSettingsService.cpp index 451d14000..1d9e33e5b 100644 --- a/src/web/WebSettingsService.cpp +++ b/src/web/WebSettingsService.cpp @@ -91,6 +91,8 @@ StateUpdateResult WebSettings::update(JsonObject & root, WebSettings & settings) settings.board_profile = root["board_profile"] | "C3MINI"; #elif CONFIG_IDF_TARGET_ESP32S2 settings.board_profile = root["board_profile"] | "S2MINI"; +#elif CONFIG_IDF_TARGET_ESP32S3 + settings.board_profile = root["board_profile"] | "S3MINI"; #elif CONFIG_IDF_TARGET_ESP32 settings.board_profile = root["board_profile"] | EMSESP_DEFAULT_BOARD_PROFILE; #endif