use crate::firmware::firmware_state::{AppCrashesStep, FirmwareState, HubHomeStep}; use crate::firmware::prometeu_context::PrometeuContext; use prometeu_hal::log::{LogLevel, LogSource}; use prometeu_system::task::TaskId; #[derive(Debug, Clone)] pub struct SystemRunningStep { pub task_id: TaskId, } impl SystemRunningStep { pub fn new(task_id: TaskId) -> Self { Self { task_id } } pub fn on_enter(&mut self, ctx: &mut PrometeuContext) { ctx.os.log(LogLevel::Info, LogSource::Hub, 0, "Entering SystemRunning".to_string()); } pub fn on_update(&mut self, ctx: &mut PrometeuContext) -> Option { let outcome = ctx.hub.update_system_profile(ctx.os, ctx.vm, ctx.signals, ctx.hw); if let Some(report) = outcome.crash { let _ = ctx.os.crash_task(self.task_id, Some(&report)); return Some(FirmwareState::AppCrashes(AppCrashesStep { report })); } if !outcome.focused_window_active { return Some(FirmwareState::HubHome(HubHomeStep)); } None } pub fn on_exit(&mut self, _ctx: &mut PrometeuContext) {} }