mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 10:37:38 -04:00
Fix checking for CONFIG_CHARGING
Change-Id: I53b9a129679fd7b322770025106ef92033226d2a
This commit is contained in:
parent
e599810ffa
commit
ce90c0481a
4 changed files with 37 additions and 38 deletions
|
@ -111,7 +111,7 @@
|
||||||
#endif
|
#endif
|
||||||
#include "appevents.h"
|
#include "appevents.h"
|
||||||
|
|
||||||
#if defined(HAVE_AS3514) && defined(CONFIG_CHARGING)
|
#if defined(HAVE_AS3514) && CONFIG_CHARGING
|
||||||
#include "ascodec.h"
|
#include "ascodec.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -119,8 +119,8 @@
|
||||||
#include "pmu-target.h"
|
#include "pmu-target.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_USBSTACK
|
#ifdef HAVE_USBSTACK
|
||||||
#include "usb_core.h"
|
#include "usb_core.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(IPOD_ACCESSORY_PROTOCOL)
|
#if defined(IPOD_ACCESSORY_PROTOCOL)
|
||||||
|
@ -374,7 +374,7 @@ static void dbg_audio_task(void)
|
||||||
static bool dbg_buffering_thread(void)
|
static bool dbg_buffering_thread(void)
|
||||||
{
|
{
|
||||||
int button;
|
int button;
|
||||||
int line;
|
int line;
|
||||||
bool done = false;
|
bool done = false;
|
||||||
size_t bufused;
|
size_t bufused;
|
||||||
size_t bufsize = pcmbuf_get_bufsize();
|
size_t bufsize = pcmbuf_get_bufsize();
|
||||||
|
@ -389,10 +389,10 @@ static bool dbg_buffering_thread(void)
|
||||||
ticks = freq_sum = 0;
|
ticks = freq_sum = 0;
|
||||||
|
|
||||||
tick_add_task(dbg_audio_task);
|
tick_add_task(dbg_audio_task);
|
||||||
|
|
||||||
FOR_NB_SCREENS(i)
|
FOR_NB_SCREENS(i)
|
||||||
screens[i].setfont(FONT_SYSFIXED);
|
screens[i].setfont(FONT_SYSFIXED);
|
||||||
|
|
||||||
while(!done)
|
while(!done)
|
||||||
{
|
{
|
||||||
button = get_action(CONTEXT_STD,HZ/5);
|
button = get_action(CONTEXT_STD,HZ/5);
|
||||||
|
@ -412,7 +412,7 @@ static bool dbg_buffering_thread(void)
|
||||||
buffering_get_debugdata(&d);
|
buffering_get_debugdata(&d);
|
||||||
bufused = bufsize - pcmbuf_free();
|
bufused = bufsize - pcmbuf_free();
|
||||||
|
|
||||||
FOR_NB_SCREENS(i)
|
FOR_NB_SCREENS(i)
|
||||||
{
|
{
|
||||||
line = 0;
|
line = 0;
|
||||||
screens[i].clear_display();
|
screens[i].clear_display();
|
||||||
|
@ -489,7 +489,7 @@ static bool dbg_buffering_thread(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
tick_remove_task(dbg_audio_task);
|
tick_remove_task(dbg_audio_task);
|
||||||
|
|
||||||
FOR_NB_SCREENS(i)
|
FOR_NB_SCREENS(i)
|
||||||
screens[i].setfont(FONT_UI);
|
screens[i].setfont(FONT_UI);
|
||||||
|
|
||||||
|
@ -917,7 +917,7 @@ static bool view_battery(void)
|
||||||
}
|
}
|
||||||
/* print header */
|
/* print header */
|
||||||
#if (CONFIG_BATTERY_MEASURE & VOLTAGE_MEASURE)
|
#if (CONFIG_BATTERY_MEASURE & VOLTAGE_MEASURE)
|
||||||
/* adjust grid scale */
|
/* adjust grid scale */
|
||||||
if ((maxv - minv) > 50)
|
if ((maxv - minv) > 50)
|
||||||
grid = 50;
|
grid = 50;
|
||||||
else
|
else
|
||||||
|
@ -929,7 +929,7 @@ static bool view_battery(void)
|
||||||
minv / 1000, minv % 1000, maxv / 1000, maxv % 1000,
|
minv / 1000, minv % 1000, maxv / 1000, maxv % 1000,
|
||||||
grid);
|
grid);
|
||||||
#elif (CONFIG_BATTERY_MEASURE & PERCENTAGE_MEASURE)
|
#elif (CONFIG_BATTERY_MEASURE & PERCENTAGE_MEASURE)
|
||||||
/* adjust grid scale */
|
/* adjust grid scale */
|
||||||
if ((maxv - minv) > 10)
|
if ((maxv - minv) > 10)
|
||||||
grid = 10;
|
grid = 10;
|
||||||
else
|
else
|
||||||
|
@ -937,31 +937,31 @@ static bool view_battery(void)
|
||||||
lcd_putsf(0, 0, "battery %d%%", power_history[0]);
|
lcd_putsf(0, 0, "battery %d%%", power_history[0]);
|
||||||
lcd_putsf(0, 1, "%d%%-%d%% (%d %%)", minv, maxv, grid);
|
lcd_putsf(0, 1, "%d%%-%d%% (%d %%)", minv, maxv, grid);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
i = 1;
|
i = 1;
|
||||||
while ((y = (minv - (minv % grid)+i*grid)) < maxv)
|
while ((y = (minv - (minv % grid)+i*grid)) < maxv)
|
||||||
{
|
{
|
||||||
graph = ((y-minv)*BAT_YSPACE)/(maxv-minv);
|
graph = ((y-minv)*BAT_YSPACE)/(maxv-minv);
|
||||||
graph = LCD_HEIGHT-1 - graph;
|
graph = LCD_HEIGHT-1 - graph;
|
||||||
|
|
||||||
/* draw dotted horizontal grid line */
|
/* draw dotted horizontal grid line */
|
||||||
for (x=0; x<LCD_WIDTH;x=x+2)
|
for (x=0; x<LCD_WIDTH;x=x+2)
|
||||||
lcd_drawpixel(x,graph);
|
lcd_drawpixel(x,graph);
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
x = 0;
|
x = 0;
|
||||||
/* draw plot of power history
|
/* draw plot of power history
|
||||||
* skip empty entries
|
* skip empty entries
|
||||||
*/
|
*/
|
||||||
for (i = BAT_LAST_VAL - 1; i > 0; i--)
|
for (i = BAT_LAST_VAL - 1; i > 0; i--)
|
||||||
{
|
{
|
||||||
if (power_history[i] && power_history[i-1])
|
if (power_history[i] && power_history[i-1])
|
||||||
{
|
{
|
||||||
y1 = (power_history[i] - minv) * BAT_YSPACE /
|
y1 = (power_history[i] - minv) * BAT_YSPACE /
|
||||||
(maxv - minv);
|
(maxv - minv);
|
||||||
y1 = MIN(MAX(LCD_HEIGHT-1 - y1, BAT_TSPACE),
|
y1 = MIN(MAX(LCD_HEIGHT-1 - y1, BAT_TSPACE),
|
||||||
LCD_HEIGHT-1);
|
LCD_HEIGHT-1);
|
||||||
y2 = (power_history[i-1] - minv) * BAT_YSPACE /
|
y2 = (power_history[i-1] - minv) * BAT_YSPACE /
|
||||||
(maxv - minv);
|
(maxv - minv);
|
||||||
|
@ -971,13 +971,13 @@ static bool view_battery(void)
|
||||||
lcd_set_drawmode(DRMODE_SOLID);
|
lcd_set_drawmode(DRMODE_SOLID);
|
||||||
|
|
||||||
/* make line thicker */
|
/* make line thicker */
|
||||||
lcd_drawline(((x*LCD_WIDTH)/(BAT_LAST_VAL)),
|
lcd_drawline(((x*LCD_WIDTH)/(BAT_LAST_VAL)),
|
||||||
y1,
|
y1,
|
||||||
(((x+1)*LCD_WIDTH)/(BAT_LAST_VAL)),
|
(((x+1)*LCD_WIDTH)/(BAT_LAST_VAL)),
|
||||||
y2);
|
y2);
|
||||||
lcd_drawline(((x*LCD_WIDTH)/(BAT_LAST_VAL))+1,
|
lcd_drawline(((x*LCD_WIDTH)/(BAT_LAST_VAL))+1,
|
||||||
y1+1,
|
y1+1,
|
||||||
(((x+1)*LCD_WIDTH)/(BAT_LAST_VAL))+1,
|
(((x+1)*LCD_WIDTH)/(BAT_LAST_VAL))+1,
|
||||||
y2+1);
|
y2+1);
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
|
@ -988,7 +988,7 @@ static bool view_battery(void)
|
||||||
#if CONFIG_CHARGING >= CHARGING_MONITOR
|
#if CONFIG_CHARGING >= CHARGING_MONITOR
|
||||||
lcd_putsf(0, 0, "Pwr status: %s",
|
lcd_putsf(0, 0, "Pwr status: %s",
|
||||||
charging_state() ? "charging" : "discharging");
|
charging_state() ? "charging" : "discharging");
|
||||||
#else
|
#else
|
||||||
lcd_puts(0, 0, "Power status: unknown");
|
lcd_puts(0, 0, "Power status: unknown");
|
||||||
#endif
|
#endif
|
||||||
battery_read_info(&y, &z);
|
battery_read_info(&y, &z);
|
||||||
|
@ -1107,8 +1107,7 @@ static bool view_battery(void)
|
||||||
/* Conversion disabled */
|
/* Conversion disabled */
|
||||||
lcd_puts(0, line++, "T Battery: ?");
|
lcd_puts(0, line++, "T Battery: ?");
|
||||||
}
|
}
|
||||||
|
#elif defined(HAVE_AS3514) && CONFIG_CHARGING
|
||||||
#elif defined(HAVE_AS3514) && defined(CONFIG_CHARGING)
|
|
||||||
static const char * const chrgstate_strings[] =
|
static const char * const chrgstate_strings[] =
|
||||||
{
|
{
|
||||||
[CHARGE_STATE_DISABLED - CHARGE_STATE_DISABLED]= "Disabled",
|
[CHARGE_STATE_DISABLED - CHARGE_STATE_DISABLED]= "Disabled",
|
||||||
|
@ -1371,7 +1370,7 @@ static int disk_callback(int btn, struct gui_synclist *lists)
|
||||||
}
|
}
|
||||||
return btn;
|
return btn;
|
||||||
}
|
}
|
||||||
#elif (CONFIG_STORAGE & STORAGE_ATA)
|
#elif (CONFIG_STORAGE & STORAGE_ATA)
|
||||||
static int disk_callback(int btn, struct gui_synclist *lists)
|
static int disk_callback(int btn, struct gui_synclist *lists)
|
||||||
{
|
{
|
||||||
(void)lists;
|
(void)lists;
|
||||||
|
@ -1740,7 +1739,7 @@ static int disk_callback(int btn, struct gui_synclist *lists)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (CONFIG_STORAGE & STORAGE_ATA)
|
#if (CONFIG_STORAGE & STORAGE_ATA)
|
||||||
static bool dbg_identify_info(void)
|
static bool dbg_identify_info(void)
|
||||||
{
|
{
|
||||||
int fd = creat("/identify_info.bin", 0666);
|
int fd = creat("/identify_info.bin", 0666);
|
||||||
|
@ -1869,9 +1868,9 @@ static int database_callback(int btn, struct gui_synclist *lists)
|
||||||
simplelist_addline("Commit delayed: %s",
|
simplelist_addline("Commit delayed: %s",
|
||||||
stat->commit_delayed ? "Yes" : "No");
|
stat->commit_delayed ? "Yes" : "No");
|
||||||
|
|
||||||
simplelist_addline("Queue length: %d",
|
simplelist_addline("Queue length: %d",
|
||||||
stat->queue_length);
|
stat->queue_length);
|
||||||
|
|
||||||
if (synced)
|
if (synced)
|
||||||
{
|
{
|
||||||
synced = false;
|
synced = false;
|
||||||
|
@ -1896,7 +1895,7 @@ static bool dbg_tagcache_info(void)
|
||||||
info.action_callback = database_callback;
|
info.action_callback = database_callback;
|
||||||
info.hide_selection = true;
|
info.hide_selection = true;
|
||||||
info.scroll_all = true;
|
info.scroll_all = true;
|
||||||
|
|
||||||
/* Don't do nonblock here, must give enough processing time
|
/* Don't do nonblock here, must give enough processing time
|
||||||
for tagcache thread. */
|
for tagcache thread. */
|
||||||
/* info.timeout = TIMEOUT_NOBLOCK; */
|
/* info.timeout = TIMEOUT_NOBLOCK; */
|
||||||
|
@ -2179,7 +2178,7 @@ static bool dbg_fm_radio(void)
|
||||||
struct simplelist_info info;
|
struct simplelist_info info;
|
||||||
#ifdef CONFIG_TUNER_MULTI
|
#ifdef CONFIG_TUNER_MULTI
|
||||||
tuner_type = tuner_detect_type();
|
tuner_type = tuner_detect_type();
|
||||||
#endif
|
#endif
|
||||||
info.scroll_all = true;
|
info.scroll_all = true;
|
||||||
simplelist_info_init(&info, "FM Radio", 1, NULL);
|
simplelist_info_init(&info, "FM Radio", 1, NULL);
|
||||||
simplelist_set_line_count(0);
|
simplelist_set_line_count(0);
|
||||||
|
@ -2446,7 +2445,7 @@ static bool dbg_isp1583(void)
|
||||||
struct simplelist_info isp1583;
|
struct simplelist_info isp1583;
|
||||||
isp1583.scroll_all = true;
|
isp1583.scroll_all = true;
|
||||||
simplelist_info_init(&isp1583, "ISP1583", dbg_usb_num_items(), NULL);
|
simplelist_info_init(&isp1583, "ISP1583", dbg_usb_num_items(), NULL);
|
||||||
isp1583.timeout = HZ/100;
|
isp1583.timeout = HZ/100;
|
||||||
isp1583.hide_selection = true;
|
isp1583.hide_selection = true;
|
||||||
isp1583.get_name = dbg_usb_item;
|
isp1583.get_name = dbg_usb_item;
|
||||||
isp1583.action_callback = isp1583_action_callback;
|
isp1583.action_callback = isp1583_action_callback;
|
||||||
|
@ -2472,7 +2471,7 @@ static bool dbg_pic(void)
|
||||||
struct simplelist_info pic;
|
struct simplelist_info pic;
|
||||||
pic.scroll_all = true;
|
pic.scroll_all = true;
|
||||||
simplelist_info_init(&pic, "PIC", pic_dbg_num_items(), NULL);
|
simplelist_info_init(&pic, "PIC", pic_dbg_num_items(), NULL);
|
||||||
pic.timeout = HZ/100;
|
pic.timeout = HZ/100;
|
||||||
pic.hide_selection = true;
|
pic.hide_selection = true;
|
||||||
pic.get_name = pic_dbg_item;
|
pic.get_name = pic_dbg_item;
|
||||||
pic.action_callback = pic_action_callback;
|
pic.action_callback = pic_action_callback;
|
||||||
|
|
|
@ -45,7 +45,7 @@ int ascodec_readbytes(unsigned int index, unsigned int len, unsigned char *data)
|
||||||
|
|
||||||
void ascodec_wait_adc_finished(void);
|
void ascodec_wait_adc_finished(void);
|
||||||
|
|
||||||
#ifdef CONFIG_CHARGING
|
#if CONFIG_CHARGING
|
||||||
bool ascodec_endofch(void);
|
bool ascodec_endofch(void);
|
||||||
bool ascodec_chg_status(void);
|
bool ascodec_chg_status(void);
|
||||||
void ascodec_monitor_endofch(void);
|
void ascodec_monitor_endofch(void);
|
||||||
|
|
|
@ -49,7 +49,7 @@ enum charge_state_type
|
||||||
/* tells what the charger is doing */
|
/* tells what the charger is doing */
|
||||||
extern enum charge_state_type charge_state;
|
extern enum charge_state_type charge_state;
|
||||||
|
|
||||||
#ifdef CONFIG_CHARGING
|
#if CONFIG_CHARGING
|
||||||
/*
|
/*
|
||||||
* Flag that the charger has been plugged in/removed: this is set for exactly
|
* Flag that the charger has been plugged in/removed: this is set for exactly
|
||||||
* one time through the power loop when the charger has been plugged in.
|
* one time through the power loop when the charger has been plugged in.
|
||||||
|
|
|
@ -297,7 +297,7 @@ void ascodec_init(void)
|
||||||
|
|
||||||
/* Generate irq for usb+charge status change */
|
/* Generate irq for usb+charge status change */
|
||||||
ascodec_write(AS3514_IRQ_ENRD0,
|
ascodec_write(AS3514_IRQ_ENRD0,
|
||||||
#ifdef CONFIG_CHARGING /* m200v4 can't charge */
|
#if CONFIG_CHARGING /* m200v4 can't charge */
|
||||||
IRQ_CHGSTAT | IRQ_ENDOFCH |
|
IRQ_CHGSTAT | IRQ_ENDOFCH |
|
||||||
#endif
|
#endif
|
||||||
IRQ_USBSTAT);
|
IRQ_USBSTAT);
|
||||||
|
@ -530,7 +530,7 @@ void ascodec_wait_adc_finished(void)
|
||||||
semaphore_wait(&adc_done_sem, TIMEOUT_BLOCK);
|
semaphore_wait(&adc_done_sem, TIMEOUT_BLOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_CHARGING
|
#if CONFIG_CHARGING
|
||||||
bool ascodec_endofch(void)
|
bool ascodec_endofch(void)
|
||||||
{
|
{
|
||||||
bool ret = ascodec_enrd0_shadow & CHG_ENDOFCH;
|
bool ret = ascodec_enrd0_shadow & CHG_ENDOFCH;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue