Now charcell displays require lcd_update() for updating the main lcd content like bitmap displays.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13050 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2007-04-06 22:55:00 +00:00
parent a5d7309d96
commit f9b90e9103
36 changed files with 131 additions and 187 deletions

View file

@ -647,9 +647,7 @@ void print_scroll(char* string)
rb->snprintf(screen[(pos+screentop) % LINES], sizeof(screen[0]), "%s", string);
rb->lcd_puts(0, pos, screen[(pos+screentop) % LINES]);
#ifndef HAVE_LCD_CHARCELLS
rb->lcd_update();
#endif
pos++;
}

View file

@ -129,10 +129,11 @@ bool exit_tsr(bool reenter)
rb->lcd_clear_display();
rb->lcd_puts_scroll(0, 0, "Batt.Bench is currently running.");
rb->lcd_puts_scroll(0, 1, "Press OFF to cancel the test");
rb->lcd_puts_scroll(0, 2, "Anything else will resume");
#ifdef HAVE_LCD_BITMAP
rb->lcd_update();
rb->lcd_puts_scroll(0, 2, "Anything else will resume");
#endif
rb->lcd_update();
if (rb->button_get(true) != BATTERY_OFF)
exit = false;
if (exit)
@ -369,21 +370,24 @@ int main(void)
int button, fd;
bool on = false;
#ifdef HAVE_LCD_BITMAP
int i;
const char *msgs[] = { "Battery Benchmark","Check file", BATTERY_LOG,
"for more info", "PLAY - start", "OFF - quit" };
#endif
rb->lcd_clear_display();
#ifdef HAVE_LCD_BITMAP
int i;
rb->lcd_clear_display();
rb->lcd_setfont(FONT_SYSFIXED);
for(i = 0; i<(int)(sizeof(msgs)/sizeof(char *)); i++)
put_centered_str(msgs[i],rb->lcd_putsxy,LCD_WIDTH,i+1);
#else
rb->lcd_puts_scroll(0, 0, "Batt.Bench.");
rb->lcd_puts_scroll(0, 1, "PLAY/STOP");
#endif
rb->lcd_update();
#ifdef HAVE_REMOTE_LCD
rb->lcd_remote_clear_display();
put_centered_str(msgs[0],rb->lcd_remote_putsxy,LCD_REMOTE_WIDTH,0);
@ -394,11 +398,6 @@ int main(void)
rb->lcd_remote_update();
#endif
#else
rb->lcd_puts_scroll(0, 0, "Batt.Bench.");
rb->lcd_puts_scroll(0, 1, "PLAY/STOP");
#endif
do
{
button = rb->button_get(true);

View file

@ -369,9 +369,8 @@ static int run_timer(int nr)
(unsigned char *)show_time((max_ticks-ticks+HZ-1)/HZ));
}
}
#ifdef HAVE_LCD_BITMAP
rb->lcd_update();
#endif
button = rb->button_get(false);
switch (button) {
/* OFF/ON key to exit */
@ -493,9 +492,8 @@ static int chessclock_set_int(char* string,
else
rb->snprintf(str, sizeof str,"%d", *variable);
rb->lcd_puts(0, FIRST_LINE+1, (unsigned char *)str);
#ifdef HAVE_LCD_BITMAP
rb->lcd_update();
#endif
button = rb->button_get(true);
switch(button) {
case CHC_SETTINGS_INC:
@ -562,9 +560,8 @@ static int simple_menu(int nr, unsigned char **strarr)
if (show<0)
show=nr-1;
rb->lcd_puts_scroll(0, FIRST_LINE, strarr[show]);
#ifdef HAVE_LCD_BITMAP
rb->lcd_update();
#endif
button = rb->button_get(true);
switch(button) {
case CHC_SETTINGS_INC:

View file

@ -90,7 +90,6 @@ void roll_credits(void)
else
rb->lcd_puts(x, line, credits[name]);
if (++name >= numnames)
break;
@ -104,6 +103,8 @@ void roll_credits(void)
x += MAX(len/2 + 2, len - new_len/2 + 1);
len = new_len;
}
rb->lcd_update();
/* abort on keypress */
if (rb->button_get_w_tmo(HZ/8) & BUTTON_REL)
return;

View file

@ -214,9 +214,7 @@ static void print_dice(const int dice[], const int total) {
rb->lcd_puts(0,START_DICE_ROW+(++row)," ");
}
#endif
#ifdef HAVE_LCD_BITMAP
rb->lcd_update();
#endif
}
static bool dice_menu(int *num_dice, int *side_index) {
int selection;

View file

@ -301,10 +301,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
break;
}
}
#ifdef HAVE_LCD_BITMAP
rb->lcd_update();
#endif
/* wait for keypress */
while(rb->button_get(true) != LP_QUIT)

View file

@ -87,8 +87,8 @@ void tidy_lcd_status(const char *name, int *removed)
rb->snprintf(text, 24, "Cleaned up %d items", *removed);
#ifdef HAVE_LCD_BITMAP
rb->lcd_puts(0, 2, text);
rb->lcd_update();
#endif
rb->lcd_update();
}
void tidy_get_absolute_path(struct dirent *entry, char *fullname,

View file

@ -290,14 +290,15 @@ static void display(longlong_t euro, longlong_t home, bool pos)
}
else
rb->lcd_puts_scroll(1,1,str);
rb->lcd_update();
}
/* Show country Abbreviation */
static void show_abbrev(void)
{
rb->lcd_puts(2,1,abbrev_str[country]);
rb->sleep(HZ*3/4);
rb->splash(HZ*3/4,abbrev_str[country]);
}
@ -325,6 +326,7 @@ static void currency_menu(void)
{
rb->lcd_puts(0,0,"Currency:");
rb->lcd_puts(0,1,currency_str[c]);
rb->lcd_update();
switch (rb->button_get(true))
{
case BUTTON_RIGHT|BUTTON_REL:
@ -361,6 +363,7 @@ static int euro_menu(void)
rb->lcd_puts(0,0," Currency");
rb->lcd_puts(0,1," Exit");
rb->lcd_putc(0,c,0xe110);
rb->lcd_update();
switch (rb->button_get(true))
{
@ -394,6 +397,7 @@ static void euro_exit(void *parameter)
//Clear the screen
rb->lcd_clear_display();
rb->lcd_update();
}

View file

@ -848,6 +848,7 @@ void ShowFlashInfo(tFlashInfo* pInfo)
{
rb->lcd_puts_scroll(0, 0, "Flash: M=? D=?");
rb->lcd_puts_scroll(0, 1, "Impossible to program");
rb->lcd_update();
WaitForButton();
}
else
@ -860,10 +861,12 @@ void ShowFlashInfo(tFlashInfo* pInfo)
{
rb->snprintf(buf, sizeof(buf), "Size: %d KB", pInfo->size / 1024);
rb->lcd_puts_scroll(0, 1, buf);
rb->lcd_update();
}
else
{
rb->lcd_puts_scroll(0, 1, "Unsupported chip");
rb->lcd_update();
WaitForButton();
}
}
@ -941,7 +944,8 @@ void DoUserDialog(char* filename)
rb->lcd_puts_scroll(0, 0, filename);
rb->lcd_puts_scroll(0, 1, "[Menu] to check");
rb->lcd_update();
button = WaitForButton();
if (button != BUTTON_MENU)
{
@ -950,7 +954,8 @@ void DoUserDialog(char* filename)
rb->lcd_clear_display();
rb->lcd_puts(0, 0, "Checking...");
rb->lcd_update();
rc = CheckFirmwareFile(filename, FlashInfo.size, is_romless);
rb->lcd_puts(0, 0, "Checked:");
switch (rc)
@ -989,6 +994,7 @@ void DoUserDialog(char* filename)
rb->lcd_puts_scroll(0, 0, "Check failed.");
break;
}
rb->lcd_update();
rb->sleep(HZ*3);
@ -996,6 +1002,7 @@ void DoUserDialog(char* filename)
{
rb->lcd_puts_scroll(0, 0, "[On] to program,");
rb->lcd_puts_scroll(0, 1, "other key to exit.");
rb->lcd_update();
}
else
{ /* error occured */
@ -1012,7 +1019,8 @@ void DoUserDialog(char* filename)
rb->lcd_clear_display();
rb->lcd_puts_scroll(0, 0, "Are you sure?");
rb->lcd_puts_scroll(0, 1, "[+] to proceed.");
rb->lcd_update();
button = WaitForButton();
if (button != BUTTON_RIGHT)
@ -1022,7 +1030,8 @@ void DoUserDialog(char* filename)
rb->lcd_clear_display();
rb->lcd_puts_scroll(0, 0, "Programming...");
rb->lcd_update();
rc = ProgramFirmwareFile(filename, FlashInfo.size);
if (rc)
@ -1031,12 +1040,14 @@ void DoUserDialog(char* filename)
rb->lcd_puts_scroll(0, 0, "Programming failed!");
rb->snprintf(buf, sizeof(buf), "%d errors", rc);
rb->lcd_puts_scroll(0, 1, buf);
rb->lcd_update();
WaitForButton();
}
rb->lcd_clear_display();
rb->lcd_puts_scroll(0, 0, "Verifying...");
rb->lcd_update();
rc = VerifyFirmwareFile(filename);
rb->lcd_clear_display();
@ -1052,6 +1063,7 @@ void DoUserDialog(char* filename)
}
rb->lcd_puts_scroll(0, 1, "Press any key to exit.");
rb->lcd_update();
WaitForButton();
}

View file

@ -323,9 +323,7 @@ static void move_cursor(int x, int y)
+ ( ( y + 4 + cursor_pos/5 )%4 )*5;
draw_cursor();
}
#ifdef HAVE_LCD_BITMAP
rb->lcd_update();
#endif
}
/* initialize the board */
@ -339,9 +337,8 @@ static void flipit_init(void)
toggle[i]=1;
draw_spot(i);
}
#ifdef HAVE_LCD_BITMAP
rb->lcd_update();
#endif
for (i=0; i<20; i++) {
cursor_pos = (rb->rand() % 20);
flipit_toggle();
@ -351,9 +348,7 @@ static void flipit_init(void)
draw_cursor();
moves = 0;
draw_info_panel();
#ifdef HAVE_LCD_BITMAP
rb->lcd_update();
#endif
}
/* the main game loop */
@ -392,9 +387,7 @@ static bool flipit_loop(void)
cursor_pos = i;
flipit_toggle();
draw_cursor();
#ifdef HAVE_LCD_BITMAP
rb->lcd_update();
#endif
rb->sleep(HZ*2/3);
}
}
@ -412,9 +405,7 @@ static bool flipit_loop(void)
cursor_pos = i;
flipit_toggle();
draw_cursor();
#ifdef HAVE_LCD_BITMAP
rb->lcd_update();
#endif
break;
}
}
@ -429,9 +420,7 @@ static bool flipit_loop(void)
if (!flipit_finished()) {
flipit_toggle();
draw_cursor();
#ifdef HAVE_LCD_BITMAP
rb->lcd_update();
#endif
}
break;
@ -546,9 +535,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
spots[i]=1;
draw_spot(i);
}
#ifdef HAVE_LCD_BITMAP
rb->lcd_update();
#endif
rb->sleep(HZ*3/2);
rb->srand(*rb->current_tick);

View file

@ -78,6 +78,7 @@ static void jackpot_exit(void *parameter)
/* Clear the screen */
rb->lcd_clear_display();
rb->lcd_update();
}
@ -115,13 +116,15 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb->lcd_putc(9,0,h2); rb->lcd_putc(10,0,h1);
rb->lcd_puts(0,1," V1.1 ");
rb->lcd_putc(1,1,h3); rb->lcd_putc(9,1,h3);
rb->lcd_update();
rb->sleep(HZ*2);
rb->lcd_clear_display();
/*First display*/
rb->lcd_clear_display();
rb->snprintf(str,sizeof(str),"[ ]$%d",g);
rb->lcd_puts(0,0,str);
rb->lcd_puts_scroll(0,1,"PLAY to begin");
rb->lcd_update();
/*Empty the event queue*/
rb->button_clear_queue();
@ -165,6 +168,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
/*Clear the Second line*/
rb->lcd_puts_scroll(0,1,"Good luck");
rb->lcd_update();
/*GO !!!!*/
if ( go && !exit )
@ -188,6 +192,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb->lcd_putc(1,0, h1);
rb->lcd_putc(2,0, h2);
rb->lcd_putc(3,0, h3);
rb->lcd_update();
for(i=0;i<3;i++)
{
if (n[i]>=0)
@ -268,6 +273,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb->snprintf(str,sizeof(str),"You win %d$",j);
rb->lcd_puts(0,1,str);
}
rb->lcd_update();
}
}

View file

@ -99,6 +99,8 @@ void pgfx_update(void)
for (i = 0; i < char_width * char_height; i++)
pgfx_rb->lcd_define_pattern(gfx_chars[i], gfx_buffer + 7 * i);
pgfx_rb->lcd_update();
}
/*** Parameter handling ***/

View file

@ -312,12 +312,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) {
#else
if (cpos != old_cpos) {
rb->lcd_clear_display();
pgfx_update();
pgfx_display(cpos, 0);
old_cpos = cpos;
}
else
pgfx_update();
pgfx_update();
#endif
rb->sleep(HZ/timer);

View file

@ -778,8 +778,8 @@ void draw_display(void)
rb->lcd_puts(0,2,METRONOME_MSG_START);
else
rb->lcd_puts(0,2,METRONOME_MSG_STOP);
rb->lcd_update();
#endif
rb->lcd_update();
#ifdef HAVE_REMOTE_LCD
rb->lcd_remote_drawline(0, 12, 111, 12);
if(sound_paused)

View file

@ -66,6 +66,7 @@ static struct plugin_api* rb;
static void impossible(void)
{
rb->lcd_puts(0,1,"Impossible!");
rb->lcd_update();
rb->sleep(HZ);
return;
}
@ -76,6 +77,7 @@ static void lose(void)
rb->lcd_define_pattern(hsmile,smile);
rb->lcd_puts(0,1,"You Win!!");
rb->lcd_putc(8,1,hsmile);
rb->lcd_update();
end=true;
rb->sleep(HZ*2);
return;
@ -88,6 +90,7 @@ static void win(void)
rb->lcd_define_pattern(hcry,cry);
rb->lcd_puts(0,1,"You Lose!!");
rb->lcd_putc(9,1,hcry);
rb->lcd_update();
end=true;
rb->sleep(HZ*2);
return;
@ -103,7 +106,7 @@ static void display_first_line(int x)
rb->lcd_puts(0,0,str);
rb->lcd_define_pattern(h1,pattern3);
for (i=0;i<x/3;i++)
for (i=0;i<x/3;i++)
rb->lcd_putc(i,0,h1);
if (x%3==2)
@ -131,6 +134,7 @@ static void nim_exit(void *parameter)
/*Clear the screen*/
rb->lcd_clear_display();
rb->lcd_update();
}
/* this is the plugin entry point */
@ -183,6 +187,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb->snprintf(str,sizeof(str),"[%d..%d]?=%d",min,v,y);
rb->lcd_puts(0,1,str);
rb->lcd_update();
go=false;
while (!go)
@ -221,6 +226,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
display_first_line(x);
rb->snprintf(str,sizeof(str),"[%d..%d]?=%d",min,v,y);
rb->lcd_puts(0,1,str);
rb->lcd_update();
}
if ( (y==0) && (x<21))
@ -281,6 +287,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
x-=y;
rb->snprintf(str,sizeof(str),"I take=%d",y);
rb->lcd_puts(0,1,str);
rb->lcd_update();
rb->sleep(HZ);
}
if ((x==1)&&(!end))

View file

@ -173,9 +173,8 @@ static bool _dir_properties(DPS* dps)
rb->snprintf(dps->tstr, 64, "Size: %s",
filesize2string(dps->bc, dps->tstr2, 64));
rb->lcd_puts(0,5,dps->tstr);
#ifdef HAVE_LCD_BITMAP
rb->lcd_update();
#endif
/* recursion */
result = _dir_properties(dps);
}
@ -302,9 +301,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* file)
rb->lcd_clear_display();
rb->lcd_puts(0,0,"File/Dir not found:");
rb->lcd_puts(0,1,(char*)file);
#ifdef HAVE_LCD_BITMAP
rb->lcd_update();
#endif
rb->action_userabort(TIMEOUT_BLOCK);
return PLUGIN_OK;
}

View file

@ -59,22 +59,16 @@ struct file_format *list = NULL;
void update_screen(bool clear)
{
char buf[15];
#if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) /* always bitmap */
int i;
rb->snprintf(buf,sizeof(buf),"Folders: %d",dirs_count);
FOR_NB_SCREENS(i)
{
rb->snprintf(buf,15,"Folders: %d",dirs_count);
if(clear)
rb->screens[i]->clear_display();
rb->screens[i]->putsxy(0,0,buf);
rb->screens[i]->update();
}
#else
rb->snprintf(buf,15,"Folders: %d",dirs_count);
if(clear)
rb->lcd_clear_display();
rb->lcd_puts(0,0,buf);
#endif
}
void traversedir(char* location, char* name)

View file

@ -893,6 +893,7 @@ void DoUserDialog(char* filename)
{
rb->lcd_puts_scroll(0, 0, "Hint: You're not using the latest bootloader. A full reflash is recommended, but not required.");
rb->lcd_puts_scroll(0, 1, "Press [Menu] to ignore");
rb->lcd_update();
if (WaitForButton() != BUTTON_MENU)
{
@ -902,6 +903,7 @@ void DoUserDialog(char* filename)
}
rb->lcd_puts(0, 0, "Checking...");
rb->lcd_update();
space = FlashInfo.size - (pos-FB + sizeof(ImageHeader));
/* size minus start */
@ -941,6 +943,7 @@ void DoUserDialog(char* filename)
rb->lcd_puts_scroll(0, 1, "Check failed.");
break;
}
rb->lcd_update();
if (rc == eOK)
{ /* was OK */
@ -955,6 +958,7 @@ void DoUserDialog(char* filename)
rb->lcd_puts_scroll(0, 0, "Flash failed.");
rb->lcd_puts_scroll(0, 1, "Any key to exit.");
}
rb->lcd_update();
button = WaitForButton();
if (rc != eOK || button != BUTTON_ON)
@ -972,6 +976,7 @@ void DoUserDialog(char* filename)
rb->lcd_clear_display();
rb->lcd_puts_scroll(0, 0, "Programming...");
rb->lcd_update();
rc = ProgramImageFile(filename, pos, &ImageHeader, UCL_HEADER, true_size);
if (rc)
@ -980,11 +985,13 @@ void DoUserDialog(char* filename)
rb->snprintf(buf, sizeof(buf), "%d errors", rc);
rb->lcd_puts_scroll(0, 0, "Programming failed!");
rb->lcd_puts_scroll(0, 1, buf);
rb->lcd_update();
button = WaitForButton();
}
rb->lcd_clear_display();
rb->lcd_puts_scroll(0, 0, "Verifying...");
rb->lcd_update();
rc = VerifyImageFile(filename, pos, &ImageHeader, UCL_HEADER, true_size);
@ -992,12 +999,14 @@ void DoUserDialog(char* filename)
if (rc == 0)
{
rb->lcd_puts(0, 0, "Verify OK.");
rb->lcd_update();
}
else
{
rb->snprintf(buf, sizeof(buf), "Verify fail! %d errors", rc);
rb->lcd_puts_scroll(0, 0, buf);
rb->lcd_puts_scroll(0, 1, "Use safe image if booting hangs: [-] during power-on");
rb->lcd_update();
button = WaitForButton();
}
}

View file

@ -34,7 +34,8 @@ rb->lcd_update()
#define PUTS(str) do { \
rb->lcd_puts(0, y, str); \
y = (y + 1) % 2; \
} while (0);
} while (0); \
rb->lcd_update()
#endif
extern struct plugin_api* rb;

View file

@ -24,9 +24,6 @@ static struct plugin_api* rb;
static int files, dirs, musicfiles;
static int lasttick;
static bool abort;
#ifdef HAVE_LCD_BITMAP
static int fontwidth, fontheight;
#endif
#if CONFIG_KEYPAD == PLAYER_PAD
#define STATS_STOP BUTTON_STOP
@ -70,43 +67,39 @@ const char *music_exts[] = {"mp3","mp2","mp1","mpa","ogg",
void prn(const char *str, int y)
{
#ifdef HAVE_LCD_BITMAP
rb->lcd_putsxy(0,y,str);
rb->lcd_puts(0,y,str);
#ifdef HAVE_REMOTE_LCD
rb->lcd_remote_putsxy(0,y,str);
#endif
#else
rb->lcd_puts(0,y,str);
rb->lcd_remote_puts(0,y,str);
#endif
}
void update_screen(void)
{
char buf[15];
#ifdef HAVE_LCD_BITMAP
rb->lcd_clear_display();
#ifdef HAVE_REMOTE_LCD
rb->lcd_remote_clear_display();
#endif
#ifdef HAVE_LCD_BITMAP
rb->snprintf(buf, sizeof(buf), "Files: %d", files);
prn(buf,0);
rb->snprintf(buf, sizeof(buf), "Music: %d", musicfiles);
prn(buf,fontheight);
prn(buf,1);
rb->snprintf(buf, sizeof(buf), "Dirs: %d", dirs);
prn(buf,fontheight*2);
rb->lcd_update();
#ifdef HAVE_REMOTE_LCD
rb->lcd_remote_update();
#endif
prn(buf,2);
#else
rb->snprintf(buf, sizeof(buf), "Files:%5d", files);
prn(buf,0);
rb->snprintf(buf, sizeof(buf), "Dirs: %5d", dirs);
prn(buf,1);
#endif
rb->lcd_update();
#ifdef HAVE_REMOTE_LCD
rb->lcd_remote_update();
#endif
}
void traversedir(char* location, char* name)
@ -177,9 +170,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
musicfiles = 0;
abort = false;
#ifdef HAVE_LCD_BITMAP
rb->lcd_getstringsize("Files: ", &fontwidth, &fontheight);
#endif
rb->splash(HZ, "Counting...");
update_screen();
lasttick = *rb->current_tick;

View file

@ -204,9 +204,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
update_lap = false;
}
#ifdef HAVE_LCD_BITMAP
rb->lcd_update();
#endif
if (! counting)
{

View file

@ -31,9 +31,7 @@ static void xingupdate(int percent)
rb->snprintf(buf, 32, "%d%%", percent);
rb->lcd_puts(0, 1, buf);
#ifdef HAVE_LCD_BITMAP
rb->lcd_update();
#endif
}
static int insert_data_in_file(char *fname, int fpos, char *buf, int num_bytes)
@ -141,9 +139,7 @@ static bool vbr_fix(char *selected_file)
rb->lcd_clear_display();
rb->lcd_puts_scroll(0, 0, selected_file);
#ifdef HAVE_LCD_BITMAP
rb->lcd_update();
#endif
xingupdate(0);

View file

@ -932,12 +932,12 @@ static void viewer_draw(int col)
if (prefs.need_scrollbar)
viewer_scrollbar();
if (col != -1)
rb->lcd_update();
#else
next_screen_to_draw_ptr = next_screen_ptr;
#endif
if (col != -1)
rb->lcd_update();
}
static void viewer_top(void)