ThingPulse / esp8266-oled-ssd1306

Driver for the SSD1306 and SH1106 based 128x64, 128x32, 64x48 pixel OLED display running on ESP8266/ESP32
https://thingpulse.com
Other
2.03k stars 643 forks source link

Corrupted display UI Frame with drawProgressBar #63

Closed hallard closed 8 years ago

hallard commented 8 years ago

Hi there,

I think I discovered a bug with drawProgressBar when using UI to scroll frames containing a bargraph. The problem occurs only during scroll, once frame is fixed all is fine!

When scrolling coming frame containing bargraph there are some line draw on display during scroll, I circled them in red on screenshot below

image

Did some of you noticed this ?

here the frame code just in case


void drawFrameRF(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) {
  char buff[32];
  int16_t percent;
  volatile uint8_t * p;
  int16_t yidx = 0;
  byte n;

  n = data.size;
  p = data.buffer;

  display->clear();
  display->setFont(Roboto_Condensed_Bold_Bold_16);

  if (!got_first) {
    display->setTextAlignment(TEXT_ALIGN_CENTER);
    display->drawString(x + 64, 14, "No radio data");
    display->drawString(x + 64, 34, "received yet");
  } else {
    display->setTextAlignment(TEXT_ALIGN_LEFT);
    if (data.type == RF_MOD_RFM69) {
      sprintf_P(buff, PSTR("NODE %d"), data.nodeid );
      display->drawString(x + 0, 0, buff);

      // rssi for RFM69B is -115 (0%) to 0 (100%)
      percent = (int16_t) data.rssi;
      // rssi range now 0 (0%) to 115 (100%)
      percent += 115;

      // now calc percentage
      percent = (percent * 100) / 115;

      if (percent > 100) percent = 100;
      if (percent < 0  ) percent = 0;

      // display bargraph on lcd
      display->drawProgressBar( x + 60, 4, 64 , 12, 50 /*percent*/);

      display->setFont(Roboto_Condensed_12);
      display->setTextAlignment(TEXT_ALIGN_CENTER);
      display->drawString(x + 64, 48, timeAgo(g_second-packet_last_seen));
    }
  }

  ui.disableIndicator();
}
FWeinb commented 8 years ago

This will be fixed by #64 in 3.2.3