Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimization? #16

Open
toncho11 opened this issue Sep 3, 2020 · 5 comments
Open

Optimization? #16

toncho11 opened this issue Sep 3, 2020 · 5 comments

Comments

@toncho11
Copy link

toncho11 commented Sep 3, 2020

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?

@kalanda
Copy link
Owner

kalanda commented Sep 3, 2020

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

@kalanda
Copy link
Owner

kalanda commented Sep 3, 2020

Btw @toncho11, don't open an issue for each answer :)

@toncho11
Copy link
Author

toncho11 commented Sep 4, 2020

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.

@kalanda
Copy link
Owner

kalanda commented Sep 4, 2020

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

@playaspec
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants