GxEPD2 not working

Hi,
I recently tried to turn my 7.3in 7 colour e paper (bought from waveshare and have its respective hat as well) to a weather station and used the code here: GitHub - xJBx1/weather_module

The code complies and uploads to the esp32 board however nothing is displayed, I tried to print just a simple triangle but again it didnt work.

I am suspecting its the gxepd library that is not working with my display.

Can anyone please help with this.

Post your annotated schematic showing all connections, power, ground and power sources. Also post your code using code tags.

Can you verify your code (versus the library) by sending output to Serial Monitor?

Also... verify your hardware is clear of the precautions on this page...

And... verify if your epaper is old and 3v3, or new and 5v. (via the link)

image
That is my output when I run the code, everything else is displayed except the screen being refreshed.......
The hardware I have is 7.3inch e-Paper HAT (F) 7 colour

above is the schematic where the right side pins attach to the driver board of the e paper, currently I am not powering the esp with the battery power since I wanted to see the output on the serial monitor, hence it it powered by the micro usb cable via my pc.

initDisplay();
  do
  {
    drawCurrentConditions(owm_onecall.current, owm_onecall.daily[0],
                          owm_air_pollution, owm_onecall.hourly[0]);
    drawForecast(owm_onecall.daily, timeInfo);
    
    drawLocationDate(CITY_STRING, dateStr);
    
    drawOutlookGraph(owm_onecall.hourly, timeInfo);
    
#if DISPLAY_ALERTS
    drawAlerts(owm_onecall.alerts, CITY_STRING, dateStr);
#endif
    drawStatusBar(statusStr, refreshTimeStr, wifiRSSI, batteryVoltage);
    
  } while (display.nextPage());
  powerOffDisplay();

above is the code snippet which is meant to initialise, refresh, display and close the screen.

below is the expansion of some of the functions above.

void initDisplay()
{
  SPI.begin(PIN_EPD_SCK,
            PIN_EPD_MISO,
            PIN_EPD_MOSI,
            PIN_EPD_CS);
  
  display.init(115200, true, 2, false);
  display.setRotation(0);
  display.setTextSize(1);
  display.setTextColor(GxEPD_BLACK);
  display.setTextWrap(false);
  //display.fillScreen(GxEPD_WHITE);
  display.setFullWindow();
  display.firstPage(); // use paged drawing mode, sets fillScreen(GxEPD_WHITE)
  return;
} // end initDisplay

/* Power-off e-paper display
 */
void powerOffDisplay()
{
  display.hibernate(); // turns powerOff() and sets controller to deep sleep for
                       // minimum power use
  digitalWrite(PIN_EPD_PWR, LOW);
  return;
} // end initDisplay

/* This function is responsible for drawing the current conditions and
 * associated icons.
 */
void drawCurrentConditions(const owm_current_t &current,
                           const owm_daily_t &today,
                           const owm_resp_air_pollution_t &owm_air_pollution,
                           const owm_hourly_t &hourly)
{
  String dataStr, unitStr;
  const float moonPhase = today.moon_phase;
  // current weather icon
  display.drawInvertedBitmap(0, 0,
                             getCurrentConditionsBitmap196(current, today),
                             196, 196, GxEPD_BLACK);

  // current temp
#ifdef UNITS_TEMP_KELVIN
  dataStr = String(static_cast<int>(round(current.temp)));
  unitStr = TXT_UNITS_TEMP_KELVIN;
#endif
#ifdef UNITS_TEMP_CELSIUS
  dataStr = String(static_cast<int>(round(kelvin_to_celsius(current.temp))));
  unitStr = TXT_UNITS_TEMP_CELSIUS;
#endif
#ifdef UNITS_TEMP_FAHRENHEIT
  dataStr = String(static_cast<int>(round(kelvin_to_fahrenheit(current.temp))));
  unitStr = TXT_UNITS_TEMP_FAHRENHEIT;
#endif
  // FONT_**_temperature fonts only have the character set used for displaying
  // temperature (0123456789.-\xB0)
  display.setFont(&FONT_48pt8b_temperature);
#if defined(DISP_BW_V2) || defined(DISP_3C_B) || defined(DISP_7C_F)
    drawString(196 + 164 / 2 - 20, 196 / 2 + 69 / 2, dataStr, CENTER);
#elif defined(DISP_BW_V1)
    drawString(156 + 164 / 2 - 20, 196 / 2 + 69 / 2, dataStr, CENTER);
#endif
  display.setFont(&FONT_14pt8b);
  drawString(display.getCursorX(), 196 / 2 - 69 / 2 + 20, unitStr, LEFT);

  // current feels like
#ifdef UNITS_TEMP_KELVIN
  dataStr = String(TXT_FEELS_LIKE) + ' '
            + String(static_cast<int>(round(current.feels_like)));
#endif
#ifdef UNITS_TEMP_CELSIUS
  dataStr = String(TXT_FEELS_LIKE) + ' '
            + String(static_cast<int>(round(
                     kelvin_to_celsius(current.feels_like))))
            + '\xB0';
#endif
#ifdef UNITS_TEMP_FAHRENHEIT
  dataStr = String(TXT_FEELS_LIKE) + ' '
            + String(static_cast<int>(round(
                     kelvin_to_fahrenheit(current.feels_like))))
            + '\xB0';
#endif
  display.setFont(&FONT_12pt8b);
#if defined(DISP_BW_V2) || defined(DISP_3C_B) || defined(DISP_7C_F)
  drawString(196 + 164 / 2, 98 + 69 / 2 + 12 + 17, dataStr, CENTER);
#elif defined(DISP_BW_V1)
  drawString(156 + 164 / 2, 98 + 69 / 2 + 12 + 17, dataStr, CENTER);
#endif
  // line dividing top and bottom display areas
  // display.drawLine(0, 196, DISP_WIDTH - 1, 196, GxEPD_BLACK);

  // current weather data icons

  display.drawInvertedBitmap(0, 204 + (48 + 8) * 0,
                             wi_sunrise_48x48, 48, 48, GxEPD_BLACK);
  display.drawInvertedBitmap(0, 204 + (48 + 8) * 1,
                             wi_strong_wind_48x48, 48, 48, GxEPD_BLACK);
  display.drawInvertedBitmap(0, 204 + (48 + 8) * 2,
                             wi_day_sunny_48x48, 48, 48, GxEPD_BLACK);
#if defined(DISP_BW_V2) || defined(DISP_3C_B) || defined(DISP_7C_F)
  display.drawInvertedBitmap(0, 204 + (48 + 8) * 3,
                             air_filter_48x48, 48, 48, GxEPD_BLACK);

  if(moonPhase == 0 || moonPhase == 1){
    display.drawInvertedBitmap(0, 204 + (48 + 8) * 4,
                             wi_moon_alt_new_48x48, 48, 48, GxEPD_BLACK);
  } else if (moonPhase<0.25){
      display.drawInvertedBitmap(0, 204 + (48 + 8) * 4,
                             wi_moon_alt_waxing_crescent_3_48x48, 48, 48, GxEPD_BLACK);
  } else if (moonPhase == 0.25){
      display.drawInvertedBitmap(0, 204 + (48 + 8) * 4,
                             wi_moon_alt_first_quarter_48x48, 48, 48, GxEPD_BLACK);
  } else if(moonPhase<0.5){
      display.drawInvertedBitmap(0, 204 + (48 + 8) * 4,
                             wi_moon_alt_waxing_gibbous_3_48x48, 48, 48, GxEPD_BLACK);
  } else if(moonPhase == 0.5){
      display.drawInvertedBitmap(0, 204 + (48 + 8) * 4,
                             wi_moon_alt_full_48x48, 48, 48, GxEPD_BLACK);
  } else if (moonPhase<0.75){
      display.drawInvertedBitmap(0, 204 + (48 + 8) * 4,
                             wi_moon_alt_waning_gibbous_3_48x48, 48, 48, GxEPD_BLACK);
  }else if (moonPhase == 0.75){
      display.drawInvertedBitmap(0, 204 + (48 + 8) * 4,
                             wi_moon_alt_third_quarter_48x48, 48, 48, GxEPD_BLACK);
  }else {
      display.drawInvertedBitmap(0, 204 + (48 + 8) * 4,
                             wi_moon_alt_waning_crescent_5_48x48, 48, 48, GxEPD_BLACK);
  }

#endif
  display.drawInvertedBitmap(170, 204 + (48 + 8) * 0,
                             wi_sunset_48x48, 48, 48, GxEPD_BLACK);
  display.drawInvertedBitmap(170, 204 + (48 + 8) * 1,
                             wi_humidity_48x48, 48, 48, GxEPD_BLACK);
  display.drawInvertedBitmap(170, 204 + (48 + 8) * 2,
                             wi_barometer_48x48, 48, 48, GxEPD_BLACK);
#if defined(DISP_BW_V2) || defined(DISP_3C_B) || defined(DISP_7C_F)
  display.drawInvertedBitmap(170, 204 + (48 + 8) * 3,
                             visibility_icon_48x48, 48, 48, GxEPD_BLACK);
  display.drawInvertedBitmap(170, 204 + (48 + 8) * 4,
                             wi_raindrops_48x48, 48, 48, GxEPD_BLACK);
#endif

  // current weather data labels
  display.setFont(&FONT_7pt8b);
  drawString(48, 204 + 10 + (48 + 8) * 0, TXT_SUNRISE, LEFT);
  drawString(48, 204 + 10 + (48 + 8) * 1, TXT_WIND, LEFT);
  drawString(48, 204 + 10 + (48 + 8) * 2, TXT_UV_INDEX, LEFT);
#if defined(DISP_BW_V2) || defined(DISP_3C_B) || defined(DISP_7C_F)
  drawString(48, 204 + 10 + (48 + 8) * 3, TXT_AIR_QUALITY_INDEX, LEFT);
  drawString(48, 204 + 10 + (48 + 8) * 4, "Moon Cycle", LEFT);
#endif
  drawString(170 + 48, 204 + 10 + (48 + 8) * 0, TXT_SUNSET, LEFT);
  drawString(170 + 48, 204 + 10 + (48 + 8) * 1, TXT_HUMIDITY, LEFT);
  drawString(170 + 48, 204 + 10 + (48 + 8) * 2, TXT_PRESSURE, LEFT);
#if defined(DISP_BW_V2) || defined(DISP_3C_B) || defined(DISP_7C_F)
  drawString(170 + 48, 204 + 10 + (48 + 8) * 3, TXT_VISIBILITY, LEFT);
  drawString(170 + 48, 204 + 10 + (48 + 8) * 4, "Hourly Rain", LEFT);
#endif

  // sunrise
  display.setFont(&FONT_12pt8b);
  char timeBuffer[12] = {}; // big enough to accommodate "hh:mm:ss am"
  time_t ts = current.sunrise;
  tm *timeInfo = localtime(&ts);
  _strftime(timeBuffer, sizeof(timeBuffer), TIME_FORMAT, timeInfo);
  drawString(48, 204 + 17 / 2 + (48 + 8) * 0 + 48 / 2, timeBuffer, LEFT);

  // wind
#ifdef WIND_INDICATOR_ARROW
  display.drawInvertedBitmap(48, 204 + 24 / 2 + (48 + 8) * 1,
                             getWindBitmap24(current.wind_deg),
                             24, 24, GxEPD_BLACK);
#endif
#ifdef UNITS_SPEED_METERSPERSECOND
  dataStr = String(static_cast<int>(round(current.wind_speed)));
  unitStr = TXT_UNITS_SPEED_METERSPERSECOND;
#endif
#ifdef UNITS_SPEED_FEETPERSECOND
  dataStr = String(static_cast<int>(round(
                   meterspersecond_to_feetpersecond(current.wind_speed) )));
  unitStr = TXT_UNITS_SPEED_FEETPERSECOND;
#endif
#ifdef UNITS_SPEED_KILOMETERSPERHOUR
  dataStr = String(static_cast<int>(round(
                   meterspersecond_to_kilometersperhour(current.wind_speed) )));
  unitStr = TXT_UNITS_SPEED_KILOMETERSPERHOUR;
#endif
#ifdef UNITS_SPEED_MILESPERHOUR
  dataStr = String(static_cast<int>(round(
                   meterspersecond_to_milesperhour(current.wind_speed) )));
  unitStr = TXT_UNITS_SPEED_MILESPERHOUR;
#endif
#ifdef UNITS_SPEED_KNOTS
  dataStr = String(static_cast<int>(round(
                   meterspersecond_to_knots(current.wind_speed) )));
  unitStr = TXT_UNITS_SPEED_KNOTS;
#endif
#ifdef UNITS_SPEED_BEAUFORT
  dataStr = String(meterspersecond_to_beaufort(current.wind_speed));
  unitStr = TXT_UNITS_SPEED_BEAUFORT;
#endif

#ifdef WIND_INDICATOR_ARROW
  drawString(48 + 24, 204 + 17 / 2 + (48 + 8) * 1 + 48 / 2, dataStr, LEFT);
#else
  drawString(48     , 204 + 17 / 2 + (48 + 8) * 1 + 48 / 2, dataStr, LEFT);
#endif
  display.setFont(&FONT_8pt8b);
  drawString(display.getCursorX(), 204 + 17 / 2 + (48 + 8) * 1 + 48 / 2,
             unitStr, LEFT);

#if defined(WIND_INDICATOR_NUMBER)
  dataStr = String(current.wind_deg) + "\xB0";
  display.setFont(&FONT_12pt8b);
  drawString(display.getCursorX() + 6, 204 + 17 / 2 + (48 + 8) * 1 + 48 / 2,
             dataStr, LEFT);
#endif
#if defined(WIND_INDICATOR_CPN_CARDINAL)                \
 || defined(WIND_INDICATOR_CPN_INTERCARDINAL)           \
 || defined(WIND_INDICATOR_CPN_SECONDARY_INTERCARDINAL) \
 || defined(WIND_INDICATOR_CPN_TERTIARY_INTERCARDINAL)
  dataStr = getCompassPointNotation(current.wind_deg);
  display.setFont(&FONT_12pt8b);
  drawString(display.getCursorX() + 6, 204 + 17 / 2 + (48 + 8) * 1 + 48 / 2,
             dataStr, LEFT);
#endif

  // uv and air quality indices
  // spacing between end of index value and start of descriptor text
  const int sp = 8;

  // uv index
  display.setFont(&FONT_12pt8b);
  uint uvi = static_cast<uint>(std::max(round(current.uvi), 0.0f));
  dataStr = String(uvi);
  drawString(48, 204 + 17 / 2 + (48 + 8) * 2 + 48 / 2, dataStr, LEFT);
  display.setFont(&FONT_7pt8b);
  dataStr = String(getUVIdesc(uvi));
  int max_w = 170 - (display.getCursorX() + sp);
  if (getStringWidth(dataStr) <= max_w)
  { // Fits on a single line, draw along bottom
    drawString(display.getCursorX() + sp, 204 + 17 / 2 + (48 + 8) * 2 + 48 / 2,
               dataStr, LEFT);
  }
  else
  { // use smaller font
    display.setFont(&FONT_5pt8b);
    if (getStringWidth(dataStr) <= max_w)
    { // Fits on a single line with smaller font, draw along bottom
      drawString(display.getCursorX() + sp,
                 204 + 17 / 2 + (48 + 8) * 2 + 48 / 2,
                 dataStr, LEFT);
    }
    else
    { // Does not fit on a single line, draw higher to allow room for 2nd line
      drawMultiLnString(display.getCursorX() + sp,
                        204 + 17 / 2 + (48 + 8) * 2 + 48 / 2 - 10,
                        dataStr, LEFT, max_w, 2, 10);
    }
  }

#if defined(DISP_BW_V2) || defined(DISP_3C_B) || defined(DISP_7C_F)
  // air quality index
  display.setFont(&FONT_12pt8b);
  int aqi = getAQI(owm_air_pollution);
  dataStr = String(aqi);
  drawString(48, 204 + 17 / 2 + (48 + 8) * 3 + 48 / 2, dataStr, LEFT);
  display.setFont(&FONT_7pt8b);
  dataStr = String(getAQIdesc(aqi));
  max_w = 170 - (display.getCursorX() + sp);
  if (getStringWidth(dataStr) <= max_w)
  { // Fits on a single line, draw along bottom
    drawString(display.getCursorX() + sp, 204 + 17 / 2 + (48 + 8) * 3 + 48 / 2,
               dataStr, LEFT);
  }
  else
  { // use smaller font
    display.setFont(&FONT_5pt8b);
    if (getStringWidth(dataStr) <= max_w)
    { // Fits on a single line with smaller font, draw along bottom
      drawString(display.getCursorX() + sp,
                 204 + 17 / 2 + (48 + 8) * 3 + 48 / 2,
                 dataStr, LEFT);
    }
    else
    { // Does not fit on a single line, draw higher to allow room for 2nd line
      drawMultiLnString(display.getCursorX() + sp,
                        204 + 17 / 2 + (48 + 8) * 3 + 48 / 2 - 10,
                        dataStr, LEFT, max_w, 2, 10);
    }
  }

  // moon cycle
  display.setFont(&FONT_12pt8b);
  drawString(48, 204 + 17 / 2 + (48 + 8) * 4 + 48 / 2, getMoonPhase(moonPhase), LEFT);
#endif // defined(DISP_BW_V2) || defined(DISP_3C_B) || defined(DISP_7C_F)

  // sunset
  memset(timeBuffer, '\0', sizeof(timeBuffer));
  ts = current.sunset;
  timeInfo = localtime(&ts);
  _strftime(timeBuffer, sizeof(timeBuffer), TIME_FORMAT, timeInfo);
  drawString(170 + 48, 204 + 17 / 2 + (48 + 8) * 0 + 48 / 2, timeBuffer, LEFT);

  // humidity
  dataStr = String(current.humidity);
  drawString(170 + 48, 204 + 17 / 2 + (48 + 8) * 1 + 48 / 2, dataStr, LEFT);
  display.setFont(&FONT_8pt8b);
  drawString(display.getCursorX(), 204 + 17 / 2 + (48 + 8) * 1 + 48 / 2,
             "%", LEFT);

  // pressure
#ifdef UNITS_PRES_HECTOPASCALS
  dataStr = String(current.pressure);
  unitStr = TXT_UNITS_PRES_HECTOPASCALS;
#endif
#ifdef UNITS_PRES_PASCALS
  dataStr = String(static_cast<int>(round(
                   hectopascals_to_pascals(current.pressure) )));
  unitStr = TXT_UNITS_PRES_PASCALS;
#endif
#ifdef UNITS_PRES_MILLIMETERSOFMERCURY
  dataStr = String(static_cast<int>(round(
                   hectopascals_to_millimetersofmercury(current.pressure) )));
  unitStr = TXT_UNITS_PRES_MILLIMETERSOFMERCURY;
#endif
#ifdef UNITS_PRES_INCHESOFMERCURY
  dataStr = String(round(1e1f *
                   hectopascals_to_inchesofmercury(current.pressure)
                   ) / 1e1f, 1);
  unitStr = TXT_UNITS_PRES_INCHESOFMERCURY;
#endif
#ifdef UNITS_PRES_MILLIBARS
  dataStr = String(static_cast<int>(round(
                   hectopascals_to_millibars(current.pressure) )));
  unitStr = TXT_UNITS_PRES_MILLIBARS;
#endif
#ifdef UNITS_PRES_ATMOSPHERES
  dataStr = String(round(1e3f *
                   hectopascals_to_atmospheres(current.pressure) )
                   / 1e3f, 3);
  unitStr = TXT_UNITS_PRES_ATMOSPHERES;
#endif
#ifdef UNITS_PRES_GRAMSPERSQUARECENTIMETER
  dataStr = String(static_cast<int>(round(
                   hectopascals_to_gramspersquarecentimeter(current.pressure)
                   )));
  unitStr = TXT_UNITS_PRES_GRAMSPERSQUARECENTIMETER;
#endif
#ifdef UNITS_PRES_POUNDSPERSQUAREINCH
  dataStr = String(round(1e2f *
                   hectopascals_to_poundspersquareinch(current.pressure)
                   ) / 1e2f, 2);
  unitStr = TXT_UNITS_PRES_POUNDSPERSQUAREINCH;
#endif
  display.setFont(&FONT_12pt8b);
  drawString(170 + 48, 204 + 17 / 2 + (48 + 8) * 2 + 48 / 2, dataStr, LEFT);
  display.setFont(&FONT_8pt8b);
  drawString(display.getCursorX(), 204 + 17 / 2 + (48 + 8) * 2 + 48 / 2,
             unitStr, LEFT);

#if defined(DISP_BW_V2) || defined(DISP_3C_B) || defined(DISP_7C_F)
  // visibility
  display.setFont(&FONT_12pt8b);
#ifdef UNITS_DIST_KILOMETERS
  float vis = meters_to_kilometers(current.visibility);
  unitStr = TXT_UNITS_DIST_KILOMETERS;
#endif
#ifdef UNITS_DIST_MILES
  float vis = meters_to_miles(current.visibility);
  unitStr = TXT_UNITS_DIST_MILES;
#endif
  // if visibility is less than 1.95, round to 1 decimal place
  // else round to int
  if (vis < 1.95)
  {
    dataStr = String(round(10 * vis) / 10.0, 1);
  }
  else
  {
    dataStr = String(static_cast<int>(round(vis)));
  }
#ifdef UNITS_DIST_KILOMETERS
  if (vis >= 10) {
#endif
#ifdef UNITS_DIST_MILES
  if (vis >= 6) {
#endif
    dataStr = "> " + dataStr;
  }
  drawString(170 + 48, 204 + 17 / 2 + (48 + 8) * 3 + 48 / 2, dataStr, LEFT);
  display.setFont(&FONT_8pt8b);
  drawString(display.getCursorX(), 204 + 17 / 2 + (48 + 8) * 3 + 48 / 2,
             unitStr, LEFT);

  //rain volume per hour
  display.setFont(&FONT_12pt8b);
  dataStr = String(hourly.rain_1h, 1);
  drawString(170 + 48, 204 + 17 / 2 + (48 + 8) * 4 + 48 / 2, dataStr, LEFT);
  display.setFont(&FONT_8pt8b);
  drawString(display.getCursorX(), 204 + 17 / 2 + (48 + 8) * 4 + 48 / 2,
             "mm", LEFT);
             
#endif // defined(DISP_BW_V2) || defined(DISP_3C_B) || defined(DISP_7C_F)
  return;
} // end drawCurrentConditions

/* This function is responsible for drawing the five day forecast.
 */
void drawForecast(owm_daily_t *const daily, tm timeInfo)
{
  // 5 day, forecast
  String hiStr, loStr;
  for (int i = 0; i < 5; ++i)
  {
#if defined(DISP_BW_V2) || defined(DISP_3C_B) || defined(DISP_7C_F)
    int x = 398 + (i * 82);
#elif defined(DISP_BW_V1)
    int x = 318 + (i * 64);
#endif
    // icons
    display.drawInvertedBitmap(x, 98 + 69 / 2 - 32 - 6,
                               getForecastBitmap64(daily[i]),
                               64, 64, GxEPD_BLACK);
    // day of week label
    display.setFont(&FONT_11pt8b);
    char dayBuffer[8] = {};
    _strftime(dayBuffer, sizeof(dayBuffer), "%a", &timeInfo); // abbrv'd day
    drawString(x + 31 - 2, 98 + 69 / 2 - 32 - 26 - 6 + 16, dayBuffer, CENTER);
    timeInfo.tm_wday = (timeInfo.tm_wday + 1) % 7; // increment to next day

    // high | low
    display.setFont(&FONT_8pt8b);
    drawString(x + 31, 98 + 69 / 2 + 38 - 6 + 12, "|", CENTER);
#ifdef UNITS_TEMP_KELVIN
  hiStr = String(static_cast<int>(round(daily[i].temp.max)));
  loStr = String(static_cast<int>(round(daily[i].temp.min)));
#endif
#ifdef UNITS_TEMP_CELSIUS
  hiStr = String(static_cast<int>(round(kelvin_to_celsius(daily[i].temp.max)
                 ))) + "\xB0";
  loStr = String(static_cast<int>(round(kelvin_to_celsius(daily[i].temp.min)
                 ))) + "\xB0";
#endif
#ifdef UNITS_TEMP_FAHRENHEIT
  hiStr = String(static_cast<int>(round(kelvin_to_fahrenheit(daily[i].temp.max)
                 ))) + "\xB0";
  loStr = String(static_cast<int>(round(kelvin_to_fahrenheit(daily[i].temp.min)
                 ))) + "\xB0";
#endif
    drawString(x + 31 - 4, 98 + 69 / 2 + 38 - 6 + 12, hiStr, RIGHT);
    drawString(x + 31 + 5, 98 + 69 / 2 + 38 - 6 + 12, loStr, LEFT);
  }

  return;
} // end drawForecast