Files
wadamesh/variants/heltec_v4/LGFXDisplay.h
T
041dd60b8d touch: beta_46 — control-center redesign, Do Not Disturb, contact safety + board fixes
- Contact-loss fix (microSD devices): atomic temp+swap saveContacts, unified robust
  boot SD-mount ladder, and a storage-truth line in the Store-on-SD setting.
- Heltec V4-R8: route MISO for the shared FSPI bus so the microSD mounts; wake-from-sleep
  freeze fixed (panel sleep goes through LovyanGFX's own bus, not the HSPI shim).
- Do Not Disturb (originally PR #156 by Tesso Codemonkey / @codemonkeybr): scheduled
  sound-silencing window in Settings > Sound + a status-bar bell.
- Control-center redesign: round icon-only chips that spread to fill each row (T-Deck 2x4,
  V4 portrait 2 rows), frosted-glass panel, real lock glyph + dynamic bell/bell-slash DND
  chip + keyboard icon+word chip (new cc_icons_16 FontAwesome font), per-chip confirmation
  toasts, press-grow clip fix, and a V4-portrait status-bar BLE/clock overlap fix.
- LilyGo T-Pager: map tile cache falls back to the microSD under the launcher (fixes the
  "storage error / reflash the tiles partition" dead-end).

Co-Authored-By: Tesso Codemonkey <798026+codemonkeybr@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-16 22:30:05 +02:00

63 lines
2.2 KiB
C++

// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
// Heltec WiFi LoRa 32 V4-R8 (+ Expansion Kit V2) — LovyanGFX ST7789 driver.
//
// The V4-R8's 8 MB OCTAL PSRAM claims GPIO33-37, so the Expansion Kit V2 moved
// the TFT off the R2's software-SPI-on-GPIO33 path onto a real hardware SPI bus
// (SPI2_HOST/FSPI: SCK=16, MOSI=15, MISO=45) that it SHARES with the micro-SD
// slot (CS=3). Hardware SPI is therefore mandatory here — hence LovyanGFX with
// bus_shared=true, exactly like the RAK Tap V2 variant. All pins come from the
// PIN_TFT_* build flags. Compiled only for the R8 (guarded in the .cpp).
#include <helpers/ui/DisplayDriver.h>
#include <helpers/RefCountedDigitalPin.h>
#define LGFX_USE_V1
#include <LovyanGFX.hpp>
class LGFXDisplay : public DisplayDriver {
private:
lgfx::Panel_ST7789 _panel;
lgfx::Bus_SPI _bus;
lgfx::Light_PWM _light;
lgfx::LGFX_Device _lcd;
bool _isOn;
uint16_t _color;
RefCountedDigitalPin* _periph_power;
public:
LGFXDisplay(RefCountedDigitalPin* peripher_power = nullptr);
bool begin();
// ---- DisplayDriver overrides ----
bool isOn() override { return _isOn; }
void turnOn() override;
void turnOff() override;
void clear() override;
void startFrame(Color bkg = DARK) override;
void setTextSize(int sz) override;
void setColor(Color c) override;
void setCursor(int x, int y) override;
void print(const char* str) override;
void fillRect(int x, int y, int w, int h) override;
void drawRect(int x, int y, int w, int h) override;
void drawXbm(int x, int y, const uint8_t* bits, int w, int h) override;
uint16_t getTextWidth(const char* str) override;
void endFrame() override;
// ---- LVGL flush entry point ----
void writePixelsRGB565(int x, int y, int w, int h, const uint16_t* pixels);
// ---- Hardware panel rotation ----
void setDisplayRotation(uint8_t r);
// ---- Anti-burn-in panel sleep (SLPIN/SLPOUT) ----
// Sends the ST7789 sleep commands over LovyanGFX's OWN SPI2 bus. The shared
// touchPanelSleep() path in UITask must call this on the R8 instead of its
// HSPI s_cmd_spi shim — that shim re-routes GPIO16/15 to HSPI and steals the
// FSPI display pins from LGFX, wedging the bus on wake (frozen last frame).
void panelSleep(bool sleep);
};