button press to initiate wifi connection

This commit is contained in:
Morgan 'ARR\!' Allen 2019-09-14 18:52:29 -07:00
parent 996a8b687f
commit 29dc7460e9

View file

@ -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);