So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By PeterKg
#81605 Hi all,

I am quite new to esp8266 programming and need your help.

The project that I am currently doing is a status monitor. For development I am using a wemos D1 mini and a waveshare e paper display. The esp8266 connects to different web pages, collects information and displays these on the e paper display. To control the display I am using the ZinggJM/GxEPD library. Pseudo code looks like this:

Code: Select all#include <GxEPD.h>
#include <GxGDEW0583T7/GxGDEW0583T7.h>
#include <Fonts/FreeMonoBold12pt7b.h>
#include <GxIO/GxIO_SPI/GxIO_SPI.h>
#include <GxIO/GxIO.h>
#include <stdio.h>
#include <string.h>
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>

// IO Pin Mapping...

void setup()
{
  //...
  // Connectin to WiFi
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  //...
}

void loop()
{
  display.fillScreen(GxEPD_WHITE);

  printHeader("Status display");
  printBody();
  printFooter();
  display.update();

  delay(100000);
}

void printHeader(char *text)
{
 //...
 display.println(text);
//...
}

void printBody()
{
  // Set up parameters
  //...
  ShowStatus("Airflow1", "Desc1", col1_start, &current_y, 0);
  ShowStatus("Airflow2", "Desc2", col1_start, &current_y, 0);
  ShowStatus("Airflow3", "Desc3", col1_start, &current_y, 0);
  ShowStatus("Airflow4", "Desc4", col1_start, &current_y, 0);
  ShowStatus("Airflow5", "Desc5", col1_start, &current_y, 0);
  ShowStatus("Airflow6", "Desc6", col1_start, &current_y, 0);
  ShowStatus("Airflow7", "Desc7", col1_start, &current_y, 0);
}

void ShowStatus(char *element, char *alt_text, int x_start, int *y_start, int modify_result)
{
  Serial.printf("settings heap size: %u\n", ESP.getFreeHeap());
  // Initialize parameters
  //...
  WiFiClient client;
  HTTPClient http;
  sprintf(http_req, "http://mysite.com/%s", element);
  http.begin(client, http_req);
  String payload = http.getString();
  // Perform some manipulation to the payload
  display.println(payload);
}

void printFooter()
{
  //...
  display.println("Version 1.2");
  //...
}



The code so far works like a charm. However when I put another line into the printBody() function to show status of Airflow8 the whole controller behaves different. Status of the other airflows will no longer be collected reliably. Uncontrolled resets are happening,...

Can anyone give me a hint where the error could be and how I could approach a solution?