summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJörg Hohensohn <hohensoh@rockbox.org>2004-10-23 16:28:06 +0000
committerJörg Hohensohn <hohensoh@rockbox.org>2004-10-23 16:28:06 +0000
commitd69c4995f67aef16ea5cc1ae881cbdfc38977e03 (patch)
treeb2a2dd4e88a3baad225c7656a74ed02edd6f113b /apps
parente9f7c1ade43857836fbeca927e90caa636fd7ee8 (diff)
downloadrockbox-d69c4995f67aef16ea5cc1ae881cbdfc38977e03.tar.gz
rockbox-d69c4995f67aef16ea5cc1ae881cbdfc38977e03.zip
the flash plugins are now checking the battery level first
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5332 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/firmware_flash.c18
-rw-r--r--apps/plugins/rockbox_flash.c18
2 files changed, 32 insertions, 4 deletions
diff --git a/apps/plugins/firmware_flash.c b/apps/plugins/firmware_flash.c
index 880b030748..972d998ca8 100644
--- a/apps/plugins/firmware_flash.c
+++ b/apps/plugins/firmware_flash.c
@@ -637,8 +637,6 @@ void DoUserDialog(char* filename)
tCheckROM result;
bool is_romless;
- 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 */
@@ -653,6 +651,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 */
+ }
+
/* check boot ROM */
result = CheckBootROM();
if (result == eUnknown)
@@ -682,6 +687,8 @@ void DoUserDialog(char* filename)
return; /* exit */
}
+ rb->lcd_setfont(FONT_SYSFIXED);
+
rc = GetFlashInfo(&FlashInfo);
ShowFlashInfo(&FlashInfo);
if (FlashInfo.size == 0) /* no valid chip */
@@ -881,6 +888,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 */
+ }
+
/* check boot ROM */
result = CheckBootROM();
if (result == eUnknown)
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 */