Hello everyone,
Unfortunately, I haven't been able to find information on my topic. Since I lack in-depth C++ knowledge and this is my first small project, I am at a loss. Here are some background details: I want to merge and use two independently functioning codes. QRCode Reader and TFT_eSPI
Project:
It aims to create a low-cost AR glasses that can recognize, decode, and display the text of a QR code captured by a camera on a TFT display. The displays will be mirrored onto the lenses of the glasses.
Hardware:
- ESP32-Cam Ai-Thinker
- TFT ST7798
- (Arduino 1.8.18)
Pins:
#define TFT_MOSI 12 // In some display driver board, it might be written as "SDA" and so on.
#define TFT_SCLK 14
#define TFT_CS 15 // Chip select control pin
#define TFT_DC 16 // Data Command control pin
#define TFT_RST 2 // Reset pin (could connect to Arduino RESET pin)
//#define TFT_BL 22 // LED back-light
#define CAMERA_MODEL_AI_THINKER \
{ \
.PWDN_GPIO_NUM = 32, \
.RESET_GPIO_NUM = -1, \
.XCLK_GPIO_NUM = 0, \
.SIOD_GPIO_NUM = 26, \
.SIOC_GPIO_NUM = 27, \
.Y9_GPIO_NUM = 35, \
.Y8_GPIO_NUM = 34, \
.Y7_GPIO_NUM = 39, \
.Y6_GPIO_NUM = 36, \
.Y5_GPIO_NUM = 21, \
.Y4_GPIO_NUM = 19, \
.Y3_GPIO_NUM = 18, \
.Y2_GPIO_NUM = 5, \
.VSYNC_GPIO_NUM = 25, \
.HREF_GPIO_NUM = 23, \
.PCLK_GPIO_NUM = 22, \
}
Code:
#include <Arduino.h>
#include <ESP32QRCodeReader.h>
#include <TFT_eSPI.h>
#include <SPI.h>
ESP32QRCodeReader reader(CAMERA_MODEL_AI_THINKER);
TFT_eSPI tft = TFT_eSPI();
// Funktion für die QR-Code-Aufgabe
void vQrCodeTask(void *pvParameters)
{
struct QRCodeData qrCodeData;
for (;;)
{
if (reader.receiveQrCode(&qrCodeData, 100))
{
Serial.println("Found QRCode");
if (qrCodeData.valid)
{
Serial.print("Payload: ");
Serial.println((const char *)qrCodeData.payload);
// Hier kannst du den QR-Code-Inhalt auf dem TFT-Display anzeigen
tft.fillScreen(TFT_BLACK);
tft.setCursor(20, 80);
tft.setTextColor(TFT_WHITE);
tft.setTextSize(2);
tft.println("QR Code:");
tft.println((const char *)qrCodeData.payload);
}
else
{
Serial.print("Invalid: ");
Serial.println((const char *)qrCodeData.payload);
}
}
vTaskDelay(100 / portTICK_PERIOD_MS);
}
}
void setup()
{
Serial.begin(115200);
Serial.println();
reader.setup();
reader.beginOnCore(1);
Serial.println("Setup QRCode Reader");
tft.init();
tft.fillScreen(TFT_BLACK);
tft.setRotation(1);
Serial.println("Setup TFT Display");
// Erstelle die QR-Code-Aufgabe
TaskHandle_t xQrCodeTaskHandle = NULL;
xTaskCreate(vQrCodeTask, "QrCodeTask", 4096, NULL, 4, &xQrCodeTaskHandle);
configASSERT(xQrCodeTaskHandle);
}
void loop()
{
// Füge hier weitere Anweisungen im Hauptloop hinzu, falls erforderlich
delay(100);
}
Problem:
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1344
load:0x40078000,len:13936
load:0x40080400,len:3600
entry 0x400805f0
Setup QRCode Reader
assert failed: heap_caps_free heap_caps.c:381 (heap != NULL && "free() target pointer is outside heap areas")
Backtrace: 0x40083821:0x3ffd4960 0x4008a12d:0x3ffd4980 0x4008f8dd:0x3ffd49a0 0x40083c66:0x3ffd4ad0 0x4008f90d:0x3ffd4af0 0x400d4c7e:0x3ffd4b10 0x400d2538:0x3ffd4b30 0x400d2704:0x3ffd81e0