Hello everybody,
first of all I will include what I am using.
I am using:
- an 7.5in V2 B/W e-paper display from waveshare with a e-Paper Driver HAT
- an WROOM ESP32 / Nodemcu ESP32S (Both of these names are written on the board)
And the following (messy) code (some variables/definitions were used for testing purpose):
/* Includes ------------------------------------------------------------------*/
#include <WiFi.h>
#include <HTTPClient.h>
#include "DEV_Config.h"
#include "EPD.h"
#include "GUI_Paint.h"
#include "imagedata.h"
#include <stdlib.h>
const char* ssid = "ESPNetwork";
const char* password = "ESPpass";
String payload;
bool CodeFetched = false;
uint32_t Converted;
/* Entry point ----------------------------------------------------------------*/
void setup()
{
Serial.begin(115200);
delay(4000);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi..");
}
Serial.println("Connected to the WiFi network");
}
/* The main loop -------------------------------------------------------------*/
void loop()
{
if ((WiFi.status() == WL_CONNECTED)) {
HTTPClient http;
http.begin("http://192.168.8.120/QRCode.bmp");
int httpCode = http.GET();
String payload = http.getString();
if (httpCode > 0) { //Check for the returning code
Serial.print("fetched binary: ");
Serial.println(payload);
// Serial.print("binary with substring: ");
// Serial.println(payload.substring(2));
// Converted = atoi (payload.c_str());
// Serial.print("binary with atoi: ");
// Serial.println(Converted);
}
else {
Serial.println("Error on HTTP request");
}
delay(1000);
http.end(); //Free the resources
printf("EPD_7IN5_V2_test Demo\r\n");
DEV_Module_Init();
Serial.print("works ");
printf("e-Paper Init and Clear...\r\n");
EPD_7IN5_V2_Init();
EPD_7IN5_V2_Clear();
DEV_Delay_ms(500);
//Create a new image cache
UBYTE *BlackImage;
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
UWORD Imagesize = ((EPD_7IN5_V2_WIDTH % 8 == 0) ? (EPD_7IN5_V2_WIDTH / 8 ) : (EPD_7IN5_V2_WIDTH / 8 + 1)) * EPD_7IN5_V2_HEIGHT;
if ((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for black memory...\r\n");
while (1);
}
printf("Paint_NewImage\r\n");
Paint_NewImage(BlackImage, EPD_7IN5_V2_WIDTH, EPD_7IN5_V2_HEIGHT, 0, WHITE);
#if 1 // show image for array
printf("show image for array\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
Paint_DrawBitMap(char_payload);
EPD_7IN5_V2_Display(BlackImage);
DEV_Delay_ms(20000);
#endif
#if 0 // Drawing on the image
//1.Select Image
printf("SelectImage:BlackImage\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
Serial.println("Char gelöscht");
#endif
printf("Clear...\r\n");
printf("Goto Sleep...\r\n");
EPD_7IN5_V2_Sleep();
free(BlackImage);
BlackImage = NULL;
CodeFetched = false;
}
}
So here's the description. I use a local web server with a bitmap on it and the esp32 is supposed to fetch that bitmap as a code, and that code is as far as I know in binary. I kind of managed to get the code trough the esp32, but it starts with BM>?>( and contains after that ?﹖ □ as a very long string and I tried to use String.substring to only get the string after "BM>?>( " but it automatically stops right at the question mark, after that it does not print anything else.
I tried to convert the string to int/hex with atoi and it also did not work out and I was getting a 0 as a output.
So I thought since the e-paper is drawn using an unsigned char array with 48000 pixels, I need to convert it into a charr array, so I did, but I got again some numbers which displayed the first couple of letters in ASCII, a couple of zeroes and other numbers, 3 times 255 and then only zeroes making the program crash entirely.
I sit on this issue for quite some time now and I did not manage to make this work.