summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2022-03-22 16:16:11 -0400
committerWilliam Wilgus <wilgus.william@gmail.com>2022-03-22 16:16:11 -0400
commit7910f4a7aa0d713286c63b42c39973c188ea961f (patch)
treebe5e49d5ae8ea5b0241062219bc25fe110a664d6
parent61bc7b91bc7bf904d196b132e9e862e059780783 (diff)
downloadrockbox-7910f4a7aa0d713286c63b42c39973c188ea961f.tar.gz
rockbox-7910f4a7aa0d713286c63b42c39973c188ea961f.zip
debug_menu cleanup/optimize some common format strings
Change-Id: I84b070f8ea264ea64bddd82f9849ec20c72a4863
-rw-r--r--apps/debug_menu.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 9546de45db..43c74bfa28 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -370,7 +370,7 @@ static bool dbg_buffering_thread(void)
370 struct buffering_debug d; 370 struct buffering_debug d;
371 size_t filebuflen = audio_get_filebuflen(); 371 size_t filebuflen = audio_get_filebuflen();
372 /* This is a size_t, but call it a long so it puts a - when it's bad. */ 372 /* This is a size_t, but call it a long so it puts a - when it's bad. */
373 373 const char * const fmt_used = "%s: %6ld/%ld";
374#ifndef CPU_MULTI_FREQUENCY 374#ifndef CPU_MULTI_FREQUENCY
375 boost_ticks = 0; 375 boost_ticks = 0;
376#endif 376#endif
@@ -406,13 +406,13 @@ static bool dbg_buffering_thread(void)
406 screens[i].clear_display(); 406 screens[i].clear_display();
407 407
408 408
409 screens[i].putsf(0, line++, "pcm: %6ld/%ld", (long) bufused, (long) bufsize); 409 screens[i].putsf(0, line++, fmt_used, "pcm", (long) bufused, (long) bufsize);
410 410
411 gui_scrollbar_draw(&screens[i],0, line*8, screens[i].lcdwidth, 6, 411 gui_scrollbar_draw(&screens[i],0, line*8, screens[i].lcdwidth, 6,
412 bufsize, 0, bufused, HORIZONTAL); 412 bufsize, 0, bufused, HORIZONTAL);
413 line++; 413 line++;
414 414
415 screens[i].putsf(0, line++, "alloc: %6ld/%ld", audio_filebufused(), 415 screens[i].putsf(0, line++, fmt_used, "alloc", audio_filebufused(),
416 (long) filebuflen); 416 (long) filebuflen);
417 417
418#if LCD_HEIGHT > 80 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_HEIGHT > 80) 418#if LCD_HEIGHT > 80 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_HEIGHT > 80)
@@ -422,7 +422,7 @@ static bool dbg_buffering_thread(void)
422 filebuflen, 0, audio_filebufused(), HORIZONTAL); 422 filebuflen, 0, audio_filebufused(), HORIZONTAL);
423 line++; 423 line++;
424 424
425 screens[i].putsf(0, line++, "real: %6ld/%ld", (long)d.buffered_data, 425 screens[i].putsf(0, line++, fmt_used, "real", (long)d.buffered_data,
426 (long)filebuflen); 426 (long)filebuflen);
427 427
428 gui_scrollbar_draw(&screens[i],0, line*8, screens[i].lcdwidth, 6, 428 gui_scrollbar_draw(&screens[i],0, line*8, screens[i].lcdwidth, 6,
@@ -431,7 +431,7 @@ static bool dbg_buffering_thread(void)
431 } 431 }
432#endif 432#endif
433 433
434 screens[i].putsf(0, line++, "usefl: %6ld/%ld", (long)(d.useful_data), 434 screens[i].putsf(0, line++, fmt_used, "usefl", (long)(d.useful_data),
435 (long)filebuflen); 435 (long)filebuflen);
436 436
437#if LCD_HEIGHT > 80 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_HEIGHT > 80) 437#if LCD_HEIGHT > 80 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_HEIGHT > 80)
@@ -856,8 +856,7 @@ static int tsc2100debug_action_callback(int action, struct gui_synclist *lists)
856 if (action == ACTION_STD_OK) 856 if (action == ACTION_STD_OK)
857 { 857 {
858 *page = (*page+1)%3; 858 *page = (*page+1)%3;
859 snprintf(lists->title, 32, 859 snprintf(lists->title, 32, "tsc2100 registers - Page %d", *page);
860 "tsc2100 registers - Page %d", *page);
861 return ACTION_REDRAW; 860 return ACTION_REDRAW;
862 } 861 }
863 return action; 862 return action;
@@ -865,7 +864,8 @@ static int tsc2100debug_action_callback(int action, struct gui_synclist *lists)
865static bool tsc2100_debug(void) 864static bool tsc2100_debug(void)
866{ 865{
867 int page = 0; 866 int page = 0;
868 char title[32] = "tsc2100 registers - Page 0"; 867 char title[32];
868 snprintf(title, 32, "tsc2100 registers - Page %d", page);
869 struct simplelist_info info; 869 struct simplelist_info info;
870 simplelist_info_init(&info, title, 32, &page); 870 simplelist_info_init(&info, title, 32, &page);
871 info.timeout = HZ/100; 871 info.timeout = HZ/100;
@@ -916,7 +916,7 @@ static bool view_battery(void)
916 else 916 else
917 grid = 5; 917 grid = 5;
918 918
919 lcd_putsf(0, 0, "battery %d.%03dV", power_history[0] / 1000, 919 lcd_putsf(0, 0, "%s %d.%03dV", "Battery", power_history[0] / 1000,
920 power_history[0] % 1000); 920 power_history[0] % 1000);
921 lcd_putsf(0, 1, "%d.%03d-%d.%03dV (%2dmV)", 921 lcd_putsf(0, 1, "%d.%03d-%d.%03dV (%2dmV)",
922 minv / 1000, minv % 1000, maxv / 1000, maxv % 1000, 922 minv / 1000, minv % 1000, maxv / 1000, maxv % 1000,
@@ -927,7 +927,7 @@ static bool view_battery(void)
927 grid = 10; 927 grid = 10;
928 else 928 else
929 grid = 1; 929 grid = 1;
930 lcd_putsf(0, 0, "battery %d%%", power_history[0]); 930 lcd_putsf(0, 0, "%s %d%%", "Battery", power_history[0]);
931 lcd_putsf(0, 1, "%d%%-%d%% (%d %%)", minv, maxv, grid); 931 lcd_putsf(0, 1, "%d%%-%d%% (%d %%)", minv, maxv, grid);
932#endif 932#endif
933 933
@@ -982,16 +982,16 @@ static bool view_battery(void)
982 lcd_putsf(0, 0, "Pwr status: %s", 982 lcd_putsf(0, 0, "Pwr status: %s",
983 charging_state() ? "charging" : "discharging"); 983 charging_state() ? "charging" : "discharging");
984#else 984#else
985 lcd_puts(0, 0, "Power status: unknown"); 985 lcd_putsf(0, 0, "Pwr status: %s", "unknown");
986#endif 986#endif
987 battery_read_info(&y, &z); 987 battery_read_info(&y, &z);
988 if (y > 0) 988 if (y > 0)
989 lcd_putsf(0, 1, "Battery: %d.%03d V (%d %%)", y / 1000, y % 1000, z); 989 lcd_putsf(0, 1, "%s: %d.%03d V (%d %%)", "Battery", y / 1000, y % 1000, z);
990 else if (z > 0) 990 else if (z > 0)
991 lcd_putsf(0, 1, "Battery: %d %%", z); 991 lcd_putsf(0, 1, "%s: %d %%", "Battery", z);
992#ifdef ADC_EXT_POWER 992#ifdef ADC_EXT_POWER
993 y = (adc_read(ADC_EXT_POWER) * EXT_SCALE_FACTOR) / 1000; 993 y = (adc_read(ADC_EXT_POWER) * EXT_SCALE_FACTOR) / 1000;
994 lcd_putsf(0, 2, "External: %d.%03d V", y / 1000, y % 1000); 994 lcd_putsf(0, 2, "%s: %d.%03d V", "External", y / 1000, y % 1000);
995#endif 995#endif
996#if CONFIG_CHARGING 996#if CONFIG_CHARGING
997#if defined IPOD_NANO || defined IPOD_VIDEO 997#if defined IPOD_NANO || defined IPOD_VIDEO
@@ -1005,7 +1005,7 @@ static bool view_battery(void)
1005 usb_pwr ? "present" : "absent"); 1005 usb_pwr ? "present" : "absent");
1006 lcd_putsf(0, 4, "EXT pwr: %s", 1006 lcd_putsf(0, 4, "EXT pwr: %s",
1007 ext_pwr ? "present" : "absent"); 1007 ext_pwr ? "present" : "absent");
1008 lcd_putsf(0, 5, "Battery: %s", 1008 lcd_putsf(0, 5, "%s: %s", "Battery",
1009 charging ? "charging" : (usb_pwr||ext_pwr) ? "charged" : "discharging"); 1009 charging ? "charging" : (usb_pwr||ext_pwr) ? "charged" : "discharging");
1010 lcd_putsf(0, 6, "Dock mode: %s", 1010 lcd_putsf(0, 6, "Dock mode: %s",
1011 dock ? "enabled" : "disabled"); 1011 dock ? "enabled" : "disabled");
@@ -1059,7 +1059,7 @@ static bool view_battery(void)
1059 1059
1060 lcd_putsf(0, line++, "State: %s", chrgstate_strings[y]); 1060 lcd_putsf(0, line++, "State: %s", chrgstate_strings[y]);
1061 1061
1062 lcd_putsf(0, line++, "Battery Switch: %s", 1062 lcd_putsf(0, line++, "%s Switch: %s", "Battery",
1063 (st & POWER_INPUT_BATTERY) ? "On" : "Off"); 1063 (st & POWER_INPUT_BATTERY) ? "On" : "Off");
1064 1064
1065 y = chrgraw_adc_voltage(); 1065 y = chrgraw_adc_voltage();
@@ -1082,11 +1082,11 @@ static bool view_battery(void)
1082 y = battery_adc_temp(); 1082 y = battery_adc_temp();
1083 1083
1084 if (y != INT_MIN) { 1084 if (y != INT_MIN) {
1085 lcd_putsf(0, line++, "T Battery: %d\u00b0C (%d\u00b0F)", y, 1085 lcd_putsf(0, line++, "T %s: %d\u00b0C (%d\u00b0F)",
1086 (9*y + 160) / 5); 1086 "Battery", y, (9*y + 160) / 5);
1087 } else { 1087 } else {
1088 /* Conversion disabled */ 1088 /* Conversion disabled */
1089 lcd_puts(0, line++, "T Battery: ?"); 1089 lcd_putsf(0, line++, "T %s: ?", "Battery");
1090 } 1090 }
1091#elif defined(HAVE_AS3514) && CONFIG_CHARGING 1091#elif defined(HAVE_AS3514) && CONFIG_CHARGING
1092 static const char * const chrgstate_strings[] = 1092 static const char * const chrgstate_strings[] =
@@ -1113,7 +1113,7 @@ static bool view_battery(void)
1113 y = pmu_read_battery_voltage(); 1113 y = pmu_read_battery_voltage();
1114 lcd_putsf(17, 1, "RAW: %d.%03d V", y / 1000, y % 1000); 1114 lcd_putsf(17, 1, "RAW: %d.%03d V", y / 1000, y % 1000);
1115 y = pmu_read_battery_current(); 1115 y = pmu_read_battery_current();
1116 lcd_putsf(0, 2, "Battery current: %d mA", y); 1116 lcd_putsf(0, 2, "%s current: %d mA", "Battery", y);
1117 lcd_putsf(0, 3, "PWRCON: %08x %08x", PWRCON, PWRCONEXT); 1117 lcd_putsf(0, 3, "PWRCON: %08x %08x", PWRCON, PWRCONEXT);
1118 lcd_putsf(0, 4, "CLKCON: %08x %03x %03x", CLKCON, CLKCON2, CLKCON3); 1118 lcd_putsf(0, 4, "CLKCON: %08x %03x %03x", CLKCON, CLKCON2, CLKCON3);
1119 lcd_putsf(0, 5, "PLL: %06x %06x %06x", PLL0PMS, PLL1PMS, PLL2PMS); 1119 lcd_putsf(0, 5, "PLL: %06x %06x %06x", PLL0PMS, PLL1PMS, PLL2PMS);
@@ -1139,9 +1139,9 @@ static bool view_battery(void)
1139 lcd_putsf(0, 3, "Charger: %s", 1139 lcd_putsf(0, 3, "Charger: %s",
1140 charger_inserted() ? "present" : "absent"); 1140 charger_inserted() ? "present" : "absent");
1141 x = (avr_hid_hdq_read_short(HDQ_REG_TEMP) / 4) - 273; 1141 x = (avr_hid_hdq_read_short(HDQ_REG_TEMP) / 4) - 273;
1142 lcd_putsf(0, 4, "Battery temperature: %d C", x); 1142 lcd_putsf(0, 4, "%s temperature: %d C", "Battery", x);
1143 x = (avr_hid_hdq_read_short(HDQ_REG_AI) * 357) / 200; 1143 x = (avr_hid_hdq_read_short(HDQ_REG_AI) * 357) / 200;
1144 lcd_putsf(0, 5, "Battery current: %d.%01d mA", x / 10, x % 10); 1144 lcd_putsf(0, 5, "%s current: %d.%01d mA", "Battery", x / 10, x % 10);
1145 x = (avr_hid_hdq_read_short(HDQ_REG_AP) * 292) / 20; 1145 x = (avr_hid_hdq_read_short(HDQ_REG_AP) * 292) / 20;
1146 lcd_putsf(0, 6, "Discharge power: %d.%01d mW", x / 10, x % 10); 1146 lcd_putsf(0, 6, "Discharge power: %d.%01d mW", x / 10, x % 10);
1147 x = (avr_hid_hdq_read_short(HDQ_REG_SAE) * 292) / 2; 1147 x = (avr_hid_hdq_read_short(HDQ_REG_SAE) * 292) / 2;
@@ -1179,7 +1179,7 @@ static bool view_battery(void)
1179 power_history[0] % 1000); 1179 power_history[0] % 1000);
1180#endif 1180#endif
1181 1181
1182 lcd_putsf(0, 6, "battery level: %d%%", battery_level()); 1182 lcd_putsf(0, 6, "%s level: %d%%", "Battery", battery_level());
1183 1183
1184 int time_left = battery_time(); 1184 int time_left = battery_time();
1185 if (time_left >= 0) 1185 if (time_left >= 0)
@@ -1188,7 +1188,7 @@ static bool view_battery(void)
1188 lcd_puts(0, 7, "Estimation n/a"); 1188 lcd_puts(0, 7, "Estimation n/a");
1189 1189
1190#if (CONFIG_BATTERY_MEASURE & CURRENT_MEASURE) 1190#if (CONFIG_BATTERY_MEASURE & CURRENT_MEASURE)
1191 lcd_putsf(0, 8, "battery current: %d mA", battery_current()); 1191 lcd_putsf(0, 8, "%s current: %d mA", "Battery", battery_current());
1192#endif 1192#endif
1193 break; 1193 break;
1194 } 1194 }
@@ -2070,12 +2070,12 @@ static int radio_callback(int btn, struct gui_synclist *lists)
2070 tea5767_dbg_info(&nfo); 2070 tea5767_dbg_info(&nfo);
2071 simplelist_addline("Philips regs:"); 2071 simplelist_addline("Philips regs:");
2072 simplelist_addline( 2072 simplelist_addline(
2073 " Read: %02X %02X %02X %02X %02X", 2073 " %s: %02X %02X %02X %02X %02X", "Read",
2074 (unsigned)nfo.read_regs[0], (unsigned)nfo.read_regs[1], 2074 (unsigned)nfo.read_regs[0], (unsigned)nfo.read_regs[1],
2075 (unsigned)nfo.read_regs[2], (unsigned)nfo.read_regs[3], 2075 (unsigned)nfo.read_regs[2], (unsigned)nfo.read_regs[3],
2076 (unsigned)nfo.read_regs[4]); 2076 (unsigned)nfo.read_regs[4]);
2077 simplelist_addline( 2077 simplelist_addline(
2078 " Write: %02X %02X %02X %02X %02X", 2078 " %s: %02X %02X %02X %02X %02X", "Write",
2079 (unsigned)nfo.write_regs[0], (unsigned)nfo.write_regs[1], 2079 (unsigned)nfo.write_regs[0], (unsigned)nfo.write_regs[1],
2080 (unsigned)nfo.write_regs[2], (unsigned)nfo.write_regs[3], 2080 (unsigned)nfo.write_regs[2], (unsigned)nfo.write_regs[3],
2081 (unsigned)nfo.write_regs[4]); 2081 (unsigned)nfo.write_regs[4]);