Fix checking for CONFIG_CHARGING

Change-Id: I53b9a129679fd7b322770025106ef92033226d2a
This commit is contained in:
Mihail Zenkov 2016-03-30 12:50:40 +00:00 committed by Gerrit Rockbox
parent e599810ffa
commit ce90c0481a
4 changed files with 37 additions and 38 deletions

View file

@ -111,7 +111,7 @@
#endif
#include "appevents.h"
#if defined(HAVE_AS3514) && defined(CONFIG_CHARGING)
#if defined(HAVE_AS3514) && CONFIG_CHARGING
#include "ascodec.h"
#endif
@ -119,8 +119,8 @@
#include "pmu-target.h"
#endif
#ifdef HAVE_USBSTACK
#include "usb_core.h"
#ifdef HAVE_USBSTACK
#include "usb_core.h"
#endif
#if defined(IPOD_ACCESSORY_PROTOCOL)
@ -374,7 +374,7 @@ static void dbg_audio_task(void)
static bool dbg_buffering_thread(void)
{
int button;
int line;
int line;
bool done = false;
size_t bufused;
size_t bufsize = pcmbuf_get_bufsize();
@ -389,10 +389,10 @@ static bool dbg_buffering_thread(void)
ticks = freq_sum = 0;
tick_add_task(dbg_audio_task);
FOR_NB_SCREENS(i)
screens[i].setfont(FONT_SYSFIXED);
while(!done)
{
button = get_action(CONTEXT_STD,HZ/5);
@ -412,7 +412,7 @@ static bool dbg_buffering_thread(void)
buffering_get_debugdata(&d);
bufused = bufsize - pcmbuf_free();
FOR_NB_SCREENS(i)
FOR_NB_SCREENS(i)
{
line = 0;
screens[i].clear_display();
@ -489,7 +489,7 @@ static bool dbg_buffering_thread(void)
}
tick_remove_task(dbg_audio_task);
FOR_NB_SCREENS(i)
screens[i].setfont(FONT_UI);
@ -917,7 +917,7 @@ static bool view_battery(void)
}
/* print header */
#if (CONFIG_BATTERY_MEASURE & VOLTAGE_MEASURE)
/* adjust grid scale */
/* adjust grid scale */
if ((maxv - minv) > 50)
grid = 50;
else
@ -929,7 +929,7 @@ static bool view_battery(void)
minv / 1000, minv % 1000, maxv / 1000, maxv % 1000,
grid);
#elif (CONFIG_BATTERY_MEASURE & PERCENTAGE_MEASURE)
/* adjust grid scale */
/* adjust grid scale */
if ((maxv - minv) > 10)
grid = 10;
else
@ -937,31 +937,31 @@ static bool view_battery(void)
lcd_putsf(0, 0, "battery %d%%", power_history[0]);
lcd_putsf(0, 1, "%d%%-%d%% (%d %%)", minv, maxv, grid);
#endif
i = 1;
while ((y = (minv - (minv % grid)+i*grid)) < maxv)
{
graph = ((y-minv)*BAT_YSPACE)/(maxv-minv);
graph = LCD_HEIGHT-1 - graph;
/* draw dotted horizontal grid line */
/* draw dotted horizontal grid line */
for (x=0; x<LCD_WIDTH;x=x+2)
lcd_drawpixel(x,graph);
i++;
}
x = 0;
/* draw plot of power history
* 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])
{
y1 = (power_history[i] - minv) * BAT_YSPACE /
y1 = (power_history[i] - minv) * BAT_YSPACE /
(maxv - minv);
y1 = MIN(MAX(LCD_HEIGHT-1 - y1, BAT_TSPACE),
y1 = MIN(MAX(LCD_HEIGHT-1 - y1, BAT_TSPACE),
LCD_HEIGHT-1);
y2 = (power_history[i-1] - minv) * BAT_YSPACE /
(maxv - minv);
@ -971,13 +971,13 @@ static bool view_battery(void)
lcd_set_drawmode(DRMODE_SOLID);
/* make line thicker */
lcd_drawline(((x*LCD_WIDTH)/(BAT_LAST_VAL)),
y1,
(((x+1)*LCD_WIDTH)/(BAT_LAST_VAL)),
lcd_drawline(((x*LCD_WIDTH)/(BAT_LAST_VAL)),
y1,
(((x+1)*LCD_WIDTH)/(BAT_LAST_VAL)),
y2);
lcd_drawline(((x*LCD_WIDTH)/(BAT_LAST_VAL))+1,
y1+1,
(((x+1)*LCD_WIDTH)/(BAT_LAST_VAL))+1,
lcd_drawline(((x*LCD_WIDTH)/(BAT_LAST_VAL))+1,
y1+1,
(((x+1)*LCD_WIDTH)/(BAT_LAST_VAL))+1,
y2+1);
x++;
}
@ -988,7 +988,7 @@ static bool view_battery(void)
#if CONFIG_CHARGING >= CHARGING_MONITOR
lcd_putsf(0, 0, "Pwr status: %s",
charging_state() ? "charging" : "discharging");
#else
#else
lcd_puts(0, 0, "Power status: unknown");
#endif
battery_read_info(&y, &z);
@ -1107,8 +1107,7 @@ static bool view_battery(void)
/* Conversion disabled */
lcd_puts(0, line++, "T Battery: ?");
}
#elif defined(HAVE_AS3514) && defined(CONFIG_CHARGING)
#elif defined(HAVE_AS3514) && CONFIG_CHARGING
static const char * const chrgstate_strings[] =
{
[CHARGE_STATE_DISABLED - CHARGE_STATE_DISABLED]= "Disabled",
@ -1371,7 +1370,7 @@ static int disk_callback(int btn, struct gui_synclist *lists)
}
return btn;
}
#elif (CONFIG_STORAGE & STORAGE_ATA)
#elif (CONFIG_STORAGE & STORAGE_ATA)
static int disk_callback(int btn, struct gui_synclist *lists)
{
(void)lists;
@ -1740,7 +1739,7 @@ static int disk_callback(int btn, struct gui_synclist *lists)
}
#endif
#if (CONFIG_STORAGE & STORAGE_ATA)
#if (CONFIG_STORAGE & STORAGE_ATA)
static bool dbg_identify_info(void)
{
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",
stat->commit_delayed ? "Yes" : "No");
simplelist_addline("Queue length: %d",
simplelist_addline("Queue length: %d",
stat->queue_length);
if (synced)
{
synced = false;
@ -1896,7 +1895,7 @@ static bool dbg_tagcache_info(void)
info.action_callback = database_callback;
info.hide_selection = true;
info.scroll_all = true;
/* Don't do nonblock here, must give enough processing time
for tagcache thread. */
/* info.timeout = TIMEOUT_NOBLOCK; */
@ -2179,7 +2178,7 @@ static bool dbg_fm_radio(void)
struct simplelist_info info;
#ifdef CONFIG_TUNER_MULTI
tuner_type = tuner_detect_type();
#endif
#endif
info.scroll_all = true;
simplelist_info_init(&info, "FM Radio", 1, NULL);
simplelist_set_line_count(0);
@ -2446,7 +2445,7 @@ static bool dbg_isp1583(void)
struct simplelist_info isp1583;
isp1583.scroll_all = true;
simplelist_info_init(&isp1583, "ISP1583", dbg_usb_num_items(), NULL);
isp1583.timeout = HZ/100;
isp1583.timeout = HZ/100;
isp1583.hide_selection = true;
isp1583.get_name = dbg_usb_item;
isp1583.action_callback = isp1583_action_callback;
@ -2472,7 +2471,7 @@ static bool dbg_pic(void)
struct simplelist_info pic;
pic.scroll_all = true;
simplelist_info_init(&pic, "PIC", pic_dbg_num_items(), NULL);
pic.timeout = HZ/100;
pic.timeout = HZ/100;
pic.hide_selection = true;
pic.get_name = pic_dbg_item;
pic.action_callback = pic_action_callback;

View file

@ -45,7 +45,7 @@ int ascodec_readbytes(unsigned int index, unsigned int len, unsigned char *data)
void ascodec_wait_adc_finished(void);
#ifdef CONFIG_CHARGING
#if CONFIG_CHARGING
bool ascodec_endofch(void);
bool ascodec_chg_status(void);
void ascodec_monitor_endofch(void);

View file

@ -49,7 +49,7 @@ enum charge_state_type
/* tells what the charger is doing */
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
* one time through the power loop when the charger has been plugged in.

View file

@ -297,7 +297,7 @@ void ascodec_init(void)
/* Generate irq for usb+charge status change */
ascodec_write(AS3514_IRQ_ENRD0,
#ifdef CONFIG_CHARGING /* m200v4 can't charge */
#if CONFIG_CHARGING /* m200v4 can't charge */
IRQ_CHGSTAT | IRQ_ENDOFCH |
#endif
IRQ_USBSTAT);
@ -530,7 +530,7 @@ void ascodec_wait_adc_finished(void)
semaphore_wait(&adc_done_sem, TIMEOUT_BLOCK);
}
#ifdef CONFIG_CHARGING
#if CONFIG_CHARGING
bool ascodec_endofch(void)
{
bool ret = ascodec_enrd0_shadow & CHG_ENDOFCH;