Skip to content

Flashing on Freenove ESP32-S3 Capacitive Touch Display #1262

@Saku241

Description

@Saku241

Hello

I'm trying to install marauder on this Freenove CYD ESP32 S3 but my arduino IDE crash everytime im verifying the code
I had to make some adjustments because touch is using I2C connections

I have update configs.h :

#define MARAUDER_MULTIBOARD_S3
 #ifdef MARAUDER_MULTIBOARD_S3
   #define HAS_TOUCH
   #define HAS_BT
   #define HAS_FULL_SCREEN
   #define HAS_SCREEN
   #define HAS_GPS
   #define HAS_SD
   #define USE_SD
   #define HAS_PSRAM
 #endif

 #ifdef HAS_SCREEN

   #ifdef MARAUDER_MULTIBOARD_S3
     #define CHAN_PER_PAGE 7
     #define SCREEN_CHAR_WIDTH 40
     #define HAS_ILI9341
     #define BANNER_TEXT_SIZE 2
     
     // Freenove S3 LCD Pins
     #define TFT_MOSI 11
     #define TFT_MISO 13
     #define TFT_SCLK 12
     #define TFT_CS   10
     #define TFT_DC   46   // LCD_RS in your doc
     #define TFT_RST  -1  // If not listed, often tied to EN or handled via software
     #define TFT_BL   45  // Set to specific pin if backlight control is needed

     #define TOUCH_SDA 16
     #define TOUCH_SCL 15
     #define TOUCH_INT 17
     #define TOUCH_RST 18
     #define TOUCH_CS  0

     #define GRAPH_VERT_LIM TFT_HEIGHT/2 - 1
     #define EXT_BUTTON_WIDTH 30
     #define SCREEN_BUFFER
     #define MAX_SCREEN_BUFFER 21
     #define SCREEN_ORIENTATION 0
     #define TFT_WIDTH 240
     #define TFT_HEIGHT 320
     
     // Standard Marauder UI Scaling
     #define CHAR_WIDTH 12
     #define SCREEN_WIDTH TFT_WIDTH
     #define SCREEN_HEIGHT TFT_HEIGHT
     #define STANDARD_FONT_CHAR_LIMIT (TFT_WIDTH/6)
     #define TEXT_HEIGHT 16
     #define TOP_FIXED_AREA 48
     #define BOT_FIXED_AREA 0
     #define YMAX 320
     #define minimum(a,b)     (((a) < (b)) ? (a) : (b))
     #define MENU_FONT &FreeMono9pt7b
     #define BUTTON_SCREEN_LIMIT 12
     #define BUTTON_ARRAY_LEN BUTTON_SCREEN_LIMIT
     #define STATUS_BAR_WIDTH 16
     #define LVGL_TICK_PERIOD 6
     #define HEIGHT_1 TFT_WIDTH
     #define WIDTH_1 TFT_WIDTH
     #define STATUSBAR_COLOR 0x4A49
   #endif

  #if defined(MARAUDER_MULTIBOARD_S3)
   #define BANNER_TIME 100
   
   #define COMMAND_PREFIX "!"
   
   // Keypad start position, key sizes and spacing
   #define KEY_X 120 // Centre of key
   #define KEY_Y 50
   #define KEY_W 240 // Width and height
   #define KEY_H 22
   #define KEY_SPACING_X 0 // X and Y gap
   #define KEY_SPACING_Y 1
   #define KEY_TEXTSIZE 1   // Font size multiplier
   #define ICON_W 22
   #define ICON_H 22
   #define BUTTON_PADDING 22
   //#define BUTTON_ARRAY_LEN 5
 #endif

And update Display.h :

#include "FT6336U.h"

...
class Display
{
...
public:
FT6336U* ft6336u;
...

and Display.cpp :

#include "FT6336U.h"

uint8_t Display::updateTouch(uint16_t *x, uint16_t *y, uint16_t threshold) {
  #ifdef HAS_ILI9341
    // 1. Scan the I2C bus for touch data
      if (this->ft6336u == nullptr) return 0;
      FT6336U_TouchPointType tp = this->ft6336u->scan();

      // 2. Check if a finger is touching the screen
      if (tp.touch_count > 0) {
        // 3. Map I2C coordinates to Screen coordinates
        // Based on your .ino logic: x = tp.y, y = 240 - tp.x
        uint16_t raw_x = tp.tp[0].y;
        uint16_t raw_y = 240 - tp.tp[0].x;

        // 4. Handle Rotation (Marauder usually runs in Landscape 1 or 3)
        // You may need to tweak these based on your specific screen orientation
        *x = raw_x;
        *y = raw_y;

        return 1; // Return 1 to tell Marauder "Yes, someone touched the screen"
      }

      return 0; // No touch detected
}

void Display::RunSetup() {
  // Initialize I2C Touch Driver
  // Using pins from your configs.h: SDA 16, SCL 15, RST 18, INT 17
  this->ft6336u = new FT6336U(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
  this->ft6336u->begin();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions