esp8266-sniffer
esp8266-sniffer copied to clipboard
Optimization?
Hi,
Is sdk_wifi_promiscuous_enable the best way to handle all incoming packages. Isn't it better to handle the packages in the loop of the Arduino program somehow?
Why? what makes loop() better than the proper way using sdk_wifi_set_promiscuous_rx_cb?
https://www.espressif.com/sites/default/files/documentation/2c-esp8266_non_os_sdk_api_reference_en.pdf
Btw @toncho11, don't open an issue for each answer :)
Sorry. I need a forum or e-mail.
I need a realtime execution (or as fast as possible) for a medical experiment, so that is why I need to understand if there is a better way.
If you use the loop for all the work, you will obtain worse results since the main loop is blocking other processes and consuming high cpu cycles. Using a the sdk_wifi_set_promiscuous_rx_cb, it will only call your callback function when is needed because packets were received, in such a way of an interruption, leaving the main loop on hold in the meantime and getting back to the main loop after that.
Anyway, I'm not an expert so I recommend you to explore and ask in the official forums https://bbs.espressif.com/search.php?keywords=sdk_wifi_set_promiscuous_rx_cb&sid=19e580006660c7ec05cc11e72b6a469f
I need a realtime execution (or as fast as possible) for a medical experiment, so that is why I need to understand if there is a better way.
Then you need to get out of the Arduino ecosystem and write a proper interrupt driven state machine. You're NEVER going to get deterministic functionality out of polled IO and blocking functions like delay(). Both bad practice when real time is a requirement.