mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-01-26 08:39:09 +03:00
GPIOs depends on board profile, #2901
This commit is contained in:
@@ -489,13 +489,19 @@ const ApplicationSettings = () => {
|
||||
name="board_profile"
|
||||
label={LL.BOARD_PROFILE()}
|
||||
value={data.board_profile}
|
||||
disabled={processingBoard || hardwareData.model.startsWith('BBQKees')}
|
||||
disabled={processingBoard}
|
||||
variant="outlined"
|
||||
onChange={changeBoardProfile}
|
||||
margin="normal"
|
||||
select
|
||||
>
|
||||
{boardProfileItems}
|
||||
{hardwareData.model.startsWith('BBQKees') ? (
|
||||
<MenuItem key={hardwareData.board} value={hardwareData.board}>
|
||||
{BOARD_PROFILES[hardwareData.board as BoardProfileKey]}
|
||||
</MenuItem>
|
||||
) : (
|
||||
boardProfileItems
|
||||
)}
|
||||
<Divider />
|
||||
<MenuItem key={'CUSTOM'} value={'CUSTOM'}>
|
||||
{LL.CUSTOM()}…
|
||||
|
||||
@@ -50,6 +50,7 @@ export interface SystemStatus {
|
||||
free_psram?: number;
|
||||
free_caps: number;
|
||||
model: string;
|
||||
board: string;
|
||||
has_loader: boolean;
|
||||
has_partition: boolean;
|
||||
partitions: {
|
||||
|
||||
@@ -2400,12 +2400,16 @@ bool System::load_board_profile(std::vector<int8_t> & data, const std::string &
|
||||
return false; // unknown, return false
|
||||
} else if (board_profile == "S32") {
|
||||
data = {2, 18, 23, 5, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0, 0}; // BBQKees Gateway S32
|
||||
valid_system_gpios_ = {0, 2, 5, 18, 23};
|
||||
} else if (board_profile == "E32") {
|
||||
data = {2, 4, 5, 17, 33, PHY_type::PHY_TYPE_LAN8720, 16, 1, 0, 0}; // BBQKees Gateway E32
|
||||
valid_system_gpios_ = {0, 2, 4, 5, 16, 17, 33};
|
||||
} else if (board_profile == "E32V2") {
|
||||
data = {2, 14, 4, 5, 34, PHY_type::PHY_TYPE_LAN8720, 15, 0, 1, 0}; // BBQKees Gateway E32 V2
|
||||
valid_system_gpios_ = {0, 2, 4, 5, 14, 15, 34};
|
||||
} else if (board_profile == "E32V2_2") {
|
||||
data = {32, 14, 4, 5, 34, PHY_type::PHY_TYPE_LAN8720, 15, 0, 1, 1}; // BBQKees Gateway E32 V2.2, rgb led
|
||||
valid_system_gpios_ = {0, 2, 4, 5, 14, 15, 32, 34, 36, 39}; // system analogs 36, 39, led 2
|
||||
} else if (board_profile == "MH-ET") {
|
||||
data = {2, 18, 23, 5, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0, 0}; // MH-ET Live D1 Mini
|
||||
} else if (board_profile == "NODEMCU") {
|
||||
@@ -2428,6 +2432,7 @@ bool System::load_board_profile(std::vector<int8_t> & data, const std::string &
|
||||
data = {17, 18, 8, 5, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0, 0}; // Liligo S3
|
||||
} else if (board_profile == "S32S3") {
|
||||
data = {2, 18, 5, 17, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0, 0}; // BBQKees Gateway S3
|
||||
valid_system_gpios_ = {0, 2, 5, 17, 18};
|
||||
} else {
|
||||
return false; // unknown, return false
|
||||
}
|
||||
@@ -2956,6 +2961,7 @@ void System::set_valid_system_gpios() {
|
||||
#elif defined(EMSESP_STANDALONE)
|
||||
valid_system_gpios_ = string_range_to_vector("0-39");
|
||||
#endif
|
||||
valid_system_gpios_.shrink_to_fit();
|
||||
}
|
||||
|
||||
// check if a pin is valid ESP32 pin and if not already used, add to the used gpio list
|
||||
|
||||
@@ -422,7 +422,7 @@ void WebSettings::set_board_profile(WebSettings & settings) {
|
||||
// Note 2: The board profile is dynamically changed for the session, but the value in the settings file on the FS remains untouched
|
||||
if (EMSESP::system_.getBBQKeesGatewayDetails(FUSE_VALUE::MFG).startsWith("BBQKees")) {
|
||||
String bbq_board = EMSESP::system_.getBBQKeesGatewayDetails(FUSE_VALUE::BOARD);
|
||||
if (!bbq_board.isEmpty()) {
|
||||
if (!bbq_board.isEmpty() && settings.board_profile != "CUSTOM") {
|
||||
#if defined(EMSESP_DEBUG)
|
||||
EMSESP::logger().info("Overriding board profile with fuse value %s", bbq_board.c_str());
|
||||
#endif
|
||||
|
||||
@@ -49,8 +49,6 @@ void WebStatusService::systemStatus(AsyncWebServerRequest * request) {
|
||||
auto * response = new AsyncJsonResponse(false);
|
||||
JsonObject root = response->getRoot();
|
||||
|
||||
root["emsesp_version"] = EMSESP_APP_VERSION;
|
||||
|
||||
//
|
||||
// System Status
|
||||
//
|
||||
@@ -130,6 +128,7 @@ void WebStatusService::systemStatus(AsyncWebServerRequest * request) {
|
||||
root["free_psram"] = ESP.getFreePsram() / 1024;
|
||||
}
|
||||
root["model"] = EMSESP::system_.getBBQKeesGatewayDetails();
|
||||
root["board"] = EMSESP::system_.getBBQKeesGatewayDetails(FUSE_VALUE::BOARD);
|
||||
#if CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S2
|
||||
root["temperature"] = (int)Helpers::transformNumFloat(EMSESP::system_.temperature(), 0, EMSESP::system_.fahrenheit() ? 2 : 0); // only 2 decimal places
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user