button press to initiate wifi connection
This commit is contained in:
parent
996a8b687f
commit
29dc7460e9
1 changed files with 13 additions and 0 deletions
13
main/main.c
13
main/main.c
|
@ -290,6 +290,19 @@ void gpio_loop() {
|
|||
|
||||
for(;;) {
|
||||
if(xQueueReceive(gpio_evt_queue, &io_num, portMAX_DELAY)) {
|
||||
EventBits_t ev_bits = xEventGroupGetBits(wm_event_group);
|
||||
|
||||
if(ev_bits & (WIFI_SCANNING|WIFI_CONNECTING)) {
|
||||
ESP_LOGI(TAG, "Scan or connection in progress...");
|
||||
continue;
|
||||
}
|
||||
|
||||
if((ev_bits & WIFI_CONNECTED) == 0) {
|
||||
ESP_LOGI(TAG, "No connectiong, connecting");
|
||||
wifi_manager_scan();
|
||||
continue;
|
||||
}
|
||||
|
||||
uint8_t level = gpio_get_level(io_num);
|
||||
printf("GPIO[%d] intr, val: %d\n", io_num, level);
|
||||
|
||||
|
|
Loading…
Reference in a new issue