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:
@@ -626,7 +626,7 @@ impl Esp<'_> {
|
|||||||
Ok(*stack)
|
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.
|
// 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 let Ok(cur) = self.ota.current_ota_state() {
|
||||||
if cur == OtaImageState::PendingVerify {
|
if cur == OtaImageState::PendingVerify {
|
||||||
|
|||||||
@@ -104,8 +104,8 @@ impl<'a> BoardInteraction<'a> for Initial<'a> {
|
|||||||
bail!("Please configure board revision")
|
bail!("Please configure board revision")
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn deep_sleep(&mut self, duration_in_ms: u64) -> ! {
|
async fn deep_sleep_ms(&mut self, duration_in_ms: u64) -> ! {
|
||||||
self.esp.deep_sleep(duration_in_ms);
|
self.esp.deep_sleep_ms(duration_in_ms);
|
||||||
}
|
}
|
||||||
fn is_day(&self) -> bool {
|
fn is_day(&self) -> bool {
|
||||||
false
|
false
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ pub trait BoardInteraction<'a> {
|
|||||||
async fn get_time(&mut self) -> DateTime<Utc>;
|
async fn get_time(&mut self) -> DateTime<Utc>;
|
||||||
async fn set_time(&mut self, time: &DateTime<FixedOffset>) -> FatResult<()>;
|
async fn set_time(&mut self, time: &DateTime<FixedOffset>) -> FatResult<()>;
|
||||||
async fn set_charge_indicator(&mut self, charging: bool) -> Result<(), FatError>;
|
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;
|
fn is_day(&self) -> bool;
|
||||||
//should be multsampled
|
//should be multsampled
|
||||||
|
|||||||
@@ -217,9 +217,9 @@ impl<'a> BoardInteraction<'a> for V3<'a> {
|
|||||||
Ok(())
|
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();
|
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 {
|
fn is_day(&self) -> bool {
|
||||||
|
|||||||
@@ -341,10 +341,10 @@ impl<'a> BoardInteraction<'a> for V4<'a> {
|
|||||||
self.charger.set_charge_indicator(charging)
|
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.awake.set_low();
|
||||||
self.charger.power_save();
|
self.charger.power_save();
|
||||||
self.esp.deep_sleep(duration_in_ms);
|
self.esp.deep_sleep_ms(duration_in_ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_day(&self) -> bool {
|
fn is_day(&self) -> bool {
|
||||||
|
|||||||
@@ -596,7 +596,7 @@ async fn safe_main(spawner: Spawner) -> FatResult<()> {
|
|||||||
board.board_hal.get_esp().set_restart_to_conf(false);
|
board.board_hal.get_esp().set_restart_to_conf(false);
|
||||||
board
|
board
|
||||||
.board_hal
|
.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;
|
.await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -991,7 +991,7 @@ async fn wait_infinity(
|
|||||||
board.board_hal.get_esp().set_restart_to_conf(false);
|
board.board_hal.get_esp().set_restart_to_conf(false);
|
||||||
// ensure clean http answer / visible confirmation
|
// ensure clean http answer / visible confirmation
|
||||||
Timer::after_millis(500).await;
|
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.
|
// Short tick while holding so the pattern updates smoothly.
|
||||||
@@ -1100,7 +1100,7 @@ async fn wait_infinity(
|
|||||||
.lock()
|
.lock()
|
||||||
.await
|
.await
|
||||||
.board_hal
|
.board_hal
|
||||||
.deep_sleep(0)
|
.deep_sleep_ms(0) // not sleeping smells like a hidden reset, we should call it that!
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user