Closed Serhii-the-Dev closed 1 month ago
well take() can only called once. As it "takes out the peripheral tree", From that central struct you then hand out the handles where you need. If you call it a second time you will get a None. And since you are unwrapping it just panics
well take() can only called once. As it "takes out the peripheral tree", From that central struct you then hand out the handles where you need. If you call it a second time you will get a None. And since you are unwrapping it just panics
Thank you, I've just put the drivers creation on top of the main
with a single call to the Peripherals::take
and now it's working. Sorry for a false alarm, I'm closing the issue.
When there are two parallel async tasks and each of those tasks tries to
Peripherals::take()
the code crashes on the very moment a second task invokes that method. It seems the issue is tied to atomics somehow however I'm not familiar nor with MCUs in general nor with ESP-IDF architecture to elaborate on that. The MCU used: ESP32-PICO-D4 on a LILYGO dev board. I have a demo program that setups a WiFi hotspot and runs UART listener in parallel, the idea is to have a board connected to another device via serial and control it from a laptop/phone for a limited timespan (kind of a first-time-setup scenario), however the panic could be reproduced on any other example which includes the parallel async tasks scenario. Here is my sample code (also adding demo.zip with a full project):The trace I have: