summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJörg Hohensohn <hohensoh@rockbox.org>2005-03-03 07:25:43 +0000
committerJörg Hohensohn <hohensoh@rockbox.org>2005-03-03 07:25:43 +0000
commit2584896920724cd5e72caaf9b64c3ef81b45ee9f (patch)
tree672817ced4c15a673fb557e87b0091cf90e43339 /apps
parent384de102469fee4e0792df8fe38586d3206774ed (diff)
downloadrockbox-2584896920724cd5e72caaf9b64c3ef81b45ee9f.tar.gz
rockbox-2584896920724cd5e72caaf9b64c3ef81b45ee9f.zip
More aggressive Recorder V1 charging (patch #1116884 from Jerry Van Baren)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6105 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/debug_menu.c53
-rw-r--r--apps/settings.c3
-rw-r--r--apps/settings_menu.c3
3 files changed, 21 insertions, 38 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 815eb5af67..7b81869e69 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -968,7 +968,7 @@ bool dbg_mas_codec(void)
968 * The power_history array is updated in power_thread of powermgmt.c. 968 * The power_history array is updated in power_thread of powermgmt.c.
969 */ 969 */
970 970
971#define BAT_FIRST_VAL MAX(POWER_HISTORY_LEN - LCD_WIDTH - 1, 0) 971#define BAT_LAST_VAL MIN(LCD_WIDTH, POWER_HISTORY_LEN)
972#define BAT_YSPACE (LCD_HEIGHT - 20) 972#define BAT_YSPACE (LCD_HEIGHT - 20)
973 973
974bool view_battery(void) 974bool view_battery(void)
@@ -986,30 +986,32 @@ bool view_battery(void)
986 switch (view) { 986 switch (view) {
987 case 0: /* voltage history graph */ 987 case 0: /* voltage history graph */
988 /* Find maximum and minimum voltage for scaling */ 988 /* Find maximum and minimum voltage for scaling */
989 maxv = minv = 0; 989 maxv = 0;
990 for (i = BAT_FIRST_VAL; i < POWER_HISTORY_LEN; i++) { 990 minv = 65535;
991 for (i = 0; i < BAT_LAST_VAL; i++) {
991 if (power_history[i] > maxv) 992 if (power_history[i] > maxv)
992 maxv = power_history[i]; 993 maxv = power_history[i];
993 if ((minv == 0) || ((power_history[i]) && 994 if (power_history[i] && (power_history[i] < minv))
994 (power_history[i] < minv)) )
995 { 995 {
996 minv = power_history[i]; 996 minv = power_history[i];
997 } 997 }
998 } 998 }
999 999
1000 if (minv < 1) 1000 if ((minv < 1) || (minv >= 65535))
1001 minv = 1; 1001 minv = 1;
1002 if (maxv < 2) 1002 if (maxv < 2)
1003 maxv = 2; 1003 maxv = 2;
1004 1004
1005 lcd_clear_display(); 1005 lcd_clear_display();
1006 lcd_puts(0, 0, "Battery voltage:"); 1006 snprintf(buf, 30, "Battery %d.%02d", power_history[0] / 100,
1007 power_history[0] % 100);
1008 lcd_puts(0, 0, buf);
1007 snprintf(buf, 30, "scale %d.%02d-%d.%02d V", 1009 snprintf(buf, 30, "scale %d.%02d-%d.%02d V",
1008 minv / 100, minv % 100, maxv / 100, maxv % 100); 1010 minv / 100, minv % 100, maxv / 100, maxv % 100);
1009 lcd_puts(0, 1, buf); 1011 lcd_puts(0, 1, buf);
1010 1012
1011 x = 0; 1013 x = 0;
1012 for (i = BAT_FIRST_VAL+1; i < POWER_HISTORY_LEN; i++) { 1014 for (i = BAT_LAST_VAL - 1; i >= 0; i--) {
1013 y = (power_history[i] - minv) * BAT_YSPACE / (maxv - minv); 1015 y = (power_history[i] - minv) * BAT_YSPACE / (maxv - minv);
1014 lcd_clearline(x, LCD_HEIGHT-1, x, 20); 1016 lcd_clearline(x, LCD_HEIGHT-1, x, 20);
1015 lcd_drawline(x, LCD_HEIGHT-1, x, 1017 lcd_drawline(x, LCD_HEIGHT-1, x,
@@ -1035,31 +1037,15 @@ bool view_battery(void)
1035 snprintf(buf, 30, "Charger: %s", 1037 snprintf(buf, 30, "Charger: %s",
1036 charger_inserted() ? "present" : "absent"); 1038 charger_inserted() ? "present" : "absent");
1037 lcd_puts(0, 3, buf); 1039 lcd_puts(0, 3, buf);
1040#endif
1038#ifdef HAVE_CHARGE_CTRL 1041#ifdef HAVE_CHARGE_CTRL
1039 snprintf(buf, 30, "Charging: %s", 1042 snprintf(buf, 30, "Charging: %s",
1040 charger_enabled ? "yes" : "no"); 1043 charger_enabled ? "yes" : "no");
1041 lcd_puts(0, 4, buf); 1044 lcd_puts(0, 4, buf);
1042#endif 1045 snprintf(buf, 30, "short delta: %d", short_delta);
1043#endif
1044 y = ( power_history[POWER_HISTORY_LEN-1] * 100
1045 + power_history[POWER_HISTORY_LEN-2] * 100
1046 - power_history[POWER_HISTORY_LEN-1-CHARGE_END_NEGD+1] * 100
1047 - power_history[POWER_HISTORY_LEN-1-CHARGE_END_NEGD] * 100 )
1048 / CHARGE_END_NEGD / 2;
1049
1050 snprintf(buf, 30, "short delta: %d", y);
1051 lcd_puts(0, 5, buf); 1046 lcd_puts(0, 5, buf);
1052 1047 snprintf(buf, 30, "long delta: %d", long_delta);
1053 y = ( power_history[POWER_HISTORY_LEN-1] * 100
1054 + power_history[POWER_HISTORY_LEN-2] * 100
1055 - power_history[POWER_HISTORY_LEN-1-CHARGE_END_ZEROD+1] * 100
1056 - power_history[POWER_HISTORY_LEN-1-CHARGE_END_ZEROD] * 100 )
1057 / CHARGE_END_ZEROD / 2;
1058
1059 snprintf(buf, 30, "long delta: %d", y);
1060 lcd_puts(0, 6, buf); 1048 lcd_puts(0, 6, buf);
1061
1062#ifdef HAVE_CHARGE_CTRL
1063 lcd_puts(0, 7, power_message); 1049 lcd_puts(0, 7, power_message);
1064#endif 1050#endif
1065 break; 1051 break;
@@ -1069,8 +1055,7 @@ bool view_battery(void)
1069 lcd_puts(0, 0, "Voltage deltas:"); 1055 lcd_puts(0, 0, "Voltage deltas:");
1070 1056
1071 for (i = 0; i <= 6; i++) { 1057 for (i = 0; i <= 6; i++) {
1072 y = power_history[POWER_HISTORY_LEN-1-i] - 1058 y = power_history[i] - power_history[i+i];
1073 power_history[POWER_HISTORY_LEN-1-i-1];
1074 snprintf(buf, 30, "-%d min: %s%d.%02d V", i, 1059 snprintf(buf, 30, "-%d min: %s%d.%02d V", i,
1075 (y < 0) ? "-" : "", ((y < 0) ? y * -1 : y) / 100, 1060 (y < 0) ? "-" : "", ((y < 0) ? y * -1 : y) / 100,
1076 ((y < 0) ? y * -1 : y ) % 100); 1061 ((y < 0) ? y * -1 : y ) % 100);
@@ -1088,19 +1073,19 @@ bool view_battery(void)
1088 snprintf(buf, 30, "Cycle time: %d m", powermgmt_last_cycle_startstop_min); 1073 snprintf(buf, 30, "Cycle time: %d m", powermgmt_last_cycle_startstop_min);
1089 lcd_puts(0, 1, buf); 1074 lcd_puts(0, 1, buf);
1090 1075
1091 snprintf(buf, 30, "Lev.at cycle start: %d%%", powermgmt_last_cycle_level); 1076 snprintf(buf, 30, "Lvl@cyc st: %d%%", powermgmt_last_cycle_level);
1092 lcd_puts(0, 2, buf); 1077 lcd_puts(0, 2, buf);
1093#endif 1078#endif
1094 1079
1095 snprintf(buf, 30, "Last PwrHist val: %d.%02d V", 1080 snprintf(buf, 30, "Last PwrHist: %d.%02d V",
1096 power_history[POWER_HISTORY_LEN-1] / 100, 1081 power_history[0] / 100,
1097 power_history[POWER_HISTORY_LEN-1] % 100); 1082 power_history[0] % 100);
1098 lcd_puts(0, 3, buf); 1083 lcd_puts(0, 3, buf);
1099 1084
1100 snprintf(buf, 30, "battery level: %d%%", battery_level()); 1085 snprintf(buf, 30, "battery level: %d%%", battery_level());
1101 lcd_puts(0, 5, buf); 1086 lcd_puts(0, 5, buf);
1102 1087
1103 snprintf(buf, 30, "Est. remaining: %d m", battery_time()); 1088 snprintf(buf, 30, "Est. remain: %d m", battery_time());
1104 lcd_puts(0, 6, buf); 1089 lcd_puts(0, 6, buf);
1105 1090
1106#ifdef HAVE_CHARGE_CTRL 1091#ifdef HAVE_CHARGE_CTRL
diff --git a/apps/settings.c b/apps/settings.c
index 86c1178745..866f87879e 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -763,8 +763,7 @@ void settings_apply(void)
763 763
764 set_poweroff_timeout(global_settings.poweroff); 764 set_poweroff_timeout(global_settings.poweroff);
765#ifdef HAVE_CHARGE_CTRL 765#ifdef HAVE_CHARGE_CTRL
766 charge_restart_level = global_settings.discharge ? 766 enable_deep_discharge(global_settings.discharge);
767 CHARGE_RESTART_LO : CHARGE_RESTART_HI;
768 enable_trickle_charge(global_settings.trickle_charge); 767 enable_trickle_charge(global_settings.trickle_charge);
769#endif 768#endif
770 769
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
index b19f2eda3c..4d164180dc 100644
--- a/apps/settings_menu.c
+++ b/apps/settings_menu.c
@@ -727,8 +727,7 @@ static bool deep_discharge(void)
727{ 727{
728 bool result; 728 bool result;
729 result = set_bool( str(LANG_DISCHARGE), &global_settings.discharge ); 729 result = set_bool( str(LANG_DISCHARGE), &global_settings.discharge );
730 charge_restart_level = global_settings.discharge ? 730 enable_deep_discharge(global_settings.discharge);
731 CHARGE_RESTART_LO : CHARGE_RESTART_HI;
732 return result; 731 return result;
733} 732}
734static bool trickle_charge(void) 733static bool trickle_charge(void)