Go Down

Topic: U8g: split screen updates - possible ? - [SOLVED] (Read 1 time) previous topic - next topic

cider101

Mar 26, 2014, 12:46 pm Last Edit: Mar 28, 2014, 09:01 am by cider101 Reason: 1
Is it possible, to split the screen updates into "smaller" sections rather then updating the full display ? Basicaly what i want to achieve, is a smaller/faster loop-time.
My current problem is, that the loop needs about 40-100ms to render the screen (depending on the complexity of the screen). If i receive serial data during the rendering, there is a good chance that the serial buffer will overflow. Currently, i'm using timer interrupts on a regular schedule to avoid the overflow problem - but this adds unnecessary complexity. So, if the screen update could be split into smaller steps (say i.e. into 128byte "pages") this would greatly reduce the loop cycle time and remove complexity - though there might be a problem with screen flickering afterwards.

Code: [Select]

switch(area) {
  case 0 : lcd.setUpdateArea(0,0, 8, 128); break;
  case 1 :  lcd.setUpdateArea(0,8, 16, 128); break;
.....
 case n :  lcd.setUpdateArea(0,8*n, 8*(n+1), 128); break;
  default: area = 0;
}



cider101

figured it out...

not drawing the full screen at once does (more or less) what i need. I wasn't aware that nextPage() could be used "outside" of the picture loop

so instead of
Code: [Select]

updateScreen() {
   lcd.firstPage();
   do {
     do the rendering
   } while(lcd.nextPage());


this works perfectly....
Code: [Select]

updateScreen() {
     do the rendering
   if(!lcd.nextPage()) {
      lcd.firstPage()
  }

and reduces my loopcycle-time  by factor 7...

olikraus


cider101


Nice solution. Thanks for this.

Oliver


i have to say thanks for your great lib - and that you designed it that way ;)
I think, i even found some hints somewhere in a discussion on your homepage which triggered my approach. Maybe you can add this somewhere on your homepage in the documentation (on the rendering loop?) so it's more obvious that one doesn't have always to use a do/while loop...

As a sugestion/wish, , it might be useful, if the rendering page could be directly set - meaning that i could use something like nextPage(2) rather then just have the ability to loop over all pages. This might increase performance as well, in the case where i know which parts of the screen have changed and need to be redrawed - though i haven't checked how much i would gain and if it's even worth the effort...

olikraus

thanks, added this as issue 251 to the u8glib project

Oliver

Go Up