-
Notifications
You must be signed in to change notification settings - Fork 96
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
[ESP32] esp-wifi crashes when trying to connect via BLE #441
Comments
I have also encountered these additional errors, but cannot reliably reproduce them for now:
|
Can you run the provided examples without issues? both of the crashes sound a lot like stack or general memory corruption to me |
The ble examples work fine. I also had all parts of my own code working before, reading the sensor and connecting via bluetooth. But when I try to put it all together, I end up with these errors.
Edit: I have been able to make it work, but only by stripping out all asynchronous and embassy-related code. And it’s still very shaky, e.g. once I check if the value changed before sending a notification it breaks again. |
Ok looking again there is one obvious thing in the code - nothing weird and explainable. // Define service methods
let mut read_sensor = |_offset: usize, data: &mut [u8]| {
// Try to get last reading, otherwise send 0.0
if let Ok(value) = SENSOR_READING.try_receive() {
data.copy_from_slice(&value);
} else {
data.copy_from_slice(&[0u8; 4]);
}
4
}; The // Define service methods
let mut read_sensor = |_offset: usize, data: &mut [u8]| {
// Try to get last reading, otherwise send 0.0
if let Ok(value) = SENSOR_READING.try_receive() {
data[..4].copy_from_slice(&value);
} else {
data[..4].copy_from_slice(&[0u8; 4]);
}
4
}; |
@bjoernQ thanks, I already found and fixed that yesterday. Didn‘t notice it was still in here. |
I guess we can close this issue now |
Context
I’m working on a project using embassy and the esp-wifi crate for BLE.
I use a Lolin32-lite board with an ESP32 Rev1.
Unexpected Behaviour
When I try to connect to the ESP32 from my Android phone, the ESP32 crashes with the following error message:
Code Example
Here’s my code to reproduce the issue:
The text was updated successfully, but these errors were encountered: