rename deepsleep to deep_sleep_ms for clarity on expected duration

in main deep sleep was larger than required by a factor of 1000, fixed
this an renamed function to make expected duration count size obvious
from the name
This commit is contained in:
2026-05-05 22:02:46 +02:00
parent d9aa96a3cb
commit e15e78cc26
6 changed files with 11 additions and 11 deletions

View File

@@ -626,7 +626,7 @@ impl Esp<'_> {
Ok(*stack)
}
pub fn deep_sleep(&mut self, duration_in_ms: u64) -> ! {
pub fn deep_sleep_ms(&mut self, duration_in_ms: u64) -> ! {
// Mark the current OTA image as valid if we reached here while in pending verify.
if let Ok(cur) = self.ota.current_ota_state() {
if cur == OtaImageState::PendingVerify {

View File

@@ -104,8 +104,8 @@ impl<'a> BoardInteraction<'a> for Initial<'a> {
bail!("Please configure board revision")
}
async fn deep_sleep(&mut self, duration_in_ms: u64) -> ! {
self.esp.deep_sleep(duration_in_ms);
async fn deep_sleep_ms(&mut self, duration_in_ms: u64) -> ! {
self.esp.deep_sleep_ms(duration_in_ms);
}
fn is_day(&self) -> bool {
false

View File

@@ -215,7 +215,7 @@ pub trait BoardInteraction<'a> {
async fn get_time(&mut self) -> DateTime<Utc>;
async fn set_time(&mut self, time: &DateTime<FixedOffset>) -> FatResult<()>;
async fn set_charge_indicator(&mut self, charging: bool) -> Result<(), FatError>;
async fn deep_sleep(&mut self, duration_in_ms: u64) -> !;
async fn deep_sleep_ms(&mut self, duration_in_ms: u64) -> !;
fn is_day(&self) -> bool;
//should be multsampled

View File

@@ -217,9 +217,9 @@ impl<'a> BoardInteraction<'a> for V3<'a> {
Ok(())
}
async fn deep_sleep(&mut self, duration_in_ms: u64) -> ! {
async fn deep_sleep_ms(&mut self, duration_in_ms: u64) -> ! {
let _ = self.shift_register.lock().await.decompose()[AWAKE].set_low();
self.esp.deep_sleep(duration_in_ms)
self.esp.deep_sleep_ms(duration_in_ms)
}
fn is_day(&self) -> bool {

View File

@@ -341,10 +341,10 @@ impl<'a> BoardInteraction<'a> for V4<'a> {
self.charger.set_charge_indicator(charging)
}
async fn deep_sleep(&mut self, duration_in_ms: u64) -> ! {
async fn deep_sleep_ms(&mut self, duration_in_ms: u64) -> ! {
self.awake.set_low();
self.charger.power_save();
self.esp.deep_sleep(duration_in_ms);
self.esp.deep_sleep_ms(duration_in_ms);
}
fn is_day(&self) -> bool {

View File

@@ -596,7 +596,7 @@ async fn safe_main(spawner: Spawner) -> FatResult<()> {
board.board_hal.get_esp().set_restart_to_conf(false);
board
.board_hal
.deep_sleep(1000 * 1000 * 60 * deep_sleep_duration_minutes as u64)
.deep_sleep_ms(1000 * 60 * deep_sleep_duration_minutes as u64)
.await;
}
}
@@ -991,7 +991,7 @@ async fn wait_infinity(
board.board_hal.get_esp().set_restart_to_conf(false);
// ensure clean http answer / visible confirmation
Timer::after_millis(500).await;
board.board_hal.deep_sleep(0).await;
board.board_hal.deep_sleep_ms(0).await; // not sleeping smells like a hidden reset, we should call it that!
}
// Short tick while holding so the pattern updates smoothly.
@@ -1100,7 +1100,7 @@ async fn wait_infinity(
.lock()
.await
.board_hal
.deep_sleep(0)
.deep_sleep_ms(0) // not sleeping smells like a hidden reset, we should call it that!
.await;
}
}