mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-12-30 09:46:32 -05:00
Simplify SD card mount status code.
This commit is contained in:
parent
435824e9b5
commit
5928086fd9
@ -128,31 +128,31 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
void handle_rtc_tick() {
|
||||
void update_sd_card_status() {
|
||||
const auto sd_card_present_now = sdc_lld_is_card_inserted(&SDCD1);
|
||||
if( sd_card_present_now != sd_card_present ) {
|
||||
sd_card_present = sd_card_present_now;
|
||||
|
||||
SDCardStatusMessage message { false };
|
||||
|
||||
if( sd_card_present ) {
|
||||
if( sdcConnect(&SDCD1) == CH_SUCCESS ) {
|
||||
if( sd_card::filesystem::mount() == FR_OK ) {
|
||||
SDCardStatusMessage message { true };
|
||||
context.message_map().send(&message);
|
||||
} else {
|
||||
// TODO: Error, modal warning?
|
||||
message.is_mounted = true;
|
||||
}
|
||||
} else {
|
||||
// TODO: Error, modal warning?
|
||||
}
|
||||
} else {
|
||||
sdcDisconnect(&SDCD1);
|
||||
|
||||
SDCardStatusMessage message { false };
|
||||
context.message_map().send(&message);
|
||||
}
|
||||
|
||||
context.message_map().send(&message);
|
||||
}
|
||||
}
|
||||
|
||||
void handle_rtc_tick() {
|
||||
update_sd_card_status();
|
||||
}
|
||||
|
||||
static ui::Widget* touch_widget(ui::Widget* const w, ui::TouchEvent event) {
|
||||
if( !w->hidden() ) {
|
||||
// To achieve reverse depth ordering (last object drawn is
|
||||
|
@ -250,7 +250,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
const bool is_mounted;
|
||||
bool is_mounted;
|
||||
};
|
||||
|
||||
class MessageHandlerMap {
|
||||
|
Loading…
Reference in New Issue
Block a user