Xinyuan-LilyGO / T-CameraPlus-S3

T-CameraPlus-S3 is an intelligent camera module developed based on the ESP32S3 chip, equipped with a 240x240 TFT display, digital microphone, speaker, one independent button, power control chip, and SD card module.
GNU General Public License v3.0
5 stars 1 forks source link

Arduino_DataBus.h:167:13: error: 'i80_device_list' has not been declared #3

Open mrmonteith opened 3 weeks ago

mrmonteith commented 3 weeks ago

IDE and version or firmware

Ardino IDE 2.3.2

Operating System

Windows 10

Description

Multiple GFX errors

In file included from c:\Users\micha\OneDrive\Documents\Arduino\libraries\Arduino_GFX-1.3.7\src/Arduino_GFX_Library.h:4, from C:\Users\micha\OneDrive\Documents\Arduino\T-CameraPlus-S3\examples\Camera_Screen\Camera_Screen.ino:16: c:\Users\micha\OneDrive\Documents\Arduino\libraries\Arduino_GFX-1.3.7\src/Arduino_DataBus.h:167:13: error: 'i80_device_list' has not been declared 167 | LIST_HEAD(i80_device_list, lcd_panel_io_i80_t) | ^~~~~~~ c:\Users\micha\OneDrive\Documents\Arduino\libraries\Arduino_GFX-1.3.7\src/Arduino_DataBus.h:167:3: error: ISO C++ forbids declaration of 'LIST_HEAD' with no type [-fpermissive] 167 | LIST_HEAD(i80_device_list, lcd_panel_io_i80_t) | ^~~~~ c:\Users\micha\OneDrive\Documents\Arduino\libraries\Arduino_GFX-1.3.7\src/Arduino_DataBus.h:167:48: error: expected ';' at end of member declaration 167 | LIST_HEAD(i80_device_list, lcd_panel_io_i80_t) | ^ | ; c:\Users\micha\OneDrive\Documents\Arduino\libraries\Arduino_GFX-1.3.7\src/Arduino_DataBus.h:168:3: error: 'device_list' does not name a type 168 | device_list; // Head of i80 device list | ^~~ c:\Users\micha\OneDrive\Documents\Arduino\libraries\Arduino_GFX-1.3.7\src/Arduino_DataBus.h:202:3: error: ISO C++ forbids declaration of 'LIST_ENTRY' with no type [-fpermissive] 202 | LIST_ENTRY(lcd_panel_io_i80_t) | ^~~~~~ c:\Users\micha\OneDrive\Documents\Arduino\libraries\Arduino_GFX-1.3.7\src/Arduino_DataBus.h:202:32: error: expected ';' at end of member declaration 202 | LIST_ENTRY(lcd_panel_io_i80_t) | ^ | ; c:\Users\micha\OneDrive\Documents\Arduino\libraries\Arduino_GFX-1.3.7\src/Arduino_DataBus.h:203:3: error: 'device_list_entry' does not name a type 203 | device_list_entry; // Entry of i80 device list | ^~~~~ In file included from c:\Users\micha\OneDrive\Documents\Arduino\libraries\Arduino_GFX-1.3.7\src/Arduino_GFX_Library.h:17: c:\Users\micha\OneDrive\Documents\Arduino\libraries\Arduino_GFX-1.3.7\src/databus/Arduino_ESP32RGBPanel.h:43:3: error: 'esp_lcd_rgb_panel_frame_trans_done_cb_t' does not name a type; did you mean 'esp_lcd_panel_io_color_trans_done_cb_t'? 43 | esp_lcd_rgb_panel_frame_trans_done_cb_t on_frame_trans_done; // Callback, invoked after frame trans done | ^~~~~~~~~~~ | esp_lcd_panel_io_color_trans_done_cb_t In file included from C:\Users\micha\OneDrive\Documents\Arduino\T-CameraPlus-S3\examples\Camera_Screen\Camera_Screen.ino:20: C:\Users\micha\OneDrive\Documents\Arduino\T-CameraPlus-S3\examples\Camera_Screen\app_httpd.tpp: In function 'void setupLedFlash(int)': C:\Users\micha\OneDrive\Documents\Arduino\T-CameraPlus-S3\examples\Camera_Screen\app_httpd.tpp:1388:5: error: 'ledcSetup' was not declared in this scope; did you mean 'ledc_stop'? 1388 | ledcSetup(LED_LEDC_CHANNEL, 5000, 8); | ^~~~~ | ledc_stop C:\Users\micha\OneDrive\Documents\Arduino\T-CameraPlus-S3\examples\Camera_Screen\app_httpd.tpp:1389:5: error: 'ledcAttachPin' was not declared in this scope; did you mean 'ledcAttach'? 1389 | ledcAttachPin(pin, LED_LEDC_CHANNEL); | ^~~~~ | ledcAttach C:\Users\micha\OneDrive\Documents\Arduino\T-CameraPlus-S3\examples\Camera_Screen\Camera_Screen.ino: In function 'void setup()': C:\Users\micha\OneDrive\Documents\Arduino\T-CameraPlus-S3\examples\Camera_Screen\Camera_Screen.ino:108:5: error: 'ledcAttachPin' was not declared in this scope; did you mean 'ledcAttach'? 108 | ledcAttachPin(LCD_BL, 1); | ^~~~~ | ledcAttach C:\Users\micha\OneDrive\Documents\Arduino\T-CameraPlus-S3\examples\Camera_Screen\Camera_Screen.ino:109:5: error: 'ledcSetup' was not declared in this scope; did you mean 'ledc_stop'? 109 | ledcSetup(1, 20000, 8); | ^~~~~ | ledc_stop

exit status 1

Compilation error: 'ledcSetup' was not declared in this scope; did you mean 'ledc_stop'?

Sketch

It's from the examples Camera_Screen.ino

/*
 * @Description(CN):
 *       这是一个将OV2640摄像头数据投影到屏幕上的例程
 *
 * @Description(EN):
 *      This is a routine that projects the OV2640 camera data onto the T-CameraPlus-S3 screen.
 *
 * @version: V1.0.0
 * @Author: LILYGO_L
 * @Date: 2023-11-15 16:57:21
 * @LastEditors: LILYGO_L
 * @LastEditTime: 2023-11-25 09:04:35
 * @License: GPL 3.0
 */
#include <Arduino.h>
#include "Arduino_GFX_Library.h"
#include "pin_config.h"
#include <esp_camera.h>
#include "camera_index.h"
#include "app_httpd.tpp"

static bool OV2640_Initialization_Flag = false;

// fp-133h01d
Arduino_DataBus *bus = new Arduino_HWSPI(
    LCD_DC /* DC */, LCD_CS /* CS */, LCD_SCLK /* SCK */, LCD_MOSI /* MOSI */, -1 /* MISO */);

Arduino_TFT *gfx = new Arduino_ST7789(
    bus, LCD_RST /* RST */, 0 /* rotation */, true /* IPS */,
    LCD_WIDTH /* width */, LCD_HEIGHT /* height */,
    0 /* col offset 1 */, 0 /* row offset 1 */, 0 /* col_offset2 */, 0 /* row_offset2 */);

bool OV2640_Initialization(void)
{
    camera_config_t config;
    config.ledc_channel = LEDC_CHANNEL_0;
    config.ledc_timer = LEDC_TIMER_0;
    config.pin_d0 = Y2_GPIO_NUM;
    config.pin_d1 = Y3_GPIO_NUM;
    config.pin_d2 = Y4_GPIO_NUM;
    config.pin_d3 = Y5_GPIO_NUM;
    config.pin_d4 = Y6_GPIO_NUM;
    config.pin_d5 = Y7_GPIO_NUM;
    config.pin_d6 = Y8_GPIO_NUM;
    config.pin_d7 = Y9_GPIO_NUM;
    config.pin_xclk = XCLK_GPIO_NUM;
    config.pin_pclk = PCLK_GPIO_NUM;
    config.pin_vsync = VSYNC_GPIO_NUM;
    config.pin_href = HREF_GPIO_NUM;
    config.pin_sccb_sda = SIOD_GPIO_NUM;
    config.pin_sccb_scl = SIOC_GPIO_NUM;
    config.pin_pwdn = PWDN_GPIO_NUM;
    config.pin_reset = RESET_GPIO_NUM;
    config.xclk_freq_hz = 20000000;
    config.frame_size = FRAMESIZE_240X240;
    // config.pixel_format = PIXFORMAT_JPEG; // for streaming
    config.pixel_format = PIXFORMAT_RGB565; // for face detection/recognition
    config.grab_mode = CAMERA_GRAB_WHEN_EMPTY;
    config.fb_location = CAMERA_FB_IN_PSRAM;
    config.jpeg_quality = 0;
    config.fb_count = 2;

    // camera init
    esp_err_t err = esp_camera_init(&config);
    if (err != ESP_OK)
    {
        Serial.printf("Camera init failed with error 0x%x", err);
        gfx->printf("Camera init failed with error 0x%x \n", err);

        return false;
    }

    sensor_t *s = esp_camera_sensor_get();
    if (s)
    {
        Serial.print("camera id:");
        Serial.println(s->id.PID);
        gfx->print("camera id:");
        gfx->println(s->id.PID);
        gfx->println();
        camera_sensor_info_t *sinfo = esp_camera_sensor_get_info(&(s->id));
        if (sinfo)
        {
            Serial.print("camera model:");
            Serial.println(sinfo->name);
            gfx->print("camera model:");
            gfx->println(sinfo->name);
            gfx->println();
        }
    }
    // initial sensors are flipped vertically and colors are a bit saturated
    if (s->id.PID == OV3660_PID)
    {
        s->set_vflip(s, 1);       // flip it back
        s->set_brightness(s, 1);  // up the brightness just a bit
        s->set_saturation(s, -2); // lower the saturation
    }

    return true;
}

void setup()
{
    Serial.begin(115200);
    Serial.println("Ciallo");

    pinMode(LCD_BL, OUTPUT);
    ledcAttachPin(LCD_BL, 1);
    ledcSetup(1, 20000, 8);
    ledcWrite(1, 255); // brightness 0 - 255

    gfx->begin();
    gfx->fillScreen(WHITE);

    gfx->setTextColor(BLACK);

    OV2640_Initialization_Flag = OV2640_Initialization();
}

void loop()
{
    if (OV2640_Initialization_Flag == true)
    {
        camera_fb_t *frame = esp_camera_fb_get();
        if (frame)
        {
            gfx->draw16bitBeRGBBitmap(0, 0, (uint16_t *)frame->buf, frame->width, frame->height);
            esp_camera_fb_return(frame);
        }
        delay(1);
    }
}

Debug Message

SD card initialization failed !  Probably from sketch already on device.

Other steps to Reproduce

I totally removed the Arduino IDE when I had this issue initially. I even removed all the AppData information and my Arduino folder and started over. So I followed the steps on the github page. Which is confusing. It says to select Adafruit Feather ESP32-S3 No PSRAM, but then says later to follow the in the platform.io file, which is different. That's not the issue as no matter what is selected I get the same errors. BTW, the latest release of GFX is far ahead of what you have. Any plans to update all of this so there is no juggling of files around?

mrmonteith commented 3 weeks ago

It all seems to be related to the ESP32 code being updated.
Migration from 2.x to 3.0

ledcSetup is removed and ledcDetachPin renamed to ledcDetach.
Arduino-ESP32 LEDC API

bool ledcAttach(uint8_t pin, uint32_t freq, uint8_t resolution);

I was able to compile the code and it uploads fine. I also get the text output to the serial port. But nothing on the display.

Llgok commented 3 weeks ago

@mrmonteith You should use the arduino esp lib version 2.0.14 to build it. 1

Llgok commented 3 weeks ago

@mrmonteith The board model used in the Platformio IDE is custom and may differ from the one in the Arduino IDE. If you want to use the board model customized in the Platformio IDE within the Arduino IDE, you need to apply to the Arduino IDE community to add the board model, which may take some time. Therefore, you can currently use other boards as substitutes; in terms of usage, there is almost no difference except for the name.

mrmonteith commented 2 weeks ago

I did all that. Even reinstalled a clean copy of the Arduino IDE and all. I spent all day today trying to get it to work. I get: camera init failed with 0xffffffff.

Llgok commented 2 weeks ago

@mrmonteith This is indeed an error, caused by not being able to locate the PSRAM. In the program, "config.fb_location = CAMERA_FB_IN_PSRAM;" was called, but actually, the PSRAM was not enabled.  I have corrected the board type [OPI PSRAM] -> [QSPI PSRAM]. 1

Alternatively, you can change "config.fb_location = CAMERA_FB_IN_PSRAM;" to ".fb_location = CAMERA_FB_IN_DRAM" in the program.