mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
add E32V2 board profile, fix autodetect and GPIOs
This commit is contained in:
@@ -8,8 +8,7 @@ export const GPIO_VALIDATOR = {
|
|||||||
if (
|
if (
|
||||||
value &&
|
value &&
|
||||||
(value === 1 ||
|
(value === 1 ||
|
||||||
(value >= 6 && value <= 12) ||
|
(value >= 6 && value <= 11) ||
|
||||||
(value >= 14 && value <= 15) ||
|
|
||||||
value === 20 ||
|
value === 20 ||
|
||||||
value === 24 ||
|
value === 24 ||
|
||||||
(value >= 28 && value <= 31) ||
|
(value >= 28 && value <= 31) ||
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ static void setup_commands(std::shared_ptr<Commands> & commands) {
|
|||||||
std::vector<int8_t> data; // led, dallas, rx, tx, button, phy_type, eth_power, eth_phy_addr, eth_clock_mode
|
std::vector<int8_t> data; // led, dallas, rx, tx, button, phy_type, eth_power, eth_phy_addr, eth_clock_mode
|
||||||
std::string board_profile = Helpers::toUpper(arguments.front());
|
std::string board_profile = Helpers::toUpper(arguments.front());
|
||||||
if (!to_app(shell).system_.load_board_profile(data, board_profile)) {
|
if (!to_app(shell).system_.load_board_profile(data, board_profile)) {
|
||||||
shell.println("Invalid board profile (S32, E32, MH-ET, NODEMCU, OLIMEX, OLIMEXPOE, C3MINI, S2MINI, S3MINI, CUSTOM)");
|
shell.println("Invalid board profile (S32, E32, E32V2, MH-ET, NODEMCU, OLIMEX, OLIMEXPOE, C3MINI, S2MINI, S3MINI, CUSTOM)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
to_app(shell).webSettingsService.update(
|
to_app(shell).webSettingsService.update(
|
||||||
|
|||||||
@@ -391,7 +391,7 @@ void System::wifi_tweak() {
|
|||||||
// and https://nodemcu.readthedocs.io/en/dev-esp32/modules/gpio/
|
// and https://nodemcu.readthedocs.io/en/dev-esp32/modules/gpio/
|
||||||
bool System::is_valid_gpio(uint8_t pin) {
|
bool System::is_valid_gpio(uint8_t pin) {
|
||||||
#if CONFIG_IDF_TARGET_ESP32 || EMSESP_STANDALONE
|
#if CONFIG_IDF_TARGET_ESP32 || EMSESP_STANDALONE
|
||||||
if ((pin == 1) || (pin >= 6 && pin <= 12) || (pin >= 14 && pin <= 15) || (pin == 20) || (pin == 24) || (pin >= 28 && pin <= 31) || (pin > 40)) {
|
if ((pin == 1) || (pin >= 6 && pin <= 11) || (pin == 20) || (pin == 24) || (pin >= 28 && pin <= 31) || (pin > 40)) {
|
||||||
#elif CONFIG_IDF_TARGET_ESP32S2
|
#elif CONFIG_IDF_TARGET_ESP32S2
|
||||||
if ((pin >= 19 && pin <= 20) || (pin >= 22 && pin <= 32) || (pin > 40)) {
|
if ((pin >= 19 && pin <= 20) || (pin >= 22 && pin <= 32) || (pin > 40)) {
|
||||||
#elif CONFIG_IDF_TARGET_ESP32C3
|
#elif CONFIG_IDF_TARGET_ESP32C3
|
||||||
@@ -1440,6 +1440,8 @@ bool System::load_board_profile(std::vector<int8_t> & data, const std::string &
|
|||||||
data = {2, 18, 23, 5, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0}; // BBQKees Gateway S32
|
data = {2, 18, 23, 5, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0}; // BBQKees Gateway S32
|
||||||
} else if (board_profile == "E32") {
|
} else if (board_profile == "E32") {
|
||||||
data = {2, 4, 5, 17, 33, PHY_type::PHY_TYPE_LAN8720, 16, 1, 0}; // BBQKees Gateway E32
|
data = {2, 4, 5, 17, 33, PHY_type::PHY_TYPE_LAN8720, 16, 1, 0}; // BBQKees Gateway E32
|
||||||
|
} else if (board_profile == "E32V2") {
|
||||||
|
data = {2, 14, 4, 5, 0, PHY_type::PHY_TYPE_LAN8720, 15, 0, 1}; // BBQKees Gateway E32 V2
|
||||||
} else if (board_profile == "MH-ET") {
|
} else if (board_profile == "MH-ET") {
|
||||||
data = {2, 18, 23, 5, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0}; // MH-ET Live D1 Mini
|
data = {2, 18, 23, 5, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0}; // MH-ET Live D1 Mini
|
||||||
} else if (board_profile == "NODEMCU") {
|
} else if (board_profile == "NODEMCU") {
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
#define EMSESP_APP_VERSION "3.6.3-dev.4a"
|
#define EMSESP_APP_VERSION "3.6.3-dev.4b"
|
||||||
|
|||||||
@@ -101,16 +101,45 @@ StateUpdateResult WebSettings::update(JsonObject & root, WebSettings & settings)
|
|||||||
if (!System::load_board_profile(data, settings.board_profile.c_str())) {
|
if (!System::load_board_profile(data, settings.board_profile.c_str())) {
|
||||||
// unknown, check for ethernet, use default E32/S32
|
// unknown, check for ethernet, use default E32/S32
|
||||||
// data is led, dallas, rx, tx, pbutton, phy, eth_power, eth_addr, eth_clock
|
// data is led, dallas, rx, tx, pbutton, phy, eth_power, eth_addr, eth_clock
|
||||||
#ifndef EMSESP_STANDALONE
|
#if CONFIG_IDF_TARGET_ESP32 && !defined(EMSESP_STANDALONE)
|
||||||
#if CONFIG_IDF_TARGET_ESP32
|
switch (EMSESP::nvs_.getUChar("boot")) {
|
||||||
|
case 0:
|
||||||
if (ETH.begin((eth_phy_type_t)1, 16, 23, 18, ETH_PHY_LAN8720, ETH_CLOCK_GPIO0_IN)) {
|
if (ETH.begin((eth_phy_type_t)1, 16, 23, 18, ETH_PHY_LAN8720, ETH_CLOCK_GPIO0_IN)) {
|
||||||
// BBQKees Gateway E32
|
EMSESP::nvs_.putUChar("boot", 2); // set to E32
|
||||||
data = {EMSESP_DEFAULT_LED_GPIO, 4, 5, 17, 33, PHY_type::PHY_TYPE_LAN8720, 16, 1, 0};
|
ESP.restart();
|
||||||
|
}
|
||||||
|
EMSESP::nvs_.putUChar("boot", 1); // next test for E32V2
|
||||||
|
ESP.restart();
|
||||||
|
case 1:
|
||||||
|
if (ETH.begin((eth_phy_type_t)0, 15, 23, 18, ETH_PHY_LAN8720, ETH_CLOCK_GPIO0_OUT)) {
|
||||||
|
EMSESP::nvs_.putUChar("boot", 3); // set to E32V2
|
||||||
|
ESP.restart();
|
||||||
|
}
|
||||||
|
EMSESP::nvs_.putUChar("boot", 4); // set to S32
|
||||||
|
ESP.restart();
|
||||||
|
case 2:
|
||||||
settings.board_profile = "E32";
|
settings.board_profile = "E32";
|
||||||
} else
|
data = {EMSESP_DEFAULT_LED_GPIO, 4, 5, 17, 33, PHY_type::PHY_TYPE_LAN8720, 16, 1, 0};
|
||||||
#endif
|
break;
|
||||||
#endif
|
case 3:
|
||||||
{
|
settings.board_profile = "E32V2";
|
||||||
|
data = {EMSESP_DEFAULT_LED_GPIO, 14, 4, 5, 0, PHY_type::PHY_TYPE_LAN8720, 15, 0, 1}; // BBQKees Gateway E32 V2
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
default:
|
||||||
|
settings.board_profile = "S32";
|
||||||
|
data = {EMSESP_DEFAULT_LED_GPIO,
|
||||||
|
EMSESP_DEFAULT_DALLAS_GPIO,
|
||||||
|
EMSESP_DEFAULT_RX_GPIO,
|
||||||
|
EMSESP_DEFAULT_TX_GPIO,
|
||||||
|
EMSESP_DEFAULT_PBUTTON_GPIO,
|
||||||
|
EMSESP_DEFAULT_PHY_TYPE,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#else
|
||||||
// BBQKees Gateway S32
|
// BBQKees Gateway S32
|
||||||
data = {EMSESP_DEFAULT_LED_GPIO,
|
data = {EMSESP_DEFAULT_LED_GPIO,
|
||||||
EMSESP_DEFAULT_DALLAS_GPIO,
|
EMSESP_DEFAULT_DALLAS_GPIO,
|
||||||
@@ -122,7 +151,7 @@ StateUpdateResult WebSettings::update(JsonObject & root, WebSettings & settings)
|
|||||||
0,
|
0,
|
||||||
0};
|
0};
|
||||||
settings.board_profile = "S32";
|
settings.board_profile = "S32";
|
||||||
}
|
#endif
|
||||||
EMSESP::logger().info("No board profile found. Re-setting to %s", settings.board_profile.c_str());
|
EMSESP::logger().info("No board profile found. Re-setting to %s", settings.board_profile.c_str());
|
||||||
} else {
|
} else {
|
||||||
EMSESP::logger().info("Loading board profile %s", settings.board_profile.c_str());
|
EMSESP::logger().info("Loading board profile %s", settings.board_profile.c_str());
|
||||||
|
|||||||
Reference in New Issue
Block a user