summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/debug_menu.c84
1 files changed, 78 insertions, 6 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 0db0e5a471..beee39a09b 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -1649,15 +1649,87 @@ static bool view_battery(void)
1649 charger_inserted() ? "present" : "absent"); 1649 charger_inserted() ? "present" : "absent");
1650 lcd_puts(0, 3, buf); 1650 lcd_puts(0, 3, buf);
1651#if defined TOSHIBA_GIGABEAT_S 1651#if defined TOSHIBA_GIGABEAT_S
1652 int line = 4;
1653 unsigned int st;
1654
1655 static const unsigned char * const chrgstate_strings[] =
1656 {
1657 "Disabled",
1658 "Error",
1659 "Discharging",
1660 "Precharge",
1661 "Constant Voltage",
1662 "Constant Current",
1663 "<unknown>",
1664 };
1665
1666 st = power_input_status() &
1667 (POWER_INPUT_CHARGER | POWER_INPUT_BATTERY);
1668 snprintf(buf, 30, "%s%s",
1669 (st & POWER_INPUT_MAIN_CHARGER) ? " Main" : "",
1670 (st & POWER_INPUT_USB_CHARGER) ? " USB" : "");
1671 lcd_puts(0, line++, buf);
1672
1673 snprintf(buf, 30, "IUSB Max: %d", usb_allowed_current());
1674 lcd_puts(0, line++, buf);
1675
1676 y = ARRAYLEN(chrgstate_strings) - 1;
1677
1678 switch (charge_state)
1679 {
1680 case CHARGE_STATE_DISABLED: y--;
1681 case CHARGE_STATE_ERROR: y--;
1682 case DISCHARGING: y--;
1683 case TRICKLE: y--;
1684 case TOPOFF: y--;
1685 case CHARGING: y--;
1686 default:;
1687 }
1688
1689 snprintf(buf, 30, "State: %s", chrgstate_strings[y]);
1690 lcd_puts(0, line++, buf);
1691
1692 snprintf(buf, 30, "Battery Switch: %s",
1693 (st & POWER_INPUT_BATTERY) ? "On" : "Off");
1694 lcd_puts(0, line++, buf);
1695
1696 y = chrgraw_adc_voltage();
1697 snprintf(buf, 30, "CHRGRAW: %d.%03d V",
1698 y / 1000, y % 1000);
1699 lcd_puts(0, line++, buf);
1700
1701 y = application_supply_adc_voltage();
1702 snprintf(buf, 30, "BP : %d.%03d V",
1703 y / 1000, y % 1000);
1704 lcd_puts(0, line++, buf);
1705
1652 y = battery_adc_charge_current(); 1706 y = battery_adc_charge_current();
1653 x = y < 0 ? '-' : ' '; 1707 if (y < 0) x = '-', y = -y;
1654 y = abs(y); 1708 else x = ' ';
1655 snprintf(buf, 30, "I Charge:%c%d.%03d A", (char)x, y / 1000, y % 1000); 1709 snprintf(buf, 30, "CHRGISN:%c%d mA", x, y);
1656 lcd_puts(0, 4, buf); 1710 lcd_puts(0, line++, buf);
1711
1712 y = cccv_regulator_dissipation();
1713 snprintf(buf, 30, "P CCCV : %d mW", y);
1714 lcd_puts(0, line++, buf);
1715
1716 y = battery_charge_current();
1717 if (y < 0) x = '-', y = -y;
1718 else x = ' ';
1719 snprintf(buf, 30, "I Charge:%c%d mA", x, y);
1720 lcd_puts(0, line++, buf);
1657 1721
1658 y = battery_adc_temp(); 1722 y = battery_adc_temp();
1659 snprintf(buf, 30, "T Battery: %dC (%dF)", y, (9*y + 160) / 5); 1723
1660 lcd_puts(0, 5, buf); 1724 if (y != INT_MIN) {
1725 snprintf(buf, 30, "T Battery: %dC (%dF)", y,
1726 (9*y + 160) / 5);
1727 } else {
1728 /* Conversion disabled */
1729 snprintf(buf, 30, "T Battery: ?");
1730 }
1731
1732 lcd_puts(0, line++, buf);
1661#endif /* defined TOSHIBA_GIGABEAT_S */ 1733#endif /* defined TOSHIBA_GIGABEAT_S */
1662#endif /* defined IPOD_NANO || defined IPOD_VIDEO */ 1734#endif /* defined IPOD_NANO || defined IPOD_VIDEO */
1663#endif /* CONFIG_CHARGING != CHARGING_CONTROL */ 1735#endif /* CONFIG_CHARGING != CHARGING_CONTROL */