implements PLN-0105
This commit is contained in:
@@ -3,10 +3,7 @@ use crate::firmware::prometeu_context::PrometeuContext;
|
||||
use prometeu_hal::color::Color;
|
||||
use prometeu_hal::log::{LogLevel, LogSource};
|
||||
use prometeu_hal::primitives::Rect;
|
||||
use prometeu_hal::{
|
||||
FrameId, GfxUiCommand, LegacyHardwareRenderSubmissionSink, RenderSubmission,
|
||||
RenderSubmissionSink, ShellUiFramePacket,
|
||||
};
|
||||
use prometeu_hal::{FrameId, GfxUiCommand, RenderSubmission, ShellUiFramePacket};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct SplashScreenStep {
|
||||
@@ -17,7 +14,7 @@ impl SplashScreenStep {
|
||||
pub fn on_enter(&mut self, ctx: &mut PrometeuContext) {
|
||||
ctx.os.log(LogLevel::Info, LogSource::Pos, 0, "Showing SplashScreen".to_string());
|
||||
// Play sound on enter
|
||||
// ctx.hw.audio_mut().play(0, 0, 0, 255, 127, 1.0, 0, LoopMode::Off);
|
||||
// ctx.platform.audio_mut().play(0, 0, 0, 255, 127, 1.0, 0, LoopMode::Off);
|
||||
}
|
||||
|
||||
pub fn on_update(&mut self, ctx: &mut PrometeuContext) -> Option<FirmwareState> {
|
||||
@@ -25,10 +22,10 @@ impl SplashScreenStep {
|
||||
const TOTAL_DURATION: u32 = 240; // 4 seconds total (updated from 2s based on total_duration logic)
|
||||
|
||||
// Update peripherals for input
|
||||
ctx.hw.pad_mut().begin_frame(ctx.signals);
|
||||
ctx.platform.input_mut().pad_mut().begin_frame(ctx.signals);
|
||||
|
||||
// Draw expanding square
|
||||
let (sw, sh) = ctx.hw.gfx().size();
|
||||
let (sw, sh) = ctx.platform.display_size();
|
||||
let max_size = (sw.min(sh) as i32 / 2).max(1);
|
||||
|
||||
let current_size = if self.frame < ANIMATION_DURATION {
|
||||
@@ -47,13 +44,14 @@ impl SplashScreenStep {
|
||||
color: Color::WHITE,
|
||||
},
|
||||
]);
|
||||
LegacyHardwareRenderSubmissionSink::new(ctx.hw)
|
||||
ctx.platform
|
||||
.render_submission_sink()
|
||||
.submit_render_submission(RenderSubmission::shell_ui(FrameId::ZERO, packet))
|
||||
.expect("firmware splash render submission should publish");
|
||||
|
||||
// Transition logic
|
||||
// If any button is pressed at any time after the animation ends
|
||||
if self.frame >= ANIMATION_DURATION && ctx.hw.pad().any() {
|
||||
if self.frame >= ANIMATION_DURATION && ctx.platform.input().pad().any() {
|
||||
return Some(FirmwareState::LaunchHub(LaunchHubStep));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user