Skip to content

Commit

Permalink
Merge branch 'master' into cyrillic
Browse files Browse the repository at this point in the history
  • Loading branch information
mverch67 authored Nov 7, 2024
2 parents c5bd0f5 + be443a5 commit e7dc200
Show file tree
Hide file tree
Showing 15 changed files with 761 additions and 415 deletions.
15 changes: 15 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# trunk-ignore-all(trivy/DS026)
# trunk-ignore-all(trivy/DS002)
# trunk-ignore-all(checkov/CKV_DOCKER_2)
# trunk-ignore-all(checkov/CKV_DOCKER_3)
FROM mcr.microsoft.com/devcontainers/cpp:1-debian-12

# trunk-ignore(terrascan/AC_DOCKER_0002)
# trunk-ignore(hadolint/DL3008)
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends \
ca-certificates \
git \
wget \
zip \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
37 changes: 37 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// For format details, see https://aka.ms/devcontainer.json.
{
"name": "Meshtastic Device-UI Dev",
"build": {
"dockerfile": "Dockerfile"
},

// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/trunk-io/devcontainer-feature/trunk:1": {},
"ghcr.io/devcontainers/features/node:1": {}
},

// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"Trunk.io",
"ms-vscode.cpptools-extension-pack",
"ms-azuretools.vscode-docker"
],
"settings": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "trunk.io",
"trunk.enableWindows": true,
"files.insertFinalNewline": false,
"files.trimFinalNewlines": false,
"cmake.configureOnOpen": false,
"[cpp]": {
"editor.defaultFormatter": "trunk.io"
}
}
}
},

"postCreateCommand": "npm install lv_i18n -g --no-fund"
}
4 changes: 3 additions & 1 deletion .github/workflows/trunk_check.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: Pull Request
on: [pull_request]
on:
pull_request:
merge_group:
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
Expand Down
4 changes: 4 additions & 0 deletions .trunk/configs/.prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
trailingComma: es5
tabWidth: 2
semi: false
singleQuote: true
42 changes: 21 additions & 21 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,44 @@
# To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml
version: 0.1
cli:
version: 1.21.0
version: 1.22.8
plugins:
sources:
- id: trunk
ref: v1.4.5
ref: v1.6.4
uri: https://github.com/trunk-io/plugins
# Many linters and tools depend on runtimes - configure them here. (https://docs.trunk.io/runtimes)
runtimes:
# enabled:
# - [email protected]
# - [email protected]
# - [email protected]
enabled:
- [email protected]
- [email protected]
- [email protected]
# This is the section where you manage your linters. (https://docs.trunk.io/check/configuration)
lint:
enabled:
- trufflehog@3.71.0
- trufflehog@3.83.4
- [email protected]
- [email protected].8
- [email protected].60
- [email protected].1
- trivy@0.50.1
- [email protected].10
- [email protected].281
- [email protected].9
- trivy@0.56.2
#- [email protected]
- taplo@0.8.1
- ruff@0.3.5
- taplo@0.9.3
- ruff@0.7.2
- [email protected]
- markdownlint@0.39.0
- oxipng@9.0.0
- svgo@3.2.0
- actionlint@1.6.27
- flake8@7.0.0
- markdownlint@0.42.0
- oxipng@9.1.2
- svgo@3.3.2
- actionlint@1.7.4
- flake8@7.1.1
- [email protected]
- [email protected]
- [email protected]
- black@24.3.0
- black@24.10.0
- git-diff-check
- gitleaks@8.18.2
- gitleaks@8.21.1
- [email protected]
- prettier@3.2.5
- prettier@3.3.3
ignore:
- linters: [ALL]
paths:
Expand Down
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format.
"recommendations": ["Trunk.io"]
}
13 changes: 13 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
// See https://code.visualstudio.com/docs/getstarted/settings#_settings-json-file
// for the documentation about the settings.json format.
"editor.formatOnSave": true,
"editor.defaultFormatter": "trunk.io",
"trunk.enableWindows": true,
"files.insertFinalNewline": false,
"files.trimFinalNewlines": false,
"cmake.configureOnOpen": false,
"[cpp]": {
"editor.defaultFormatter": "trunk.io"
}
}
3 changes: 2 additions & 1 deletion include/DisplayDriverConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ class DisplayDriverConfig
WT32_SC01_PLUS,
ESP2432S028RV1,
ESP2432S028RV2,
ESP4848S040
ESP4848S040,
MAKERFABS480X480
};

struct panel_config_t {
Expand Down
4 changes: 2 additions & 2 deletions include/LGFXDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ template <class LGFX> void LGFXDriver<LGFX>::task_handler(void)
}
}
if (powerSaving) {
int pin_int = 0;
int pin_int = -1;
if (hasTouch()) {
#ifndef CUSTOM_TOUCH_DRIVER
pin_int = lgfx->touch()->config().pin_int;
Expand All @@ -115,7 +115,7 @@ template <class LGFX> void LGFXDriver<LGFX>::task_handler(void)
pin_int = BUTTON_PIN;
#endif
}
if (DisplayDriver::view->sleep(pin_int) ||
if ((pin_int >= 0 && DisplayDriver::view->sleep(pin_int)) ||
(screenTimeout > lv_display_get_inactive_time(NULL) &&
((DisplayDriver::view->isScreenLocked() &&
lv_display_get_inactive_time(NULL) < defaultScreenLockTimeout) ||
Expand Down
52 changes: 4 additions & 48 deletions include/LGFX_4848S040.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,7 @@
#include <lgfx/v1/platforms/esp32s3/Bus_RGB.hpp>
#include <lgfx/v1/platforms/esp32s3/Panel_RGB.hpp>

#ifdef CUSTOM_TOUCH_DRIVER
#include <bb_captouch.h>

#define TOUCH_SDA 19
#define TOUCH_SCL 45
#define TOUCH_INT -1
#define TOUCH_RST -1

// avoid lovyanGFX touch driver:
// custom class for redirecting getTouch() calls and to alternative implementation
class LGFX_Touch : public lgfx::LGFX_Device
{
public:
bool init_impl(bool use_reset, bool use_clear) override
{
bool result = LGFX_Device::init_impl(use_reset, use_clear);
bbct.init(TOUCH_SDA, TOUCH_SCL);
bbct.setOrientation(0, 480, 480);
return result;
}

int8_t getTouchInt(void) { return TOUCH_INT; }

// unfortunately not declared as virtual in base class, need to choose a different name
bool getTouchXY(uint16_t* touchX, uint16_t* touchY) {
TOUCHINFO ti;
if (bbct.getSamples(&ti)) {
*touchX = ti.x[0];
*touchY = ti.y[0];
if (*touchX < 480 && *touchY < 480)
return true;
}
return false;
};

private:
BBCapTouch bbct;
};

class LGFX_4848S040 : public LGFX_Touch
#else
class LGFX_4848S040 : public lgfx::LGFX_Device
#endif
{
lgfx::Panel_ST7701_guition_esp32_4848S040 _panel_instance;
lgfx::Bus_RGB _bus_instance;
Expand All @@ -59,7 +17,7 @@ class LGFX_4848S040 : public lgfx::LGFX_Device
const uint16_t screenWidth = 480;
const uint16_t screenHeight = 480;

bool hasButton(void) { return true; }
bool hasButton(void) { return false; }

LGFX_4848S040(void)
{
Expand Down Expand Up @@ -134,7 +92,7 @@ class LGFX_4848S040 : public lgfx::LGFX_Device
{
auto cfg = _light_instance.config();
cfg.pin_bl = 38;
cfg.freq = 2000;
cfg.freq = 80; // higher value decrease brightness
_light_instance.config(cfg);
}
_panel_instance.light(&_light_instance);
Expand All @@ -149,17 +107,15 @@ class LGFX_4848S040 : public lgfx::LGFX_Device
cfg.pin_int = GPIO_NUM_NC;
cfg.pin_rst = GPIO_NUM_NC;
cfg.bus_shared = false;
cfg.offset_rotation = 0;
cfg.offset_rotation = 3;

cfg.i2c_port = 1;
cfg.i2c_port = 0;
cfg.i2c_addr = 0x5D;
cfg.pin_sda = 19;
cfg.pin_scl = 45;
cfg.freq = 400000;
_touch_instance.config(cfg);
#ifndef CUSTOM_TOUCH_DRIVER
_panel_instance.setTouch(&_touch_instance);
#endif
}

setPanel(&_panel_instance);
Expand Down
121 changes: 121 additions & 0 deletions include/LGFX_MAKERFABS480X480.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
#pragma once
#define LGFX_USE_V1

#include <LovyanGFX.hpp>
#include <lgfx/v1/platforms/esp32s3/Bus_RGB.hpp>
#include <lgfx/v1/platforms/esp32s3/Panel_RGB.hpp>

class LGFX_MAKERFABS480X480 : public lgfx::LGFX_Device
{
lgfx::Panel_ST7701 _panel_instance;
lgfx::Bus_RGB _bus_instance;
lgfx::Light_PWM _light_instance;
lgfx::Touch_GT911 _touch_instance;

public:
const uint16_t screenWidth = 480;
const uint16_t screenHeight = 480;

bool hasButton(void) { return false; }

LGFX_MAKERFABS480X480(void)
{
{
auto cfg = _panel_instance.config();
cfg.memory_width = 480;
cfg.memory_height = 480;
cfg.panel_width = screenWidth;
cfg.panel_height = screenHeight;
cfg.offset_x = 0;
cfg.offset_y = 0;
cfg.offset_rotation = 0;
_panel_instance.config(cfg);
}

{
auto cfg = _panel_instance.config_detail();
cfg.pin_cs = 1;
cfg.pin_sclk = 12;
cfg.pin_mosi = 11;
cfg.use_psram = 1;
_panel_instance.config_detail(cfg);
}

{
auto cfg = _bus_instance.config();
cfg.panel = &_panel_instance;
cfg.pin_d0 = GPIO_NUM_6; // B0
cfg.pin_d1 = GPIO_NUM_7; // B1
cfg.pin_d2 = GPIO_NUM_15; // B2
cfg.pin_d3 = GPIO_NUM_16; // B3
cfg.pin_d4 = GPIO_NUM_8; // B4
cfg.pin_d5 = GPIO_NUM_0; // G0
cfg.pin_d6 = GPIO_NUM_9; // G1
cfg.pin_d7 = GPIO_NUM_14; // G2
cfg.pin_d8 = GPIO_NUM_47; // G3
cfg.pin_d9 = GPIO_NUM_48; // G4
cfg.pin_d10 = GPIO_NUM_3; // G5
cfg.pin_d11 = GPIO_NUM_39; // R0
cfg.pin_d12 = GPIO_NUM_40; // R1
cfg.pin_d13 = GPIO_NUM_41; // R2
cfg.pin_d14 = GPIO_NUM_42; // R3
cfg.pin_d15 = GPIO_NUM_2; // R4

cfg.pin_henable = GPIO_NUM_45;
cfg.pin_vsync = GPIO_NUM_4;
cfg.pin_hsync = GPIO_NUM_5;
cfg.pin_pclk = GPIO_NUM_21;
cfg.freq_write = 14000000;

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.pclk_idle_high = 0;
cfg.de_idle_high = 1;

_bus_instance.config(cfg);
}
_panel_instance.setBus(&_bus_instance);

{
auto cfg = _light_instance.config();
cfg.pin_bl = 44;
//cfg.freq = 80; // higher value decrease brightness
_light_instance.config(cfg);
}
_panel_instance.light(&_light_instance);

{
auto cfg = _touch_instance.config();
cfg.pin_cs = GPIO_NUM_NC;
cfg.x_min = 0;
cfg.x_max = 479;
cfg.y_min = 0;
cfg.y_max = 479;
cfg.bus_shared = false;
cfg.offset_rotation = 0;

cfg.i2c_port = 1;
cfg.i2c_addr = 0x5D;
cfg.pin_int = GPIO_NUM_NC;
cfg.pin_sda = GPIO_NUM_17;
cfg.pin_scl = GPIO_NUM_18;
cfg.pin_rst = GPIO_NUM_38;

cfg.freq = 400000;
_touch_instance.config(cfg);
_panel_instance.setTouch(&_touch_instance);

}

setPanel(&_panel_instance);
}
};
Loading

0 comments on commit e7dc200

Please sign in to comment.