mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
set EMSESP_DEFAULT_BOARD_PROFILE nd store to NVS
This commit is contained in:
@@ -96,6 +96,7 @@ board_build.partitions = esp32_partition_16M.csv
|
||||
build_flags =
|
||||
${common.build_flags}
|
||||
-O2
|
||||
-DEMSESP_DEFAULT_BOARD_PROFILE = "S32S3"
|
||||
build_unflags = ${common.unbuild_flags}
|
||||
|
||||
[env:esp32_4M]
|
||||
@@ -127,7 +128,9 @@ extends = espressi32_base_tasmota
|
||||
board = lolin_c3_mini
|
||||
board_upload.flash_size = 4MB
|
||||
board_build.partitions = esp32_partition_4M.csv
|
||||
build_flags = ${common.build_flags}
|
||||
build_flags =
|
||||
${common.build_flags}
|
||||
-DEMSESP_DEFAULT_BOARD_PROFILE = "C3MINI"
|
||||
|
||||
; lolin C3 mini v1 needs special wifi init.
|
||||
; https://www.wemos.cc/en/latest/c3/c3_mini_1_0_0.html#about-wifi
|
||||
@@ -139,13 +142,16 @@ board_build.partitions = esp32_partition_4M.csv
|
||||
build_flags =
|
||||
${common.build_flags}
|
||||
-DBOARD_C3_MINI_V1
|
||||
-DEMSESP_DEFAULT_BOARD_PROFILE = "C3MINI"
|
||||
|
||||
[env:lolin_s2_mini]
|
||||
extends = espressi32_base_tasmota
|
||||
board = lolin_s2_mini
|
||||
board_upload.flash_size = 4MB
|
||||
board_build.partitions = esp32_partition_4M.csv
|
||||
build_flags = ${common.build_flags}
|
||||
build_flags =
|
||||
${common.build_flags}
|
||||
-DEMSESP_DEFAULT_BOARD_PROFILE = "S2MINI"
|
||||
|
||||
[env:lolin_s3]
|
||||
extends = espressi32_base
|
||||
@@ -158,6 +164,7 @@ board_upload.wait_for_upload_port = false
|
||||
build_flags =
|
||||
${common.build_flags}
|
||||
-O2
|
||||
-DEMSESP_DEFAULT_BOARD_PROFILE = "S32S3"
|
||||
|
||||
; to build and run: pio run -e standalone -t exec
|
||||
[env:standalone]
|
||||
|
||||
@@ -87,6 +87,11 @@ StateUpdateResult WebSettings::update(JsonObject & root, WebSettings & settings)
|
||||
|
||||
// load default GPIO configuration based on board profile
|
||||
std::vector<int8_t> data; // // led, dallas, rx, tx, button, phy_type, eth_power, eth_phy_addr, eth_clock_mode
|
||||
settings.board_profile = root["board_profile"] | EMSESP_DEFAULT_BOARD_PROFILE;
|
||||
if ((String)EMSESP_DEFAULT_BOARD_PROFILE != "default" && EMSESP::nvs_.getString("boot") == "") {
|
||||
EMSESP::nvs_.putString("boot", EMSESP_DEFAULT_BOARD_PROFILE);
|
||||
}
|
||||
/*
|
||||
#if CONFIG_IDF_TARGET_ESP32C3
|
||||
settings.board_profile = root["board_profile"] | "C3MINI";
|
||||
#elif CONFIG_IDF_TARGET_ESP32S2
|
||||
@@ -97,12 +102,12 @@ StateUpdateResult WebSettings::update(JsonObject & root, WebSettings & settings)
|
||||
#elif CONFIG_IDF_TARGET_ESP32
|
||||
settings.board_profile = root["board_profile"] | EMSESP_DEFAULT_BOARD_PROFILE;
|
||||
#endif
|
||||
|
||||
*/
|
||||
if (!System::load_board_profile(data, settings.board_profile.c_str())) {
|
||||
// unknown, check for NVS or scan for ethernet, use default E32/E32V2/S32
|
||||
#if CONFIG_IDF_TARGET_ESP32 && !defined(EMSESP_STANDALONE)
|
||||
settings.board_profile = EMSESP::nvs_.getString("boot");
|
||||
if (!System::load_board_profile(data, settings.board_profile.c_str())) {
|
||||
#if CONFIG_IDF_TARGET_ESP32 && !defined(EMSESP_STANDALONE)
|
||||
if (settings.board_profile == "") { // empty: new test
|
||||
if (ETH.begin((eth_phy_type_t)1, 16, 23, 18, ETH_PHY_LAN8720, ETH_CLOCK_GPIO0_IN)) {
|
||||
EMSESP::nvs_.putString("boot", "E32");
|
||||
@@ -119,11 +124,11 @@ StateUpdateResult WebSettings::update(JsonObject & root, WebSettings & settings)
|
||||
EMSESP::nvs_.putString("boot", "S32");
|
||||
}
|
||||
ESP.restart();
|
||||
}
|
||||
#else
|
||||
settings.board_profile = "S32";
|
||||
System::load_board_profile(data, settings.board_profile.c_str());
|
||||
#endif
|
||||
}
|
||||
EMSESP::logger().info("No board profile found. Re-setting to %s", settings.board_profile.c_str());
|
||||
} else {
|
||||
EMSESP::logger().info("Loading board profile %s", settings.board_profile.c_str());
|
||||
|
||||
Reference in New Issue
Block a user