Pages: [1]   Go Down
Author Topic: U8g: split screen updates - possible ? - [SOLVED]  (Read 169 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 1
Posts: 62
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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;
}

« Last Edit: March 28, 2014, 03:01:17 am by cider101 » Logged

Offline Offline
Jr. Member
**
Karma: 1
Posts: 62
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
updateScreen() {
   lcd.firstPage();
   do {
     do the rendering
   } while(lcd.nextPage());

this works perfectly....
Code:
updateScreen() {
     do the rendering
   if(!lcd.nextPage()) {
      lcd.firstPage()
  }
and reduces my loopcycle-time  by factor 7...
Logged

Germany
Offline Offline
Edison Member
*
Karma: 100
Posts: 1217
If you believe something is right, you won't see what's wrong (David Straker).
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Nice solution. Thanks for this.

Oliver
Logged

Offline Offline
Jr. Member
**
Karma: 1
Posts: 62
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Nice solution. Thanks for this.

Oliver

i have to say thanks for your great lib - and that you designed it that way smiley-wink
 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...
Logged

Germany
Offline Offline
Edison Member
*
Karma: 100
Posts: 1217
If you believe something is right, you won't see what's wrong (David Straker).
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks, added this as issue 251 to the u8glib project

Oliver
Logged

Pages: [1]   Go Up
Jump to: