summaryrefslogtreecommitdiff
path: root/apps/plugins/rockbox_flash.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/rockbox_flash.c')
-rw-r--r--apps/plugins/rockbox_flash.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/apps/plugins/rockbox_flash.c b/apps/plugins/rockbox_flash.c
index e01cc012ee..91d440e1e0 100644
--- a/apps/plugins/rockbox_flash.c
+++ b/apps/plugins/rockbox_flash.c
@@ -625,8 +625,6 @@ void DoUserDialog(char* filename)
UINT32 crc;
bool show_greet = false;
- rb->lcd_setfont(FONT_SYSFIXED);
-
/* this can only work if Rockbox runs in DRAM, not flash ROM */
if ((UINT8*)rb >= FB && (UINT8*)rb < FB + 4096*1024) /* 4 MB max */
{ /* we're running from flash */
@@ -634,6 +632,13 @@ void DoUserDialog(char* filename)
return; /* exit */
}
+ /* refuse to work if the power may fail meanwhile */
+ if (!rb->battery_level_safe())
+ {
+ rb->splash(HZ*3, true, "Battery too low!");
+ return; /* exit */
+ }
+
/* "allocate" memory */
sector = rb->plugin_get_buffer(&memleft);
if (memleft < SECTORSIZE) /* need buffer for a flash sector */
@@ -642,6 +647,8 @@ void DoUserDialog(char* filename)
return; /* exit */
}
+ rb->lcd_setfont(FONT_SYSFIXED);
+
pos = (void*)GetSecondImage();
rc = GetFlashInfo(&FlashInfo);
@@ -824,6 +831,13 @@ void DoUserDialog(char* filename)
return; /* exit */
}
+ /* refuse to work if the power may fail meanwhile */
+ if (!rb->battery_level_safe())
+ {
+ rb->splash(HZ*3, true, "Batt. too low!");
+ return; /* exit */
+ }
+
/* "allocate" memory */
sector = rb->plugin_get_buffer(&memleft);
if (memleft < SECTORSIZE) /* need buffer for a flash sector */