olikraus / u8g2

U8glib library for monochrome displays, version 2
Other
4.91k stars 1.03k forks source link

Pixel Loss #2348

Closed Alejandro13C closed 3 weeks ago

Alejandro13C commented 5 months ago

Hi all,

I see how i lost a lot of pixel. Some picture: image image image

`u8g2.firstPage(); SerialLogger(); do {

if(Vbat < 12.0){    //If the battery is less than 12.0, show battery voltage.
  //Converts from float to const char
  dtostrf(Vbat, 4, 2, Battery_char); 
  u8g2.drawStr(35 , 60, Battery_char);
  u8g2.drawStr(85 , 60 , "V");
  u8g2.drawXBMP(48, 2, 40, 40, BatteryLogo);

} else {

  // Else show Oil pressure value.
  dtostrf(Oil_pressure, 4, 2, OP_char);
  u8g2.drawStr(75 , 60 , "Bar");
  u8g2.drawXBMP(48, 10, 32, 32, OilLogo);

}

} while ( u8g2.nextPage() ); delay(1000); `

Thanks in Advance!

olikraus commented 5 months ago

Never change the content within the "while" first/next page loop. To solve this, move the while loop into the if/else body.

Alejandro13C commented 5 months ago

Hi,

Okey, thanks i will create one while for each case. Thanks!

Alejandro13C commented 3 weeks ago

Not an issue. Use proper structure.