add better loading feedback in various configs

This commit is contained in:
bunnie 2025-10-05 16:59:55 +08:00
parent 0f98c3bea1
commit 07ec63a1b3

View file

@ -279,48 +279,51 @@ pub fn usb_ep1_bulk_out_complete(
("none", 0) ("none", 0)
} }
}; };
if status != 0 if status != 0 && status % UX_UPDATE_INTERVAL_BYTES == 0 {
&& status % UX_UPDATE_INTERVAL_BYTES == 0 if IS_BAOSEC.load(Ordering::SeqCst) {
&& IS_BAOSEC.load(Ordering::SeqCst) // conjure a pointer to the sh1107 object
{ let iox = Iox::new(utralib::utra::iox::HW_IOX_BASE as *mut u32);
// conjure a pointer to the sh1107 object let (channel, _, _, _) = bao1x_hal::board::get_display_pins();
let iox = Iox::new(utralib::utra::iox::HW_IOX_BASE as *mut u32); // these parameters are copied out of the sh1107 driver. Maybe we should just
let (channel, _, _, _) = bao1x_hal::board::get_display_pins(); // create a convenience function that "just sets
// these parameters are copied out of the sh1107 driver. Maybe we should just create // these" since hardware peripherals don't
// a convenience function that "just sets these" since hardware peripherals don't // spontaneously move around, and when they do you'd like to have a single spot to
// spontaneously move around, and when they do you'd like to have a single spot to // maintain the changes...
// maintain the changes... let mut sh1107 = unsafe {
let mut sh1107 = unsafe { Oled128x128::from_raw_parts(
Oled128x128::from_raw_parts( (
( match channel {
match channel { SpimChannel::Channel0 => utra::udma_spim_0::HW_UDMA_SPIM_0_BASE,
SpimChannel::Channel0 => utra::udma_spim_0::HW_UDMA_SPIM_0_BASE, SpimChannel::Channel1 => utra::udma_spim_1::HW_UDMA_SPIM_1_BASE,
SpimChannel::Channel1 => utra::udma_spim_1::HW_UDMA_SPIM_1_BASE, SpimChannel::Channel2 => utra::udma_spim_2::HW_UDMA_SPIM_2_BASE,
SpimChannel::Channel2 => utra::udma_spim_2::HW_UDMA_SPIM_2_BASE, SpimChannel::Channel3 => utra::udma_spim_3::HW_UDMA_SPIM_3_BASE,
SpimChannel::Channel3 => utra::udma_spim_3::HW_UDMA_SPIM_3_BASE, },
}, SpimCs::Cs0,
SpimCs::Cs0, 0,
0, 0,
0, None,
None, SpimMode::Standard,
SpimMode::Standard, SpimByteAlign::Disable,
SpimByteAlign::Disable, bao1x_hal::ifram::IframRange::from_raw_parts(
bao1x_hal::ifram::IframRange::from_raw_parts( bao1x_hal::board::DISPLAY_IFRAM_ADDR,
bao1x_hal::board::DISPLAY_IFRAM_ADDR, bao1x_hal::board::DISPLAY_IFRAM_ADDR,
bao1x_hal::board::DISPLAY_IFRAM_ADDR, 4096 * 2,
4096 * 2, ),
2048 + 256,
2048,
0,
), ),
2048 + 256, &iox,
2048, )
0, };
), // have to restore this because the frame buffer is lost on the raw-parts
&iox, // conversion
) sh1107.blit_screen(&ux_api::bitmaps::baochip128x128::BITMAP);
}; let msg = alloc::format!("{} - {}k", partition, status / 1024);
// have to restore this because the frame buffer is lost on the raw-parts conversion crate::marquee(&mut sh1107, &msg);
sh1107.blit_screen(&ux_api::bitmaps::baochip128x128::BITMAP); } else {
let msg = alloc::format!("{} - {}k", partition, status / 1024); crate::println_d!("{} - {}k", partition, status / 1024);
crate::marquee(&mut sh1107, &msg); }
} }
} }
// replace the tracking block with the new one, if a new one was provided // replace the tracking block with the new one, if a new one was provided