Open jukrut opened 1 week ago
This works fine on at least S3 and C6
Seems like on ESP32 we power down RTC ram while we don't do it for S3/C6 by default for deep-sleep
However, it's already user configurable. This should make it work for ESP32:
let timer = TimerWakeupSource::new(core::time::Duration::from_secs(1));
println!("sleeping!");
delay.delay_millis(100);
let mut cfg = RtcSleepConfig::deep();
cfg.set_rtc_fastmem_pd_en(false);
rtc.sleep(&cfg, &[&timer]);
We probably want to use similar defaults for different chips. (So not closing this now)
Thx I can confirm it works now as expected.
Sounds very good to have that the default in the future.
My €.02:
I don't think we can win here. On one hand, we can optimize for lowest power by default, then we'll have questions like this. We can improve documentation I guess to make the situation better. On the other hand, if we optimize for defaults that don't break users' expectations, we'll end up with questions like "why does deep-sleep consume too much power?". Again, documentation could help with that, too.
But what even are defaults the users want? What features do we want to keep enabled to satisfy everybody? I think esp-hal should aim for lowest power by default, then allow users to turn back on what they need.
I think esp-hal should aim for lowest power by default, then allow users to turn back on what they need.
In general what we do specifically is less important to me, but being consistent is. With that said I agree with this, we should default to lowest power.
And probably we should improve documentation (i.e. state what deep and light-sleep defaults are)
I totally agree. It can't be perfect for all situations. It's probably a question of target audience..
The only problem I had was : that the example code didn't work.
If there would be a deep sleep example without persistence and lower power defaults or low power optimization and a example with persistence that had the other settings.
of course documentation would also be nice... but for me a example says more then 1000 words.
In my xp as a developer with other tooling, libs or so: I am happy if the defaults work and I had to further optimize for e.g. performance or low power..
Bug description
I cloned the esp-hal repo and ran the
ram.rs
example with a little adjustment:and either I misunderstand ram(rtc_fast, persistent) or something somewhere doesn't work like it should :)
running it and grep for SOME_PERS...
with this code (esp-idf-template):
it works as expected.
To Reproduce
Expected behavior
data is persisted and updated (incremented in this special case)
Environment