stop0 working

This commit is contained in:
Priec
2025-12-14 11:56:09 +01:00
parent 58561ec392
commit 49cc8dcc71
5 changed files with 44 additions and 1 deletions

View File

@@ -40,6 +40,7 @@ pub struct StopModeConfig {
#[derive(Debug, Clone, Copy, PartialEq, Eq, defmt::Format)]
pub enum StopMode {
Stop0,
Stop1,
Stop2,
Stop3,
@@ -80,17 +81,26 @@ pub async fn uart_cmd_task() {
b'3' => CMD_CH.send(LowPowerCmd::Standby).await,
b'4' => CMD_CH.send(LowPowerCmd::Shutdown).await,
b'5' => {
let _ = PIPE_HW_TX.write(b"Enter Stop mode number (1-3): ").await;
let _ = PIPE_HW_TX.write(b"Enter Stop mode number (0-3): ").await;
b.fill(0);
let n = PIPE_HW_RX.read(&mut b).await;
if n == 0 { print_menu().await; continue; }
let stop_mode = match b[0] {
b'0' => StopMode::Stop0,
b'1' => StopMode::Stop1,
b'2' => StopMode::Stop2,
b'3' => StopMode::Stop3,
_ => { print_menu().await; continue; }
};
if matches!(stop_mode, StopMode::Stop0) {
CMD_CH.send(LowPowerCmd::StopMode(StopModeConfig {
mode: stop_mode,
entry: StopEntry::Wfi, // to tu je, lebo nejdem prepisovat kod, kvoli
// posratemu halu co si nevie urobit konzistentnost
})).await;
continue;
}
let _ = PIPE_HW_TX.write(b"Enter entry method (1=WFI,2=WFE,3=WFE no clear): ").await;
b.fill(0);
let n = PIPE_HW_RX.read(&mut b).await;