main button pin moved to webguiapp config
This commit is contained in:
parent
6f89c3a70b
commit
c36915e864
8
Kconfig
8
Kconfig
|
|
@ -16,6 +16,14 @@ menu "webguiapp configuration"
|
||||||
string "Default user password"
|
string "Default user password"
|
||||||
default "password"
|
default "password"
|
||||||
|
|
||||||
|
config MAIN_FUNCTIONAL_BUTTON_GPIO
|
||||||
|
int "Main functional button GPIO"
|
||||||
|
range -1 34
|
||||||
|
default 15
|
||||||
|
help
|
||||||
|
Set the GPIO number for main system button. Mainly needed for settings default reset. If not
|
||||||
|
used set -1
|
||||||
|
|
||||||
menu "SPI settings"
|
menu "SPI settings"
|
||||||
config WEBGUIAPP_SPI_ENABLE
|
config WEBGUIAPP_SPI_ENABLE
|
||||||
bool "Enabled SPI interface"
|
bool "Enabled SPI interface"
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,13 @@ esp_err_t WebGuiAppInit(void)
|
||||||
esp_err_t err = nvs_flash_init();
|
esp_err_t err = nvs_flash_init();
|
||||||
ESP_ERROR_CHECK(esp_netif_init());
|
ESP_ERROR_CHECK(esp_netif_init());
|
||||||
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
||||||
if (err == ESP_ERR_NVS_NO_FREE_PAGES || err == ESP_ERR_NVS_NEW_VERSION_FOUND || MANUAL_RESET == 1 || gpio_get_level(GPIO_NUM_15) == 0)
|
if (err == ESP_ERR_NVS_NO_FREE_PAGES ||
|
||||||
|
err == ESP_ERR_NVS_NEW_VERSION_FOUND ||
|
||||||
|
MANUAL_RESET == 1
|
||||||
|
#if (CONFIG_MAIN_FUNCTIONAL_BUTTON_GPIO >= 0)
|
||||||
|
|| gpio_get_level(GPIO_NUM_15) == 0
|
||||||
|
#endif
|
||||||
|
)
|
||||||
{
|
{
|
||||||
// 1.OTA app partition table has a smaller NVS partition size than the non-OTA
|
// 1.OTA app partition table has a smaller NVS partition size than the non-OTA
|
||||||
// partition table. This size mismatch may cause NVS initialization to fail.
|
// partition table. This size mismatch may cause NVS initialization to fail.
|
||||||
|
|
@ -140,43 +146,16 @@ if(GetSysConf()->wifiSettings.Flags1.bIsAP)
|
||||||
|
|
||||||
static void InitSysIO(void)
|
static void InitSysIO(void)
|
||||||
{
|
{
|
||||||
/*
|
#if (CONFIG_MAIN_FUNCTIONAL_BUTTON_GPIO >= 0)
|
||||||
gpio_pad_select_gpio(GPIO_NUM_2);
|
gpio_pad_select_gpio(CONFIG_MAIN_FUNCTIONAL_BUTTON_GPIO);
|
||||||
gpio_pad_select_gpio(GPIO_NUM_0);
|
gpio_set_direction(CONFIG_MAIN_FUNCTIONAL_BUTTON_GPIO, GPIO_MODE_INPUT);
|
||||||
gpio_pad_select_gpio(GPIO_NUM_4);
|
gpio_set_pull_mode(CONFIG_MAIN_FUNCTIONAL_BUTTON_GPIO, GPIO_PULLUP_ONLY);
|
||||||
gpio_pad_select_gpio(GPIO_NUM_34);
|
gpio_pullup_en(CONFIG_MAIN_FUNCTIONAL_BUTTON_GPIO);
|
||||||
gpio_pad_select_gpio(GPIO_NUM_16);
|
|
||||||
gpio_pad_select_gpio(GPIO_NUM_17);
|
|
||||||
gpio_pad_select_gpio(GPIO_NUM_25);
|
|
||||||
gpio_pad_select_gpio(GPIO_NUM_26);
|
|
||||||
gpio_pad_select_gpio(GPIO_NUM_27);
|
|
||||||
gpio_pad_select_gpio(GPIO_NUM_32);
|
|
||||||
gpio_pad_select_gpio(GPIO_NUM_33);
|
|
||||||
gpio_pad_select_gpio(GPIO_NUM_39);
|
|
||||||
|
|
||||||
gpio_set_direction(GPIO_NUM_0, GPIO_MODE_INPUT);
|
#endif
|
||||||
gpio_set_direction(GPIO_NUM_2, GPIO_MODE_OUTPUT);
|
|
||||||
gpio_set_direction(GPIO_NUM_4, GPIO_MODE_OUTPUT);
|
|
||||||
gpio_set_direction(GPIO_NUM_16, GPIO_MODE_OUTPUT);
|
|
||||||
gpio_set_direction(GPIO_NUM_17, GPIO_MODE_OUTPUT);
|
|
||||||
gpio_set_direction(GPIO_NUM_25, GPIO_MODE_OUTPUT);
|
|
||||||
gpio_set_direction(GPIO_NUM_26, GPIO_MODE_OUTPUT);
|
|
||||||
gpio_set_direction(GPIO_NUM_27, GPIO_MODE_INPUT);
|
|
||||||
gpio_set_direction(GPIO_NUM_32, GPIO_MODE_OUTPUT);
|
|
||||||
gpio_set_direction(GPIO_NUM_33, GPIO_MODE_INPUT);
|
|
||||||
gpio_set_direction(GPIO_NUM_34, GPIO_MODE_INPUT);
|
|
||||||
gpio_set_direction(GPIO_NUM_39, GPIO_MODE_INPUT);
|
|
||||||
|
|
||||||
gpio_set_level(GPIO_NUM_2, 1);
|
|
||||||
gpio_set_level(GPIO_NUM_4, 1);
|
|
||||||
gpio_set_level(GPIO_NUM_16, 1);
|
|
||||||
gpio_set_level(GPIO_NUM_17, 1);
|
|
||||||
gpio_set_level(GPIO_NUM_25, 0); //RELAY
|
|
||||||
gpio_set_level(GPIO_NUM_26, 0); //TRIAC
|
|
||||||
gpio_set_level(GPIO_NUM_32, 1); //0- current , 1- voltage
|
|
||||||
*/
|
|
||||||
ESP_ERROR_CHECK(gpio_install_isr_service(ESP_INTR_FLAG_IRAM));
|
ESP_ERROR_CHECK(gpio_install_isr_service(ESP_INTR_FLAG_IRAM));
|
||||||
ESP_LOGI(TAG, "GPIO initialized OK");
|
ESP_LOGI(TAG, "System GPIO's initialized OK");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user