espressif / esp-rainmaker

ESP RainMaker Agent for firmware development
Apache License 2.0
431 stars 145 forks source link

WiFi event block other processes (MEGH-4615) #262

Closed nravin5 closed 1 year ago

nravin5 commented 1 year ago

Answers checklist.

General issue report

/ Wait for Wi-Fi connection / xEventGroupWaitBits(wifi_event_group, WIFI_CONNECTED_EVENT, false, true, portMAX_DELAY);

this function in app_wifi.c blocks other operations when there is no wifi....or not provisioning.

in case of we read push button input we can not get value until wifi get connected.

shahpiyushv commented 1 year ago

This particular call just blocks the main task, and not any others. How exactly are you managing your button events?

nravin5 commented 1 year ago

we use while loop to read pin status.... when device starts it waiting for Wi-Fi is get connected, when its connected every things work well, but if not connected it will wait.....

sanketwadekar commented 1 year ago

@nravin5 You could create a separate task to read the pin status.

shahpiyushv commented 1 year ago

@nravin5, any reason why you aren't using interrupts? Does your application actually need some polling? Please remember to add a delay in your loop, even if you create your own task, so that it doesn't hog the CPU.

nravin5 commented 1 year ago

@nravin5, any reason why you aren't using interrupts? Does your application actually need some polling? Please remember to add a delay in your loop, even if you create your own task, so that it doesn't hog the CPU.

At hardware level if there is any type wire connection issue or push pin rusting or any thing which creates random trigger in that case the interrupts are disturbing the whole system. In another case we can control when and how I want to read the pin values.... as my priority is run each function one by one not interrupting to others is my use case "home automation Project"