From a6be3714a3e65ba87db6adeef23777d21d5ab9a3 Mon Sep 17 00:00:00 2001 From: CTCaer Date: Tue, 5 May 2020 19:02:01 +0300 Subject: [PATCH] ums: Update Nyx status bar during UMS --- nyx/nyx_gui/usb/usb_gadget_ums.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/nyx/nyx_gui/usb/usb_gadget_ums.c b/nyx/nyx_gui/usb/usb_gadget_ums.c index da2b4bc..0758cd7 100644 --- a/nyx/nyx_gui/usb/usb_gadget_ums.c +++ b/nyx/nyx_gui/usb/usb_gadget_ums.c @@ -1740,6 +1740,25 @@ static void handle_exception(usbd_gadget_ums_t *ums, bulk_ctxt_t *bulk_ctxt) } } +static inline void _system_maintainance(usbd_gadget_ums_t *ums) +{ + static u32 timer_dram = 0; + static u32 timer_status_bar = 0; + + u32 time = get_tmr_ms(); + + if (timer_dram < time) + { + minerva_periodic_training(); + timer_dram = get_tmr_ms() + 100; + } + else if (timer_status_bar < time) + { + ums->system_maintenance(true); + timer_status_bar = get_tmr_ms() + 30000; + } +} + int usb_device_gadget_ums(usb_ctxt_t *usbs) { int res = 0; @@ -1818,7 +1837,8 @@ int usb_device_gadget_ums(usb_ctxt_t *usbs) do { - minerva_periodic_training(); + // Do DRAM training and update system tasks. + _system_maintainance(&ums); // Check for force unmount button combo. if (btn_read_vol() == (BTN_VOL_UP | BTN_VOL_DOWN))