guild icon
Toit
#:question: ESPnow & Wifi alternaltely possible ?
Thread channel in help
kaxori
kaxori 04/21/2025 04:03 PM
I got a simple ESPnow-example working.
Jag is disabled for a long time and a boot button press is used to exit the app.

Now it would be nice to switch programmatically between ESPnow and Wifi (MQTT, ...).
Is that possible ?
kaxoriOPkaxori
I got a simple ESPnow-example working. Jag is disabled for a long time and a boot button press is used to exit the app. Now it would be nice to switch programmatically between ES...
floitsch
floitsch 04/22/2025 08:42 AM
At the moment WiFi and ESPNow can't run at the same time.
You would need to coordinate the uses of WiFi and ESPNow to make this work.
Jaguar doesn't really have a way to be controlled from the outside (except for the -D flags.This means that you can't run Jaguar while having a container that sporadically connects to EPSNow.

The following options would fix this:
- allow WiFi and EPSNow at the same time. In theory the ESP-IDF supports this (as long as EPSNow uses the same channel as the WiFi). That's work that would probably need to be done by us.
- change Jaguar so it has a way to disconnect from WiFi. Maybe add a service to it that allows you to ask it to turn off the WiFi for a period of time. We did something similar in Artemis.
- use your own Jaguar implementation. Jaguar is getting more complicated with time, but the basics are really simple. You can probably reimplement a mini-version in ~100 lines of code? We did something similar for our testing: https://github.com/toitlang/toit/blob/master/tests/hw/esp-tester/mini-jag.toit
- implement a network service. Jaguar uses the standard network service which, by default, uses WiFi. However, you could add your own network service that supports disconnecting from WiFi. Artemis uses this to support other networks than WiFi (while still using net.open). This is basically a cleaner version of "change Jaguar" from above, since you get the same behavior but without changing Jaguar itself.

If you are interested in trying one of these options, let me know, and I can try to provide more information.
Program your microcontrollers in a fast and robust high-level language. - toitlang/toit
kaxori
kaxori 04/22/2025 10:50 AM
Thank you for the info.
I prefer to implement a simple message gateway by serial coupling of two ESPs.
floitsch
floitsch 04/22/2025 10:51 AM
I was thinking of doing the same thing.
The best solution would be to support running espnow and wifi at the same time. Unfortunately that requires a bit of low-level work.
floitsch
floitsch 04/22/2025 10:52 AM
If only one side can initiate the communication then you can just shut-down that side before you communicate on the other one.
floitsch
floitsch 04/22/2025 10:52 AM
However, if both sides can send a message, then there is currently no really nice solution.
kaxori
kaxori 04/22/2025 11:00 AM
In the current ESPnow experimental state, I want to implement a remote operated, battery driven bell (outdoor notification).
If this goes well, there will definitely be more remote-controlled devices in the garden. Their connection to my Home Assistant would then be easily possible via MQTT using that gateway.
kaxoriOPkaxori
In the current ESPnow experimental state, I want to implement a remote operated, battery driven bell (outdoor notification). If this goes well, there will definitely be more remot...
floitsch
floitsch 04/22/2025 02:55 PM
In that case you could have a receiver-esp listen to esp-now messages, and switch to WiFi whenever it receives one.
8 messages in total