From 0d36a488f2afcb09f90c802aea9eff9db97aa5c4 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sat, 13 Jul 2024 01:07:51 +0200 Subject: [PATCH 01/25] preliminary target environment --- boards/seeed-sensecap-indicator.json | 40 ++++++++++++ .../seeed-sensecap-indicator/pins_arduino.h | 56 ++++++++++++++++ .../seeed-sensecap-indicator/platformio.ini | 18 ++++++ variants/seeed-sensecap-indicator/variant.h | 64 +++++++++++++++++++ 4 files changed, 178 insertions(+) create mode 100644 boards/seeed-sensecap-indicator.json create mode 100644 variants/seeed-sensecap-indicator/pins_arduino.h create mode 100644 variants/seeed-sensecap-indicator/platformio.ini create mode 100644 variants/seeed-sensecap-indicator/variant.h diff --git a/boards/seeed-sensecap-indicator.json b/boards/seeed-sensecap-indicator.json new file mode 100644 index 0000000000..a381d4a00e --- /dev/null +++ b/boards/seeed-sensecap-indicator.json @@ -0,0 +1,40 @@ +{ + "build": { + "arduino": { + "ldscript": "esp32s3_out.ld", + "partitions": "default_8MB.csv", + "memory_type": "qio_opi" + }, + "core": "esp32", + "extra_flags": [ + "-DBOARD_HAS_PSRAM", + "-DARDUINO_USB_CDC_ON_BOOT=0", + "-DARDUINO_USB_MODE=1", + "-DARDUINO_RUNNING_CORE=1", + "-DARDUINO_EVENT_RUNNING_CORE=1" + ], + "f_cpu": "240000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "hwids": [["0x1A86", "0x7523"]], + "mcu": "esp32s3", + "variant": "seeed-sensecap-indicator" + }, + "connectivity": ["wifi", "bluetooth", "lora"], + "debug": { + "openocd_target": "esp32s3.cfg" + }, + "frameworks": ["arduino"], + "name": "Seeed Studio SenseCAP Indicator", + "upload": { + "flash_size": "8MB", + "maximum_ram_size": 327680, + "maximum_size": 8388608, + "require_upload_port": true, + "use_1200bps_touch": true, + "wait_for_upload_port": true, + "speed": 921600 + }, + "url": "https://www.seeedstudio.com/Indicator-for-Meshtastic.html", + "vendor": "Seeed Studio" +} diff --git a/variants/seeed-sensecap-indicator/pins_arduino.h b/variants/seeed-sensecap-indicator/pins_arduino.h new file mode 100644 index 0000000000..300f0e0f5d --- /dev/null +++ b/variants/seeed-sensecap-indicator/pins_arduino.h @@ -0,0 +1,56 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +// static const uint8_t LED_BUILTIN = -1; + +// static const uint8_t TX = 43; +// static const uint8_t RX = 44; + +static const uint8_t SDA = 39; +static const uint8_t SCL = 40; + +// Default SPI will be mapped to Radio +static const uint8_t SS = -1; +static const uint8_t MOSI = 48; +static const uint8_t MISO = 47; +static const uint8_t SCK = 41; + +static const uint8_t A0 = 1; +static const uint8_t A1 = 2; +static const uint8_t A2 = 3; +static const uint8_t A3 = 4; +static const uint8_t A4 = 5; +static const uint8_t A5 = 6; +static const uint8_t A6 = 7; +static const uint8_t A7 = 8; +static const uint8_t A8 = 9; +static const uint8_t A9 = 10; +static const uint8_t A10 = 11; +static const uint8_t A11 = 12; +static const uint8_t A12 = 13; +static const uint8_t A13 = 14; +static const uint8_t A14 = 15; +static const uint8_t A15 = 16; +static const uint8_t A16 = 17; +static const uint8_t A17 = 18; +static const uint8_t A18 = 19; +static const uint8_t A19 = 20; + +static const uint8_t T1 = 1; +static const uint8_t T2 = 2; +static const uint8_t T3 = 3; +static const uint8_t T4 = 4; +static const uint8_t T5 = 5; +static const uint8_t T6 = 6; +static const uint8_t T7 = 7; +static const uint8_t T8 = 8; +static const uint8_t T9 = 9; +static const uint8_t T10 = 10; +static const uint8_t T11 = 11; +static const uint8_t T12 = 12; +static const uint8_t T13 = 13; +static const uint8_t T14 = 14; + +#endif /* Pins_Arduino_h */ \ No newline at end of file diff --git a/variants/seeed-sensecap-indicator/platformio.ini b/variants/seeed-sensecap-indicator/platformio.ini new file mode 100644 index 0000000000..58420cb326 --- /dev/null +++ b/variants/seeed-sensecap-indicator/platformio.ini @@ -0,0 +1,18 @@ +; Seeed Studio SenseCAP Indicator +[env:seeed-sensecap-indicator] +extends = esp32s3_base +board = seeed-sensecap-indicator +board_check = true +upload_protocol = esptool + +build_flags = ${esp32_base.build_flags} + -Ivariants/seeed-sensecap-indicator + -DSENSECAP_INDICATOR + -DPRIVATE_HW + -DPCF8563_RTC=0x51 + +lib_deps = ${esp32s3_base.lib_deps} + lovyan03/LovyanGFX@^1.1.16 + lewisxhe/PCF8563_Library@1.0.1 + earlephilhower/ESP8266Audio@^1.9.7 + earlephilhower/ESP8266SAM@^1.0.1 \ No newline at end of file diff --git a/variants/seeed-sensecap-indicator/variant.h b/variants/seeed-sensecap-indicator/variant.h new file mode 100644 index 0000000000..abf400a64b --- /dev/null +++ b/variants/seeed-sensecap-indicator/variant.h @@ -0,0 +1,64 @@ +#define I2C_SDA 39 +#define I2C_SCL 40 + +#define BUTTON_PIN 38 +// #define BUTTON_NEED_PULLUP + +// #define BATTERY_PIN 27 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage +// #define ADC_CHANNEL ADC1_GPIO27_CHANNEL +// #define ADC_MULTIPLIER 2 + +// ST7789 TFT LCD +#define ST7789_CS -1 // IO04 +#define ST7789_RS -1 // DC +#define ST7789_SDA 48 // MOSI +#define ST7789_SCK 41 +#define ST7789_RESET -1 // IO05 +#define ST7789_MISO 47 +#define ST7789_BUSY -1 +#define ST7789_BL 45 +#define ST7789_SPI_HOST SPI2_HOST +#define ST7789_BACKLIGHT_EN 45 +#define SPI_FREQUENCY 20000000 +#define SPI_READ_FREQUENCY 16000000 +#define TFT_HEIGHT 480 +#define TFT_WIDTH 480 +#define TFT_OFFSET_X 0 +#define TFT_OFFSET_Y 0 +#define TFT_OFFSET_ROTATION 2 +#define TFT_BL ST7789_BACKLIGHT_EN +#define SCREEN_ROTATE +#define SCREEN_TRANSITION_FRAMERATE 5 // fps + +#define HAS_TOUCHSCREEN 1 +#define SCREEN_TOUCH_INT -1 // IO06 +#define TOUCH_I2C_PORT 0x55 +#define TOUCH_SLAVE_ADDRESS -1 + +// Buzzer +#define PIN_BUZZER 19 + +#define HAS_GPS 0 +#undef GPS_RX_PIN +#undef GPS_TX_PIN + +#define USE_SX1262 +#define USE_SX1268 + +#define LORA_SCK 41 +#define LORA_MISO 47 +#define LORA_MOSI 48 +#define LORA_CS -1 // IO00 + +#define LORA_DIO0 -1 // a no connect on the SX1262 module +#define LORA_RESET -1 // IO01 +#define LORA_DIO1 -1 // IO03 SX1262 IRQ +#define LORA_DIO2 -1 // IO02 SX1262 BUSY +#define LORA_DIO3 + +#define SX126X_CS LORA_CS +#define SX126X_DIO1 LORA_DIO1 +#define SX126X_BUSY LORA_DIO2 +#define SX126X_RESET LORA_RESET +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 From d2ca19dc35198934d67f1459c3e432e1e6b375b1 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sun, 14 Jul 2024 11:00:02 +0200 Subject: [PATCH 02/25] add debug tool --- boards/seeed-sensecap-indicator.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/boards/seeed-sensecap-indicator.json b/boards/seeed-sensecap-indicator.json index a381d4a00e..3fc57126f9 100644 --- a/boards/seeed-sensecap-indicator.json +++ b/boards/seeed-sensecap-indicator.json @@ -18,10 +18,12 @@ "flash_mode": "qio", "hwids": [["0x1A86", "0x7523"]], "mcu": "esp32s3", - "variant": "seeed-sensecap-indicator" + "variant": "esp32s3r8" }, "connectivity": ["wifi", "bluetooth", "lora"], "debug": { + "default_tool": "esp-builtin", + "onboard_tools": ["esp-builtin"], "openocd_target": "esp32s3.cfg" }, "frameworks": ["arduino"], From 3c502127096b40f8bf845f5198684effe9e78607 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sun, 14 Jul 2024 11:00:25 +0200 Subject: [PATCH 03/25] add screen definitions --- src/graphics/Screen.cpp | 19 +++--- src/graphics/ScreenFonts.h | 3 +- src/graphics/TFTDisplay.cpp | 111 +++++++++++++++++++++++++++++++++++- src/graphics/images.h | 4 +- src/main.cpp | 4 +- 5 files changed, 127 insertions(+), 14 deletions(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index b2059b71c6..26149417b8 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -1086,7 +1086,8 @@ static void drawNodes(OLEDDisplay *display, int16_t x, int16_t y, const NodeStat { char usersString[20]; snprintf(usersString, sizeof(usersString), "%d/%d", nodeStatus->getNumOnline(), nodeStatus->getNumTotal()); -#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7735_CS) || defined(ST7789_CS) || defined(HX8357_CS)) && \ +#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7701_CS) || defined(ST7735_CS) || defined(ST7789_CS) || \ + defined(HX8357_CS)) && \ !defined(DISPLAY_FORCE_SMALL_FONTS) display->drawFastImage(x, y + 3, 8, 8, imgUser); #else @@ -1507,7 +1508,8 @@ Screen::Screen(ScanI2C::DeviceAddress address, meshtastic_Config_DisplayConfig_O #elif defined(USE_SSD1306) dispdev = new SSD1306Wire(address.address, -1, -1, geometry, (address.port == ScanI2C::I2CPort::WIRE1) ? HW_I2C::I2C_TWO : HW_I2C::I2C_ONE); -#elif defined(ST7735_CS) || defined(ILI9341_DRIVER) || defined(ST7789_CS) || defined(RAK14014) || defined(HX8357_CS) +#elif defined(ST7735_CS) || defined(ILI9341_DRIVER) || defined(ST7701_CS) || defined(ST7789_CS) || defined(RAK14014) || \ + defined(HX8357_CS) dispdev = new TFTDisplay(address.address, -1, -1, geometry, (address.port == ScanI2C::I2CPort::WIRE1) ? HW_I2C::I2C_TWO : HW_I2C::I2C_ONE); #elif defined(USE_EINK) && !defined(USE_EINK_DYNAMICDISPLAY) @@ -1683,7 +1685,8 @@ void Screen::setup() // Standard behaviour is to FLIP the screen (needed on T-Beam). If this config item is set, unflip it, and thereby logically // flip it. If you have a headache now, you're welcome. if (!config.display.flip_screen) { -#if defined(ST7735_CS) || defined(ILI9341_DRIVER) || defined(ST7789_CS) || defined(RAK14014) || defined(HX8357_CS) +#if defined(ST7701_CS) || defined(ST7735_CS) || defined(ILI9341_DRIVER) || defined(ST7701_CS) || defined(ST7789_CS) || \ + defined(RAK14014) || defined(HX8357_CS) static_cast(dispdev)->flipScreenVertically(); #else dispdev->flipScreenVertically(); @@ -2379,7 +2382,8 @@ void DebugInfo::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16 #ifdef ARCH_ESP32 if (millis() - storeForwardModule->lastHeartbeat > (storeForwardModule->heartbeatInterval * 1200)) { // no heartbeat, overlap a bit -#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7735_CS) || defined(ST7789_CS) || defined(HX8357_CS)) && \ +#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7701_CS) || defined(ST7735_CS) || defined(ST7789_CS) || \ + defined(HX8357_CS)) && \ !defined(DISPLAY_FORCE_SMALL_FONTS) display->drawFastImage(x + SCREEN_WIDTH - 14 - display->getStringWidth(ourId), y + 3 + FONT_HEIGHT_SMALL, 12, 8, imgQuestionL1); @@ -2390,7 +2394,8 @@ void DebugInfo::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16 imgQuestion); #endif } else { -#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7735_CS) || defined(ST7789_CS) || defined(HX8357_CS)) && \ +#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7701_CS) || defined(ST7735_CS) || defined(ST7789_CS) || \ + defined(HX8357_CS)) && \ !defined(DISPLAY_FORCE_SMALL_FONTS) display->drawFastImage(x + SCREEN_WIDTH - 18 - display->getStringWidth(ourId), y + 3 + FONT_HEIGHT_SMALL, 16, 8, imgSFL1); @@ -2404,8 +2409,8 @@ void DebugInfo::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16 #endif } else { // TODO: Raspberry Pi supports more than just the one screen size -#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7735_CS) || defined(ST7789_CS) || defined(HX8357_CS) || \ - ARCH_PORTDUINO) && \ +#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7701_CS) || defined(ST7735_CS) || defined(ST7789_CS) || \ + defined(HX8357_CS) || ARCH_PORTDUINO) && \ !defined(DISPLAY_FORCE_SMALL_FONTS) display->drawFastImage(x + SCREEN_WIDTH - 14 - display->getStringWidth(ourId), y + 3 + FONT_HEIGHT_SMALL, 12, 8, imgInfoL1); diff --git a/src/graphics/ScreenFonts.h b/src/graphics/ScreenFonts.h index 8a48d053e9..b61d1fb005 100644 --- a/src/graphics/ScreenFonts.h +++ b/src/graphics/ScreenFonts.h @@ -8,7 +8,8 @@ #include "graphics/fonts/OLEDDisplayFontsUA.h" #endif -#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7735_CS) || defined(ST7789_CS) || defined(HX8357_CS)) && \ +#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7701_CS) || defined(ST7735_CS) || defined(ST7789_CS) || \ + defined(HX8357_CS)) && \ !defined(DISPLAY_FORCE_SMALL_FONTS) // The screen is bigger so use bigger fonts #define FONT_SMALL ArialMT_Plain_16 // Height: 19 diff --git a/src/graphics/TFTDisplay.cpp b/src/graphics/TFTDisplay.cpp index 8ea90c5232..0c01ece4c8 100644 --- a/src/graphics/TFTDisplay.cpp +++ b/src/graphics/TFTDisplay.cpp @@ -508,10 +508,117 @@ class LGFX : public lgfx::LGFX_Device static LGFX *tft = nullptr; +#elif defined(ST7701_CS) +#include // Graphics and font library for ST7701 driver chip +#include +#include + +class LGFX : public lgfx::LGFX_Device +{ + lgfx::Panel_ST7701 _panel_instance; + lgfx::Bus_RGB _bus_instance; + lgfx::Light_PWM _light_instance; + lgfx::Touch_FT5x06 _touch_instance; + + public: + LGFX(void) + { + { + auto cfg = _panel_instance.config(); + cfg.memory_width = 800; + cfg.memory_height = 480; + cfg.panel_width = 800; + cfg.panel_height = 480; + cfg.offset_x = TFT_OFFSET_X; + cfg.offset_y = TFT_OFFSET_Y; + _panel_instance.config(cfg); + } + + { + auto cfg = _bus_instance.config(); + cfg.panel = &_panel_instance; +#ifdef SENSECAP_INDICATOR + cfg.pin_d0 = GPIO_NUM_15; // B0 + cfg.pin_d1 = GPIO_NUM_14; // B1 + cfg.pin_d2 = GPIO_NUM_13; // B2 + cfg.pin_d3 = GPIO_NUM_12; // B3 + cfg.pin_d4 = GPIO_NUM_11; // B4 + + cfg.pin_d5 = GPIO_NUM_10; // G0 + cfg.pin_d6 = GPIO_NUM_9; // G1 + cfg.pin_d7 = GPIO_NUM_8; // G2 + cfg.pin_d8 = GPIO_NUM_7; // G3 + cfg.pin_d9 = GPIO_NUM_6; // G4 + cfg.pin_d10 = GPIO_NUM_5; // G5 + + cfg.pin_d11 = GPIO_NUM_4; // R0 + cfg.pin_d12 = GPIO_NUM_3; // R1 + cfg.pin_d13 = GPIO_NUM_2; // R2 + cfg.pin_d14 = GPIO_NUM_1; // R3 + cfg.pin_d15 = GPIO_NUM_0; // R4 + + cfg.pin_henable = GPIO_NUM_18; // ??? + cfg.pin_vsync = GPIO_NUM_17; + cfg.pin_hsync = GPIO_NUM_16; + cfg.pin_pclk = GPIO_NUM_21; + cfg.freq_write = 12000000; // 40000000 + + cfg.hsync_polarity = 0; + cfg.hsync_front_porch = 10; + cfg.hsync_pulse_width = 8; + cfg.hsync_back_porch = 50; + + cfg.vsync_polarity = 0; + cfg.vsync_front_porch = 10; + cfg.vsync_pulse_width = 8; + cfg.vsync_back_porch = 20; + + cfg.pclk_active_neg = 0; + cfg.de_idle_high = 1; // ??? + cfg.pclk_idle_high = 0; // ??? +#endif + _bus_instance.config(cfg); + } + _panel_instance.setBus(&_bus_instance); + + { + auto cfg = _light_instance.config(); + cfg.pin_bl = ST7701_BL; + _light_instance.config(cfg); + } + _panel_instance.light(&_light_instance); + + { + auto cfg = _touch_instance.config(); + cfg.pin_cs = -1; + cfg.x_min = 0; + cfg.x_max = 479; + cfg.y_min = 0; + cfg.y_max = 479; + cfg.pin_int = -1; // SCREEN_TOUCH_INT + cfg.pin_rst = -1; // SCREEN_TOUCH_RST + cfg.bus_shared = true; + cfg.offset_rotation = TFT_OFFSET_ROTATION; + + cfg.i2c_port = TOUCH_I2C_PORT; + cfg.i2c_addr = TOUCH_SLAVE_ADDRESS; + cfg.pin_sda = I2C_SDA; + cfg.pin_scl = I2C_SCL; + cfg.freq = 400000; + _touch_instance.config(cfg); + _panel_instance.setTouch(&_touch_instance); + } + + setPanel(&_panel_instance); + } +}; + +static LGFX *tft = nullptr; + #endif -#if defined(ST7735_CS) || defined(ST7789_CS) || defined(ILI9341_DRIVER) || defined(RAK14014) || defined(HX8357_CS) || \ - (ARCH_PORTDUINO && HAS_SCREEN != 0) +#if defined(ST7701_CS) || defined(ST7735_CS) || defined(ST7789_CS) || defined(ILI9341_DRIVER) || defined(RAK14014) || \ + defined(HX8357_CS) || (ARCH_PORTDUINO && HAS_SCREEN != 0) #include "SPILock.h" #include "TFTDisplay.h" #include diff --git a/src/graphics/images.h b/src/graphics/images.h index d4c738610a..f876fb5565 100644 --- a/src/graphics/images.h +++ b/src/graphics/images.h @@ -20,8 +20,8 @@ const uint8_t bluetoothConnectedIcon[36] PROGMEM = {0xfe, 0x01, 0xff, 0x03, 0x03 0xfe, 0x31, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0xf0, 0x3f, 0xe0, 0x1f}; #endif -#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7735_CS) || defined(ST7789_CS) || defined(HX8357_CS) || \ - ARCH_PORTDUINO) && \ +#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7701_CS) || defined(ST7735_CS) || defined(ST7789_CS) || \ + defined(HX8357_CS) || ARCH_PORTDUINO) && \ !defined(DISPLAY_FORCE_SMALL_FONTS) const uint8_t imgQuestionL1[] PROGMEM = {0xff, 0x01, 0x01, 0x32, 0x7b, 0x49, 0x49, 0x6f, 0x26, 0x01, 0x01, 0xff}; const uint8_t imgQuestionL2[] PROGMEM = {0x0f, 0x08, 0x08, 0x08, 0x06, 0x0f, 0x0f, 0x06, 0x08, 0x08, 0x08, 0x0f}; diff --git a/src/main.cpp b/src/main.cpp index 1879423449..4f8efc8ca5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -723,8 +723,8 @@ void setup() // Don't call screen setup until after nodedb is setup (because we need // the current region name) -#if defined(ST7735_CS) || defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7789_CS) || defined(HX8357_CS) || \ - defined(USE_ST7789) +#if defined(ST7701_CS) || defined(ST7735_CS) || defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7789_CS) || \ + defined(HX8357_CS) || defined(USE_ST7789) screen->setup(); #elif defined(ARCH_PORTDUINO) if (screen_found.port != ScanI2C::I2CPort::NO_I2C || settingsMap[displayPanel]) { From 2fc3fcea389df1a9f8ce8faf2bc2a649afbe2c69 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sun, 14 Jul 2024 11:00:56 +0200 Subject: [PATCH 04/25] screen definitions --- variants/seeed-sensecap-indicator/variant.h | 46 +++++++++++---------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/variants/seeed-sensecap-indicator/variant.h b/variants/seeed-sensecap-indicator/variant.h index abf400a64b..d59aa9f17a 100644 --- a/variants/seeed-sensecap-indicator/variant.h +++ b/variants/seeed-sensecap-indicator/variant.h @@ -1,3 +1,6 @@ +#define IO_EXPANDER 0x40 +#define IO_EXPANDER_ADDR 0x20 + #define I2C_SDA 39 #define I2C_SCL 40 @@ -8,32 +11,33 @@ // #define ADC_CHANNEL ADC1_GPIO27_CHANNEL // #define ADC_MULTIPLIER 2 -// ST7789 TFT LCD -#define ST7789_CS -1 // IO04 -#define ST7789_RS -1 // DC -#define ST7789_SDA 48 // MOSI -#define ST7789_SCK 41 -#define ST7789_RESET -1 // IO05 -#define ST7789_MISO 47 -#define ST7789_BUSY -1 -#define ST7789_BL 45 -#define ST7789_SPI_HOST SPI2_HOST -#define ST7789_BACKLIGHT_EN 45 +// ST7701 TFT LCD +#define ST7701_CS -1 // (4 | IO_EXPANDER) +#define ST7701_RS -1 // DC +#define ST7701_SDA 48 // MOSI +#define ST7701_SCK 41 +#define ST7701_RESET (5 | IO_EXPANDER) +#define ST7701_MISO 47 +#define ST7701_BUSY -1 +#define ST7701_BL 45 +#define ST7701_SPI_HOST SPI2_HOST +#define ST7701_BACKLIGHT_EN 45 #define SPI_FREQUENCY 20000000 #define SPI_READ_FREQUENCY 16000000 #define TFT_HEIGHT 480 #define TFT_WIDTH 480 #define TFT_OFFSET_X 0 #define TFT_OFFSET_Y 0 -#define TFT_OFFSET_ROTATION 2 -#define TFT_BL ST7789_BACKLIGHT_EN +#define TFT_OFFSET_ROTATION 1 +#define TFT_BL 45 #define SCREEN_ROTATE #define SCREEN_TRANSITION_FRAMERATE 5 // fps -#define HAS_TOUCHSCREEN 1 -#define SCREEN_TOUCH_INT -1 // IO06 -#define TOUCH_I2C_PORT 0x55 -#define TOUCH_SLAVE_ADDRESS -1 +#define HAS_TOUCHSCREEN 3 +#define SCREEN_TOUCH_INT (6 | IO_EXPANDER) +#define SCREEN_TOUCH_RST (7 | IO_EXPANDER) +#define TOUCH_I2C_PORT 1 +#define TOUCH_SLAVE_ADDRESS 0x48 // Buzzer #define PIN_BUZZER 19 @@ -48,12 +52,12 @@ #define LORA_SCK 41 #define LORA_MISO 47 #define LORA_MOSI 48 -#define LORA_CS -1 // IO00 +#define LORA_CS -1 // (0 | IO_EXPANDER) #define LORA_DIO0 -1 // a no connect on the SX1262 module -#define LORA_RESET -1 // IO01 -#define LORA_DIO1 -1 // IO03 SX1262 IRQ -#define LORA_DIO2 -1 // IO02 SX1262 BUSY +#define LORA_RESET -1 // (1 | IO_EXPANDER) +#define LORA_DIO1 -1 // (3 | IO_EXPANDER) // SX1262 IRQ +#define LORA_DIO2 -1 // (2 | IO_EXPANDER) // SX1262 BUSY #define LORA_DIO3 #define SX126X_CS LORA_CS From 70de3f409f99d25acabbe3374e4bf647cb6d6ef7 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sun, 14 Jul 2024 11:01:13 +0200 Subject: [PATCH 05/25] remove rtc, debug build --- variants/seeed-sensecap-indicator/platformio.ini | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/variants/seeed-sensecap-indicator/platformio.ini b/variants/seeed-sensecap-indicator/platformio.ini index 58420cb326..3db1ce7b51 100644 --- a/variants/seeed-sensecap-indicator/platformio.ini +++ b/variants/seeed-sensecap-indicator/platformio.ini @@ -4,15 +4,14 @@ extends = esp32s3_base board = seeed-sensecap-indicator board_check = true upload_protocol = esptool +build_type = debug -build_flags = ${esp32_base.build_flags} +build_flags = ${esp32_base.build_flags} -Og -Ivariants/seeed-sensecap-indicator -DSENSECAP_INDICATOR - -DPRIVATE_HW - -DPCF8563_RTC=0x51 + -DPRIVATE_HW ; TODO lib_deps = ${esp32s3_base.lib_deps} lovyan03/LovyanGFX@^1.1.16 - lewisxhe/PCF8563_Library@1.0.1 earlephilhower/ESP8266Audio@^1.9.7 earlephilhower/ESP8266SAM@^1.0.1 \ No newline at end of file From e11c8700500711a3a803c07106978ad4448c597f Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sun, 14 Jul 2024 11:18:21 +0200 Subject: [PATCH 06/25] correct rotation --- src/graphics/TFTDisplay.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/graphics/TFTDisplay.cpp b/src/graphics/TFTDisplay.cpp index 0c01ece4c8..c7700c0f32 100644 --- a/src/graphics/TFTDisplay.cpp +++ b/src/graphics/TFTDisplay.cpp @@ -849,7 +849,7 @@ bool TFTDisplay::connect() ft6336u.begin(); pinMode(SCREEN_TOUCH_INT, INPUT_PULLUP); attachInterrupt(digitalPinToInterrupt(SCREEN_TOUCH_INT), rak14014_tpIntHandle, FALLING); -#elif defined(T_DECK) || defined(PICOMPUTER_S3) || defined(CHATTER_2) +#elif defined(T_DECK) || defined(PICOMPUTER_S3) || defined(SENSECAP_INDICATOR) || defined(CHATTER_2) tft->setRotation(1); // T-Deck has the TFT in landscape #elif defined(T_WATCH_S3) tft->setRotation(2); // T-Watch S3 left-handed orientation From cf056fa31ef4e52a65392135ff8b9a95b8198b22 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Tue, 23 Jul 2024 06:58:41 -0500 Subject: [PATCH 07/25] Add real hwmodel --- src/platform/esp32/architecture.h | 2 ++ variants/seeed-sensecap-indicator/platformio.ini | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/platform/esp32/architecture.h b/src/platform/esp32/architecture.h index fd3f92a9c3..ee42610605 100644 --- a/src/platform/esp32/architecture.h +++ b/src/platform/esp32/architecture.h @@ -159,6 +159,8 @@ #define HW_VENDOR meshtastic_HardwareModel_HELTEC_VISION_MASTER_E290 #elif defined(HELTEC_MESH_NODE_T114) #define HW_VENDOR meshtastic_HardwareModel_HELTEC_MESH_NODE_T114 +#elif defined(SENSECAP_INDICATOR) +#define HW_VENDOR meshtastic_HardwareModel_SENSECAP_INDICATOR #endif // ----------------------------------------------------------------------------- diff --git a/variants/seeed-sensecap-indicator/platformio.ini b/variants/seeed-sensecap-indicator/platformio.ini index 3db1ce7b51..2088e00070 100644 --- a/variants/seeed-sensecap-indicator/platformio.ini +++ b/variants/seeed-sensecap-indicator/platformio.ini @@ -9,7 +9,6 @@ build_type = debug build_flags = ${esp32_base.build_flags} -Og -Ivariants/seeed-sensecap-indicator -DSENSECAP_INDICATOR - -DPRIVATE_HW ; TODO lib_deps = ${esp32s3_base.lib_deps} lovyan03/LovyanGFX@^1.1.16 From a25ca6f0ad8887f4c31af8e914209f245ac2887c Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 31 Jul 2024 22:53:39 +0200 Subject: [PATCH 08/25] fix width --- src/graphics/TFTDisplay.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/graphics/TFTDisplay.cpp b/src/graphics/TFTDisplay.cpp index c7700c0f32..49a427bfbb 100644 --- a/src/graphics/TFTDisplay.cpp +++ b/src/graphics/TFTDisplay.cpp @@ -527,8 +527,8 @@ class LGFX : public lgfx::LGFX_Device auto cfg = _panel_instance.config(); cfg.memory_width = 800; cfg.memory_height = 480; - cfg.panel_width = 800; - cfg.panel_height = 480; + cfg.panel_width = TFT_WIDTH; + cfg.panel_height = TFT_HEIGHT; cfg.offset_x = TFT_OFFSET_X; cfg.offset_y = TFT_OFFSET_Y; _panel_instance.config(cfg); @@ -595,8 +595,8 @@ class LGFX : public lgfx::LGFX_Device cfg.x_max = 479; cfg.y_min = 0; cfg.y_max = 479; - cfg.pin_int = -1; // SCREEN_TOUCH_INT - cfg.pin_rst = -1; // SCREEN_TOUCH_RST + cfg.pin_int = SCREEN_TOUCH_INT; + cfg.pin_rst = SCREEN_TOUCH_RST; cfg.bus_shared = true; cfg.offset_rotation = TFT_OFFSET_ROTATION; @@ -819,12 +819,12 @@ bool TFTDisplay::connect() tft = new LGFX; #endif + LOG_INFO("Power to TFT Backlight\n"); #ifdef TFT_BL pinMode(TFT_BL, OUTPUT); digitalWrite(TFT_BL, TFT_BACKLIGHT_ON); // pinMode(PIN_3V3_EN, OUTPUT); // digitalWrite(PIN_3V3_EN, HIGH); - LOG_INFO("Power to TFT Backlight\n"); #endif #ifdef ST7735_BL_V03 @@ -835,7 +835,6 @@ bool TFTDisplay::connect() #endif #ifdef UNPHONE unphone.backlight(true); // using unPhone library - LOG_INFO("Power to TFT Backlight\n"); #endif tft->init(); From 3674fe0bf55d01453687639344867c0d5a8f08c6 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 31 Jul 2024 22:54:32 +0200 Subject: [PATCH 09/25] use IO expander ports --- variants/seeed-sensecap-indicator/variant.h | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/variants/seeed-sensecap-indicator/variant.h b/variants/seeed-sensecap-indicator/variant.h index d59aa9f17a..8ec95d9cb1 100644 --- a/variants/seeed-sensecap-indicator/variant.h +++ b/variants/seeed-sensecap-indicator/variant.h @@ -1,6 +1,3 @@ -#define IO_EXPANDER 0x40 -#define IO_EXPANDER_ADDR 0x20 - #define I2C_SDA 39 #define I2C_SCL 40 @@ -12,7 +9,7 @@ // #define ADC_MULTIPLIER 2 // ST7701 TFT LCD -#define ST7701_CS -1 // (4 | IO_EXPANDER) +#define ST7701_CS (4 | IO_EXPANDER) #define ST7701_RS -1 // DC #define ST7701_SDA 48 // MOSI #define ST7701_SCK 41 @@ -52,12 +49,12 @@ #define LORA_SCK 41 #define LORA_MISO 47 #define LORA_MOSI 48 -#define LORA_CS -1 // (0 | IO_EXPANDER) +#define LORA_CS (0 | IO_EXPANDER) -#define LORA_DIO0 -1 // a no connect on the SX1262 module -#define LORA_RESET -1 // (1 | IO_EXPANDER) -#define LORA_DIO1 -1 // (3 | IO_EXPANDER) // SX1262 IRQ -#define LORA_DIO2 -1 // (2 | IO_EXPANDER) // SX1262 BUSY +#define LORA_DIO0 -1 // a no connect on the SX1262 module +#define LORA_RESET (1 | IO_EXPANDER) +#define LORA_DIO1 (3 | IO_EXPANDER) // SX1262 IRQ +#define LORA_DIO2 (2 | IO_EXPANDER) // SX1262 BUSY #define LORA_DIO3 #define SX126X_CS LORA_CS From 88494176b5e003bd034e42dabfc1e926cd6dfd0b Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 31 Jul 2024 23:39:58 +0200 Subject: [PATCH 10/25] link to modified arduino-esp32 --- variants/seeed-sensecap-indicator/platformio.ini | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/variants/seeed-sensecap-indicator/platformio.ini b/variants/seeed-sensecap-indicator/platformio.ini index 2088e00070..f15f9444eb 100644 --- a/variants/seeed-sensecap-indicator/platformio.ini +++ b/variants/seeed-sensecap-indicator/platformio.ini @@ -1,6 +1,10 @@ ; Seeed Studio SenseCAP Indicator [env:seeed-sensecap-indicator] extends = esp32s3_base +platform_packages = +; platformio/framework-arduinoespressif32 @ symlink:///home/manuel/Documents/PlatformIO/Projects/arduino-esp32-fork + platformio/framework-arduinoespressif32 @ https://github.com/mverch67/arduino-esp32.git#add_tca9535 ; based on 2.0.16 + board = seeed-sensecap-indicator board_check = true upload_protocol = esptool @@ -9,6 +13,7 @@ build_type = debug build_flags = ${esp32_base.build_flags} -Og -Ivariants/seeed-sensecap-indicator -DSENSECAP_INDICATOR + -DIO_EXPANDER=0x40 lib_deps = ${esp32s3_base.lib_deps} lovyan03/LovyanGFX@^1.1.16 From 9f182c305eb2d0b8e490bcab2cb19d70d4e2a66b Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 1 Aug 2024 00:34:16 +0200 Subject: [PATCH 11/25] added config_detail --- src/graphics/TFTDisplay.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/graphics/TFTDisplay.cpp b/src/graphics/TFTDisplay.cpp index 49a427bfbb..2d98baf902 100644 --- a/src/graphics/TFTDisplay.cpp +++ b/src/graphics/TFTDisplay.cpp @@ -534,6 +534,15 @@ class LGFX : public lgfx::LGFX_Device _panel_instance.config(cfg); } + { + auto cfg = _panel_instance.config_detail(); + cfg.pin_cs = ST7701_CS; + cfg.pin_sclk = ST7701_SCK; + cfg.pin_mosi = ST7701_SDA; + // cfg.use_psram = 1; + _panel_instance.config_detail(cfg); + } + { auto cfg = _bus_instance.config(); cfg.panel = &_panel_instance; From d4a9e0de688ed27084a6f7cedb5dca8535787761 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 1 Aug 2024 21:49:25 +0200 Subject: [PATCH 12/25] rotate screen --- src/graphics/TFTDisplay.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/graphics/TFTDisplay.cpp b/src/graphics/TFTDisplay.cpp index 2d98baf902..c21ce6e05a 100644 --- a/src/graphics/TFTDisplay.cpp +++ b/src/graphics/TFTDisplay.cpp @@ -857,9 +857,9 @@ bool TFTDisplay::connect() ft6336u.begin(); pinMode(SCREEN_TOUCH_INT, INPUT_PULLUP); attachInterrupt(digitalPinToInterrupt(SCREEN_TOUCH_INT), rak14014_tpIntHandle, FALLING); -#elif defined(T_DECK) || defined(PICOMPUTER_S3) || defined(SENSECAP_INDICATOR) || defined(CHATTER_2) +#elif defined(T_DECK) || defined(PICOMPUTER_S3) || defined(CHATTER_2) tft->setRotation(1); // T-Deck has the TFT in landscape -#elif defined(T_WATCH_S3) +#elif defined(T_WATCH_S3) || defined(SENSECAP_INDICATOR) tft->setRotation(2); // T-Watch S3 left-handed orientation #else tft->setRotation(3); // Orient horizontal and wide underneath the silkscreen name label From 392d7ca8e060459a6be47334b156385254338284 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sat, 31 Aug 2024 23:04:08 +0200 Subject: [PATCH 13/25] remove touch INT --- src/graphics/TFTDisplay.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/graphics/TFTDisplay.cpp b/src/graphics/TFTDisplay.cpp index c21ce6e05a..53cb6f760b 100644 --- a/src/graphics/TFTDisplay.cpp +++ b/src/graphics/TFTDisplay.cpp @@ -604,7 +604,7 @@ class LGFX : public lgfx::LGFX_Device cfg.x_max = 479; cfg.y_min = 0; cfg.y_max = 479; - cfg.pin_int = SCREEN_TOUCH_INT; + cfg.pin_int = -1; // don't use SCREEN_TOUCH_INT; cfg.pin_rst = SCREEN_TOUCH_RST; cfg.bus_shared = true; cfg.offset_rotation = TFT_OFFSET_ROTATION; From 50cd755c5ad88fc33658e0918569c2a0715ec95a Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 6 Sep 2024 19:38:40 +0200 Subject: [PATCH 14/25] add delay to display log --- src/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main.cpp b/src/main.cpp index d5d020655d..2d5fccc4f5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -262,6 +262,7 @@ void setup() #ifdef DEBUG_PORT consoleInit(); // Set serial baud rate and init our mesh console + delay(2000); // TODO: remove me #endif #if ARCH_PORTDUINO struct timeval tv; From 607fb091a1148ab9d0be2c66916065a122b64943 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Fri, 6 Sep 2024 19:39:34 +0200 Subject: [PATCH 15/25] color log and radiolib log --- variants/seeed-sensecap-indicator/platformio.ini | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/variants/seeed-sensecap-indicator/platformio.ini b/variants/seeed-sensecap-indicator/platformio.ini index f15f9444eb..54a855890d 100644 --- a/variants/seeed-sensecap-indicator/platformio.ini +++ b/variants/seeed-sensecap-indicator/platformio.ini @@ -2,7 +2,7 @@ [env:seeed-sensecap-indicator] extends = esp32s3_base platform_packages = -; platformio/framework-arduinoespressif32 @ symlink:///home/manuel/Documents/PlatformIO/Projects/arduino-esp32-fork +; platformio/framework-arduinoespressif32 @ symlink:///home/manuel/Documents/PlatformIO/Projects/arduino-esp32 platformio/framework-arduinoespressif32 @ https://github.com/mverch67/arduino-esp32.git#add_tca9535 ; based on 2.0.16 board = seeed-sensecap-indicator @@ -13,6 +13,8 @@ build_type = debug build_flags = ${esp32_base.build_flags} -Og -Ivariants/seeed-sensecap-indicator -DSENSECAP_INDICATOR + -DCONFIG_ARDUHAL_LOG_COLORS + -DRADIOLIB_DEBUG_SPI=1 -DIO_EXPANDER=0x40 lib_deps = ${esp32s3_base.lib_deps} From a4e262302b455438760c1b9fe7f9a58e9b240d4b Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 9 Sep 2024 00:34:35 +0200 Subject: [PATCH 16/25] LoRa init --- src/configuration.h | 1 + src/detect/ScanI2C.h | 1 + src/detect/ScanI2CTwoWire.cpp | 1 + src/main.cpp | 2 +- variants/seeed-sensecap-indicator/platformio.ini | 12 ++++++++---- variants/seeed-sensecap-indicator/variant.h | 1 - 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/configuration.h b/src/configuration.h index 047dbd7275..0f04047dec 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -162,6 +162,7 @@ along with this program. If not, see . // ----------------------------------------------------------------------------- // IO Expander // ----------------------------------------------------------------------------- +#define TCA9535_ADDR 0x20 #define TCA9555_ADDR 0x26 // ----------------------------------------------------------------------------- diff --git a/src/detect/ScanI2C.h b/src/detect/ScanI2C.h index 0a5b360dec..4e921fcbbb 100644 --- a/src/detect/ScanI2C.h +++ b/src/detect/ScanI2C.h @@ -42,6 +42,7 @@ class ScanI2C BMA423, BQ24295, LSM6DS3, + TCA9535, TCA9555, VEML7700, RCWL9620, diff --git a/src/detect/ScanI2CTwoWire.cpp b/src/detect/ScanI2CTwoWire.cpp index 21e7ca8ac1..b1776645cb 100644 --- a/src/detect/ScanI2CTwoWire.cpp +++ b/src/detect/ScanI2CTwoWire.cpp @@ -371,6 +371,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize) SCAN_SIMPLE_CASE(BMX160_ADDR, BMX160, "BMX160 accelerometer found\n"); SCAN_SIMPLE_CASE(BMA423_ADDR, BMA423, "BMA423 accelerometer found\n"); SCAN_SIMPLE_CASE(LSM6DS3_ADDR, LSM6DS3, "LSM6DS3 accelerometer found at address 0x%x\n", (uint8_t)addr.address); + SCAN_SIMPLE_CASE(TCA9535_ADDR, TCA9535, "TCA9535 I2C expander found\n"); SCAN_SIMPLE_CASE(TCA9555_ADDR, TCA9555, "TCA9555 I2C expander found\n"); SCAN_SIMPLE_CASE(VEML7700_ADDR, VEML7700, "VEML7700 light sensor found\n"); SCAN_SIMPLE_CASE(TSL25911_ADDR, TSL2591, "TSL2591 light sensor found\n"); diff --git a/src/main.cpp b/src/main.cpp index 2d5fccc4f5..fc8468b937 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -750,7 +750,7 @@ void setup() // the current region name) #if defined(ST7701_CS) || defined(ST7735_CS) || defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7789_CS) || \ defined(HX8357_CS) || defined(USE_ST7789) - screen->setup(); + // FIXME: lovyanGFX breaks I2C... screen->setup(); #elif defined(ARCH_PORTDUINO) if (screen_found.port != ScanI2C::I2CPort::NO_I2C || settingsMap[displayPanel]) { screen->setup(); diff --git a/variants/seeed-sensecap-indicator/platformio.ini b/variants/seeed-sensecap-indicator/platformio.ini index 54a855890d..7a25d31b72 100644 --- a/variants/seeed-sensecap-indicator/platformio.ini +++ b/variants/seeed-sensecap-indicator/platformio.ini @@ -8,16 +8,20 @@ platform_packages = board = seeed-sensecap-indicator board_check = true upload_protocol = esptool -build_type = debug -build_flags = ${esp32_base.build_flags} -Og +build_flags = ${esp32_base.build_flags} -Ivariants/seeed-sensecap-indicator -DSENSECAP_INDICATOR -DCONFIG_ARDUHAL_LOG_COLORS - -DRADIOLIB_DEBUG_SPI=1 + -DRADIOLIB_DEBUG_SPI=0 + -DRADIOLIB_DEBUG_PROTOCOL=0 + -DRADIOLIB_DEBUG_BASIC=0 + -DRADIOLIB_VERBOSE_ASSERT=1 + -DRADIOLIB_SPI_PARANOID=0 -DIO_EXPANDER=0x40 lib_deps = ${esp32s3_base.lib_deps} lovyan03/LovyanGFX@^1.1.16 earlephilhower/ESP8266Audio@^1.9.7 - earlephilhower/ESP8266SAM@^1.0.1 \ No newline at end of file + earlephilhower/ESP8266SAM@^1.0.1 + robtillaart/TCA9555@^0.3.2 \ No newline at end of file diff --git a/variants/seeed-sensecap-indicator/variant.h b/variants/seeed-sensecap-indicator/variant.h index 8ec95d9cb1..23071b0421 100644 --- a/variants/seeed-sensecap-indicator/variant.h +++ b/variants/seeed-sensecap-indicator/variant.h @@ -62,4 +62,3 @@ #define SX126X_BUSY LORA_DIO2 #define SX126X_RESET LORA_RESET #define SX126X_DIO2_AS_RF_SWITCH -#define SX126X_DIO3_TCXO_VOLTAGE 1.8 From 6d2c6d9d4b8b5e2e398eed4c25d6ad121d84e493 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 9 Sep 2024 00:45:36 +0200 Subject: [PATCH 17/25] make trunk happy --- src/graphics/Screen.cpp | 16 ++++++++-------- src/graphics/ScreenFonts.h | 4 ++-- src/graphics/images.h | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 7ede5756e1..3ed5123727 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -1093,8 +1093,8 @@ static void drawNodes(OLEDDisplay *display, int16_t x, int16_t y, const NodeStat { char usersString[20]; snprintf(usersString, sizeof(usersString), "%d/%d", nodeStatus->getNumOnline(), nodeStatus->getNumTotal()); -#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7701_CS) || defined(ST7735_CS) || defined(ST7789_CS) || defined(USE_ST7789) || \ - defined(HX8357_CS)) && \ +#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7701_CS) || defined(ST7735_CS) || defined(ST7789_CS) || \ + defined(USE_ST7789) || defined(HX8357_CS)) && \ !defined(DISPLAY_FORCE_SMALL_FONTS) display->drawFastImage(x, y + 3, 8, 8, imgUser); #else @@ -2417,8 +2417,8 @@ void DebugInfo::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16 #ifdef ARCH_ESP32 if (millis() - storeForwardModule->lastHeartbeat > (storeForwardModule->heartbeatInterval * 1200)) { // no heartbeat, overlap a bit -#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7701_CS) || defined(ST7735_CS) || defined(ST7789_CS) || defined(USE_ST7789) || \ - defined(HX8357_CS)) && \ +#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7701_CS) || defined(ST7735_CS) || defined(ST7789_CS) || \ + defined(USE_ST7789) || defined(HX8357_CS)) && \ !defined(DISPLAY_FORCE_SMALL_FONTS) display->drawFastImage(x + SCREEN_WIDTH - 14 - display->getStringWidth(ourId), y + 3 + FONT_HEIGHT_SMALL, 12, 8, imgQuestionL1); @@ -2429,8 +2429,8 @@ void DebugInfo::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16 imgQuestion); #endif } else { -#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7701_CS) || defined(ST7735_CS) || defined(ST7789_CS) || defined(USE_ST7789) || \ - defined(HX8357_CS)) && \ +#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7701_CS) || defined(ST7735_CS) || defined(ST7789_CS) || \ + defined(USE_ST7789) || defined(HX8357_CS)) && \ !defined(DISPLAY_FORCE_SMALL_FONTS) display->drawFastImage(x + SCREEN_WIDTH - 18 - display->getStringWidth(ourId), y + 3 + FONT_HEIGHT_SMALL, 16, 8, imgSFL1); @@ -2444,8 +2444,8 @@ void DebugInfo::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16 #endif } else { // TODO: Raspberry Pi supports more than just the one screen size -#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7701_CS) || defined(ST7735_CS) || defined(ST7789_CS) || defined(USE_ST7789) || \ - defined(HX8357_CS) || ARCH_PORTDUINO) && \ +#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7701_CS) || defined(ST7735_CS) || defined(ST7789_CS) || \ + defined(USE_ST7789) || defined(HX8357_CS) || ARCH_PORTDUINO) && \ !defined(DISPLAY_FORCE_SMALL_FONTS) display->drawFastImage(x + SCREEN_WIDTH - 14 - display->getStringWidth(ourId), y + 3 + FONT_HEIGHT_SMALL, 12, 8, imgInfoL1); diff --git a/src/graphics/ScreenFonts.h b/src/graphics/ScreenFonts.h index 4e0d7fdabc..34c832635c 100644 --- a/src/graphics/ScreenFonts.h +++ b/src/graphics/ScreenFonts.h @@ -12,8 +12,8 @@ #include "graphics/fonts/OLEDDisplayFontsUA.h" #endif -#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7701_CS) || defined(ST7735_CS) || defined(ST7789_CS) || defined(USE_ST7789) || \ - defined(HX8357_CS)) && \ +#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7701_CS) || defined(ST7735_CS) || defined(ST7789_CS) || \ + defined(USE_ST7789) || defined(HX8357_CS)) && \ !defined(DISPLAY_FORCE_SMALL_FONTS) // The screen is bigger so use bigger fonts #define FONT_SMALL ArialMT_Plain_16 // Height: 19 diff --git a/src/graphics/images.h b/src/graphics/images.h index 435d6045d3..7028f18e3a 100644 --- a/src/graphics/images.h +++ b/src/graphics/images.h @@ -20,8 +20,8 @@ const uint8_t bluetoothConnectedIcon[36] PROGMEM = {0xfe, 0x01, 0xff, 0x03, 0x03 0xfe, 0x31, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0xf0, 0x3f, 0xe0, 0x1f}; #endif -#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7701_CS) || defined(ST7735_CS) || defined(ST7789_CS) || defined(USE_ST7789) || \ - defined(HX8357_CS) || ARCH_PORTDUINO) && \ +#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7701_CS) || defined(ST7735_CS) || defined(ST7789_CS) || \ + defined(USE_ST7789) || defined(HX8357_CS) || ARCH_PORTDUINO) && \ !defined(DISPLAY_FORCE_SMALL_FONTS) const uint8_t imgQuestionL1[] PROGMEM = {0xff, 0x01, 0x01, 0x32, 0x7b, 0x49, 0x49, 0x6f, 0x26, 0x01, 0x01, 0xff}; const uint8_t imgQuestionL2[] PROGMEM = {0x0f, 0x08, 0x08, 0x08, 0x06, 0x0f, 0x0f, 0x06, 0x08, 0x08, 0x08, 0x0f}; From 0d49186834673964b7c564e11733cb5025d3be56 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 9 Sep 2024 23:30:54 +0200 Subject: [PATCH 18/25] add lovyanGFX patch lib for io expander --- variants/seeed-sensecap-indicator/platformio.ini | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/variants/seeed-sensecap-indicator/platformio.ini b/variants/seeed-sensecap-indicator/platformio.ini index 7a25d31b72..aa4b60100f 100644 --- a/variants/seeed-sensecap-indicator/platformio.ini +++ b/variants/seeed-sensecap-indicator/platformio.ini @@ -8,20 +8,25 @@ platform_packages = board = seeed-sensecap-indicator board_check = true upload_protocol = esptool +build_type = debug -build_flags = ${esp32_base.build_flags} +build_flags = ${esp32_base.build_flags} -O0 -Ivariants/seeed-sensecap-indicator -DSENSECAP_INDICATOR -DCONFIG_ARDUHAL_LOG_COLORS -DRADIOLIB_DEBUG_SPI=0 -DRADIOLIB_DEBUG_PROTOCOL=0 -DRADIOLIB_DEBUG_BASIC=0 - -DRADIOLIB_VERBOSE_ASSERT=1 + -DRADIOLIB_VERBOSE_ASSERT=0 -DRADIOLIB_SPI_PARANOID=0 -DIO_EXPANDER=0x40 + -DIO_EXPANDER_IRQ=42 + ;-DIO_EXPANDER_DEBUG + -DUSE_ARDUINO_HAL_GPIO lib_deps = ${esp32s3_base.lib_deps} - lovyan03/LovyanGFX@^1.1.16 + lovyan03/LovyanGFX @ https://github.com/mverch67/LovyanGFX#develop +; file:///home/manuel/Documents/PlatformIO/Projects/LovyanGFX earlephilhower/ESP8266Audio@^1.9.7 earlephilhower/ESP8266SAM@^1.0.1 robtillaart/TCA9555@^0.3.2 \ No newline at end of file From 5eeff3076fccc8230027d0f5096cb2de7ff139ea Mon Sep 17 00:00:00 2001 From: mverch67 Date: Mon, 9 Sep 2024 23:33:39 +0200 Subject: [PATCH 19/25] fix lib --- variants/seeed-sensecap-indicator/platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variants/seeed-sensecap-indicator/platformio.ini b/variants/seeed-sensecap-indicator/platformio.ini index aa4b60100f..b74e23da2c 100644 --- a/variants/seeed-sensecap-indicator/platformio.ini +++ b/variants/seeed-sensecap-indicator/platformio.ini @@ -25,7 +25,7 @@ build_flags = ${esp32_base.build_flags} -O0 -DUSE_ARDUINO_HAL_GPIO lib_deps = ${esp32s3_base.lib_deps} - lovyan03/LovyanGFX @ https://github.com/mverch67/LovyanGFX#develop + https://github.com/mverch67/LovyanGFX#develop ; file:///home/manuel/Documents/PlatformIO/Projects/LovyanGFX earlephilhower/ESP8266Audio@^1.9.7 earlephilhower/ESP8266SAM@^1.0.1 From 2a02b3cf1039edfcbf2253958455b15f27b24ff3 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 10 Sep 2024 13:17:39 +0200 Subject: [PATCH 20/25] fix display&touch function --- src/main.cpp | 2 +- variants/seeed-sensecap-indicator/variant.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 22e24f52b7..0a8ac52de6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -748,7 +748,7 @@ void setup() // the current region name) #if defined(ST7701_CS) || defined(ST7735_CS) || defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7789_CS) || \ defined(HX8357_CS) || defined(USE_ST7789) - // FIXME: lovyanGFX breaks I2C... screen->setup(); + screen->setup(); #elif defined(ARCH_PORTDUINO) if (screen_found.port != ScanI2C::I2CPort::NO_I2C || settingsMap[displayPanel]) { screen->setup(); diff --git a/variants/seeed-sensecap-indicator/variant.h b/variants/seeed-sensecap-indicator/variant.h index 23071b0421..d7ed329eb9 100644 --- a/variants/seeed-sensecap-indicator/variant.h +++ b/variants/seeed-sensecap-indicator/variant.h @@ -25,15 +25,15 @@ #define TFT_WIDTH 480 #define TFT_OFFSET_X 0 #define TFT_OFFSET_Y 0 -#define TFT_OFFSET_ROTATION 1 +#define TFT_OFFSET_ROTATION 0 #define TFT_BL 45 #define SCREEN_ROTATE #define SCREEN_TRANSITION_FRAMERATE 5 // fps -#define HAS_TOUCHSCREEN 3 +#define HAS_TOUCHSCREEN 1 #define SCREEN_TOUCH_INT (6 | IO_EXPANDER) #define SCREEN_TOUCH_RST (7 | IO_EXPANDER) -#define TOUCH_I2C_PORT 1 +#define TOUCH_I2C_PORT 0 #define TOUCH_SLAVE_ADDRESS 0x48 // Buzzer From a4520426a6ef52872b984d1c0a489823a1a83ea9 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 10 Sep 2024 13:28:21 +0200 Subject: [PATCH 21/25] touch driver I2C scan --- src/configuration.h | 5 +++++ src/detect/ScanI2C.h | 3 ++- src/detect/ScanI2CTwoWire.cpp | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/configuration.h b/src/configuration.h index 0f04047dec..c211f0423e 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -172,6 +172,11 @@ along with this program. If not, see . #define GPS_THREAD_INTERVAL 200 #endif +// ----------------------------------------------------------------------------- +// Touchscreen +// ----------------------------------------------------------------------------- +#define FT6336U_ADDR 0x48 + // convert 24-bit color to 16-bit (56K) #define COLOR565(r, g, b) (((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3)) diff --git a/src/detect/ScanI2C.h b/src/detect/ScanI2C.h index 4e921fcbbb..84beda31f4 100644 --- a/src/detect/ScanI2C.h +++ b/src/detect/ScanI2C.h @@ -53,7 +53,8 @@ class ScanI2C AHT10, BMX160, DFROBOT_LARK, - NAU7802 + NAU7802, + FT6336U } DeviceType; // typedef uint8_t DeviceAddress; diff --git a/src/detect/ScanI2CTwoWire.cpp b/src/detect/ScanI2CTwoWire.cpp index b1776645cb..be20301169 100644 --- a/src/detect/ScanI2CTwoWire.cpp +++ b/src/detect/ScanI2CTwoWire.cpp @@ -378,6 +378,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize) SCAN_SIMPLE_CASE(OPT3001_ADDR, OPT3001, "OPT3001 light sensor found\n"); SCAN_SIMPLE_CASE(MLX90632_ADDR, MLX90632, "MLX90632 IR temp sensor found\n"); SCAN_SIMPLE_CASE(NAU7802_ADDR, NAU7802, "NAU7802 based scale found\n"); + SCAN_SIMPLE_CASE(FT6336U_ADDR, FT6336U, "FT6336U touchscreen found\n"); default: LOG_INFO("Device found at address 0x%x was not able to be enumerated\n", addr.address); From efa759c3509948a594ec0ec2e131270443f5e248 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 10 Sep 2024 13:49:00 +0200 Subject: [PATCH 22/25] remove delay --- src/main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 0a8ac52de6..1401f4f0b4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -262,7 +262,6 @@ void setup() #ifdef DEBUG_PORT consoleInit(); // Set serial baud rate and init our mesh console - delay(2000); // TODO: remove me #endif #if ARCH_PORTDUINO struct timeval tv; From 76136dc17843d83e33251c19e1003f61719c4713 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Tue, 10 Sep 2024 14:20:12 +0200 Subject: [PATCH 23/25] build for release --- variants/seeed-sensecap-indicator/platformio.ini | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/variants/seeed-sensecap-indicator/platformio.ini b/variants/seeed-sensecap-indicator/platformio.ini index b74e23da2c..38b8715852 100644 --- a/variants/seeed-sensecap-indicator/platformio.ini +++ b/variants/seeed-sensecap-indicator/platformio.ini @@ -8,9 +8,8 @@ platform_packages = board = seeed-sensecap-indicator board_check = true upload_protocol = esptool -build_type = debug -build_flags = ${esp32_base.build_flags} -O0 +build_flags = ${esp32_base.build_flags} -Ivariants/seeed-sensecap-indicator -DSENSECAP_INDICATOR -DCONFIG_ARDUHAL_LOG_COLORS From 6d1e1e52b500ff98612a3b4f815f43790f06e659 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Wed, 11 Sep 2024 08:41:19 +0200 Subject: [PATCH 24/25] minor code cleanup --- src/graphics/TFTDisplay.cpp | 8 ++++---- variants/seeed-sensecap-indicator/platformio.ini | 5 +---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/graphics/TFTDisplay.cpp b/src/graphics/TFTDisplay.cpp index b10d0d2720..c0326abec5 100644 --- a/src/graphics/TFTDisplay.cpp +++ b/src/graphics/TFTDisplay.cpp @@ -558,11 +558,11 @@ class LGFX : public lgfx::LGFX_Device cfg.pin_d14 = GPIO_NUM_1; // R3 cfg.pin_d15 = GPIO_NUM_0; // R4 - cfg.pin_henable = GPIO_NUM_18; // ??? + cfg.pin_henable = GPIO_NUM_18; cfg.pin_vsync = GPIO_NUM_17; cfg.pin_hsync = GPIO_NUM_16; cfg.pin_pclk = GPIO_NUM_21; - cfg.freq_write = 12000000; // 40000000 + cfg.freq_write = 12000000; cfg.hsync_polarity = 0; cfg.hsync_front_porch = 10; @@ -575,8 +575,8 @@ class LGFX : public lgfx::LGFX_Device cfg.vsync_back_porch = 20; cfg.pclk_active_neg = 0; - cfg.de_idle_high = 1; // ??? - cfg.pclk_idle_high = 0; // ??? + cfg.de_idle_high = 1; + cfg.pclk_idle_high = 0; #endif _bus_instance.config(cfg); } diff --git a/variants/seeed-sensecap-indicator/platformio.ini b/variants/seeed-sensecap-indicator/platformio.ini index 38b8715852..e6bb2145ef 100644 --- a/variants/seeed-sensecap-indicator/platformio.ini +++ b/variants/seeed-sensecap-indicator/platformio.ini @@ -2,7 +2,6 @@ [env:seeed-sensecap-indicator] extends = esp32s3_base platform_packages = -; platformio/framework-arduinoespressif32 @ symlink:///home/manuel/Documents/PlatformIO/Projects/arduino-esp32 platformio/framework-arduinoespressif32 @ https://github.com/mverch67/arduino-esp32.git#add_tca9535 ; based on 2.0.16 board = seeed-sensecap-indicator @@ -25,7 +24,5 @@ build_flags = ${esp32_base.build_flags} lib_deps = ${esp32s3_base.lib_deps} https://github.com/mverch67/LovyanGFX#develop -; file:///home/manuel/Documents/PlatformIO/Projects/LovyanGFX earlephilhower/ESP8266Audio@^1.9.7 - earlephilhower/ESP8266SAM@^1.0.1 - robtillaart/TCA9555@^0.3.2 \ No newline at end of file + earlephilhower/ESP8266SAM@^1.0.1 \ No newline at end of file From b10056d389f5ef7ccded401540f7a899e9fb20b4 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Thu, 12 Sep 2024 08:01:25 +0200 Subject: [PATCH 25/25] allow trunk to be happy --- src/graphics/Screen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index c0fadba72c..ff1254812a 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -19,8 +19,8 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "../userPrefs.h" #include "Screen.h" +#include "../userPrefs.h" #include "PowerMon.h" #include "configuration.h" #if HAS_SCREEN