mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-19 09:16:41 +00:00
Merge branch 'master' into web-style
This commit is contained in:
commit
7995da76d1
35
.devcontainer/devcontainer.json
Normal file
35
.devcontainer/devcontainer.json
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||||
|
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
|
||||||
|
{
|
||||||
|
"name": "Ubuntu",
|
||||||
|
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
||||||
|
"image": "mcr.microsoft.com/devcontainers/base:jammy",
|
||||||
|
|
||||||
|
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||||
|
"features": {
|
||||||
|
"ghcr.io/devcontainers/features/python:1": {}
|
||||||
|
},
|
||||||
|
|
||||||
|
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||||
|
// "forwardPorts": [],
|
||||||
|
|
||||||
|
// Use 'postCreateCommand' to run commands after the container is created.
|
||||||
|
// "postCreateCommand": "uname -a",
|
||||||
|
|
||||||
|
// Configure tool-specific properties.
|
||||||
|
"customizations": {
|
||||||
|
"vscode": {
|
||||||
|
"extensions": [
|
||||||
|
"ms-vscode.cpptools",
|
||||||
|
"platformio.platformio-ide"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
||||||
|
// "remoteUser": "root"
|
||||||
|
|
||||||
|
// Allow uploading to device
|
||||||
|
"mounts": ["type=bind,source=/dev/bus/usb,target=/dev/bus/usb"],
|
||||||
|
"runArgs": ["--privileged"]
|
||||||
|
}
|
12
.github/dependabot.yml
vendored
Normal file
12
.github/dependabot.yml
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# To get started with Dependabot version updates, you'll need to specify which
|
||||||
|
# package ecosystems to update and where the package manifests are located.
|
||||||
|
# Please see the documentation for more information:
|
||||||
|
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||||
|
# https://containers.dev/guide/dependabot
|
||||||
|
|
||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: "devcontainers"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
47
.github/workflows/build.yaml
vendored
47
.github/workflows/build.yaml
vendored
@ -2,7 +2,7 @@ name: Build branch
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
types: [created]
|
types: [published]
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
@ -15,6 +15,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build_esp32:
|
build_esp32:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
#runs-on: ubuntu-24.04
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
@ -31,13 +32,13 @@ jobs:
|
|||||||
- out: dustinwatts
|
- out: dustinwatts
|
||||||
env: "freetouchdeck_4MB -e freetouchdeck_8MB -e esp32-touchdown"
|
env: "freetouchdeck_4MB -e freetouchdeck_8MB -e esp32-touchdown"
|
||||||
- out: elecrow
|
- out: elecrow
|
||||||
env: "esp32-terminal-rgb_16MB -e esp32-terminal-spi_16MB -e elecrow-s3-8048c070_4MB"
|
env: "esp32-terminal-rgb_16MB -e esp32-terminal-spi_16MB -e elecrow-s3-8048c050_4MB -e elecrow-s3-8048c070_4MB"
|
||||||
- out: globalsecurity
|
- out: globalsecurity
|
||||||
env: gs-t3e_16MB
|
env: gs-t3e_16MB
|
||||||
- out: guition
|
- out: guition
|
||||||
env: esp32-s3-4848s040_16MB
|
env: esp32-s3-4848s040_16MB -e guition-jc4827w543c_4MB
|
||||||
- out: lanbon
|
- out: lanbon
|
||||||
env: lanbon_l8
|
env: lanbon_l8 -e lanbon_l9
|
||||||
- out: lilygo-ttgo
|
- out: lilygo-ttgo
|
||||||
env: "lilygo-lily-pi_st7796 -e lilygo-lily-pi_ili9481 -e ttgo-t7-v1_5_ili9341_4MB -e ttgo-t7-v1_5_ili9341_16MB"
|
env: "lilygo-lily-pi_st7796 -e lilygo-lily-pi_ili9481 -e ttgo-t7-v1_5_ili9341_4MB -e ttgo-t7-v1_5_ili9341_16MB"
|
||||||
- out: lolin
|
- out: lolin
|
||||||
@ -51,9 +52,9 @@ jobs:
|
|||||||
- out: seeed-studios
|
- out: seeed-studios
|
||||||
env: "sensecap-indicator-d1_8MB"
|
env: "sensecap-indicator-d1_8MB"
|
||||||
- out: sunton
|
- out: sunton
|
||||||
env: "esp32-2432s028r_4MB -e esp32-2432s028r-ili9342_4MB -e esp32-2432s032c_4MB -e esp32-3248s035c_4MB -e esp32-3248s035r_4MB -e sunton-4827s043c_16MB -e sunton-8048s043c_16MB -e sunton-8048s050c_16MB -e sunton-8048s070c_16MB"
|
env: "esp32-2432s028r_4MB -e esp32-2432s028r-ili9342_4MB -e esp32-2432s028r_v2_4MB -e esp32-2432s032c_4MB -e esp32-3248s035c_4MB -e esp32-3248s035r_4MB -e sunton-4827s043c_16MB -e sunton-8048s043c_16MB -e sunton-8048s050c_16MB -e sunton-8048s070c_16MB"
|
||||||
- out: waveshare
|
- out: waveshare
|
||||||
env: "esp32-one_ili9486 -e esp32-one_st7796"
|
env: "esp32-one_ili9486 -e esp32-one_st7796 -e ws_esp32_s3_touch_lcd_4p3"
|
||||||
- out: wireless-tag
|
- out: wireless-tag
|
||||||
env: "wt32-sc01_4MB -e wt32-sc01_16MB -e wt-86-32-3zw1 -e wt32-sc01-plus_8MB -e wt32-sc01-plus_16MB"
|
env: "wt32-sc01_4MB -e wt32-sc01_16MB -e wt-86-32-3zw1 -e wt32-sc01-plus_8MB -e wt32-sc01-plus_16MB"
|
||||||
- out: yeacreate
|
- out: yeacreate
|
||||||
@ -101,30 +102,20 @@ jobs:
|
|||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.environment.out }}
|
name: ${{ matrix.environment.out }}
|
||||||
path: build_output/firmware/*.bin
|
path: build_output/firmware/*.*n
|
||||||
- name: Create release and upload firmware
|
## Release only:
|
||||||
|
- name: Zip artifact for deployment
|
||||||
if: github.ref != 'refs/heads/master'
|
if: github.ref != 'refs/heads/master'
|
||||||
run: |
|
run: |
|
||||||
set -x
|
zip ${{ matrix.environment.out }}.zip build_output/firmware/*.bin -r
|
||||||
assets=()
|
- name: On Release, upload assets to that Release
|
||||||
for asset in build_output/firmware/*.bin; do
|
if: github.ref != 'refs/heads/master'
|
||||||
assets+=("-a" "$asset")
|
uses: AButler/upload-release-assets@v3.0
|
||||||
done
|
with:
|
||||||
tag_name="${GITHUB_REF##*/}"
|
files: ${{ matrix.environment.out }}.zip
|
||||||
hub release edit "${assets[@]}" -m "$tag_name" "$tag_name"
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
#- name: Create release and upload firmware
|
|
||||||
# run: |
|
|
||||||
# set -x
|
|
||||||
# assets=()
|
|
||||||
# for asset in build_output/firmware/*.bin; do
|
|
||||||
# assets+=("-a" "$asset")
|
|
||||||
# done
|
|
||||||
# tag_name="${GITHUB_REF##*/}"
|
|
||||||
# hub release create "${assets[@]}" -m "$tag_name" "$tag_name"
|
|
||||||
# env:
|
|
||||||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
linux_build:
|
linux_build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
2
.github/workflows/build_linux.yaml
vendored
2
.github/workflows/build_linux.yaml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: Build branch
|
name: Build Linux (Obsolete)
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@ -3,7 +3,7 @@ on:
|
|||||||
# types: [created]
|
# types: [created]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
name: Create Release
|
name: Create Release (Obsolete)
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
43
boards/esp32s3_flash_16MB.json
Normal file
43
boards/esp32s3_flash_16MB.json
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
"build": {
|
||||||
|
"arduino": {
|
||||||
|
"ldscript": "esp32s3_out.ld"
|
||||||
|
},
|
||||||
|
"core": "esp32",
|
||||||
|
"extra_flags": [
|
||||||
|
"-DARDUINO_ESP32S3_DEV",
|
||||||
|
"-DARDUINO_USB_MODE=1",
|
||||||
|
"-DARDUINO_RUNNING_CORE=1",
|
||||||
|
"-DARDUINO_EVENT_RUNNING_CORE=1"
|
||||||
|
],
|
||||||
|
"f_cpu": "240000000L",
|
||||||
|
"f_flash": "80000000L",
|
||||||
|
"flash_mode": "qio",
|
||||||
|
"mcu": "esp32s3",
|
||||||
|
"variant": "esp32s3"
|
||||||
|
},
|
||||||
|
"connectivity": [
|
||||||
|
"wifi"
|
||||||
|
],
|
||||||
|
"debug": {
|
||||||
|
"default_tool": "esp-builtin",
|
||||||
|
"onboard_tools": [
|
||||||
|
"esp-builtin"
|
||||||
|
],
|
||||||
|
"openocd_target": "esp32s3.cfg"
|
||||||
|
},
|
||||||
|
"frameworks": [
|
||||||
|
"arduino",
|
||||||
|
"espidf"
|
||||||
|
],
|
||||||
|
"name": "ESP32-S3-FLASH-16MB",
|
||||||
|
"upload": {
|
||||||
|
"flash_size": "16MB",
|
||||||
|
"maximum_ram_size": 327680,
|
||||||
|
"maximum_size": 16777216,
|
||||||
|
"require_upload_port": true,
|
||||||
|
"speed": 921600
|
||||||
|
},
|
||||||
|
"url": "null",
|
||||||
|
"vendor": "null"
|
||||||
|
}
|
@ -58,4 +58,4 @@
|
|||||||
<div id="toast"></div>
|
<div id="toast"></div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
@ -15,18 +15,18 @@
|
|||||||
"theme": "Tema de IU",
|
"theme": "Tema de IU",
|
||||||
"color1": "Color Primario",
|
"color1": "Color Primario",
|
||||||
"color2": "Color Secundario",
|
"color2": "Color Secundario",
|
||||||
"pages": "Diseño inicial",
|
"pages": "Diseño Inicial",
|
||||||
"font": "Fuente por Defecto",
|
"font": "Fuente por Defecto",
|
||||||
"startpage": "Página inicial",
|
"startpage": "Página de Inicio",
|
||||||
"startdim": "Brillo inicial"
|
"startdim": "Brillo Inicial"
|
||||||
},
|
},
|
||||||
"screenshot": {
|
"screenshot": {
|
||||||
"title": "Captura de pantalla",
|
"title": "Captura de Pantalla",
|
||||||
"btn": "Captura de pantalla",
|
"btn": "Captura de Pantalla",
|
||||||
"nav": "Captura de pantalla",
|
"nav": "Captura de Pantalla",
|
||||||
"prev": "Página Previa",
|
"prev": "Prev Página",
|
||||||
"next": "Siguiente Página",
|
"next": "Siguiente Página",
|
||||||
"refresh": "Refrescar"
|
"refresh": "Actualizar"
|
||||||
},
|
},
|
||||||
"info": {
|
"info": {
|
||||||
"title": "Información",
|
"title": "Información",
|
||||||
@ -36,16 +36,16 @@
|
|||||||
"config": {
|
"config": {
|
||||||
"title": "Configuración",
|
"title": "Configuración",
|
||||||
"btn": "Configuración",
|
"btn": "Configuración",
|
||||||
"nav": "Configuración"
|
"nav": "Configuraciones"
|
||||||
},
|
},
|
||||||
"ota": {
|
"ota": {
|
||||||
"title": "Actualización de firmware",
|
"title": "Actualización de Firmware",
|
||||||
"btn": "Actualización de firmware",
|
"btn": "Actualización de Firmware",
|
||||||
"nav": "Firmware",
|
"nav": "Firmware",
|
||||||
"submit": "Actualizar Firmware",
|
"submit": "Actualizar Firmware",
|
||||||
"file": "Archivo Firmware",
|
"file": "Archivo Firmware",
|
||||||
"url": "URL del firmware",
|
"url": "URL del Firmware",
|
||||||
"redirect": "Seguir redirecciones",
|
"redirect": "Sigue Redirecciones",
|
||||||
"never": "Nunca",
|
"never": "Nunca",
|
||||||
"strict": "Estricto",
|
"strict": "Estricto",
|
||||||
"always": "Siempre"
|
"always": "Siempre"
|
||||||
@ -56,10 +56,10 @@
|
|||||||
"nav": "Editor de Archivos"
|
"nav": "Editor de Archivos"
|
||||||
},
|
},
|
||||||
"reset": {
|
"reset": {
|
||||||
"title": "Restaurar conf de fábrica",
|
"title": "Reconfiguración de Fábrica",
|
||||||
"btn": "Restaurar conf de fábrica",
|
"btn": "Restaurar conf de Fábrica",
|
||||||
"warning": "Aviso",
|
"warning": "Aviso",
|
||||||
"message": "Este proceso restablecerá todos los ajustes a los valores por defecto. El flash interno se borrará y el dispositivo se reiniciará. Puede que necesite conectarse al AP WiFi mostrado en el panel para reconfigurar el dispositivo antes de volver a acceder a él.",
|
"message": "Este proceso restablecerá todos los ajustes a los valores predeterminados. El flash interno se borrará y el dispositivo se reiniciará. Es posible que necesite conectarse al AP WiFi mostrado en el panel para reconfigurar el dispositivo antes de volver a acceder a él.",
|
||||||
"fileloss": "¡TODOS LOS ARCHIVOS SERÁN PERDIDOS!"
|
"fileloss": "¡TODOS LOS ARCHIVOS SERÁN PERDIDOS!"
|
||||||
},
|
},
|
||||||
"reboot": {
|
"reboot": {
|
||||||
@ -81,23 +81,23 @@
|
|||||||
"apache2": "Licencia Apache2"
|
"apache2": "Licencia Apache2"
|
||||||
},
|
},
|
||||||
"wifi": {
|
"wifi": {
|
||||||
"title": "Ajustes Wifi",
|
"title": "Ajustes WiFi",
|
||||||
"btn": "Ajustes Wifi",
|
"btn": "Ajustes WiFi",
|
||||||
"ssid": "SSID"
|
"ssid": "SSID"
|
||||||
},
|
},
|
||||||
"wg": {
|
"wg": {
|
||||||
"title": "WireGuard Settings",
|
"title": "Ajustes de WireGuard",
|
||||||
"btn": "WireGuard Settings",
|
"btn": "Ajustes de WireGuard",
|
||||||
"vpnip": "VPN IP",
|
"vpnip": "IP VPN",
|
||||||
"privkey": "Private Key",
|
"privkey": "Clave Privada",
|
||||||
"host": "Remote IP",
|
"host": "IP Remota",
|
||||||
"port": "Remote Port",
|
"port": "Puerto Remoto",
|
||||||
"pubkey": "Remote Public Key"
|
"pubkey": "Clave Pública Remota"
|
||||||
},
|
},
|
||||||
"mqtt": {
|
"mqtt": {
|
||||||
"title": "Ajustes MQTT",
|
"title": "Ajustes MQTT",
|
||||||
"btn": "Ajustes MQTT",
|
"btn": "Ajustes MQTT",
|
||||||
"name": "Nombre de equipo",
|
"name": "Nombre del Host",
|
||||||
"group": "Nombre del Grupo",
|
"group": "Nombre del Grupo",
|
||||||
"host": "Broker",
|
"host": "Broker",
|
||||||
"port": "Puerto",
|
"port": "Puerto",
|
||||||
@ -124,9 +124,9 @@
|
|||||||
},
|
},
|
||||||
"gpio": "Ajustes GPIO",
|
"gpio": "Ajustes GPIO",
|
||||||
"debug": {
|
"debug": {
|
||||||
"title": "Ajustes de depuración",
|
"title": "Ajustes de Depuración",
|
||||||
"btn": "Ajustes de depuración",
|
"btn": "Ajustes de Depuración",
|
||||||
"baud": "Baudios",
|
"baud": "Tasa Baudios",
|
||||||
"tele": "Periodo de Tele",
|
"tele": "Periodo de Tele",
|
||||||
"ansi": "Usar códigos ANSI",
|
"ansi": "Usar códigos ANSI",
|
||||||
"host": "Servidor Syslog",
|
"host": "Servidor Syslog",
|
||||||
@ -139,9 +139,9 @@
|
|||||||
"title": "Ajustes de Tiempo",
|
"title": "Ajustes de Tiempo",
|
||||||
"btn": "Ajustes de Tiempo",
|
"btn": "Ajustes de Tiempo",
|
||||||
"region": "Región",
|
"region": "Región",
|
||||||
"zone": "Zona horaria",
|
"zone": "Zona Horaria",
|
||||||
"tz": "Zona horaria",
|
"tz": "Zona Horaria",
|
||||||
"ntp": "Servidores NTP"
|
"ntp": "Servidor NTP"
|
||||||
},
|
},
|
||||||
"region": {
|
"region": {
|
||||||
"etc": "Etcetera ",
|
"etc": "Etcetera ",
|
||||||
@ -149,7 +149,7 @@
|
|||||||
"af": "Africa ",
|
"af": "Africa ",
|
||||||
"as": "Asia ",
|
"as": "Asia ",
|
||||||
"au": "Australia ",
|
"au": "Australia ",
|
||||||
"aq": "Antarctica ",
|
"aq": "Antártida ",
|
||||||
"eu": "Europa ",
|
"eu": "Europa ",
|
||||||
"na": "América del Norte ",
|
"na": "América del Norte ",
|
||||||
"sa": "América del Sur ",
|
"sa": "América del Sur ",
|
||||||
|
@ -86,13 +86,13 @@
|
|||||||
"ssid": "SSID"
|
"ssid": "SSID"
|
||||||
},
|
},
|
||||||
"wg": {
|
"wg": {
|
||||||
"title": "WireGuard Settings",
|
"title": "Paramètres WireGuard",
|
||||||
"btn": "WireGuard Settings",
|
"btn": "Paramètres WireGuard",
|
||||||
"vpnip": "VPN IP",
|
"vpnip": "IP du VPN",
|
||||||
"privkey": "Private Key",
|
"privkey": "Clé Privée",
|
||||||
"host": "Remote IP",
|
"host": "Adresse IP distante",
|
||||||
"port": "Remote Port",
|
"port": "Port Distant",
|
||||||
"pubkey": "Remote Public Key"
|
"pubkey": "Clé publique distante"
|
||||||
},
|
},
|
||||||
"mqtt": {
|
"mqtt": {
|
||||||
"title": "Paramètres MQTT",
|
"title": "Paramètres MQTT",
|
||||||
|
162
data/ru_RU.json
Normal file
162
data/ru_RU.json
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
{
|
||||||
|
"en": {
|
||||||
|
"language": "Русский",
|
||||||
|
"home": {
|
||||||
|
"title": "Главное меню",
|
||||||
|
"btn": "Главное меню",
|
||||||
|
"nav": "Домой"
|
||||||
|
},
|
||||||
|
"save": "Сохранить настройки",
|
||||||
|
"user": "Имя пользователя",
|
||||||
|
"pass": "Пароль",
|
||||||
|
"hasp": {
|
||||||
|
"title": "Оформление",
|
||||||
|
"btn": "Настройка оформления",
|
||||||
|
"theme": "Тема интерфейса",
|
||||||
|
"color1": "Основной цвет",
|
||||||
|
"color2": "Вторичный цвет",
|
||||||
|
"pages": "Начальный макет",
|
||||||
|
"font": "Шрифт по умолчанию",
|
||||||
|
"startpage": "Стартовая страница",
|
||||||
|
"startdim": "Ярокость при запуске"
|
||||||
|
},
|
||||||
|
"screenshot": {
|
||||||
|
"title": "Скриншот",
|
||||||
|
"btn": "Скриншот",
|
||||||
|
"nav": "Скиншот",
|
||||||
|
"prev": "Предыдущая страница",
|
||||||
|
"next": "Следующая страница",
|
||||||
|
"refresh": "Обновить"
|
||||||
|
},
|
||||||
|
"info": {
|
||||||
|
"title": "Информация",
|
||||||
|
"btn": "Информация",
|
||||||
|
"nav": "Информация"
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"title": "Настройки",
|
||||||
|
"btn": "Настройки",
|
||||||
|
"nav": "Настройки"
|
||||||
|
},
|
||||||
|
"ota": {
|
||||||
|
"title": "Обновление прошивки",
|
||||||
|
"btn": "Обновление прошивки",
|
||||||
|
"nav": "Прошивка",
|
||||||
|
"submit": "Обновление прошивки",
|
||||||
|
"file": "Файл прошивки",
|
||||||
|
"url": "URL прошивки",
|
||||||
|
"redirect": "Разрешить редиректы",
|
||||||
|
"never": "Никогда",
|
||||||
|
"strict": "Строго",
|
||||||
|
"always": "Всегда"
|
||||||
|
},
|
||||||
|
"editor": {
|
||||||
|
"title": "Редактор файлов",
|
||||||
|
"btn": "Редактор файлов",
|
||||||
|
"nav": "Редактор файлов"
|
||||||
|
},
|
||||||
|
"reset": {
|
||||||
|
"title": "Сброс на заводские настройки",
|
||||||
|
"btn": "Сброс на заводские настройки",
|
||||||
|
"warning": "Предупреждение",
|
||||||
|
"message": "Этот процесс вернет все настройки к значениям по умолчанию. Внутренняя флэш-память будет очищена и устройство перезапустится. Возможно, вам придется подключиться к точке доступа Wi-Fi, отображаемой на панели, чтобы перенастроить устройство перед повторным доступом к нему.",
|
||||||
|
"fileloss": "ВСЕ ФАЙЛЫ БУДУТ ПОТЕРЯНЫ!"
|
||||||
|
},
|
||||||
|
"reboot": {
|
||||||
|
"title": "Перезагрузка...",
|
||||||
|
"btn": "Перезагрузка",
|
||||||
|
"nav": "Перезагрузка",
|
||||||
|
"message": "Устройство перезагружается."
|
||||||
|
},
|
||||||
|
"about": {
|
||||||
|
"credits": "Based on the previous work of the following open source developers:",
|
||||||
|
"copyright": "Copyright ",
|
||||||
|
"rights": "All rights reserved.",
|
||||||
|
"clause1": "Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:",
|
||||||
|
"clause2": "The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.",
|
||||||
|
"clause3": "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
|
||||||
|
"mit": "Лицензия MIT",
|
||||||
|
"bsd": "Лицезия BSD",
|
||||||
|
"freebsd": "Лицензия FreeBSD",
|
||||||
|
"apache2": "Лицензия Apache2"
|
||||||
|
},
|
||||||
|
"wifi": {
|
||||||
|
"title": "Настройка WiFi",
|
||||||
|
"btn": "Настройка WiFi",
|
||||||
|
"ssid": "SSID"
|
||||||
|
},
|
||||||
|
"wg": {
|
||||||
|
"title": "Настройки WireGuard",
|
||||||
|
"btn": "Настройки WireGuard",
|
||||||
|
"vpnip": "VPN IP",
|
||||||
|
"privkey": "Private Key",
|
||||||
|
"host": "Remote IP",
|
||||||
|
"port": "Remote Port",
|
||||||
|
"pubkey": "Remote Public Key"
|
||||||
|
},
|
||||||
|
"mqtt": {
|
||||||
|
"title": "Настройки MQTT",
|
||||||
|
"btn": "Настройки MQTT",
|
||||||
|
"name": "Имя хоста",
|
||||||
|
"group": "Имя группы",
|
||||||
|
"host": "Брокер",
|
||||||
|
"port": "Порт",
|
||||||
|
"node_t": "Node Topic",
|
||||||
|
"group_t": "Group Topic",
|
||||||
|
"broadcast_t": "Broadcast Topic",
|
||||||
|
"hass_t": "HA LWT Topic"
|
||||||
|
},
|
||||||
|
"http": {
|
||||||
|
"title": "Настройки HTTP",
|
||||||
|
"btn": "Настройки HTTP"
|
||||||
|
},
|
||||||
|
"ftp": {
|
||||||
|
"title": "Настройки FTP",
|
||||||
|
"btn": "Настройкаи FTP",
|
||||||
|
"port": "FTP порт",
|
||||||
|
"pasv": "Пароль"
|
||||||
|
},
|
||||||
|
"gui": {
|
||||||
|
"title": "Настройки экрана",
|
||||||
|
"btn": "Настройки экрана",
|
||||||
|
"antiburn": "Прдеотвращение выгорания",
|
||||||
|
"calibrate": "Калибровка"
|
||||||
|
},
|
||||||
|
"gpio": "Настройки GPIO",
|
||||||
|
"debug": {
|
||||||
|
"title": "Настройки отладки",
|
||||||
|
"btn": "Настройки отладки",
|
||||||
|
"baud": "Baudrate",
|
||||||
|
"tele": "Tele период",
|
||||||
|
"ansi": "Использовать кодировку ANSI",
|
||||||
|
"host": "Сервер Syslog",
|
||||||
|
"port": "Порт Syslog",
|
||||||
|
"ietf": "IETF (RFC 5424)",
|
||||||
|
"bsd": "BSD (RFC 3164)",
|
||||||
|
"log": "Объект"
|
||||||
|
},
|
||||||
|
"time": {
|
||||||
|
"title": "Настройки времени",
|
||||||
|
"btn": "Настройки времени",
|
||||||
|
"region": "Регион",
|
||||||
|
"zone": "Часовой пояс",
|
||||||
|
"tz": "Часовой пояс",
|
||||||
|
"ntp": "Сервер NTP"
|
||||||
|
},
|
||||||
|
"region": {
|
||||||
|
"etc": "Прочие ",
|
||||||
|
"continents": "Континент ",
|
||||||
|
"af": "Африка ",
|
||||||
|
"as": "Азия ",
|
||||||
|
"au": "Австралия ",
|
||||||
|
"aq": "Антарктика ",
|
||||||
|
"eu": "Европа ",
|
||||||
|
"na": "Северная Америка ",
|
||||||
|
"sa": "Южна Америка ",
|
||||||
|
"islands": "Острова ",
|
||||||
|
"at": "Атлантический океан ",
|
||||||
|
"in": "Индийский океан ",
|
||||||
|
"pa": "Тихий океан "
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
162
data/sv_SE.json
Normal file
162
data/sv_SE.json
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
{
|
||||||
|
"en": {
|
||||||
|
"language": "Svenska",
|
||||||
|
"home": {
|
||||||
|
"title": "Huvudmeny",
|
||||||
|
"btn": "Huvudmeny",
|
||||||
|
"nav": "Hem"
|
||||||
|
},
|
||||||
|
"save": "Spara Inställningar",
|
||||||
|
"user": "Användarnamn",
|
||||||
|
"pass": "Lösenord",
|
||||||
|
"hasp": {
|
||||||
|
"title": "HASP Design",
|
||||||
|
"btn": "HASP Design",
|
||||||
|
"theme": "UI Tema",
|
||||||
|
"color1": "Primärfärg",
|
||||||
|
"color2": "Sekundärfärg",
|
||||||
|
"pages": "Starta Layout",
|
||||||
|
"font": "Standardtypsnitt",
|
||||||
|
"startpage": "Startsida",
|
||||||
|
"startdim": "Startljusstyrka"
|
||||||
|
},
|
||||||
|
"screenshot": {
|
||||||
|
"title": "Skärmbild",
|
||||||
|
"btn": "Skärmbild",
|
||||||
|
"nav": "Skärmbild",
|
||||||
|
"prev": "Föregående Sida",
|
||||||
|
"next": "Nästa Sida",
|
||||||
|
"refresh": "Uppdatera"
|
||||||
|
},
|
||||||
|
"info": {
|
||||||
|
"title": "Information",
|
||||||
|
"btn": "Information",
|
||||||
|
"nav": "Information"
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"title": "Inställningar",
|
||||||
|
"btn": "Konfiguration",
|
||||||
|
"nav": "Inställningar"
|
||||||
|
},
|
||||||
|
"ota": {
|
||||||
|
"title": "Firmware-uppdatering",
|
||||||
|
"btn": "Firmware-uppdatering",
|
||||||
|
"nav": "Firmware",
|
||||||
|
"submit": "Uppdatera Firmware",
|
||||||
|
"file": "Firmware-fil",
|
||||||
|
"url": "Firmware URL",
|
||||||
|
"redirect": "Följ omdirigeringar",
|
||||||
|
"never": "Aldrig",
|
||||||
|
"strict": "Strikt",
|
||||||
|
"always": "Alltid"
|
||||||
|
},
|
||||||
|
"editor": {
|
||||||
|
"title": "Filredigerare",
|
||||||
|
"btn": "Filredigerare",
|
||||||
|
"nav": "Filredigerare"
|
||||||
|
},
|
||||||
|
"reset": {
|
||||||
|
"title": "Fabriksåterställning",
|
||||||
|
"btn": "Fabriksåterställning",
|
||||||
|
"warning": "Varning",
|
||||||
|
"message": "Denna process kommer att återställa alla inställningar till standardvärden. Det interna minnet kommer att raderas och enheten startas om. Du kan behöva ansluta till WiFi AP som visas på panelen för att konfigurera om enheten innan du öppnar den igen.",
|
||||||
|
"fileloss": "ALLA FILLER KOMMER ATT FÖRLORAS!"
|
||||||
|
},
|
||||||
|
"reboot": {
|
||||||
|
"title": "Startar om...",
|
||||||
|
"btn": "Omstart",
|
||||||
|
"nav": "Omstart",
|
||||||
|
"message": "Enheten startar om."
|
||||||
|
},
|
||||||
|
"about": {
|
||||||
|
"credits": "Baserat på det tidigare arbetet av följande utvecklare av öppen källkod:",
|
||||||
|
"copyright": "Copyright ",
|
||||||
|
"rights": "Alla rättigheter förbehållna.",
|
||||||
|
"clause1": "Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:",
|
||||||
|
"clause2": "The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.",
|
||||||
|
"clause3": "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
|
||||||
|
"mit": "MIT Licens",
|
||||||
|
"bsd": "BSD Licens",
|
||||||
|
"freebsd": "FreeBSD Licens",
|
||||||
|
"apache2": "Apache2 Licens"
|
||||||
|
},
|
||||||
|
"wifi": {
|
||||||
|
"title": "Inställningar för WiFi",
|
||||||
|
"btn": "Inställningar för WiFi",
|
||||||
|
"ssid": "SSID"
|
||||||
|
},
|
||||||
|
"wg": {
|
||||||
|
"title": "Inställningar för WireGuard",
|
||||||
|
"btn": "Inställningar för WireGuard",
|
||||||
|
"vpnip": "VPN IP-adress",
|
||||||
|
"privkey": "Privat nyckel",
|
||||||
|
"host": "Fjärr-IP",
|
||||||
|
"port": "Fjärrport",
|
||||||
|
"pubkey": "Publik fjärrnyckel"
|
||||||
|
},
|
||||||
|
"mqtt": {
|
||||||
|
"title": "MQTT Inställningar",
|
||||||
|
"btn": "MQTT Inställningar",
|
||||||
|
"name": "Servernamn",
|
||||||
|
"group": "Gruppnamn",
|
||||||
|
"host": "Broker",
|
||||||
|
"port": "Port",
|
||||||
|
"node_t": "Nod topic",
|
||||||
|
"group_t": "Grupp topic",
|
||||||
|
"broadcast_t": "Broadcast topic",
|
||||||
|
"hass_t": "HA LWT topic"
|
||||||
|
},
|
||||||
|
"http": {
|
||||||
|
"title": "HTTP Inställningar",
|
||||||
|
"btn": "HTTP Inställningar"
|
||||||
|
},
|
||||||
|
"ftp": {
|
||||||
|
"title": "FTP Inställningar",
|
||||||
|
"btn": "FTP Inställningar",
|
||||||
|
"port": "FTP Port",
|
||||||
|
"pasv": "Passiv port"
|
||||||
|
},
|
||||||
|
"gui": {
|
||||||
|
"title": "Bildskärmsinställningar",
|
||||||
|
"btn": "Bildskärmsinställningar",
|
||||||
|
"antiburn": "Antiburn",
|
||||||
|
"calibrate": "Kalibrera"
|
||||||
|
},
|
||||||
|
"gpio": "GPIO Inställningar",
|
||||||
|
"debug": {
|
||||||
|
"title": "Debug Inställningar",
|
||||||
|
"btn": "Debug Inställningar",
|
||||||
|
"baud": "Datahastighet",
|
||||||
|
"tele": "Telemetri period",
|
||||||
|
"ansi": "Använd ANSI-kod",
|
||||||
|
"host": "Syslog server",
|
||||||
|
"port": "Syslog port",
|
||||||
|
"ietf": "IETF (RFC 5424)",
|
||||||
|
"bsd": "BSD (RFC 3164)",
|
||||||
|
"log": "Facilitet"
|
||||||
|
},
|
||||||
|
"time": {
|
||||||
|
"title": "Tidsinställningar",
|
||||||
|
"btn": "Tidsinställningar",
|
||||||
|
"region": "Region",
|
||||||
|
"zone": "Tidszon",
|
||||||
|
"tz": "Tidszon",
|
||||||
|
"ntp": "NTP-servrar"
|
||||||
|
},
|
||||||
|
"region": {
|
||||||
|
"etc": "Etcetera ",
|
||||||
|
"continents": "Kontinenter ",
|
||||||
|
"af": "Afrika ",
|
||||||
|
"as": "Asien ",
|
||||||
|
"au": "Australien ",
|
||||||
|
"aq": "Antarktis",
|
||||||
|
"eu": "Europa ",
|
||||||
|
"na": "Nordamerika ",
|
||||||
|
"sa": "Sydamerika ",
|
||||||
|
"islands": "Öar ",
|
||||||
|
"at": "Atlanten ",
|
||||||
|
"in": "Indiska oceanen ",
|
||||||
|
"pa": "Stilla havet "
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -116,8 +116,8 @@ typedef int16_t lv_coord_t;
|
|||||||
# define LV_MEM_AUTO_DEFRAG 1
|
# define LV_MEM_AUTO_DEFRAG 1
|
||||||
#else /*LV_MEM_CUSTOM*/
|
#else /*LV_MEM_CUSTOM*/
|
||||||
#define LV_MEM_CUSTOM_INCLUDE <stdlib.h> /*Header for the dynamic memory function*/
|
#define LV_MEM_CUSTOM_INCLUDE <stdlib.h> /*Header for the dynamic memory function*/
|
||||||
#define LV_MEM_CUSTOM_ALLOC malloc /*Wrapper to malloc*/
|
#define LV_MEM_CUSTOM_ALLOC hasp_malloc /*Wrapper to malloc*/
|
||||||
#define LV_MEM_CUSTOM_FREE free /*Wrapper to free*/
|
#define LV_MEM_CUSTOM_FREE hasp_free /*Wrapper to free*/
|
||||||
#endif /*LV_MEM_CUSTOM*/
|
#endif /*LV_MEM_CUSTOM*/
|
||||||
|
|
||||||
#ifndef LV_VDB_SIZE
|
#ifndef LV_VDB_SIZE
|
||||||
@ -211,7 +211,7 @@ typedef void* lv_group_user_data_t;
|
|||||||
#define LV_USE_FILESYSTEM 1
|
#define LV_USE_FILESYSTEM 1
|
||||||
#if LV_USE_FILESYSTEM
|
#if LV_USE_FILESYSTEM
|
||||||
/*Declare the type of the user data of file system drivers (can be e.g. `void *`, `int`, `struct`)*/
|
/*Declare the type of the user data of file system drivers (can be e.g. `void *`, `int`, `struct`)*/
|
||||||
typedef void* lv_fs_drv_user_data_t;
|
typedef const char* lv_fs_drv_user_data_t;
|
||||||
|
|
||||||
/*File system interface*/
|
/*File system interface*/
|
||||||
#ifndef LV_USE_FS_IF
|
#ifndef LV_USE_FS_IF
|
||||||
@ -229,7 +229,7 @@ typedef void* lv_fs_drv_user_data_t;
|
|||||||
//# define LV_FS_IF_SPIFFS '\0' // no internal esp Flash
|
//# define LV_FS_IF_SPIFFS '\0' // no internal esp Flash
|
||||||
#endif
|
#endif
|
||||||
#endif /*LV_USE_FS_IF*/
|
#endif /*LV_USE_FS_IF*/
|
||||||
#if HASP_TARGET_ARDUINO
|
#if HASP_TARGET_ARDUINO && !defined(LV_FS_PC_PATH)
|
||||||
#define LV_FS_PC_PATH "/littlefs"
|
#define LV_FS_PC_PATH "/littlefs"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -105,8 +105,8 @@ typedef int16_t lv_coord_t;
|
|||||||
# define LV_MEM_AUTO_DEFRAG 1
|
# define LV_MEM_AUTO_DEFRAG 1
|
||||||
#else /*LV_MEM_CUSTOM*/
|
#else /*LV_MEM_CUSTOM*/
|
||||||
# define LV_MEM_CUSTOM_INCLUDE <stdlib.h> /*Header for the dynamic memory function*/
|
# define LV_MEM_CUSTOM_INCLUDE <stdlib.h> /*Header for the dynamic memory function*/
|
||||||
# define LV_MEM_CUSTOM_ALLOC malloc /*Wrapper to malloc*/
|
# define LV_MEM_CUSTOM_ALLOC hasp_malloc /*Wrapper to malloc*/
|
||||||
# define LV_MEM_CUSTOM_FREE free /*Wrapper to free*/
|
# define LV_MEM_CUSTOM_FREE hasp_free /*Wrapper to free*/
|
||||||
#endif /*LV_MEM_CUSTOM*/
|
#endif /*LV_MEM_CUSTOM*/
|
||||||
|
|
||||||
/* Use the standard memcpy and memset instead of LVGL's own functions.
|
/* Use the standard memcpy and memset instead of LVGL's own functions.
|
||||||
|
@ -160,7 +160,6 @@
|
|||||||
**************************************************/
|
**************************************************/
|
||||||
//#define HASP_USE_MDNS 0 // Disable MDNS
|
//#define HASP_USE_MDNS 0 // Disable MDNS
|
||||||
//#define HASP_USE_CUSTOM 1 // Enable compilation of custom code from /src/custom
|
//#define HASP_USE_CUSTOM 1 // Enable compilation of custom code from /src/custom
|
||||||
//#define HASP_USE_HA // Enable Home Assistant auto-discovery
|
|
||||||
//#define HASP_START_CONSOLE 0 // Disable starting of serial console at boot
|
//#define HASP_START_CONSOLE 0 // Disable starting of serial console at boot
|
||||||
//#define HASP_START_TELNET 0 // Disable starting of telnet service at boot
|
//#define HASP_START_TELNET 0 // Disable starting of telnet service at boot
|
||||||
//#define HASP_START_HTTP 0 // Disable starting of web interface at boot
|
//#define HASP_START_HTTP 0 // Disable starting of web interface at boot
|
||||||
|
@ -265,6 +265,136 @@ static const uint8_t st7701_sensecap_indicator_init_operations[] = {
|
|||||||
DELAY, 120,
|
DELAY, 120,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const uint8_t st7701_t_panel_init_operations[] = {
|
||||||
|
|
||||||
|
BEGIN_WRITE,
|
||||||
|
WRITE_COMMAND_8, 0xFF,
|
||||||
|
WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x13,
|
||||||
|
|
||||||
|
WRITE_C8_D8, 0xEF, 0x08,
|
||||||
|
|
||||||
|
WRITE_COMMAND_8, 0xFF,
|
||||||
|
WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x10,
|
||||||
|
|
||||||
|
WRITE_C8_D16, 0xC0, 0x3B, 0x00,
|
||||||
|
WRITE_C8_D16, 0xC1, 0x0B, 0x02,
|
||||||
|
|
||||||
|
WRITE_COMMAND_8, 0xC2,
|
||||||
|
WRITE_BYTES, 3, 0x30, 0x02, 0x37,
|
||||||
|
|
||||||
|
WRITE_C8_D8, 0xCC, 0x10,
|
||||||
|
|
||||||
|
WRITE_COMMAND_8, 0xB0, // Positive Voltage Gamma Control
|
||||||
|
WRITE_BYTES, 16,
|
||||||
|
0x00, 0x0F, 0x16, 0x0E,
|
||||||
|
0x11, 0x07, 0x09, 0x09,
|
||||||
|
0x08, 0x23, 0x05, 0x11,
|
||||||
|
0x0F, 0x28, 0x2D, 0x18,
|
||||||
|
|
||||||
|
WRITE_COMMAND_8, 0xB1, // Negative Voltage Gamma Control
|
||||||
|
WRITE_BYTES, 16,
|
||||||
|
0x00, 0x0F, 0x16, 0x0E,
|
||||||
|
0x11, 0x07, 0x09, 0x08,
|
||||||
|
0x09, 0x23, 0x05, 0x11,
|
||||||
|
0x0F, 0x28, 0x2D, 0x18,
|
||||||
|
|
||||||
|
WRITE_COMMAND_8, 0xFF,
|
||||||
|
WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x11,
|
||||||
|
|
||||||
|
WRITE_C8_D8, 0xB0, 0x4D,
|
||||||
|
WRITE_C8_D8, 0xB1, 0x33,
|
||||||
|
WRITE_C8_D8, 0xB2, 0x87,
|
||||||
|
WRITE_C8_D8, 0xB5, 0x4B,
|
||||||
|
WRITE_C8_D8, 0xB7, 0x8C,
|
||||||
|
WRITE_C8_D8, 0xB8, 0x20,
|
||||||
|
WRITE_C8_D8, 0xC1, 0x78,
|
||||||
|
WRITE_C8_D8, 0xC2, 0x78,
|
||||||
|
WRITE_C8_D8, 0xD0, 0x88,
|
||||||
|
|
||||||
|
WRITE_COMMAND_8, 0xE0,
|
||||||
|
WRITE_BYTES, 3, 0x00, 0x00, 0x02,
|
||||||
|
|
||||||
|
WRITE_COMMAND_8, 0xE1,
|
||||||
|
WRITE_BYTES, 11,
|
||||||
|
0x02, 0xF0, 0x00, 0x00,
|
||||||
|
0x03, 0xF0, 0x00, 0x00,
|
||||||
|
0x00, 0x44, 0x44,
|
||||||
|
|
||||||
|
WRITE_COMMAND_8, 0xE2,
|
||||||
|
WRITE_BYTES, 12,
|
||||||
|
0x10, 0x10, 0x40, 0x40,
|
||||||
|
0xF2, 0xF0, 0x00, 0x00,
|
||||||
|
0xF2, 0xF0, 0x00, 0x00,
|
||||||
|
|
||||||
|
WRITE_COMMAND_8, 0xE3,
|
||||||
|
WRITE_BYTES, 4, 0x00, 0x00, 0x11, 0x11,
|
||||||
|
|
||||||
|
WRITE_C8_D16, 0xE4, 0x44, 0x44,
|
||||||
|
|
||||||
|
WRITE_COMMAND_8, 0xE5,
|
||||||
|
WRITE_BYTES, 16,
|
||||||
|
0x07, 0xEF, 0xF0, 0xF0,
|
||||||
|
0x09, 0xF1, 0xF0, 0xF0,
|
||||||
|
0x03, 0xF3, 0xF0, 0xF0,
|
||||||
|
0x05, 0xED, 0xF0, 0xF0,
|
||||||
|
|
||||||
|
WRITE_COMMAND_8, 0xE6,
|
||||||
|
WRITE_BYTES, 4, 0x00, 0x00, 0x11, 0x11,
|
||||||
|
|
||||||
|
WRITE_C8_D16, 0xE7, 0x44, 0x44,
|
||||||
|
|
||||||
|
WRITE_COMMAND_8, 0xE8,
|
||||||
|
WRITE_BYTES, 16,
|
||||||
|
0x08, 0xF0, 0xF0, 0xF0,
|
||||||
|
0x0A, 0xF2, 0xF0, 0xF0,
|
||||||
|
0x04, 0xF4, 0xF0, 0xF0,
|
||||||
|
0x06, 0xEE, 0xF0, 0xF0,
|
||||||
|
|
||||||
|
WRITE_COMMAND_8, 0xEB,
|
||||||
|
WRITE_BYTES, 7,
|
||||||
|
0x00, 0x00, 0xE4, 0xE4,
|
||||||
|
0x44, 0x88, 0x40,
|
||||||
|
|
||||||
|
WRITE_C8_D16, 0xEC, 0x78, 0x00,
|
||||||
|
|
||||||
|
WRITE_COMMAND_8, 0xED,
|
||||||
|
WRITE_BYTES, 16,
|
||||||
|
0x20, 0xF9, 0x87, 0x76,
|
||||||
|
0x65, 0x54, 0x4F, 0xFF,
|
||||||
|
0xFF, 0xF4, 0x45, 0x56,
|
||||||
|
0x67, 0x78, 0x9F, 0x02,
|
||||||
|
|
||||||
|
WRITE_COMMAND_8, 0xEF,
|
||||||
|
WRITE_BYTES, 6,
|
||||||
|
0x10, 0x0D, 0x04, 0x08,
|
||||||
|
0x3F, 0x1F,
|
||||||
|
|
||||||
|
// WRITE_C8_D8, 0xCD, 0x05,//Test
|
||||||
|
|
||||||
|
WRITE_C8_D8, 0x3A, 0x55,
|
||||||
|
|
||||||
|
WRITE_C8_D8, 0x36, 0x08,
|
||||||
|
|
||||||
|
WRITE_COMMAND_8, 0x11,
|
||||||
|
|
||||||
|
// WRITE_COMMAND_8, 0xFF,//Test
|
||||||
|
// WRITE_BYTES, 5,
|
||||||
|
// 0x77, 0x01, 0x00, 0x00,
|
||||||
|
// 0x12,
|
||||||
|
|
||||||
|
// WRITE_C8_D8, 0xD1, 0x81,//Test
|
||||||
|
// WRITE_C8_D8, 0xD2, 0x08,//Test
|
||||||
|
|
||||||
|
WRITE_COMMAND_8, 0x29, // Display On
|
||||||
|
|
||||||
|
// WRITE_C8_D8, 0x35, 0x00,//Test
|
||||||
|
// WRITE_C8_D8, 0xCE, 0x04,//Test
|
||||||
|
|
||||||
|
// WRITE_COMMAND_8, 0xF2,//Test
|
||||||
|
// WRITE_BYTES, 4,
|
||||||
|
// 0xF0, 0xA3, 0xA3, 0x71,
|
||||||
|
|
||||||
|
END_WRITE};
|
||||||
|
|
||||||
class Arduino_RGB_Display_Mod : public Arduino_GFX{
|
class Arduino_RGB_Display_Mod : public Arduino_GFX{
|
||||||
public:
|
public:
|
||||||
|
@ -293,10 +293,9 @@ uint8_t FtpServer::handleFTP() {
|
|||||||
void FtpServer::clientConnected()
|
void FtpServer::clientConnected()
|
||||||
{
|
{
|
||||||
// DEBUG_PRINTLN( F(" Client connected!") );
|
// DEBUG_PRINTLN( F(" Client connected!") );
|
||||||
client.print(F("220 ---")); client.print(welcomeMessage); client.println(F(" ---"));
|
client.print (F("220--- ")); client.print(welcomeMessage); client.println(F(" ---"));
|
||||||
// client.print(F("220---")); client.print(welcomeMessage); client.println(F(" ---"));
|
// client.println(F(" -- By Renzo Mischianti --"));
|
||||||
// client.println(F("220--- By Renzo Mischianti ---"));
|
client.print (F("220 -- Version ")); client.print(FTP_SERVER_VERSION);
|
||||||
// client.print(F("220 -- Version ")); client.print(FTP_SERVER_VERSION); client.println(F(" --"));
|
|
||||||
iCL = 0;
|
iCL = 0;
|
||||||
if (FtpServer::_callback) {
|
if (FtpServer::_callback) {
|
||||||
FtpServer::_callback(FTP_CONNECT, free(), capacity());
|
FtpServer::_callback(FTP_CONNECT, free(), capacity());
|
||||||
|
24
lib/cst816t/LICENSE
Normal file
24
lib/cst816t/LICENSE
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
This is free and unencumbered software released into the public domain.
|
||||||
|
|
||||||
|
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||||
|
distribute this software, either in source code form or as a compiled
|
||||||
|
binary, for any purpose, commercial or non-commercial, and by any
|
||||||
|
means.
|
||||||
|
|
||||||
|
In jurisdictions that recognize copyright laws, the author or authors
|
||||||
|
of this software dedicate any and all copyright interest in the
|
||||||
|
software to the public domain. We make this dedication for the benefit
|
||||||
|
of the public at large and to the detriment of our heirs and
|
||||||
|
successors. We intend this dedication to be an overt act of
|
||||||
|
relinquishment in perpetuity of all present and future rights to this
|
||||||
|
software under copyright law.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||||
|
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
|
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
For more information, please refer to <https://unlicense.org>
|
145
lib/cst816t/README.md
Normal file
145
lib/cst816t/README.md
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
# cst816t capacitive touch ic
|
||||||
|
|
||||||
|
[](https://github.com/koendv/cst816t/raw/master/extras/P169H002-CTP.jpg)
|
||||||
|
|
||||||
|
|
||||||
|
This is an Arduino library for the cst816t capacitive touch ic. The cst816t capacitive touch ic is able to decode clicks, double clicks, swipes and long press in hardware. Tested on stm32duino.
|
||||||
|
|
||||||
|
The cst816t runs on voltages from 1.8V to 3.3V. Do not connect the cst816t to 5V arduinos such as Arduino UNO. Connecting the cst816t to 5V will probably damage the device.
|
||||||
|
|
||||||
|
Hardware requirements:
|
||||||
|
|
||||||
|
- power supply 2.8V to 3.6V
|
||||||
|
- power supply ripple <= 50mv;
|
||||||
|
- logic level 1.8V to 3.3V
|
||||||
|
- i2c rate 10Khz to 400Khz
|
||||||
|
|
||||||
|
## Use
|
||||||
|
|
||||||
|
Code for the cst816t consists of a setup, done once, and a loop, done repeatedly.
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
The cst816t touch sensor needs an I2C bus, a reset pin and a interrupt pin:
|
||||||
|
```
|
||||||
|
#include <Wire.h>
|
||||||
|
#include "cst816t.h"
|
||||||
|
TwoWire Wire2(TP_SDA, TP_SCL);
|
||||||
|
cst816t touchpad(Wire2, TP_RST, TP_IRQ);
|
||||||
|
```
|
||||||
|
The ic can run in four modes: touch, change, fast, motion.
|
||||||
|
|
||||||
|
### mode touch
|
||||||
|
```
|
||||||
|
void setup() {
|
||||||
|
touchpad.begin(mode_touch);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
In mode _touch_, if a finger touches the display the ic sends an interrupt every 10ms. After receiving the interrupt, you can read updated touch coordinates and finger count. All processing is done on the mcu.
|
||||||
|
|
||||||
|
### mode change
|
||||||
|
```
|
||||||
|
void setup() {
|
||||||
|
touchpad.begin(mode_change);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
In mode _change_ the ic sends an interrupt when the finger changes position. Compared to mode touch, the number of interrupts is more moderate.
|
||||||
|
|
||||||
|
### mode fast
|
||||||
|
|
||||||
|
```
|
||||||
|
void setup() {
|
||||||
|
touchpad.begin(mode_fast);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
In mode _fast_ the ic sends an interrupt when the finger has completed one of the following movements: single click, swipe up, swipe down, swipe left, swipe right.
|
||||||
|
|
||||||
|
Touch response is fast because there is no need to wait to distinguish between single click, double click and long press.
|
||||||
|
|
||||||
|
### mode motion
|
||||||
|
|
||||||
|
```
|
||||||
|
void setup() {
|
||||||
|
touchpad.begin(mode_motion);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
In mode _motion_ the ic sends an interrupt when the finger has completed the following movements: single click, **double click**, swipe up, swipe down, swipe left, swipe right, **long press**. All processing is done in the cst816 touch ic. The processing in the mcu is minimal.
|
||||||
|
|
||||||
|
## Loop
|
||||||
|
|
||||||
|
Test repeatedly if there is an update from the touch panel. If there is an update from the touch panel, read gesture, (x, y) coordinates, and number of fingers touching the display.
|
||||||
|
|
||||||
|
```
|
||||||
|
void loop() {
|
||||||
|
if (touchpad.available()) {
|
||||||
|
switch (touchpad.gesture_id) {
|
||||||
|
case GESTURE_NONE:
|
||||||
|
Serial.print("NONE");
|
||||||
|
break;
|
||||||
|
case GESTURE_SWIPE_DOWN:
|
||||||
|
Serial.print("SWIPE DOWN");
|
||||||
|
break;
|
||||||
|
case GESTURE_SWIPE_UP:
|
||||||
|
Serial.print("SWIPE UP");
|
||||||
|
break;
|
||||||
|
case GESTURE_SWIPE_LEFT:
|
||||||
|
Serial.print("SWIPE LEFT");
|
||||||
|
break;
|
||||||
|
case GESTURE_SWIPE_RIGHT:
|
||||||
|
Serial.print("SWIPE RIGHT");
|
||||||
|
break;
|
||||||
|
case GESTURE_SINGLE_CLICK:
|
||||||
|
Serial.print("SINGLE CLICK");
|
||||||
|
break;
|
||||||
|
case GESTURE_DOUBLE_CLICK:
|
||||||
|
Serial.print("DOUBLE CLICK");
|
||||||
|
break;
|
||||||
|
case GESTURE_LONG_PRESS:
|
||||||
|
Serial.print("LONG PRESS");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Serial.print("UNKNOWN ");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Serial.print("at (");
|
||||||
|
Serial.print(touchpad.x);
|
||||||
|
Serial.print(", ");
|
||||||
|
Serial.print(touchpad.y);
|
||||||
|
Serial.print(") fingers: ");
|
||||||
|
Serial.println(touchpad.finger_num);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
The library comes with three example Arduino sketches: touchme, smartwatch, and lvgl. To compile the examples, use [stm32duino](https://github.com/stm32duino/Arduino_Core_STM32/wiki).
|
||||||
|
|
||||||
|
### touchme
|
||||||
|
|
||||||
|
A simple sketch that uses the CST816T touch sensor. When the display is touched, the (x, y) coordinates and the action - click or swipe - are printed on the serial port.
|
||||||
|
|
||||||
|
### smartwatch
|
||||||
|
|
||||||
|
A small Arduino sketch for the [P169H002-CTP](https://www.google.com/search?q=P169H002-CTP) smartwatch display. The P169H002-CTP is a 1.69 inch 240x280 lcd display with an ST7789 lcd driver and a CST816T touch sensor. The sketch prints a text - "click" or "swipe" - on the spot where the display is touched.
|
||||||
|
|
||||||
|
### lvgl
|
||||||
|
|
||||||
|
[LVGL](http://www.lvgl.io) (Light and Versatile Graphics Library) is a graphics library for embedded systems. An Arduino sketch is given which draws a button on a P169H002-CTP display.
|
||||||
|
|
||||||
|
This lvgl example uses the Adafruit GFX library. For improved speed, you may wish to check if there is a library that is more optimized for the processor you use.
|
||||||
|
|
||||||
|
## Links
|
||||||
|
Arduino libraries for ST7789 tft driver:
|
||||||
|
|
||||||
|
- [Adafruit ST7789](https://github.com/adafruit/Adafruit-ST7735-Library/)
|
||||||
|
- [TFT_eSPI](https://github.com/Bodmer/TFT_eSPI)
|
||||||
|
- [ST7789-STM32](https://github.com/Floyd-Fish/ST7789-STM32)
|
||||||
|
- [ST7789-STM32-uGUI](https://github.com/deividAlfa/ST7789-STM32-uGUI)
|
||||||
|
|
||||||
|
[Schematic](extras/Schematic_drawing_2023-06-21.pdf
|
||||||
|
) for the P169H002-CTP display. VCC = 3.3V. The ambient light sensor is used to set display intensity.
|
||||||
|
|
||||||
|
The P169H002-CTP display is available from [Aliexpress](https://www.aliexpress.com/item/1005005238299349.html).
|
128
lib/cst816t/examples/lvgl_button/lvgl_button.ino
Normal file
128
lib/cst816t/examples/lvgl_button/lvgl_button.ino
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
/* lvgl demo on P169H002-CTP display */
|
||||||
|
|
||||||
|
#include <SPI.h>
|
||||||
|
#include <Adafruit_GFX.h> // Core graphics library
|
||||||
|
#include <Adafruit_ST7789.h> // Hardware-specific library for ST7789
|
||||||
|
|
||||||
|
#include <Wire.h>
|
||||||
|
#include "cst816t.h" // capacitive touch
|
||||||
|
|
||||||
|
/* Note: in lv_conf.h: set lv_tick to Arduino millis() */
|
||||||
|
|
||||||
|
#include <lvgl.h>
|
||||||
|
|
||||||
|
// display
|
||||||
|
#define TFT_X 240
|
||||||
|
#define TFT_Y 280
|
||||||
|
|
||||||
|
#define TFT_CS PB1
|
||||||
|
#define TFT_RST PA4
|
||||||
|
#define TFT_DC PB0
|
||||||
|
#define TFT_MOSI PB15
|
||||||
|
#define TFT_SCLK PB13
|
||||||
|
#define TFT_LED PA8
|
||||||
|
|
||||||
|
// touch
|
||||||
|
#define TP_SDA PB11
|
||||||
|
#define TP_SCL PB10
|
||||||
|
#define TP_RST PA15
|
||||||
|
#define TP_IRQ PB3
|
||||||
|
|
||||||
|
TwoWire Wire2(TP_SDA, TP_SCL);
|
||||||
|
cst816t touchpad(Wire2, TP_RST, TP_IRQ);
|
||||||
|
|
||||||
|
SPIClass SPI_1(PB15, PB14, PB13);
|
||||||
|
Adafruit_ST7789 tft = Adafruit_ST7789(&SPI_1, TFT_CS, TFT_DC, TFT_RST);
|
||||||
|
|
||||||
|
static lv_disp_draw_buf_t disp_buf;
|
||||||
|
static lv_color_t buf_1[TFT_X * 10];
|
||||||
|
static lv_color_t buf_2[TFT_X * 10];
|
||||||
|
static lv_disp_drv_t disp_drv;
|
||||||
|
static lv_indev_drv_t indev_drv;
|
||||||
|
|
||||||
|
/* lvgl display output */
|
||||||
|
/* Using Adafruit display driver. Depending upon architecture, other drivers may be faster. */
|
||||||
|
void disp_flush_cb(lv_disp_drv_t* disp_drv, const lv_area_t* area, lv_color_t* color_p) {
|
||||||
|
uint32_t w = 1 + area->x2 - area->x1;
|
||||||
|
uint32_t h = 1 + area->y2 - area->y1;
|
||||||
|
uint32_t len = w * h;
|
||||||
|
tft.startWrite();
|
||||||
|
tft.setAddrWindow(area->x1, area->y1, w, h);
|
||||||
|
tft.writePixels(&color_p->full, len);
|
||||||
|
tft.endWrite();
|
||||||
|
lv_disp_flush_ready(disp_drv);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* lvgl touchpad input */
|
||||||
|
void touchpad_input_read(lv_indev_drv_t* drv, lv_indev_data_t* data) {
|
||||||
|
static uint32_t tp_x = 0;
|
||||||
|
static uint32_t tp_y = 0;
|
||||||
|
static uint32_t tp_fingers = 0;
|
||||||
|
if (touchpad.available()) {
|
||||||
|
tp_x = touchpad.x;
|
||||||
|
tp_y = touchpad.y;
|
||||||
|
tp_fingers = touchpad.finger_num;
|
||||||
|
}
|
||||||
|
data->point.x = tp_x;
|
||||||
|
data->point.y = tp_y;
|
||||||
|
if (tp_fingers != 0) data->state = LV_INDEV_STATE_PRESSED;
|
||||||
|
else data->state = LV_INDEV_STATE_RELEASED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* lvgl button callback */
|
||||||
|
void btn_event_cb(lv_event_t* e) {
|
||||||
|
lv_event_code_t code = lv_event_get_code(e);
|
||||||
|
lv_obj_t* btn = lv_event_get_target(e);
|
||||||
|
if (code == LV_EVENT_CLICKED) {
|
||||||
|
static uint8_t cnt = 0;
|
||||||
|
cnt++;
|
||||||
|
/*Get the first child of the button which is the label and change its text*/
|
||||||
|
lv_obj_t* label = lv_obj_get_child(btn, 0);
|
||||||
|
lv_label_set_text_fmt(label, "Button %d", cnt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(9600);
|
||||||
|
Serial.println("boot");
|
||||||
|
|
||||||
|
analogWriteResolution(8);
|
||||||
|
analogWrite(TFT_LED, 127); // display backlight at 50%
|
||||||
|
|
||||||
|
tft.init(240, 280); // Init ST7789 280x240
|
||||||
|
tft.fillScreen(ST77XX_BLACK);
|
||||||
|
tft.setTextColor(ST77XX_WHITE);
|
||||||
|
tft.setRotation(2);
|
||||||
|
|
||||||
|
touchpad.begin(mode_change);
|
||||||
|
|
||||||
|
/* display */
|
||||||
|
lv_init();
|
||||||
|
lv_disp_draw_buf_init(&disp_buf, buf_1, buf_2, TFT_X * 10);
|
||||||
|
lv_disp_drv_init(&disp_drv);
|
||||||
|
disp_drv.draw_buf = &disp_buf;
|
||||||
|
disp_drv.flush_cb = disp_flush_cb;
|
||||||
|
disp_drv.hor_res = TFT_X;
|
||||||
|
disp_drv.ver_res = TFT_Y;
|
||||||
|
lv_disp_t* disp;
|
||||||
|
disp = lv_disp_drv_register(&disp_drv);
|
||||||
|
|
||||||
|
/* touchpad */
|
||||||
|
lv_indev_drv_init(&indev_drv);
|
||||||
|
indev_drv.type = LV_INDEV_TYPE_POINTER;
|
||||||
|
indev_drv.read_cb = touchpad_input_read;
|
||||||
|
lv_indev_t* my_indev = lv_indev_drv_register(&indev_drv);
|
||||||
|
|
||||||
|
/* button */
|
||||||
|
lv_obj_t* btn = lv_btn_create(lv_scr_act());
|
||||||
|
lv_obj_center(btn);
|
||||||
|
lv_obj_set_size(btn, 120, 50);
|
||||||
|
lv_obj_add_event_cb(btn, btn_event_cb, LV_EVENT_ALL, NULL);
|
||||||
|
lv_obj_t* label = lv_label_create(btn);
|
||||||
|
lv_label_set_text(label, "Button");
|
||||||
|
lv_obj_center(label);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
lv_timer_handler();
|
||||||
|
}
|
87
lib/cst816t/examples/smartwatch/smartwatch.ino
Normal file
87
lib/cst816t/examples/smartwatch/smartwatch.ino
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
demo of P168H002-CTP display.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <SPI.h>
|
||||||
|
#include <Adafruit_GFX.h> // Core graphics library
|
||||||
|
#include <Adafruit_ST7789.h> // Hardware-specific library for ST7789
|
||||||
|
|
||||||
|
#include <Wire.h>
|
||||||
|
#include "cst816t.h" // capacitive touch
|
||||||
|
|
||||||
|
// display
|
||||||
|
#define TFT_X 240
|
||||||
|
#define TFT_Y 280
|
||||||
|
|
||||||
|
#define TFT_CS PB1
|
||||||
|
#define TFT_RST PA4
|
||||||
|
#define TFT_DC PB0
|
||||||
|
#define TFT_MOSI PB15
|
||||||
|
#define TFT_SCLK PB13
|
||||||
|
#define TFT_LED PA8
|
||||||
|
|
||||||
|
// touch
|
||||||
|
#define TP_SDA PB11
|
||||||
|
#define TP_SCL PB10
|
||||||
|
#define TP_RST PA15
|
||||||
|
#define TP_IRQ PB3
|
||||||
|
|
||||||
|
TwoWire Wire2(TP_SDA, TP_SCL);
|
||||||
|
cst816t touchpad(Wire2, TP_RST, TP_IRQ);
|
||||||
|
|
||||||
|
SPIClass SPI_1(PB15, PB14, PB13);
|
||||||
|
Adafruit_ST7789 tft = Adafruit_ST7789(&SPI_1, TFT_CS, TFT_DC, TFT_RST);
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(9600);
|
||||||
|
Serial.println("boot");
|
||||||
|
|
||||||
|
analogWriteResolution(8);
|
||||||
|
analogWrite(TFT_LED, 127); // display backlight at 50%
|
||||||
|
|
||||||
|
tft.init(240, 280); // Init ST7789 280x240
|
||||||
|
tft.fillScreen(ST77XX_BLACK);
|
||||||
|
tft.setTextColor(ST77XX_WHITE);
|
||||||
|
tft.setTextSize(0);
|
||||||
|
tft.setRotation(2);
|
||||||
|
|
||||||
|
touchpad.begin(mode_motion);
|
||||||
|
tft.setCursor(TFT_X / 2, TFT_Y / 2);
|
||||||
|
tft.println(touchpad.version());
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
if (touchpad.available()) {
|
||||||
|
tft.setCursor(touchpad.x, touchpad.y);
|
||||||
|
tft.fillScreen(ST77XX_BLACK);
|
||||||
|
switch (touchpad.gesture_id) {
|
||||||
|
case GESTURE_NONE:
|
||||||
|
tft.print("NONE");
|
||||||
|
break;
|
||||||
|
case GESTURE_SWIPE_DOWN:
|
||||||
|
tft.print("SWIPE DOWN");
|
||||||
|
break;
|
||||||
|
case GESTURE_SWIPE_UP:
|
||||||
|
tft.print("SWIPE UP");
|
||||||
|
break;
|
||||||
|
case GESTURE_SWIPE_LEFT:
|
||||||
|
tft.print("SWIPE LEFT");
|
||||||
|
break;
|
||||||
|
case GESTURE_SWIPE_RIGHT:
|
||||||
|
tft.print("SWIPE RIGHT");
|
||||||
|
break;
|
||||||
|
case GESTURE_SINGLE_CLICK:
|
||||||
|
tft.print("SINGLE CLICK");
|
||||||
|
break;
|
||||||
|
case GESTURE_DOUBLE_CLICK:
|
||||||
|
tft.print("DOUBLE CLICK");
|
||||||
|
break;
|
||||||
|
case GESTURE_LONG_PRESS:
|
||||||
|
tft.print("LONG PRESS");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
tft.print("?");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
23
lib/cst816t/examples/touchme/touchme.ino
Normal file
23
lib/cst816t/examples/touchme/touchme.ino
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/* demo for the CST816T capacitive touch ic */
|
||||||
|
|
||||||
|
#include <Wire.h>
|
||||||
|
#include "cst816t.h"
|
||||||
|
|
||||||
|
#define TP_SDA PB11
|
||||||
|
#define TP_SCL PB10
|
||||||
|
#define TP_RST PA15
|
||||||
|
#define TP_IRQ PB3
|
||||||
|
|
||||||
|
TwoWire Wire2(TP_SDA, TP_SCL);
|
||||||
|
cst816t touchpad(Wire2, TP_RST, TP_IRQ);
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
// decode everything: single click, double click, long press, swipe up, swipe down, swipe left, swipe right
|
||||||
|
touchpad.begin(mode_motion);
|
||||||
|
Serial.println(touchpad.version());
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
if (touchpad.available())
|
||||||
|
Serial.println(touchpad.state());
|
||||||
|
}
|
11027
lib/cst816t/extras/3d_model_p169h002.stp
Normal file
11027
lib/cst816t/extras/3d_model_p169h002.stp
Normal file
File diff suppressed because it is too large
Load Diff
BIN
lib/cst816t/extras/AN-CST816T寄存器说明-v1.pdf
Normal file
BIN
lib/cst816t/extras/AN-CST816T寄存器说明-v1.pdf
Normal file
Binary file not shown.
BIN
lib/cst816t/extras/CAD_DRAWING_P169H002-CTP.dwg
Normal file
BIN
lib/cst816t/extras/CAD_DRAWING_P169H002-CTP.dwg
Normal file
Binary file not shown.
BIN
lib/cst816t/extras/DATASHEET_ST7789V.pdf
Normal file
BIN
lib/cst816t/extras/DATASHEET_ST7789V.pdf
Normal file
Binary file not shown.
BIN
lib/cst816t/extras/DS-CST816T数据手册V2.2.pdf
Normal file
BIN
lib/cst816t/extras/DS-CST816T数据手册V2.2.pdf
Normal file
Binary file not shown.
BIN
lib/cst816t/extras/P169H002-CTP-small.jpg
Normal file
BIN
lib/cst816t/extras/P169H002-CTP-small.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 555 KiB |
BIN
lib/cst816t/extras/P169H002-CTP.jpg
Normal file
BIN
lib/cst816t/extras/P169H002-CTP.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.9 MiB |
BIN
lib/cst816t/extras/P169H002-CTP.pdf
Normal file
BIN
lib/cst816t/extras/P169H002-CTP.pdf
Normal file
Binary file not shown.
BIN
lib/cst816t/extras/SCHEMATIC-P169H002-CTP.pdf
Normal file
BIN
lib/cst816t/extras/SCHEMATIC-P169H002-CTP.pdf
Normal file
Binary file not shown.
2575
lib/cst816t/extras/Schematic_drawing_2023-06-21.pdf
Normal file
2575
lib/cst816t/extras/Schematic_drawing_2023-06-21.pdf
Normal file
File diff suppressed because it is too large
Load Diff
BIN
lib/cst816t/extras/cst78XX驱动调试V1.0.pdf
Normal file
BIN
lib/cst816t/extras/cst78XX驱动调试V1.0.pdf
Normal file
Binary file not shown.
11
lib/cst816t/library.properties
Normal file
11
lib/cst816t/library.properties
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
name=cst816t
|
||||||
|
version=1.5.1
|
||||||
|
author=koendv
|
||||||
|
maintainer=koendv
|
||||||
|
sentence=cst816t capacitive touch screen
|
||||||
|
paragraph=An Arduino library for the cst816t capacitive touch screen IC
|
||||||
|
category=Other
|
||||||
|
url=https://github.com/koendv/cst816t
|
||||||
|
architectures=*
|
||||||
|
includes=cst816t.h
|
||||||
|
|
203
lib/cst816t/src/cst816t.cpp
Normal file
203
lib/cst816t/src/cst816t.cpp
Normal file
@ -0,0 +1,203 @@
|
|||||||
|
/* CST816T capacitive touch-screen driver.
|
||||||
|
Koen De Vleeschauwer, 2023
|
||||||
|
Literature:
|
||||||
|
DS-CST816T-V2.2.pdf datasheet
|
||||||
|
AN-CST816T-v1.pdf register description
|
||||||
|
CST78XX-V1.0.pdf firmware upgrade how-to
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "cst816t.h"
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define CST816T_ADDRESS 0x15
|
||||||
|
|
||||||
|
#define REG_GESTURE_ID 0x01
|
||||||
|
#define REG_FINGER_NUM 0x02
|
||||||
|
#define REG_XPOS_H 0x03
|
||||||
|
#define REG_XPOS_L 0x04
|
||||||
|
#define REG_YPOS_H 0x05
|
||||||
|
#define REG_YPOS_L 0x06
|
||||||
|
#define REG_CHIP_ID 0xA7
|
||||||
|
#define REG_PROJ_ID 0xA8
|
||||||
|
#define REG_FW_VERSION 0xA9
|
||||||
|
#define REG_FACTORY_ID 0xAA
|
||||||
|
#define REG_SLEEP_MODE 0xE5
|
||||||
|
#define REG_IRQ_CTL 0xFA
|
||||||
|
#define REG_LONG_PRESS_TICK 0xEB
|
||||||
|
#define REG_MOTION_MASK 0xEC
|
||||||
|
#define REG_DIS_AUTOSLEEP 0xFE
|
||||||
|
|
||||||
|
#define MOTION_MASK_CONTINUOUS_LEFT_RIGHT 0b100
|
||||||
|
#define MOTION_MASK_CONTINUOUS_UP_DOWN 0b010
|
||||||
|
#define MOTION_MASK_DOUBLE_CLICK 0b001
|
||||||
|
|
||||||
|
#define IRQ_EN_TOUCH 0x40
|
||||||
|
#define IRQ_EN_CHANGE 0x20
|
||||||
|
#define IRQ_EN_MOTION 0x10
|
||||||
|
#define IRQ_EN_LONGPRESS 0x01
|
||||||
|
|
||||||
|
static bool tp_event = false;
|
||||||
|
static void tp_isr() {
|
||||||
|
tp_event = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
cst816t::cst816t(TwoWire &_wire, int8_t _rst, int8_t _irq)
|
||||||
|
: wire(_wire) {
|
||||||
|
rst = _rst;
|
||||||
|
irq = _irq;
|
||||||
|
chip_id = 0;
|
||||||
|
firmware_version = 0;
|
||||||
|
tp_event = false;
|
||||||
|
gesture_id = 0;
|
||||||
|
finger_num = 0;
|
||||||
|
x = 0;
|
||||||
|
y = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cst816t::begin(touchpad_mode tp_mode) {
|
||||||
|
uint8_t dta[4];
|
||||||
|
pinMode(irq, INPUT);
|
||||||
|
|
||||||
|
if (rst >= 0) {
|
||||||
|
pinMode(rst, OUTPUT);
|
||||||
|
digitalWrite(rst, HIGH);
|
||||||
|
delay(100);
|
||||||
|
digitalWrite(rst, LOW);
|
||||||
|
delay(10);
|
||||||
|
digitalWrite(rst, HIGH);
|
||||||
|
delay(100);
|
||||||
|
}
|
||||||
|
|
||||||
|
wire.begin();
|
||||||
|
|
||||||
|
if (i2c_read(CST816T_ADDRESS, REG_CHIP_ID, dta, sizeof(dta))) {
|
||||||
|
Serial.println("i2c error");
|
||||||
|
return false; // Sikertelen inicializálás
|
||||||
|
}
|
||||||
|
|
||||||
|
chip_id = dta[0];
|
||||||
|
firmware_version = dta[3];
|
||||||
|
|
||||||
|
uint8_t irq_en = 0x0;
|
||||||
|
uint8_t motion_mask = 0x0;
|
||||||
|
switch (tp_mode) {
|
||||||
|
case mode_touch:
|
||||||
|
irq_en = IRQ_EN_TOUCH;
|
||||||
|
break;
|
||||||
|
case mode_change:
|
||||||
|
irq_en = IRQ_EN_CHANGE;
|
||||||
|
break;
|
||||||
|
case mode_fast:
|
||||||
|
irq_en = IRQ_EN_MOTION;
|
||||||
|
break;
|
||||||
|
case mode_motion:
|
||||||
|
irq_en = IRQ_EN_MOTION | IRQ_EN_LONGPRESS;
|
||||||
|
motion_mask = MOTION_MASK_DOUBLE_CLICK;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return false; // Érvénytelen mód esetén sikertelen inicializálás
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i2c_write(CST816T_ADDRESS, REG_IRQ_CTL, &irq_en, 1) ||
|
||||||
|
i2c_write(CST816T_ADDRESS, REG_MOTION_MASK, &motion_mask, 1)) {
|
||||||
|
Serial.println("i2c write error");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
attachInterrupt(digitalPinToInterrupt(irq), tp_isr, FALLING);
|
||||||
|
|
||||||
|
// Disable auto sleep
|
||||||
|
uint8_t dis_auto_sleep = 0xFF;
|
||||||
|
if (i2c_write(CST816T_ADDRESS, REG_DIS_AUTOSLEEP, &dis_auto_sleep, 1)) {
|
||||||
|
Serial.println("Failed to disable auto sleep");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true; // Sikeres inicializálás
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool cst816t::available() {
|
||||||
|
uint8_t dta[6];
|
||||||
|
if (tp_event && !i2c_read(CST816T_ADDRESS, REG_GESTURE_ID, dta, sizeof(dta))) {
|
||||||
|
tp_event = false;
|
||||||
|
gesture_id = dta[0];
|
||||||
|
finger_num = dta[1];
|
||||||
|
x = (((uint16_t)dta[2] & 0x0f) << 8) | (uint16_t)dta[3];
|
||||||
|
y = (((uint16_t)dta[4] & 0x0f) << 8) | (uint16_t)dta[5];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t cst816t::i2c_read(uint16_t addr, uint8_t reg_addr, uint8_t *reg_data, uint32_t length) {
|
||||||
|
wire.beginTransmission(addr);
|
||||||
|
wire.write(reg_addr);
|
||||||
|
if (wire.endTransmission(true)) return -1;
|
||||||
|
wire.requestFrom((uint8_t)addr, (size_t)length, (bool)true);
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
*reg_data++ = wire.read();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t cst816t::i2c_write(uint8_t addr, uint8_t reg_addr, const uint8_t *reg_data, uint32_t length) {
|
||||||
|
wire.beginTransmission(addr);
|
||||||
|
wire.write(reg_addr);
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
wire.write(*reg_data++);
|
||||||
|
}
|
||||||
|
if (wire.endTransmission(true)) return -1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
String cst816t::version() {
|
||||||
|
String tp_version;
|
||||||
|
switch (chip_id) {
|
||||||
|
case CHIPID_CST716: tp_version = "CST716"; break;
|
||||||
|
case CHIPID_CST816S: tp_version = "CST816S"; break;
|
||||||
|
case CHIPID_CST816T: tp_version = "CST816T"; break;
|
||||||
|
case CHIPID_CST816D: tp_version = "CST816D"; break;
|
||||||
|
default:
|
||||||
|
tp_version = "? 0x" + String(chip_id, HEX);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
tp_version += " firmware " + String(firmware_version);
|
||||||
|
return tp_version;
|
||||||
|
}
|
||||||
|
|
||||||
|
String cst816t::state() {
|
||||||
|
String s;
|
||||||
|
switch (gesture_id) {
|
||||||
|
case GESTURE_NONE:
|
||||||
|
s = "NONE";
|
||||||
|
break;
|
||||||
|
case GESTURE_SWIPE_DOWN:
|
||||||
|
s = "SWIPE DOWN";
|
||||||
|
break;
|
||||||
|
case GESTURE_SWIPE_UP:
|
||||||
|
s = "SWIPE UP";
|
||||||
|
break;
|
||||||
|
case GESTURE_SWIPE_LEFT:
|
||||||
|
s = "SWIPE LEFT";
|
||||||
|
break;
|
||||||
|
case GESTURE_SWIPE_RIGHT:
|
||||||
|
s = "SWIPE RIGHT";
|
||||||
|
break;
|
||||||
|
case GESTURE_SINGLE_CLICK:
|
||||||
|
s = "SINGLE CLICK";
|
||||||
|
break;
|
||||||
|
case GESTURE_DOUBLE_CLICK:
|
||||||
|
s = "DOUBLE CLICK";
|
||||||
|
break;
|
||||||
|
case GESTURE_LONG_PRESS:
|
||||||
|
s = "LONG PRESS";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
s = "UNKNOWN 0x";
|
||||||
|
s += String(gesture_id, HEX);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
s += '\t' + String(x) + '\t' + String(y);
|
||||||
|
return s;
|
||||||
|
}
|
56
lib/cst816t/src/cst816t.h
Normal file
56
lib/cst816t/src/cst816t.h
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
#ifndef _CST816T_H_
|
||||||
|
#define _CST816T_H_
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include <Wire.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define CHIPID_CST716 0x20
|
||||||
|
#define CHIPID_CST816S 0xB4
|
||||||
|
#define CHIPID_CST816T 0xB5
|
||||||
|
#define CHIPID_CST816D 0xB6
|
||||||
|
|
||||||
|
#define GESTURE_NONE 0x00
|
||||||
|
#define GESTURE_SWIPE_UP 0x01
|
||||||
|
#define GESTURE_SWIPE_DOWN 0x02
|
||||||
|
#define GESTURE_SWIPE_LEFT 0x03
|
||||||
|
#define GESTURE_SWIPE_RIGHT 0x04
|
||||||
|
#define GESTURE_SINGLE_CLICK 0x05
|
||||||
|
#define GESTURE_DOUBLE_CLICK 0x0B
|
||||||
|
#define GESTURE_LONG_PRESS 0x0C
|
||||||
|
|
||||||
|
enum touchpad_mode {
|
||||||
|
mode_touch,
|
||||||
|
mode_change,
|
||||||
|
mode_fast,
|
||||||
|
mode_motion
|
||||||
|
};
|
||||||
|
|
||||||
|
class cst816t {
|
||||||
|
public:
|
||||||
|
cst816t(TwoWire &_wire, int8_t _rst, int8_t _irq);
|
||||||
|
/*
|
||||||
|
mode_touch: interrupt every 10ms when a touch is detected
|
||||||
|
mode_change: interrupt when a touch change is detected
|
||||||
|
mode_fast: interrupt when a click or swipe is detected
|
||||||
|
mode_motion: interrupt when a click, swipe, double click, or long press is detected
|
||||||
|
*/
|
||||||
|
bool begin(touchpad_mode tp_mode = mode_change);
|
||||||
|
bool available();
|
||||||
|
String version();
|
||||||
|
String state();
|
||||||
|
uint8_t chip_id;
|
||||||
|
uint8_t firmware_version;
|
||||||
|
uint8_t gesture_id;
|
||||||
|
uint8_t finger_num;
|
||||||
|
uint16_t x;
|
||||||
|
uint16_t y;
|
||||||
|
private:
|
||||||
|
TwoWire& wire;
|
||||||
|
int8_t rst;
|
||||||
|
int8_t irq;
|
||||||
|
uint8_t i2c_read(uint16_t addr, uint8_t reg_addr, uint8_t *reg_data, uint32_t length);
|
||||||
|
uint8_t i2c_write(uint8_t addr, uint8_t reg_addr, const uint8_t *reg_data, uint32_t length);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -14,6 +14,13 @@
|
|||||||
/*********************
|
/*********************
|
||||||
* DEFINES
|
* DEFINES
|
||||||
*********************/
|
*********************/
|
||||||
|
#ifndef LV_FS_PC_PATH
|
||||||
|
#ifndef WIN32
|
||||||
|
#define LV_FS_PC_PATH "./" /*Project root*/
|
||||||
|
#else
|
||||||
|
#define LV_FS_PC_PATH ".\\" /*Project root*/
|
||||||
|
#endif
|
||||||
|
#endif /*LV_FS_PATH*/
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* TYPEDEFS
|
* TYPEDEFS
|
||||||
@ -26,8 +33,8 @@
|
|||||||
void lv_fs_if_fatfs_init(void);
|
void lv_fs_if_fatfs_init(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_FS_IF_PC != '\0'
|
#if LV_FS_IF_PC != '\0' || LV_FS_IF_SD != '\0'
|
||||||
void lv_fs_if_pc_init(void);
|
void lv_fs_if_pc_init(char letter, const char* path);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
@ -48,13 +55,16 @@ void lv_fs_if_pc_init(void);
|
|||||||
void lv_fs_if_init(void)
|
void lv_fs_if_init(void)
|
||||||
{
|
{
|
||||||
#if LV_FS_IF_FATFS != '\0'
|
#if LV_FS_IF_FATFS != '\0'
|
||||||
lv_fs_if_fatfs_init();
|
lv_fs_if_fatfs_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_FS_IF_PC != '\0'
|
#if LV_FS_IF_PC != '\0'
|
||||||
lv_fs_if_pc_init();
|
lv_fs_if_pc_init(LV_FS_IF_PC, LV_FS_PC_PATH);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if LV_FS_IF_SD != '\0'
|
||||||
|
lv_fs_if_pc_init(LV_FS_IF_SD, LV_FS_SD_PATH);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
|
@ -19,17 +19,6 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*********************
|
|
||||||
* DEFINES
|
|
||||||
*********************/
|
|
||||||
#ifndef LV_FS_PC_PATH
|
|
||||||
#ifndef WIN32
|
|
||||||
#define LV_FS_PC_PATH "./" /*Projet root*/
|
|
||||||
#else
|
|
||||||
#define LV_FS_PC_PATH ".\\" /*Projet root*/
|
|
||||||
#endif
|
|
||||||
#endif /*LV_FS_PATH*/
|
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* TYPEDEFS
|
* TYPEDEFS
|
||||||
**********************/
|
**********************/
|
||||||
@ -77,7 +66,7 @@ static lv_fs_res_t fs_dir_close(lv_fs_drv_t* drv, void* dir_p);
|
|||||||
/**
|
/**
|
||||||
* Register a driver for the File system interface
|
* Register a driver for the File system interface
|
||||||
*/
|
*/
|
||||||
void lv_fs_if_pc_init(void)
|
void lv_fs_if_pc_init(char letter, const char* path)
|
||||||
{
|
{
|
||||||
/*---------------------------------------------------
|
/*---------------------------------------------------
|
||||||
* Register the file system interface in LittlevGL
|
* Register the file system interface in LittlevGL
|
||||||
@ -89,7 +78,7 @@ void lv_fs_if_pc_init(void)
|
|||||||
|
|
||||||
/*Set up fields...*/
|
/*Set up fields...*/
|
||||||
fs_drv.file_size = sizeof(file_t);
|
fs_drv.file_size = sizeof(file_t);
|
||||||
fs_drv.letter = LV_FS_IF_PC;
|
fs_drv.letter = letter;
|
||||||
fs_drv.open_cb = fs_open;
|
fs_drv.open_cb = fs_open;
|
||||||
fs_drv.close_cb = fs_close;
|
fs_drv.close_cb = fs_close;
|
||||||
fs_drv.read_cb = fs_read;
|
fs_drv.read_cb = fs_read;
|
||||||
@ -107,6 +96,8 @@ void lv_fs_if_pc_init(void)
|
|||||||
fs_drv.dir_open_cb = fs_dir_open;
|
fs_drv.dir_open_cb = fs_dir_open;
|
||||||
fs_drv.dir_read_cb = fs_dir_read;
|
fs_drv.dir_read_cb = fs_dir_read;
|
||||||
|
|
||||||
|
fs_drv.user_data = path;
|
||||||
|
|
||||||
lv_fs_drv_register(&fs_drv);
|
lv_fs_drv_register(&fs_drv);
|
||||||
|
|
||||||
// char cur_path[512] = "";
|
// char cur_path[512] = "";
|
||||||
@ -145,10 +136,10 @@ static lv_fs_res_t fs_open(lv_fs_drv_t* drv, void* file_p, const char* path, lv_
|
|||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
char buf[256];
|
char buf[256];
|
||||||
sprintf(buf, LV_FS_PC_PATH "/%s", path);
|
sprintf(buf, "%s/%s", drv->user_data, path);
|
||||||
#else
|
#else
|
||||||
char buf[256];
|
char buf[256];
|
||||||
sprintf(buf, LV_FS_PC_PATH "\\%s", path);
|
sprintf(buf, "%s\\%s", drv->user_data, path);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LV_LOG_USER(buf);
|
LV_LOG_USER(buf);
|
||||||
@ -255,6 +246,7 @@ static lv_fs_res_t fs_size(lv_fs_drv_t* drv, void* file_p, uint32_t* size_p)
|
|||||||
|
|
||||||
return LV_FS_RES_OK;
|
return LV_FS_RES_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Give the position of the read write pointer
|
* Give the position of the read write pointer
|
||||||
* @param drv pointer to a driver where this function belongs
|
* @param drv pointer to a driver where this function belongs
|
||||||
@ -318,8 +310,8 @@ static lv_fs_res_t fs_rename(lv_fs_drv_t* drv, const char* oldname, const char*
|
|||||||
static char new[512];
|
static char new[512];
|
||||||
static char old[512];
|
static char old[512];
|
||||||
|
|
||||||
sprintf(old, LV_FS_PC_PATH "/%s", oldname);
|
sprintf(old, "%s/%s", drv->user_data, oldname);
|
||||||
sprintf(new, LV_FS_PC_PATH "/%s", newname);
|
sprintf(new, "%s/%s", drv->user_data, newname);
|
||||||
|
|
||||||
int r = rename(old, new);
|
int r = rename(old, new);
|
||||||
|
|
||||||
@ -365,7 +357,7 @@ static lv_fs_res_t fs_dir_open(lv_fs_drv_t* drv, void* dir_p, const char* path)
|
|||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
/*Make the path relative to the current directory (the projects root folder)*/
|
/*Make the path relative to the current directory (the projects root folder)*/
|
||||||
char buf[256];
|
char buf[256];
|
||||||
sprintf(buf, LV_FS_PC_PATH "/%s", path);
|
sprintf(buf, "%s/%s", drv->user_data, path);
|
||||||
if((d = opendir(buf)) == NULL) {
|
if((d = opendir(buf)) == NULL) {
|
||||||
return LV_FS_RES_FS_ERR;
|
return LV_FS_RES_FS_ERR;
|
||||||
} else {
|
} else {
|
||||||
@ -380,7 +372,7 @@ static lv_fs_res_t fs_dir_open(lv_fs_drv_t* drv, void* dir_p, const char* path)
|
|||||||
|
|
||||||
/*Make the path relative to the current directory (the projects root folder)*/
|
/*Make the path relative to the current directory (the projects root folder)*/
|
||||||
char buf[256];
|
char buf[256];
|
||||||
sprintf(buf, LV_FS_PC_PATH "\\%s\\*", path);
|
sprintf(buf, "%s\\%s\\*", drv->user_data, path);
|
||||||
|
|
||||||
strcpy(next_fn, "");
|
strcpy(next_fn, "");
|
||||||
d = FindFirstFile(buf, &fdata);
|
d = FindFirstFile(buf, &fdata);
|
||||||
|
@ -75,7 +75,7 @@ build_flags =
|
|||||||
-D HASP_VER_MAJ=0
|
-D HASP_VER_MAJ=0
|
||||||
-D HASP_VER_MIN=7
|
-D HASP_VER_MIN=7
|
||||||
;-D HASP_VER_REV=4
|
;-D HASP_VER_REV=4
|
||||||
-D HASP_VER_REV=0-rc12
|
-D HASP_VER_REV=0-rc15
|
||||||
;-D HASP_VER_REV=4-rc1
|
;-D HASP_VER_REV=4-rc1
|
||||||
${override.build_flags}
|
${override.build_flags}
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ lib_deps =
|
|||||||
|
|
||||||
[arduinogfx]
|
[arduinogfx]
|
||||||
lib_deps =
|
lib_deps =
|
||||||
moononournation/GFX Library for Arduino@1.4.0 ; Update needs modification of custom PCA class
|
moononournation/GFX Library for Arduino@1.4.7 ; Update needs modification of custom PCA class
|
||||||
;git+https://github.com/moononournation/Arduino_GFX.git
|
;git+https://github.com/moononournation/Arduino_GFX.git
|
||||||
|
|
||||||
[tft_espi]
|
[tft_espi]
|
||||||
|
@ -22,7 +22,7 @@ build_flags =
|
|||||||
|
|
||||||
;region -- Default Build Environments : Used when Build All ---
|
;region -- Default Build Environments : Used when Build All ---
|
||||||
extra_default_envs =
|
extra_default_envs =
|
||||||
; Uncomment specific environments or create extra:
|
; Uncomment specific environments or create extra (copy names from square brackets in user_setups/*/*.ini):
|
||||||
; az-touch-mod-esp32_ili9341_4MB
|
; az-touch-mod-esp32_ili9341_4MB
|
||||||
; az-touch-mod-esp32_ili9341_8MB
|
; az-touch-mod-esp32_ili9341_8MB
|
||||||
; d1-mini-esp32_ili9341
|
; d1-mini-esp32_ili9341
|
||||||
@ -64,6 +64,9 @@ extra_default_envs =
|
|||||||
; makerfabs-tft35-cap_4MB
|
; makerfabs-tft35-cap_4MB
|
||||||
; makerfabs-tft-s2_ili9488
|
; makerfabs-tft-s2_ili9488
|
||||||
; nodemcu32s-raspi
|
; nodemcu32s-raspi
|
||||||
|
; panlee-zw3d95ce01s-ar-4848_16MB
|
||||||
|
; panlee-zw3d95ce01s-tr-4848_16MB
|
||||||
|
; panlee-zw3d95ce01s-ur-4848_16MB
|
||||||
; s2-mini-esp32s2_ili9341
|
; s2-mini-esp32s2_ili9341
|
||||||
; ttgo_esp32_poe-ili9341
|
; ttgo_esp32_poe-ili9341
|
||||||
; lilygo-lily-pi_ili9481
|
; lilygo-lily-pi_ili9481
|
||||||
@ -78,6 +81,9 @@ extra_default_envs =
|
|||||||
; wt-86-32-3zw1
|
; wt-86-32-3zw1
|
||||||
; yeacreate-nscreen32
|
; yeacreate-nscreen32
|
||||||
; wz2432r028
|
; wz2432r028
|
||||||
|
; ws_esp32_s3_touch_lcd_4p3
|
||||||
|
; ttgo-t-display-s3_st7789_16MB
|
||||||
|
; ttgo-t-display-s3_st7789_touch_16MB
|
||||||
;endregion
|
;endregion
|
||||||
|
|
||||||
;region -- Define your local COM ports for each environment ---
|
;region -- Define your local COM ports for each environment ---
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include "hasplib.h"
|
#include "hasplib.h"
|
||||||
|
|
||||||
#if defined(HASP_USE_CUSTOM) && false // <-- set this to true in your code
|
#if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0 && false // <-- set this to true in your code
|
||||||
|
|
||||||
#include "hasp_debug.h"
|
#include "hasp_debug.h"
|
||||||
|
|
||||||
@ -98,4 +98,8 @@ void custom_topic_payload(const char* topic, const char* payload, uint8_t source
|
|||||||
// LOG_VERBOSE(TAG_CUSTOM, "Handled custom message: %s => %s", topic, payload);
|
// LOG_VERBOSE(TAG_CUSTOM, "Handled custom message: %s => %s", topic, payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void custom_state_subtopic(const char* subtopic, const char* payload){
|
||||||
|
// Not used
|
||||||
|
}
|
||||||
|
|
||||||
#endif // HASP_USE_CUSTOM
|
#endif // HASP_USE_CUSTOM
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#include "hasplib.h"
|
#include "hasplib.h"
|
||||||
|
|
||||||
#if defined(HASP_USE_CUSTOM) && false // <-- set this to true in your code
|
#if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0 && false // <-- set this to true in your code
|
||||||
|
|
||||||
#include "hasp_debug.h"
|
#include "hasp_debug.h"
|
||||||
|
|
||||||
@ -53,4 +53,9 @@ void custom_topic_payload(const char* topic, const char* payload, uint8_t source
|
|||||||
// Not used
|
// Not used
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void custom_state_subtopic(const char* subtopic, const char* payload){
|
||||||
|
// Not used
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // HASP_USE_CUSTOM
|
#endif // HASP_USE_CUSTOM
|
@ -9,7 +9,7 @@
|
|||||||
#define HASP_CUSTOM_H
|
#define HASP_CUSTOM_H
|
||||||
|
|
||||||
#include "hasplib.h"
|
#include "hasplib.h"
|
||||||
#if defined(HASP_USE_CUSTOM)
|
#if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
|
||||||
|
|
||||||
/* This function is called at boot */
|
/* This function is called at boot */
|
||||||
void custom_setup();
|
void custom_setup();
|
||||||
@ -32,6 +32,11 @@ void custom_get_sensors(JsonDocument& doc);
|
|||||||
/* Receive custom topic & payload messages */
|
/* Receive custom topic & payload messages */
|
||||||
void custom_topic_payload(const char* topic, const char* payload, uint8_t source);
|
void custom_topic_payload(const char* topic, const char* payload, uint8_t source);
|
||||||
|
|
||||||
|
/* Get notified when a state message is sent out */
|
||||||
|
/* Can be used to send state changes through other means then MQTT, e.g. Serial2 */
|
||||||
|
/* https://github.com/HASwitchPlate/openHASP/issues/611 */
|
||||||
|
void custom_state_subtopic(const char* subtopic, const char* payload);
|
||||||
|
|
||||||
#endif // HASP_USE_CUSTOM
|
#endif // HASP_USE_CUSTOM
|
||||||
|
|
||||||
#endif // HASP_CUSTOM_H
|
#endif // HASP_CUSTOM_H
|
||||||
|
@ -451,6 +451,11 @@ long Esp32Device::get_uptime()
|
|||||||
#elif defined(M5STACK) || defined(M5STACKLGFX)
|
#elif defined(M5STACK) || defined(M5STACKLGFX)
|
||||||
#warning Building for M5Stack core2
|
#warning Building for M5Stack core2
|
||||||
#include "dev/esp32/m5stackcore2.h"
|
#include "dev/esp32/m5stackcore2.h"
|
||||||
|
|
||||||
|
#elif defined(TWATCH)
|
||||||
|
#warning Building for TTGo T-Watch
|
||||||
|
#include "dev/esp32/twatch.h"
|
||||||
|
|
||||||
#else
|
#else
|
||||||
dev::Esp32Device haspDevice;
|
dev::Esp32Device haspDevice;
|
||||||
#endif
|
#endif
|
||||||
|
@ -86,6 +86,8 @@ class Esp32Device : public BaseDevice {
|
|||||||
#elif defined(M5STACK) || defined (M5STACKLGFX)
|
#elif defined(M5STACK) || defined (M5STACKLGFX)
|
||||||
// #warning Building for M5Stack core2
|
// #warning Building for M5Stack core2
|
||||||
#include "m5stackcore2.h"
|
#include "m5stackcore2.h"
|
||||||
|
#elif defined(TWATCH)
|
||||||
|
#include "twatch.h"
|
||||||
#else
|
#else
|
||||||
using dev::Esp32Device;
|
using dev::Esp32Device;
|
||||||
extern dev::Esp32Device haspDevice;
|
extern dev::Esp32Device haspDevice;
|
||||||
|
39
src/dev/esp32/twatch.cpp
Normal file
39
src/dev/esp32/twatch.cpp
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#include "twatch.h"
|
||||||
|
|
||||||
|
#if defined(TWATCH)
|
||||||
|
|
||||||
|
#include "Wire.h"
|
||||||
|
#include "dev/esp32/esp32.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This covers the TWatch 2019 and 2020 PMIC. Only the init function is implemented
|
||||||
|
* because the TWatch 2020 v1 variant has not just the backlight connected to LDO2,
|
||||||
|
* but also the power for the display controller. This shouldn't get regulated down
|
||||||
|
* or be switched off (since the latter would require display being re-inited) so we
|
||||||
|
* don't let the user switch it off.
|
||||||
|
*
|
||||||
|
* This *could* get fixed, by detecting hardware type and changing behaviour, but
|
||||||
|
* this device isn't particularly common and OpenHASP probably isn't the proper tool
|
||||||
|
* for this hardware. It's nice to have some support though.
|
||||||
|
*/
|
||||||
|
namespace dev {
|
||||||
|
void TWatch::init(void) {
|
||||||
|
Wire.begin();
|
||||||
|
|
||||||
|
Wire.beginTransmission(53);
|
||||||
|
Wire.write(0x12);
|
||||||
|
Wire.write(0b00000110); // Enable LDO2, DC-DC3, disable others
|
||||||
|
Wire.endTransmission();
|
||||||
|
|
||||||
|
// Section set LDO2 to 3.3V
|
||||||
|
uint8_t ldo_ctrl = ~0;
|
||||||
|
Wire.beginTransmission(53);
|
||||||
|
Wire.write(0x28);
|
||||||
|
Wire.write(ldo_ctrl);
|
||||||
|
Wire.endTransmission();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dev::TWatch haspDevice;
|
||||||
|
|
||||||
|
#endif
|
20
src/dev/esp32/twatch.h
Normal file
20
src/dev/esp32/twatch.h
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#ifndef HASP_DEVICE_TWATCH
|
||||||
|
#define HASP_DEVICE_TWATCH
|
||||||
|
|
||||||
|
#if defined(TWATCH)
|
||||||
|
|
||||||
|
#include "esp32.h"
|
||||||
|
|
||||||
|
namespace dev {
|
||||||
|
class TWatch : public Esp32Device {
|
||||||
|
public:
|
||||||
|
void init() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
using dev::TWatch;
|
||||||
|
extern dev::TWatch haspDevice;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
@ -17,7 +17,7 @@ Contributors:
|
|||||||
/----------------------------------------------------------------------------*/
|
/----------------------------------------------------------------------------*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#if defined(ARDUINO) && defined(LGFX_USE_V1)
|
#if defined(ARDUINO) && defined(LGFX_USE_V1) && !defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||||
|
|
||||||
#include "Arduino.h"
|
#include "Arduino.h"
|
||||||
#include "LovyanGFX.hpp"
|
#include "LovyanGFX.hpp"
|
||||||
|
@ -113,6 +113,12 @@
|
|||||||
#ifndef SPI_READ_FREQUENCY
|
#ifndef SPI_READ_FREQUENCY
|
||||||
#define SPI_READ_FREQUENCY 0
|
#define SPI_READ_FREQUENCY 0
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef TFT_OFFSET_X
|
||||||
|
#define TFT_OFFSET_X 0
|
||||||
|
#endif
|
||||||
|
#ifndef TFT_OFFSET_Y
|
||||||
|
#define TFT_OFFSET_Y 0
|
||||||
|
#endif
|
||||||
#ifndef TFT_OFFSET_ROTATION
|
#ifndef TFT_OFFSET_ROTATION
|
||||||
#define TFT_OFFSET_ROTATION 0
|
#define TFT_OFFSET_ROTATION 0
|
||||||
#endif
|
#endif
|
||||||
|
@ -32,6 +32,7 @@ enum lv_hasp_obj_type_t {
|
|||||||
TFT_PANEL_RM68140,
|
TFT_PANEL_RM68140,
|
||||||
TFT_PANEL_RGB,
|
TFT_PANEL_RGB,
|
||||||
TFT_PANEL_EPD,
|
TFT_PANEL_EPD,
|
||||||
|
TFT_PANEL_GC9A01,
|
||||||
TFT_PANEL_LAST,
|
TFT_PANEL_LAST,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -25,7 +25,34 @@ void ArduinoGfx::init(int w, int h)
|
|||||||
{
|
{
|
||||||
LOG_TRACE(TAG_TFT, F(D_SERVICE_STARTING));
|
LOG_TRACE(TAG_TFT, F(D_SERVICE_STARTING));
|
||||||
|
|
||||||
#if(TFT_WIDTH == 480) && (TFT_HEIGHT == 480) && defined(LILYGO_T_RGB)
|
#if(TFT_WIDTH == 170) && (TFT_HEIGHT == 320)
|
||||||
|
Arduino_DataBus* bus = new Arduino_ESP32PAR8(TFT_DC, TFT_CS, TFT_WR, TFT_RD, TFT_D0, TFT_D1, TFT_D2, TFT_D3, TFT_D4,
|
||||||
|
TFT_D5, TFT_D6, TFT_D7);
|
||||||
|
tft = new Arduino_ST7789(bus, TFT_RST /* RST */, TFT_ROTATION /* rotation */, true /* IPS */, TFT_WIDTH /* width */,
|
||||||
|
TFT_HEIGHT /* height */, 35 /* col offset 1 */, 0 /* row offset 1 */,
|
||||||
|
35 /* col offset 2 */, 0 /* row offset 2 */
|
||||||
|
);
|
||||||
|
tft->begin(SPI_FREQUENCY); // Used for SPI displays
|
||||||
|
|
||||||
|
#elif(TFT_WIDTH == 480) && (TFT_HEIGHT == 480) && defined(LILYGO_T_PANEL)
|
||||||
|
Wire.begin(17, 18);
|
||||||
|
Arduino_DataBus* bus = new Arduino_XL9535SWSPI(17 /* SDA */, 18 /* SCL */, -1 /* XL PWD */, 17 /* XL CS */,
|
||||||
|
15 /* XL SCK */, 16 /* XL MOSI */, &Wire);
|
||||||
|
Arduino_ESP32RGBPanel* rgbpanel = new Arduino_ESP32RGBPanel(
|
||||||
|
-1 /* DE */, TFT_VSYNC /* VSYNC */, TFT_HSYNC /* HSYNC */, TFT_PCLK /* PCLK */, TFT_B0 /* B0 */,
|
||||||
|
TFT_B1 /* B1 */, TFT_B2 /* B2 */, TFT_B3 /* B3 */, TFT_B4 /* B4 */, TFT_G0 /* G0 */, TFT_G1 /* G1 */,
|
||||||
|
TFT_G2 /* G2 */, TFT_G3 /* G3 */, TFT_G4 /* G4 */, TFT_G5 /* G5 */, TFT_R0 /* R0 */, TFT_R1 /* R1 */,
|
||||||
|
TFT_R2 /* R2 */, TFT_R3 /* R3 */, TFT_R4 /* R4 */, 1 /* hsync_polarity */, 20 /* hsync_front_porch */,
|
||||||
|
2 /* hsync_pulse_width */, 0 /* hsync_back_porch */, 1 /* vsync_polarity */, 30 /* vsync_front_porch */,
|
||||||
|
8 /* vsync_pulse_width */, 1 /* vsync_back_porch */, 10 /* pclk_active_neg */, 6000000L /* prefer_speed */,
|
||||||
|
false /* useBigEndian */, 0 /* de_idle_high*/, 0 /* pclk_idle_high */);
|
||||||
|
|
||||||
|
tft = new Arduino_RGB_Display(TFT_WIDTH /* width */, TFT_HEIGHT /* height */, rgbpanel, 0 /* rotation */,
|
||||||
|
true /* auto_flush */, bus, -1 /* RST */, st7701_t_panel_init_operations,
|
||||||
|
sizeof(st7701_t_panel_init_operations));
|
||||||
|
tft->begin(GFX_NOT_DEFINED); // Used for RFB displays
|
||||||
|
|
||||||
|
#elif(TFT_WIDTH == 480) && (TFT_HEIGHT == 480) && defined(LILYGO_T_RGB)
|
||||||
Wire.begin(8 /* SDA */, 48 /* SCL */, 800000L /* speed */);
|
Wire.begin(8 /* SDA */, 48 /* SCL */, 800000L /* speed */);
|
||||||
Arduino_DataBus* bus = new Arduino_XL9535SWSPI(8 /* SDA */, 48 /* SCL */, 2 /* XL PWD */, 3 /* XL CS */,
|
Arduino_DataBus* bus = new Arduino_XL9535SWSPI(8 /* SDA */, 48 /* SCL */, 2 /* XL PWD */, 3 /* XL CS */,
|
||||||
5 /* XL SCK */, 4 /* XL MOSI */);
|
5 /* XL SCK */, 4 /* XL MOSI */);
|
||||||
@ -35,8 +62,9 @@ void ArduinoGfx::init(int w, int h)
|
|||||||
6 /* B1 */, 5 /* B2 */, 3 /* B3 */, 2 /* B4 */, 1 /* hsync_polarity */, 50 /* hsync_front_porch */,
|
6 /* B1 */, 5 /* B2 */, 3 /* B3 */, 2 /* B4 */, 1 /* hsync_polarity */, 50 /* hsync_front_porch */,
|
||||||
1 /* hsync_pulse_width */, 30 /* hsync_back_porch */, 1 /* vsync_polarity */, 20 /* vsync_front_porch */,
|
1 /* hsync_pulse_width */, 30 /* hsync_back_porch */, 1 /* vsync_polarity */, 20 /* vsync_front_porch */,
|
||||||
1 /* vsync_pulse_width */, 30 /* vsync_back_porch */, 1 /* pclk_active_neg */);
|
1 /* vsync_pulse_width */, 30 /* vsync_back_porch */, 1 /* pclk_active_neg */);
|
||||||
tft = new Arduino_RGB_Display(w, h, rgbpanel, 0 /* rotation */, TFT_AUTO_FLUSH, bus, TFT_RST,
|
tft = new Arduino_RGB_Display(w, h, rgbpanel, 0 /* rotation */, TFT_AUTO_FLUSH, bus, TFT_RST,
|
||||||
st7701_type4_init_operations, sizeof(st7701_type4_init_operations));
|
st7701_type4_init_operations, sizeof(st7701_type4_init_operations));
|
||||||
|
tft->begin(GFX_NOT_DEFINED); // Used for RFB displays
|
||||||
|
|
||||||
#elif(TFT_WIDTH == 480) && (TFT_HEIGHT == 480) && defined(SENSECAP_INDICATOR_D1)
|
#elif(TFT_WIDTH == 480) && (TFT_HEIGHT == 480) && defined(SENSECAP_INDICATOR_D1)
|
||||||
Wire.begin(TOUCH_SDA, TOUCH_SCL, I2C_TOUCH_FREQUENCY);
|
Wire.begin(TOUCH_SDA, TOUCH_SCL, I2C_TOUCH_FREQUENCY);
|
||||||
@ -44,14 +72,16 @@ void ArduinoGfx::init(int w, int h)
|
|||||||
pinMode(TFT_MOSI, OUTPUT);
|
pinMode(TFT_MOSI, OUTPUT);
|
||||||
pinMode(TFT_MISO, OUTPUT);
|
pinMode(TFT_MISO, OUTPUT);
|
||||||
Arduino_DataBus* bus = new Arduino_PCA9535SWSPI(TOUCH_SDA, TOUCH_SCL, 5 /* XL PWD */, 4 /* XL CS */,
|
Arduino_DataBus* bus = new Arduino_PCA9535SWSPI(TOUCH_SDA, TOUCH_SCL, 5 /* XL PWD */, 4 /* XL CS */,
|
||||||
TFT_SCLK /* XL SCK */, TFT_MOSI /* XL MOSI */, &Wire);
|
TFT_SCLK /* XL SCK */, TFT_MOSI /* XL MOSI */, &Wire);
|
||||||
Arduino_ESP32RGBPanel* rgbpanel = new Arduino_ESP32RGBPanel(
|
Arduino_ESP32RGBPanel* rgbpanel = new Arduino_ESP32RGBPanel(
|
||||||
TFT_DE, TFT_VSYNC, TFT_HSYNC, TFT_PCLK, TFT_R0, TFT_R1, TFT_R2, TFT_R3, TFT_R4, TFT_G0, TFT_G1, TFT_G2, TFT_G3,
|
TFT_DE, TFT_VSYNC, TFT_HSYNC, TFT_PCLK, TFT_R0, TFT_R1, TFT_R2, TFT_R3, TFT_R4, TFT_G0, TFT_G1, TFT_G2, TFT_G3,
|
||||||
TFT_G4, TFT_G5, TFT_B0, TFT_B1, TFT_B2, TFT_B3, TFT_B4, TFT_HSYNC_POLARITY, TFT_HSYNC_FRONT_PORCH,
|
TFT_G4, TFT_G5, TFT_B0, TFT_B1, TFT_B2, TFT_B3, TFT_B4, TFT_HSYNC_POLARITY, TFT_HSYNC_FRONT_PORCH,
|
||||||
TFT_HSYNC_PULSE_WIDTH, TFT_HSYNC_BACK_PORCH, TFT_VSYNC_POLARITY, TFT_VSYNC_FRONT_PORCH, TFT_VSYNC_PULSE_WIDTH,
|
TFT_HSYNC_PULSE_WIDTH, TFT_HSYNC_BACK_PORCH, TFT_VSYNC_POLARITY, TFT_VSYNC_FRONT_PORCH, TFT_VSYNC_PULSE_WIDTH,
|
||||||
TFT_VSYNC_BACK_PORCH);
|
TFT_VSYNC_BACK_PORCH);
|
||||||
tft = new Arduino_RGB_Display(w, h, rgbpanel, 0 /* rotation */, TFT_AUTO_FLUSH, bus, TFT_RST,
|
tft = new Arduino_RGB_Display(w, h, rgbpanel, 0 /* rotation */, TFT_AUTO_FLUSH, bus, TFT_RST,
|
||||||
st7701_sensecap_indicator_init_operations, sizeof(st7701_sensecap_indicator_init_operations));
|
st7701_sensecap_indicator_init_operations,
|
||||||
|
sizeof(st7701_sensecap_indicator_init_operations));
|
||||||
|
tft->begin(GFX_NOT_DEFINED); // Used for RFB displays
|
||||||
|
|
||||||
#elif(TFT_WIDTH == 480) && (TFT_HEIGHT == 480) && defined(GC9503V_DRIVER)
|
#elif(TFT_WIDTH == 480) && (TFT_HEIGHT == 480) && defined(GC9503V_DRIVER)
|
||||||
Arduino_DataBus* bus = new Arduino_SWSPI(TFT_DC, TFT_CS, TFT_SCLK, TFT_MOSI, TFT_MISO);
|
Arduino_DataBus* bus = new Arduino_SWSPI(TFT_DC, TFT_CS, TFT_SCLK, TFT_MOSI, TFT_MISO);
|
||||||
@ -62,6 +92,7 @@ void ArduinoGfx::init(int w, int h)
|
|||||||
TFT_VSYNC_BACK_PORCH);
|
TFT_VSYNC_BACK_PORCH);
|
||||||
tft = new Arduino_RGB_Display(w, h, rgbpanel, 0 /* rotation */, TFT_AUTO_FLUSH, bus, TFT_RST,
|
tft = new Arduino_RGB_Display(w, h, rgbpanel, 0 /* rotation */, TFT_AUTO_FLUSH, bus, TFT_RST,
|
||||||
gc9503v_type1_init_operations, sizeof(gc9503v_type1_init_operations));
|
gc9503v_type1_init_operations, sizeof(gc9503v_type1_init_operations));
|
||||||
|
tft->begin(GFX_NOT_DEFINED); // Used for RFB displays
|
||||||
|
|
||||||
#elif(TFT_WIDTH == 480) && (TFT_HEIGHT == 480) && defined(ST7701_DRIVER) && defined(ST7701_4848S040)
|
#elif(TFT_WIDTH == 480) && (TFT_HEIGHT == 480) && defined(ST7701_DRIVER) && defined(ST7701_4848S040)
|
||||||
Arduino_DataBus* bus = new Arduino_SWSPI(TFT_DC, TFT_CS, TFT_SCLK, TFT_MOSI, TFT_MISO);
|
Arduino_DataBus* bus = new Arduino_SWSPI(TFT_DC, TFT_CS, TFT_SCLK, TFT_MOSI, TFT_MISO);
|
||||||
@ -73,6 +104,8 @@ void ArduinoGfx::init(int w, int h)
|
|||||||
|
|
||||||
tft = new Arduino_RGB_Display(w, h, rgbpanel, 0 /* rotation */, TFT_AUTO_FLUSH, bus, TFT_RST,
|
tft = new Arduino_RGB_Display(w, h, rgbpanel, 0 /* rotation */, TFT_AUTO_FLUSH, bus, TFT_RST,
|
||||||
st7701_4848S040_init_operations, sizeof(st7701_4848S040_init_operations));
|
st7701_4848S040_init_operations, sizeof(st7701_4848S040_init_operations));
|
||||||
|
tft->begin(GFX_NOT_DEFINED); // Used for RFB displays
|
||||||
|
|
||||||
#elif(TFT_WIDTH == 480) && (TFT_HEIGHT == 480) && defined(ST7701_DRIVER)
|
#elif(TFT_WIDTH == 480) && (TFT_HEIGHT == 480) && defined(ST7701_DRIVER)
|
||||||
/* More data bus class: https://github.com/moononournation/Arduino_GFX/wiki/Data-Bus-Class */
|
/* More data bus class: https://github.com/moononournation/Arduino_GFX/wiki/Data-Bus-Class */
|
||||||
Arduino_DataBus* bus = new Arduino_SWSPI(TFT_DC, TFT_CS, TFT_SCLK, TFT_MOSI, TFT_MISO);
|
Arduino_DataBus* bus = new Arduino_SWSPI(TFT_DC, TFT_CS, TFT_SCLK, TFT_MOSI, TFT_MISO);
|
||||||
@ -85,6 +118,13 @@ void ArduinoGfx::init(int w, int h)
|
|||||||
/* More display class: https://github.com/moononournation/Arduino_GFX/wiki/Display-Class */
|
/* More display class: https://github.com/moononournation/Arduino_GFX/wiki/Display-Class */
|
||||||
tft = new Arduino_RGB_Display(w, h, rgbpanel, 0 /* rotation */, TFT_AUTO_FLUSH, bus, TFT_RST,
|
tft = new Arduino_RGB_Display(w, h, rgbpanel, 0 /* rotation */, TFT_AUTO_FLUSH, bus, TFT_RST,
|
||||||
st7701_type1_init_operations, sizeof(st7701_type1_init_operations));
|
st7701_type1_init_operations, sizeof(st7701_type1_init_operations));
|
||||||
|
tft->begin(GFX_NOT_DEFINED); // Used for RFB displays
|
||||||
|
|
||||||
|
#elif(TFT_WIDTH == 480) && (TFT_HEIGHT == 272) && defined(NV3041A_DRIVER)
|
||||||
|
Arduino_DataBus* bus = new Arduino_ESP32QSPI(TFT_CS, TFT_SCK, TFT_D0, TFT_D1, TFT_D2, TFT_D3);
|
||||||
|
tft = new Arduino_NV3041A(bus, TFT_RST, TFT_ROTATION, TFT_IPS);
|
||||||
|
tft->begin(GFX_NOT_DEFINED); // Used for RFB displays
|
||||||
|
|
||||||
#elif 1
|
#elif 1
|
||||||
/* Reset is not implemented in the panel */
|
/* Reset is not implemented in the panel */
|
||||||
if(TFT_RST != GFX_NOT_DEFINED) {
|
if(TFT_RST != GFX_NOT_DEFINED) {
|
||||||
@ -103,15 +143,11 @@ void ArduinoGfx::init(int w, int h)
|
|||||||
TFT_HSYNC_PULSE_WIDTH, TFT_HSYNC_BACK_PORCH, TFT_VSYNC_POLARITY, TFT_VSYNC_FRONT_PORCH, TFT_VSYNC_PULSE_WIDTH,
|
TFT_HSYNC_PULSE_WIDTH, TFT_HSYNC_BACK_PORCH, TFT_VSYNC_POLARITY, TFT_VSYNC_FRONT_PORCH, TFT_VSYNC_PULSE_WIDTH,
|
||||||
TFT_VSYNC_BACK_PORCH, TFT_PCLK_ACTIVE_NEG, TFT_PREFER_SPEED);
|
TFT_VSYNC_BACK_PORCH, TFT_PCLK_ACTIVE_NEG, TFT_PREFER_SPEED);
|
||||||
|
|
||||||
Arduino_RGB_Display_Mod* gfx = new Arduino_RGB_Display_Mod(TFT_WIDTH, TFT_HEIGHT, bus);
|
tft = new Arduino_RGB_Display_Mod(TFT_WIDTH, TFT_HEIGHT, bus);
|
||||||
tft = gfx;
|
tft->begin(GFX_NOT_DEFINED); // Used for RFB displays
|
||||||
// fb = ((Arduino_RGBPanel_Mod*)tft)->getFramebuffer();
|
// fb = ((Arduino_RGBPanel_Mod*)tft)->getFramebuffer();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* TFT init */
|
|
||||||
LOG_DEBUG(TAG_TFT, F("%s - %d"), __FILE__, __LINE__);
|
|
||||||
tft->begin(GFX_NOT_DEFINED);
|
|
||||||
LOG_DEBUG(TAG_TFT, F("%s - %d"), __FILE__, __LINE__);
|
|
||||||
// tft.setSwapBytes(true); /* set endianness */
|
// tft.setSwapBytes(true); /* set endianness */
|
||||||
LOG_INFO(TAG_TFT, F(D_SERVICE_STARTED));
|
LOG_INFO(TAG_TFT, F(D_SERVICE_STARTED));
|
||||||
}
|
}
|
||||||
@ -262,6 +298,116 @@ void IRAM_ATTR ArduinoGfx::flush_pixels(lv_disp_drv_t* disp, const lv_area_t* ar
|
|||||||
|
|
||||||
bool ArduinoGfx::is_driver_pin(uint8_t pin)
|
bool ArduinoGfx::is_driver_pin(uint8_t pin)
|
||||||
{
|
{
|
||||||
|
if(false // start condition is always needed
|
||||||
|
|
||||||
|
// Use individual checks instead of switch statement, as some case labels could be duplicated
|
||||||
|
#ifdef TFT_MOSI
|
||||||
|
|| (pin == TFT_MOSI)
|
||||||
|
#endif
|
||||||
|
#ifdef TFT_MISO
|
||||||
|
|| (pin == TFT_MISO)
|
||||||
|
#endif
|
||||||
|
#ifdef TFT_SCLK
|
||||||
|
|| (pin == TFT_SCLK)
|
||||||
|
#endif
|
||||||
|
#ifdef TFT_CS
|
||||||
|
|| (pin == TFT_CS)
|
||||||
|
#endif
|
||||||
|
#ifdef TFT_DC
|
||||||
|
|| (pin == TFT_DC)
|
||||||
|
#endif
|
||||||
|
#ifdef TFT_DE
|
||||||
|
|| (pin == TFT_DE)
|
||||||
|
#endif
|
||||||
|
#ifdef TFT_PCLK
|
||||||
|
|| (pin == TFT_PCLK)
|
||||||
|
#endif
|
||||||
|
#ifdef TFT_VSYNC
|
||||||
|
|| (pin == TFT_VSYNC)
|
||||||
|
#endif
|
||||||
|
#ifdef TFT_HSYNC
|
||||||
|
|| (pin == TFT_HSYNC)
|
||||||
|
#endif
|
||||||
|
#ifdef TFT_RST
|
||||||
|
|| (pin == TFT_RST)
|
||||||
|
#endif
|
||||||
|
#ifdef TFT_BUSY
|
||||||
|
|| (pin == TFT_BUSY)
|
||||||
|
#endif
|
||||||
|
#ifdef TFT_RD
|
||||||
|
|| (pin == TFT_RD)
|
||||||
|
#endif
|
||||||
|
#ifdef TFT_R0
|
||||||
|
|| (pin == TFT_R0)
|
||||||
|
#endif
|
||||||
|
#ifdef TFT_R1
|
||||||
|
|| (pin == TFT_R1)
|
||||||
|
#endif
|
||||||
|
#ifdef TFT_R2
|
||||||
|
|| (pin == TFT_R2)
|
||||||
|
#endif
|
||||||
|
#ifdef TFT_R3
|
||||||
|
|| (pin == TFT_R3)
|
||||||
|
#endif
|
||||||
|
#ifdef TFT_R4
|
||||||
|
|| (pin == TFT_R4)
|
||||||
|
#endif
|
||||||
|
#ifdef TFT_G0
|
||||||
|
|| (pin == TFT_G0)
|
||||||
|
#endif
|
||||||
|
#ifdef TFT_G1
|
||||||
|
|| (pin == TFT_G1)
|
||||||
|
#endif
|
||||||
|
#ifdef TFT_G2
|
||||||
|
|| (pin == TFT_G2)
|
||||||
|
#endif
|
||||||
|
#ifdef TFT_G3
|
||||||
|
|| (pin == TFT_G3)
|
||||||
|
#endif
|
||||||
|
#ifdef TFT_G4
|
||||||
|
|| (pin == TFT_G4)
|
||||||
|
#endif
|
||||||
|
#ifdef TFT_G5
|
||||||
|
|| (pin == TFT_G5)
|
||||||
|
#endif
|
||||||
|
#ifdef TFT_B0
|
||||||
|
|| (pin == TFT_B0)
|
||||||
|
#endif
|
||||||
|
#ifdef TFT_B1
|
||||||
|
|| (pin == TFT_B1)
|
||||||
|
#endif
|
||||||
|
#ifdef TFT_B2
|
||||||
|
|| (pin == TFT_B2)
|
||||||
|
#endif
|
||||||
|
#ifdef TFT_B3
|
||||||
|
|| (pin == TFT_B3)
|
||||||
|
#endif
|
||||||
|
#ifdef TFT_B4
|
||||||
|
|| (pin == TFT_B4)
|
||||||
|
#endif
|
||||||
|
#ifdef TOUCH_SDA
|
||||||
|
|| (pin == TOUCH_SDA)
|
||||||
|
#endif
|
||||||
|
#ifdef TOUCH_SCL
|
||||||
|
|| (pin == TOUCH_SCL)
|
||||||
|
#endif
|
||||||
|
#ifdef TOUCH_RST
|
||||||
|
|| (pin == TOUCH_RST)
|
||||||
|
#endif
|
||||||
|
#ifdef TOUCH_IRQ
|
||||||
|
|| (pin == TOUCH_IRQ)
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef ARDUINO_ARCH_ESP8266
|
||||||
|
#ifndef TFT_SPI_OVERLAP
|
||||||
|
if((pin >= 12) && (pin <= 14)) return true; // HSPI
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -299,6 +445,8 @@ const char* ArduinoGfx::get_tft_model()
|
|||||||
return "R61529";
|
return "R61529";
|
||||||
#elif defined(RM68140_DRIVER)
|
#elif defined(RM68140_DRIVER)
|
||||||
return "RM68140";
|
return "RM68140";
|
||||||
|
#elif defined(NV3041A_DRIVER)
|
||||||
|
return "NV3041A";
|
||||||
#else
|
#else
|
||||||
return "Other";
|
return "Other";
|
||||||
#endif
|
#endif
|
||||||
@ -336,6 +484,8 @@ uint32_t ArduinoGfx::get_tft_driver()
|
|||||||
return 0x61529;
|
return 0x61529;
|
||||||
#elif defined(RM68140_DRIVER)
|
#elif defined(RM68140_DRIVER)
|
||||||
return 0x68140;
|
return 0x68140;
|
||||||
|
#elif defined(NV3041A_DRIVER)
|
||||||
|
return 0x3041A;
|
||||||
#else
|
#else
|
||||||
return 0x0;
|
return 0x0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -94,8 +94,11 @@ static lgfx::Bus_Parallel8* init_parallel_8_bus(Preferences* prefs, int8_t data_
|
|||||||
cfg.pin_rd = prefs->getInt("rd", TFT_RD);
|
cfg.pin_rd = prefs->getInt("rd", TFT_RD);
|
||||||
cfg.pin_wr = prefs->getInt("wr", TFT_WR);
|
cfg.pin_wr = prefs->getInt("wr", TFT_WR);
|
||||||
cfg.pin_rs = prefs->getInt("rs", TFT_DC);
|
cfg.pin_rs = prefs->getInt("rs", TFT_DC);
|
||||||
cfg.freq_write = prefs->getUInt("write_freq", SPI_FREQUENCY);
|
#ifndef CONFIG_IDF_TARGET_ESP32C3
|
||||||
#if !defined(CONFIG_IDF_TARGET_ESP32S3)
|
cfg.freq_write = prefs->getUInt("write_freq", SPI_FREQUENCY);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(CONFIG_IDF_TARGET_ESP32S3) && !defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||||
uint8_t port = prefs->getUInt("i2s_port", 0);
|
uint8_t port = prefs->getUInt("i2s_port", 0);
|
||||||
switch(port) {
|
switch(port) {
|
||||||
#if SOC_I2S_NUM > 1
|
#if SOC_I2S_NUM > 1
|
||||||
@ -201,8 +204,8 @@ static void configure_panel(lgfx::Panel_Device* panel, Preferences* prefs)
|
|||||||
cfg.memory_width = prefs->getUInt("memory_width", cfg.panel_width); // Maximum width supported by driver IC
|
cfg.memory_width = prefs->getUInt("memory_width", cfg.panel_width); // Maximum width supported by driver IC
|
||||||
cfg.memory_height = prefs->getUInt("memory_height", cfg.panel_height); // Maximum height supported by driver IC
|
cfg.memory_height = prefs->getUInt("memory_height", cfg.panel_height); // Maximum height supported by driver IC
|
||||||
|
|
||||||
cfg.offset_x = prefs->getUInt("offset_x", 0); // Amount of offset in the X direction of the panel
|
cfg.offset_x = prefs->getUInt("offset_x", TFT_OFFSET_X); // Amount of offset in the X direction of the panel
|
||||||
cfg.offset_y = prefs->getUInt("offset_y", 0); // Amount of offset in the Y direction of the panel
|
cfg.offset_y = prefs->getUInt("offset_y", TFT_OFFSET_Y); // Amount of offset in the Y direction of the panel
|
||||||
cfg.offset_rotation =
|
cfg.offset_rotation =
|
||||||
prefs->getUInt("offset_rotation", TFT_OFFSET_ROTATION); // Offset of the rotation 0 ~ 7 (4 ~ 7 is upside down)
|
prefs->getUInt("offset_rotation", TFT_OFFSET_ROTATION); // Offset of the rotation 0 ~ 7 (4 ~ 7 is upside down)
|
||||||
|
|
||||||
@ -328,6 +331,11 @@ lgfx::Panel_Device* LovyanGfx::_init_panel(lgfx::IBus* bus)
|
|||||||
LOG_VERBOSE(TAG_TFT, F("Panel_RGB"));
|
LOG_VERBOSE(TAG_TFT, F("Panel_RGB"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case TFT_PANEL_GC9A01: {
|
||||||
|
panel = new lgfx::Panel_GC9A01();
|
||||||
|
LOG_VERBOSE(TAG_TFT, F("Panel_GC9A01"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
default: { // Needs to be in curly braces
|
default: { // Needs to be in curly braces
|
||||||
LOG_FATAL(TAG_TFT, F(D_SERVICE_START_FAILED ": %s line %d"), __FILE__, __LINE__);
|
LOG_FATAL(TAG_TFT, F(D_SERVICE_START_FAILED ": %s line %d"), __FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
@ -372,6 +380,32 @@ lgfx::ITouch* _init_touch(Preferences* preferences)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if TOUCH_DRIVER == 0x0820
|
||||||
|
|
||||||
|
{ // タッチスクリーン制御の設定を行います。(必要なければ削除)
|
||||||
|
auto touch = new lgfx::Touch_FT5x06();
|
||||||
|
auto cfg = touch->config();
|
||||||
|
|
||||||
|
cfg.x_min = 0; // The minimum X value obtained from the touchscreen (raw value).
|
||||||
|
cfg.x_max = TFT_WIDTH - 1; // The maximum X value obtained from the touchscreen (raw value).
|
||||||
|
cfg.y_min = 0; // The minimum Y value obtained from the touchscreen (raw value).
|
||||||
|
cfg.y_max = TFT_HEIGHT - 1; // The maximum Y value obtained from the touchscreen (raw value).
|
||||||
|
cfg.bus_shared = true; // If using a common bus with the screen, set it to true.
|
||||||
|
cfg.offset_rotation = TOUCH_OFFSET_ROTATION; // Adjustment when the display orientation does not match the touch orientation. Set in values from 0 to 7.
|
||||||
|
|
||||||
|
// I2C接続の場合
|
||||||
|
cfg.i2c_port = I2C_TOUCH_PORT; // 使用するI2Cを選択 (0 or 1)
|
||||||
|
cfg.i2c_addr = I2C_TOUCH_ADDRESS; // I2Cデバイスアドレス番号
|
||||||
|
cfg.pin_sda = TOUCH_SDA; // SDAが接続されているピン番号
|
||||||
|
cfg.pin_scl = TOUCH_SCL; // SCLが接続されているピン番号
|
||||||
|
cfg.pin_int = TOUCH_IRQ; // INTが接続されているピン番号
|
||||||
|
cfg.freq = I2C_TOUCH_FREQUENCY; // I2Cクロックを設定
|
||||||
|
|
||||||
|
touch->config(cfg);
|
||||||
|
return touch;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if TOUCH_DRIVER == 0x6336
|
#if TOUCH_DRIVER == 0x6336
|
||||||
{
|
{
|
||||||
auto touch = new lgfx::Touch_FT5x06();
|
auto touch = new lgfx::Touch_FT5x06();
|
||||||
@ -455,6 +489,31 @@ lgfx::ITouch* _init_touch(Preferences* preferences)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if TOUCH_DRIVER == 0x816
|
||||||
|
{
|
||||||
|
auto touch = new lgfx::Touch_CST816S();
|
||||||
|
auto cfg = touch->config();
|
||||||
|
|
||||||
|
cfg.x_min = 0;
|
||||||
|
cfg.x_max = TFT_WIDTH - 1;
|
||||||
|
cfg.y_min = 0;
|
||||||
|
cfg.y_max = TFT_HEIGHT - 1;
|
||||||
|
cfg.pin_int = TOUCH_IRQ;
|
||||||
|
cfg.bus_shared = true;
|
||||||
|
cfg.offset_rotation = TOUCH_OFFSET_ROTATION;
|
||||||
|
|
||||||
|
// I2C接続の場合
|
||||||
|
cfg.i2c_port = I2C_TOUCH_PORT;
|
||||||
|
cfg.i2c_addr = I2C_TOUCH_ADDRESS;
|
||||||
|
cfg.pin_sda = TOUCH_SDA;
|
||||||
|
cfg.pin_scl = TOUCH_SCL;
|
||||||
|
cfg.freq = I2C_TOUCH_FREQUENCY;
|
||||||
|
|
||||||
|
touch->config(cfg);
|
||||||
|
return touch;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // HASP_USE_LGFX_TOUCH
|
#endif // HASP_USE_LGFX_TOUCH
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -683,7 +742,7 @@ void LovyanGfx::init(int w, int h)
|
|||||||
cfg.dummy_read_bits = 1;
|
cfg.dummy_read_bits = 1;
|
||||||
cfg.readable = true;
|
cfg.readable = true;
|
||||||
cfg.invert = INVERT_COLORS;
|
cfg.invert = INVERT_COLORS;
|
||||||
cfg.rgb_order = false;
|
cfg.rgb_order = (TFT_RGB_ORDER != 0); // true if the red and blue of the panel are swapped
|
||||||
cfg.dlen_16bit = false;
|
cfg.dlen_16bit = false;
|
||||||
cfg.bus_shared = false;
|
cfg.bus_shared = false;
|
||||||
_panel_instance->config(cfg);
|
_panel_instance->config(cfg);
|
||||||
@ -771,6 +830,73 @@ void LovyanGfx::init(int w, int h)
|
|||||||
cfg.pin_mosi = TOUCH_MOSI;
|
cfg.pin_mosi = TOUCH_MOSI;
|
||||||
cfg.pin_miso = TOUCH_MISO;
|
cfg.pin_miso = TOUCH_MISO;
|
||||||
cfg.pin_cs = TOUCH_CS;
|
cfg.pin_cs = TOUCH_CS;
|
||||||
|
_touch_instance->config(cfg);
|
||||||
|
_panel_instance->setTouch(_touch_instance);
|
||||||
|
}
|
||||||
|
#elif defined(ESP32_2432S022C)
|
||||||
|
//pinMode(PWR_EN, OUTPUT);
|
||||||
|
//digitalWrite(PWR_EN, HIGH);
|
||||||
|
|
||||||
|
auto _panel_instance = new lgfx::Panel_ST7789();
|
||||||
|
auto _bus_instance = new lgfx::Bus_Parallel8();
|
||||||
|
auto _touch_instance = new lgfx::Touch_CST816S();
|
||||||
|
{
|
||||||
|
auto cfg = _bus_instance->config();
|
||||||
|
cfg.freq_write = 16000000;
|
||||||
|
cfg.pin_wr = TFT_WR;
|
||||||
|
cfg.pin_rd = TFT_RD;
|
||||||
|
cfg.pin_rs = TFT_DC; // D/C
|
||||||
|
cfg.pin_d0 = TFT_D0;
|
||||||
|
cfg.pin_d1 = TFT_D1;
|
||||||
|
cfg.pin_d2 = TFT_D2;
|
||||||
|
cfg.pin_d3 = TFT_D3;
|
||||||
|
cfg.pin_d4 = TFT_D4;
|
||||||
|
cfg.pin_d5 = TFT_D5;
|
||||||
|
cfg.pin_d6 = TFT_D6;
|
||||||
|
cfg.pin_d7 = TFT_D7;
|
||||||
|
_bus_instance->config(cfg);
|
||||||
|
_panel_instance->setBus(_bus_instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto cfg = _panel_instance->config();
|
||||||
|
cfg.pin_cs = TFT_CS;
|
||||||
|
cfg.pin_rst = TFT_RST;
|
||||||
|
cfg.pin_busy = TFT_BUSY;
|
||||||
|
cfg.memory_width = TFT_WIDTH;
|
||||||
|
cfg.memory_height = TFT_HEIGHT;
|
||||||
|
cfg.panel_width = TFT_WIDTH;
|
||||||
|
cfg.panel_height = TFT_HEIGHT;
|
||||||
|
cfg.offset_x = 0;
|
||||||
|
cfg.offset_y = 0;
|
||||||
|
cfg.offset_rotation = TFT_ROTATION;
|
||||||
|
cfg.dummy_read_pixel = 8;
|
||||||
|
cfg.dummy_read_bits = 1;
|
||||||
|
cfg.readable = true;
|
||||||
|
cfg.invert = false;
|
||||||
|
cfg.rgb_order = false;
|
||||||
|
cfg.dlen_16bit = false;
|
||||||
|
cfg.bus_shared = false;
|
||||||
|
_panel_instance->config(cfg);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto cfg = _touch_instance->config();
|
||||||
|
|
||||||
|
cfg.x_min = 0;
|
||||||
|
cfg.x_max = TFT_WIDTH;
|
||||||
|
cfg.y_min = 0;
|
||||||
|
cfg.y_max = TFT_HEIGHT;
|
||||||
|
cfg.pin_int = TOUCH_IRQ;
|
||||||
|
cfg.bus_shared = true;
|
||||||
|
cfg.offset_rotation = 0;
|
||||||
|
|
||||||
|
cfg.i2c_port = I2C_TOUCH_PORT;
|
||||||
|
cfg.i2c_addr = I2C_TOUCH_ADDRESS;
|
||||||
|
cfg.pin_sda = TOUCH_SDA;
|
||||||
|
cfg.pin_scl = TOUCH_SCL;
|
||||||
|
cfg.freq = I2C_TOUCH_FREQUENCY;
|
||||||
|
|
||||||
_touch_instance->config(cfg);
|
_touch_instance->config(cfg);
|
||||||
_panel_instance->setTouch(_touch_instance);
|
_panel_instance->setTouch(_touch_instance);
|
||||||
}
|
}
|
||||||
@ -1261,6 +1387,8 @@ const char* LovyanGfx::get_tft_model()
|
|||||||
return "R61529";
|
return "R61529";
|
||||||
#elif defined(RM68140_DRIVER)
|
#elif defined(RM68140_DRIVER)
|
||||||
return "RM68140";
|
return "RM68140";
|
||||||
|
#elif defined(GC9A01_DRIVER)
|
||||||
|
return "GC9A01";
|
||||||
#else
|
#else
|
||||||
return "Other";
|
return "Other";
|
||||||
#endif
|
#endif
|
||||||
@ -1302,6 +1430,8 @@ uint32_t LovyanGfx::get_tft_driver()
|
|||||||
return TFT_PANEL_EPD;
|
return TFT_PANEL_EPD;
|
||||||
#elif defined(RGB_DRIVER)
|
#elif defined(RGB_DRIVER)
|
||||||
return TFT_PANEL_RGB;
|
return TFT_PANEL_RGB;
|
||||||
|
#elif defined(GC9A01_DRIVER)
|
||||||
|
return TFT_PANEL_GC9A01;
|
||||||
#else
|
#else
|
||||||
return TFT_PANEL_UNKNOWN;
|
return TFT_PANEL_UNKNOWN;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,107 +1,113 @@
|
|||||||
/* MIT License - Copyright (c) 2019-2024 Francis Van Roie
|
/* MIT License - Copyright (c) 2019-2024 Francis Van Roie
|
||||||
For full license information read the LICENSE file in the project folder */
|
For full license information read the LICENSE file in the project folder */
|
||||||
|
|
||||||
#ifndef HASP_BASE_TOUCH_DRIVER_H
|
#ifndef HASP_BASE_TOUCH_DRIVER_H
|
||||||
#define HASP_BASE_TOUCH_DRIVER_H
|
#define HASP_BASE_TOUCH_DRIVER_H
|
||||||
|
|
||||||
#ifdef ARDUINO
|
#ifdef ARDUINO
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "hasplib.h"
|
#include "hasplib.h"
|
||||||
#include "lvgl.h"
|
#include "lvgl.h"
|
||||||
|
|
||||||
namespace dev {
|
namespace dev {
|
||||||
|
|
||||||
class BaseTouch {
|
class BaseTouch {
|
||||||
public:
|
public:
|
||||||
void init(int w, int h)
|
void init(int w, int h)
|
||||||
{}
|
{}
|
||||||
// void loop()
|
// void loop()
|
||||||
// {}
|
// {}
|
||||||
void show_info()
|
void show_info()
|
||||||
{}
|
{}
|
||||||
void set_rotation(uint8_t rotation)
|
void set_rotation(uint8_t rotation)
|
||||||
{}
|
{}
|
||||||
void set_invert(bool invert_display)
|
void set_invert(bool invert_display)
|
||||||
{}
|
{}
|
||||||
IRAM_ATTR bool read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data)
|
IRAM_ATTR bool read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data)
|
||||||
{
|
{
|
||||||
data->state = LV_INDEV_STATE_REL;
|
data->state = LV_INDEV_STATE_REL;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
void calibrate(uint16_t* calData)
|
void calibrate(uint16_t* calData)
|
||||||
{}
|
{}
|
||||||
void set_calibration(uint16_t* calData)
|
void set_calibration(uint16_t* calData)
|
||||||
{}
|
{}
|
||||||
bool is_driver_pin(uint8_t)
|
bool is_driver_pin(uint8_t)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const char* get_touch_model()
|
const char* get_touch_model()
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace dev
|
} // namespace dev
|
||||||
|
|
||||||
#ifndef TOUCH_DRIVER
|
#ifndef TOUCH_DRIVER
|
||||||
#define TOUCH_DRIVER -1 // No Touch
|
#define TOUCH_DRIVER -1 // No Touch
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TOUCH_DRIVER == 0x2046 && defined(USER_SETUP_LOADED)
|
#if TOUCH_DRIVER == 0x2046 && defined(USER_SETUP_LOADED)
|
||||||
#warning Building for TFT_eSPI XPT2046
|
#warning Building for TFT_eSPI XPT2046
|
||||||
//#include "touch_driver_xpt2046.h"
|
//#include "touch_driver_xpt2046.h"
|
||||||
#include "touch_driver_tftespi.h"
|
#include "touch_driver_tftespi.h"
|
||||||
#elif TOUCH_DRIVER == 0x2046 && defined(LGFX_USE_V1) && defined(HASP_USE_LGFX_TOUCH)
|
#elif TOUCH_DRIVER == 0x2046 && defined(LGFX_USE_V1) && defined(HASP_USE_LGFX_TOUCH)
|
||||||
#warning Building for LovyanGFX XPT2046
|
#warning Building for LovyanGFX XPT2046
|
||||||
#include "touch_driver_lovyangfx.h"
|
#include "touch_driver_lovyangfx.h"
|
||||||
#elif TOUCH_DRIVER == 0x0911 && defined(LGFX_USE_V1) && defined(HASP_USE_LGFX_TOUCH)
|
#elif TOUCH_DRIVER == 0x0911 && defined(LGFX_USE_V1) && defined(HASP_USE_LGFX_TOUCH)
|
||||||
#warning Building for LovyanGFX GT911
|
#warning Building for LovyanGFX GT911
|
||||||
#include "touch_driver_lovyangfx.h"
|
#include "touch_driver_lovyangfx.h"
|
||||||
#elif TOUCH_DRIVER == 0x6336 && defined(LGFX_USE_V1) && defined(HASP_USE_LGFX_TOUCH)
|
#elif TOUCH_DRIVER == 0x6336 && defined(LGFX_USE_V1) && defined(HASP_USE_LGFX_TOUCH)
|
||||||
#warning Building for LovyanGFX FT6336
|
#warning Building for LovyanGFX FT6336
|
||||||
#include "touch_driver_lovyangfx.h"
|
#include "touch_driver_lovyangfx.h"
|
||||||
#elif defined(LGFX_USE_V1) && defined(HASP_USE_LGFX_TOUCH)
|
#elif defined(LGFX_USE_V1) && defined(HASP_USE_LGFX_TOUCH)
|
||||||
#warning Building for LovyanGFX
|
#warning Building for LovyanGFX
|
||||||
#include "touch_driver_lovyangfx.h"
|
#include "touch_driver_lovyangfx.h"
|
||||||
#elif TOUCH_DRIVER == 0x5206
|
#elif TOUCH_DRIVER == 0x5206
|
||||||
#warning Building for FT5206
|
#warning Building for FT5206
|
||||||
#include "touch_driver_ft5206.h"
|
#include "touch_driver_ft5206.h"
|
||||||
#elif TOUCH_DRIVER == 0x6336
|
#elif TOUCH_DRIVER == 0x6336
|
||||||
#warning Building for FT6336
|
#warning Building for FT6336
|
||||||
#include "touch_driver_ft6336u.h"
|
#include "touch_driver_ft6336u.h"
|
||||||
#elif TOUCH_DRIVER == 0x0610
|
#elif TOUCH_DRIVER == 0x0610
|
||||||
#warning Building for STMPE610
|
#warning Building for STMPE610
|
||||||
#include "touch_driver_stmpe610.h"
|
#include "touch_driver_stmpe610.h"
|
||||||
#elif TOUCH_DRIVER == 0x0911
|
#elif TOUCH_DRIVER == 0x0911
|
||||||
#warning Building for GT911
|
#warning Building for GT911
|
||||||
#include "touch_driver_gt911.h"
|
#include "touch_driver_gt911.h"
|
||||||
#elif TOUCH_DRIVER == 0x0ADC
|
#elif TOUCH_DRIVER == 0x0ADC
|
||||||
#warning Building for analog touch
|
#warning Building for analog touch
|
||||||
#include "touch_driver_analog.h"
|
#include "touch_driver_analog.h"
|
||||||
#elif TOUCH_DRIVER == 0x1680
|
#elif TOUCH_DRIVER == 0x1680
|
||||||
#warning Building for GSL1680
|
#warning Building for GSL1680
|
||||||
#include "touch_driver_gslx680.h"
|
#include "touch_driver_gslx680.h"
|
||||||
#elif TOUCH_DRIVER == 0x2007
|
#elif TOUCH_DRIVER == 0x2007
|
||||||
#warning Building for TSC2007
|
#warning Building for TSC2007
|
||||||
#include "touch_driver_tsc2007.h"
|
#include "touch_driver_tsc2007.h"
|
||||||
#elif defined(LGFX_USE_V1)
|
#elif defined(LGFX_USE_V1)
|
||||||
#warning Building for LovyanGfx Touch
|
#warning Building for LovyanGfx Touch
|
||||||
#include "touch_driver_lovyangfx.h"
|
#include "touch_driver_lovyangfx.h"
|
||||||
#else
|
#elif TOUCH_DRIVER == 0x3240
|
||||||
#warning Building for Generic Touch
|
#warning Building for CST3240
|
||||||
using dev::BaseTouch;
|
#include "touch_driver_cst3240.h"
|
||||||
extern dev::BaseTouch haspTouch;
|
#elif TOUCH_DRIVER == 0x816
|
||||||
// IRAM_ATTR bool touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data)
|
#warning Building for CST816S
|
||||||
// {
|
#include "touch_driver_cst816.h"
|
||||||
// data->state = LV_INDEV_STATE_REL;
|
#else
|
||||||
// return false;
|
#warning Building for Generic Touch
|
||||||
// }
|
using dev::BaseTouch;
|
||||||
#endif
|
extern dev::BaseTouch haspTouch;
|
||||||
|
// IRAM_ATTR bool touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data)
|
||||||
#endif
|
// {
|
||||||
|
// data->state = LV_INDEV_STATE_REL;
|
||||||
// #elif TOUCH_DRIVER == 0x2046B
|
// return false;
|
||||||
// touched = XPT2046_getXY(&normal_x, &normal_y, true);
|
// }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// #elif TOUCH_DRIVER == 0x2046B
|
||||||
|
// touched = XPT2046_getXY(&normal_x, &normal_y, true);
|
||||||
|
72
src/drv/touch/touch_driver_cst3240.cpp
Normal file
72
src/drv/touch/touch_driver_cst3240.cpp
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
/* MIT License - Copyright (c) 2019-2024 Francis Van Roie
|
||||||
|
For full license information read the LICENSE file in the project folder */
|
||||||
|
|
||||||
|
#if defined(ARDUINO) && (TOUCH_DRIVER == 0x3240) && !defined(HASP_USE_LGFX_TOUCH)
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include "ArduinoLog.h"
|
||||||
|
#include "hasp_conf.h"
|
||||||
|
#include "touch_driver_cst3240.h"
|
||||||
|
|
||||||
|
#include <Wire.h>
|
||||||
|
#include "TouchLib.h"
|
||||||
|
|
||||||
|
#include "touch_driver.h" // base class
|
||||||
|
#include "touch_helper.h" // i2c scanner
|
||||||
|
|
||||||
|
#include "../../hasp/hasp.h" // for hasp_sleep_state
|
||||||
|
extern uint8_t hasp_sleep_state;
|
||||||
|
|
||||||
|
TouchLib touch(Wire, TOUCH_SDA, TOUCH_SCL, I2C_TOUCH_ADDRESS);
|
||||||
|
|
||||||
|
namespace dev {
|
||||||
|
|
||||||
|
IRAM_ATTR bool TouchCst3240::read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data)
|
||||||
|
{
|
||||||
|
touch.read();
|
||||||
|
TP_Point t = touch.getPoint(0);
|
||||||
|
|
||||||
|
if((touch.getPointNum() == 1) && (t.pressure > 0) && (t.state != 0)) {
|
||||||
|
|
||||||
|
if(hasp_sleep_state != HASP_SLEEP_OFF) hasp_update_sleep_state(); // update Idle
|
||||||
|
|
||||||
|
#ifdef TOUCH_WIDTH
|
||||||
|
data->point.x = map(t.x, 0, TOUCH_WIDTH - 1, 0, TFT_WIDTH - 1);
|
||||||
|
#else
|
||||||
|
data->point.x = t.x;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef TOUCH_HEIGHT
|
||||||
|
data->point.y = map(t.y, 0, TOUCH_HEIGHT - 1, 0, TFT_HEIGHT - 1);
|
||||||
|
#else
|
||||||
|
data->point.y = t.y;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
data->state = LV_INDEV_STATE_PR;
|
||||||
|
hasp_set_sleep_offset(0); // Reset the offset
|
||||||
|
|
||||||
|
} else {
|
||||||
|
data->state = LV_INDEV_STATE_REL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Return `false` because we are not buffering and no more data to read*/
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TouchCst3240::init(int w, int h)
|
||||||
|
{
|
||||||
|
Wire.begin(TOUCH_SDA, TOUCH_SCL, (uint32_t)I2C_TOUCH_FREQUENCY);
|
||||||
|
if(touch.init() == true) {
|
||||||
|
LOG_INFO(TAG_DRVR, "CST3240 %s (480x480)", D_SERVICE_STARTED);
|
||||||
|
} else {
|
||||||
|
LOG_WARNING(TAG_DRVR, "CST3240 %s", D_SERVICE_START_FAILED);
|
||||||
|
}
|
||||||
|
|
||||||
|
Wire.begin(TOUCH_SDA, TOUCH_SCL, (uint32_t)I2C_TOUCH_FREQUENCY);
|
||||||
|
touch_scan(Wire); // The address could change during begin, so scan afterwards
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace dev
|
||||||
|
|
||||||
|
dev::TouchCst3240 haspTouch;
|
||||||
|
|
||||||
|
#endif // ARDUINO
|
26
src/drv/touch/touch_driver_cst3240.h
Normal file
26
src/drv/touch/touch_driver_cst3240.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/* MIT License - Copyright (c) 2019-2024 Francis Van Roie
|
||||||
|
For full license information read the LICENSE file in the project folder */
|
||||||
|
|
||||||
|
#ifndef HASP_CST3240_TOUCH_DRIVER_H
|
||||||
|
#define HASP_CST3240_TOUCH_DRIVER_H
|
||||||
|
|
||||||
|
#ifdef ARDUINO
|
||||||
|
#include "lvgl.h"
|
||||||
|
#include "touch_driver.h"
|
||||||
|
|
||||||
|
namespace dev {
|
||||||
|
|
||||||
|
class TouchCst3240 : public BaseTouch {
|
||||||
|
public:
|
||||||
|
IRAM_ATTR bool read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data);
|
||||||
|
void init(int w, int h);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace dev
|
||||||
|
|
||||||
|
using dev::TouchCst3240;
|
||||||
|
extern dev::TouchCst3240 haspTouch;
|
||||||
|
|
||||||
|
#endif // ARDUINO
|
||||||
|
|
||||||
|
#endif // HASP_CST3240_TOUCH_DRIVER_H
|
70
src/drv/touch/touch_driver_cst816.cpp
Normal file
70
src/drv/touch/touch_driver_cst816.cpp
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
/* MIT License - Copyright (c) 2019-2024 Francis Van Roie
|
||||||
|
For full license information read the LICENSE file in the project folder */
|
||||||
|
|
||||||
|
#if defined(ARDUINO) && (TOUCH_DRIVER == 0x816)
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include "ArduinoLog.h"
|
||||||
|
#include "hasp_conf.h"
|
||||||
|
#include "touch_driver_cst816.h"
|
||||||
|
|
||||||
|
#include <Wire.h>
|
||||||
|
#include "cst816t.h"
|
||||||
|
|
||||||
|
#include "touch_driver.h" // base class
|
||||||
|
#include "touch_helper.h" // i2c scanner
|
||||||
|
|
||||||
|
#include "../../hasp/hasp.h" // for hasp_sleep_state
|
||||||
|
extern uint8_t hasp_sleep_state;
|
||||||
|
|
||||||
|
cst816t touchpad(Wire, TOUCH_RST, TOUCH_IRQ);
|
||||||
|
|
||||||
|
namespace dev {
|
||||||
|
|
||||||
|
IRAM_ATTR bool TouchCst816::read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data)
|
||||||
|
{
|
||||||
|
if(touchpad.available()) {
|
||||||
|
|
||||||
|
if(hasp_sleep_state != HASP_SLEEP_OFF) hasp_update_sleep_state(); // update Idle
|
||||||
|
//LOG_INFO(TAG_DRVR, "CST816 touched x:%d, y:%d", touchpad.x, touchpad.y);
|
||||||
|
|
||||||
|
#ifdef TOUCH_WIDTH
|
||||||
|
data->point.x = map(touchpad.x, 0, TOUCH_WIDTH - 1, 0, TFT_WIDTH - 1);
|
||||||
|
#else
|
||||||
|
data->point.x = touchpad.x;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef TOUCH_HEIGHT
|
||||||
|
data->point.y = map(touchpad.y, 0, TOUCH_HEIGHT - 1, 0, TFT_HEIGHT - 1);
|
||||||
|
#else
|
||||||
|
data->point.y = touchpad.y;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
data->state = LV_INDEV_STATE_PR;
|
||||||
|
hasp_set_sleep_offset(0); // Reset the offset
|
||||||
|
|
||||||
|
} else {
|
||||||
|
data->state = LV_INDEV_STATE_REL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Return `false` because we are not buffering and no more data to read*/
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TouchCst816::init(int w, int h)
|
||||||
|
{
|
||||||
|
Wire.begin(TOUCH_SDA, TOUCH_SCL, (uint32_t)I2C_TOUCH_FREQUENCY);
|
||||||
|
if(touchpad.begin(mode_touch) == true) {
|
||||||
|
LOG_INFO(TAG_DRVR, "CST816 %s (170X320)", D_SERVICE_STARTED);
|
||||||
|
} else {
|
||||||
|
LOG_WARNING(TAG_DRVR, "CST816 %s", D_SERVICE_START_FAILED);
|
||||||
|
}
|
||||||
|
|
||||||
|
Wire.begin(TOUCH_SDA, TOUCH_SCL, (uint32_t)I2C_TOUCH_FREQUENCY);
|
||||||
|
touch_scan(Wire); // The address could change during begin, so scan afterwards
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace dev
|
||||||
|
|
||||||
|
dev::TouchCst816 haspTouch;
|
||||||
|
|
||||||
|
#endif // ARDUINO
|
27
src/drv/touch/touch_driver_cst816.h
Normal file
27
src/drv/touch/touch_driver_cst816.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/* MIT License - Copyright (c) 2019-2024 Francis Van Roie
|
||||||
|
For full license information read the LICENSE file in the project folder */
|
||||||
|
|
||||||
|
#ifndef HASP_CST816_TOUCH_DRIVER_H
|
||||||
|
#define HASP_CST816_TOUCH_DRIVER_H
|
||||||
|
|
||||||
|
#ifdef ARDUINO
|
||||||
|
#include "lvgl.h"
|
||||||
|
#include "touch_driver.h"
|
||||||
|
|
||||||
|
namespace dev {
|
||||||
|
|
||||||
|
class TouchCst816 : public BaseTouch {
|
||||||
|
public:
|
||||||
|
IRAM_ATTR bool read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data);
|
||||||
|
void init(int w, int h);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace dev
|
||||||
|
|
||||||
|
using dev::TouchCst816;
|
||||||
|
extern dev::TouchCst816 haspTouch;
|
||||||
|
|
||||||
|
#endif // ARDUINO
|
||||||
|
|
||||||
|
#endif // HASP_CST816_TOUCH_DRIVER_H
|
||||||
|
|
@ -29,8 +29,7 @@ bool touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data)
|
|||||||
data->state = LV_INDEV_STATE_REL;
|
data->state = LV_INDEV_STATE_REL;
|
||||||
|
|
||||||
// while touched, but the state is released => read next point
|
// while touched, but the state is released => read next point
|
||||||
while(data->state == LV_INDEV_STATE_REL && stmpe610_touchpanel.touched()) {
|
while(data->state == LV_INDEV_STATE_REL && !stmpe610_touchpanel.bufferEmpty()) {
|
||||||
|
|
||||||
TS_Point point = stmpe610_touchpanel.getPoint();
|
TS_Point point = stmpe610_touchpanel.getPoint();
|
||||||
Log.trace(TAG_DRVR, F("STMPE610: x=%i y=%i z=%i"), point.x, point.y, point.z);
|
Log.trace(TAG_DRVR, F("STMPE610: x=%i y=%i z=%i"), point.x, point.y, point.z);
|
||||||
|
|
||||||
|
@ -111,7 +111,8 @@ lv_font_t* hasp_get_font(uint8_t fontid)
|
|||||||
*/
|
*/
|
||||||
HASP_ATTRIBUTE_FAST_MEM void hasp_update_sleep_state()
|
HASP_ATTRIBUTE_FAST_MEM void hasp_update_sleep_state()
|
||||||
{
|
{
|
||||||
if(hasp_first_touch_state) return; // don't update sleep when first touch is still active
|
// Don't fast exit, see issue #839
|
||||||
|
// if(hasp_first_touch_state) return; // don't update sleep when first touch is still active
|
||||||
|
|
||||||
uint32_t idle = lv_disp_get_inactive_time(lv_disp_get_default()) / 1000;
|
uint32_t idle = lv_disp_get_inactive_time(lv_disp_get_default()) / 1000;
|
||||||
idle += sleepTimeOffset; // To force a specific state
|
idle += sleepTimeOffset; // To force a specific state
|
||||||
@ -217,11 +218,12 @@ void hasp_antiburn_cb(lv_task_t* task)
|
|||||||
lv_obj_t* layer = lv_disp_get_layer_sys(NULL);
|
lv_obj_t* layer = lv_disp_get_layer_sys(NULL);
|
||||||
if(layer) {
|
if(layer) {
|
||||||
// Fill a buffer with random colors
|
// Fill a buffer with random colors
|
||||||
lv_color_t color[1223];
|
lv_color_t color[1223]; // prime
|
||||||
size_t len = sizeof(color) / sizeof(color[0]);
|
size_t max_len = sizeof(color) / sizeof(color[0]);
|
||||||
for(size_t x = 0; x < len; x++) {
|
for(size_t x = 0; x < max_len; x++) {
|
||||||
color[x].full = HASP_RANDOM(UINT16_MAX);
|
color[x].full = HASP_RANDOM(UINT16_MAX);
|
||||||
}
|
}
|
||||||
|
max_len -= 64; // leave some headroom to randomize
|
||||||
|
|
||||||
// list of possible draw widths; prime numbers combat recurring patterns on the screen
|
// list of possible draw widths; prime numbers combat recurring patterns on the screen
|
||||||
uint8_t prime[] = {61, 67, 73, 79, 83, 89, 97, 103, 109, 113, 127, 131, 137, 139, 149,
|
uint8_t prime[] = {61, 67, 73, 79, 83, 89, 97, 103, 109, 113, 127, 131, 137, 139, 149,
|
||||||
@ -230,17 +232,27 @@ void hasp_antiburn_cb(lv_task_t* task)
|
|||||||
lv_disp_t* disp = lv_disp_get_default();
|
lv_disp_t* disp = lv_disp_get_default();
|
||||||
lv_disp_drv_t* disp_drv = &disp->driver;
|
lv_disp_drv_t* disp_drv = &disp->driver;
|
||||||
|
|
||||||
lv_coord_t scr_h = lv_obj_get_height(layer) - 1;
|
lv_coord_t scr_h;
|
||||||
lv_coord_t scr_w = lv_obj_get_width(layer) - 1;
|
lv_coord_t scr_w;
|
||||||
lv_coord_t w = 487; // first prime larger than 480
|
|
||||||
|
if(disp_drv->sw_rotate) {
|
||||||
|
scr_w = disp_drv->hor_res - 1; // use hardware w
|
||||||
|
scr_h = disp_drv->ver_res - 1; // use hardware h
|
||||||
|
} else {
|
||||||
|
scr_w = lv_obj_get_width(layer) - 1; // use software w
|
||||||
|
scr_h = lv_obj_get_height(layer) - 1; // use software h
|
||||||
|
}
|
||||||
|
|
||||||
|
lv_coord_t w = scr_w; // maximum screen width
|
||||||
lv_area_t area;
|
lv_area_t area;
|
||||||
|
|
||||||
area.y1 = 0;
|
area.y1 = 0;
|
||||||
while(area.y1 <= scr_h) {
|
while(area.y1 <= scr_h) {
|
||||||
if(w > scr_w) w = scr_w; // limit to the actual screenwidth
|
if(w > scr_w) w = scr_w; // limit to the actual screenwidth
|
||||||
if(w > len) w = len; // don't overrun the buffer
|
if(w > max_len) w = max_len; // don't overrun the buffer
|
||||||
lv_coord_t h = len / w;
|
lv_coord_t h = max_len / w;
|
||||||
size_t headroom = len % w; // additional bytes in the buffer that can be used for a random offset
|
size_t headroom = (sizeof(color) / sizeof(color[0])) -
|
||||||
|
(h * w); // additional bytes in the buffer that can be used for a random offset
|
||||||
|
|
||||||
area.y2 = area.y1 + h - 1;
|
area.y2 = area.y1 + h - 1;
|
||||||
if(area.y2 > scr_h) area.y2 = scr_h;
|
if(area.y2 > scr_h) area.y2 = scr_h;
|
||||||
@ -255,16 +267,16 @@ void hasp_antiburn_cb(lv_task_t* task)
|
|||||||
area.x1 += w;
|
area.x1 += w;
|
||||||
}
|
}
|
||||||
|
|
||||||
w = prime[HASP_RANDOM(sizeof(prime))]; // new random width
|
w = prime[HASP_RANDOM(sizeof(prime) / sizeof(prime[0]))]; // new random width
|
||||||
area.y1 += h;
|
area.y1 += h;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(task->repeat_count != 1) return; // don't stop yet
|
|
||||||
|
|
||||||
// task is about to get deleted
|
// task is about to get deleted
|
||||||
hasp_stop_antiburn();
|
if(task->repeat_count == 1) {
|
||||||
dispatch_state_antiburn(HASP_EVENT_OFF);
|
hasp_stop_antiburn();
|
||||||
|
dispatch_state_antiburn(HASP_EVENT_OFF);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -98,7 +98,7 @@ const char** my_map_create(const char* payload)
|
|||||||
{
|
{
|
||||||
// Reserve memory for JsonDocument
|
// Reserve memory for JsonDocument
|
||||||
// StaticJsonDocument<1024> map_doc;
|
// StaticJsonDocument<1024> map_doc;
|
||||||
size_t maxsize = (128u * ((strlen(payload) / 128) + 1)) + 256;
|
size_t maxsize = (128u * ((strlen(payload) / 128) + 1)) + 1024;
|
||||||
DynamicJsonDocument map_doc(maxsize);
|
DynamicJsonDocument map_doc(maxsize);
|
||||||
DeserializationError jsonError = deserializeJson(map_doc, payload);
|
DeserializationError jsonError = deserializeJson(map_doc, payload);
|
||||||
|
|
||||||
@ -1751,6 +1751,7 @@ static hasp_attribute_type_t attribute_common_text(lv_obj_t* obj, uint16_t attr_
|
|||||||
{LV_HASP_LABEL, ATTR_TEXT, my_label_set_text, my_label_get_text},
|
{LV_HASP_LABEL, ATTR_TEXT, my_label_set_text, my_label_get_text},
|
||||||
{LV_HASP_LABEL, ATTR_TEMPLATE, my_obj_set_template, my_obj_get_template},
|
{LV_HASP_LABEL, ATTR_TEMPLATE, my_obj_set_template, my_obj_get_template},
|
||||||
{LV_HASP_CHECKBOX, ATTR_TEXT, lv_checkbox_set_text, lv_checkbox_get_text},
|
{LV_HASP_CHECKBOX, ATTR_TEXT, lv_checkbox_set_text, lv_checkbox_get_text},
|
||||||
|
{LV_HASP_DROPDOWN, ATTR_TEXT, my_dropdown_set_text, my_dropdown_get_text},
|
||||||
{LV_HASP_TABVIEW, ATTR_TEXT, my_tabview_set_text, my_tabview_get_text},
|
{LV_HASP_TABVIEW, ATTR_TEXT, my_tabview_set_text, my_tabview_get_text},
|
||||||
{LV_HASP_TEXTAREA, ATTR_TEXT, lv_textarea_set_text, lv_textarea_get_text},
|
{LV_HASP_TEXTAREA, ATTR_TEXT, lv_textarea_set_text, lv_textarea_get_text},
|
||||||
{LV_HASP_TAB, ATTR_TEXT, my_tab_set_text, my_tab_get_text},
|
{LV_HASP_TAB, ATTR_TEXT, my_tab_set_text, my_tab_get_text},
|
||||||
|
@ -472,6 +472,31 @@ lv_obj_t* FindButtonLabel(lv_obj_t* btn)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OK - lvgl does not return a const char *
|
||||||
|
static const char* my_dropdown_get_text(const lv_obj_t* dd)
|
||||||
|
{
|
||||||
|
const char* str_p = lv_dropdown_get_text((lv_obj_t*)dd);
|
||||||
|
return str_p ? str_p : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
// OK - lvgl does not return a const char *
|
||||||
|
static void my_dropdown_set_text(lv_obj_t* dd, const char* text)
|
||||||
|
{
|
||||||
|
size_t len = 0;
|
||||||
|
if(text) len = strlen(text) + 1;
|
||||||
|
|
||||||
|
// release previous text
|
||||||
|
char* str_p = (char*)lv_dropdown_get_text(dd);
|
||||||
|
if(str_p) lv_mem_free(str_p);
|
||||||
|
|
||||||
|
// reserve and copy new text
|
||||||
|
str_p = (char*)lv_mem_alloc(len);
|
||||||
|
if(str_p != NULL) strncpy(str_p, text, len);
|
||||||
|
|
||||||
|
lv_dropdown_set_text((lv_obj_t*)dd, str_p); // library does not return const
|
||||||
|
lv_obj_invalidate(dd); // Needed if old ptr is equal to new ptr
|
||||||
|
}
|
||||||
|
|
||||||
// OK - lvgl does not return a const char *
|
// OK - lvgl does not return a const char *
|
||||||
static const char* my_label_get_text(const lv_obj_t* label)
|
static const char* my_label_get_text(const lv_obj_t* label)
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,7 @@ uint16_t dispatchSecondsToNextTeleperiod = 0;
|
|||||||
uint16_t dispatchSecondsToNextSensordata = 0;
|
uint16_t dispatchSecondsToNextSensordata = 0;
|
||||||
uint16_t dispatchSecondsToNextDiscovery = 0;
|
uint16_t dispatchSecondsToNextDiscovery = 0;
|
||||||
uint8_t nCommands = 0;
|
uint8_t nCommands = 0;
|
||||||
haspCommand_t commands[28];
|
haspCommand_t commands[29];
|
||||||
|
|
||||||
moodlight_t moodlight = {.brightness = 255};
|
moodlight_t moodlight = {.brightness = 255};
|
||||||
uint8_t saved_jsonl_page = 0;
|
uint8_t saved_jsonl_page = 0;
|
||||||
@ -52,7 +52,7 @@ uint8_t saved_jsonl_page = 0;
|
|||||||
*/
|
*/
|
||||||
void dispatch_state_subtopic(const char* subtopic, const char* payload)
|
void dispatch_state_subtopic(const char* subtopic, const char* payload)
|
||||||
{
|
{
|
||||||
#if HASP_USE_MQTT == 0 && HASP_USE_TASMOTA_CLIENT == 0
|
#if HASP_USE_MQTT == 0 && defined(HASP_USE_TASMOTA_CLIENT) && HASP_USE_TASMOTA_CLIENT > 0
|
||||||
LOG_TRACE(TAG_MSGR, F("%s => %s"), subtopic, payload);
|
LOG_TRACE(TAG_MSGR, F("%s => %s"), subtopic, payload);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@ -74,11 +74,15 @@ void dispatch_state_subtopic(const char* subtopic, const char* payload)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HASP_USE_TASMOTA_CLIENT > 0
|
#if defined(HASP_USE_TASMOTA_CLIENT) && HASP_USE_TASMOTA_CLIENT > 0
|
||||||
slave_send_state(subtopic, payload);
|
slave_send_state(subtopic, payload);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
|
||||||
|
custom_state_subtopic(subtopic, payload);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void dispatch_state_eventid(const char* topic, hasp_event_t eventid)
|
void dispatch_state_eventid(const char* topic, hasp_event_t eventid)
|
||||||
@ -448,7 +452,7 @@ void dispatch_topic_payload(const char* topic, const char* payload, bool update,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HASP_USE_CUSTOM)
|
#if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
|
||||||
if(topic == strstr_P(topic, PSTR(MQTT_TOPIC_CUSTOM "/"))) { // startsWith custom
|
if(topic == strstr_P(topic, PSTR(MQTT_TOPIC_CUSTOM "/"))) { // startsWith custom
|
||||||
topic += 7u;
|
topic += 7u;
|
||||||
custom_topic_payload(topic, (char*)payload, source);
|
custom_topic_payload(topic, (char*)payload, source);
|
||||||
@ -864,6 +868,46 @@ void dispatch_run_script(const char*, const char* payload, uint8_t source)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
void dispatch_fs(const char*, const char* payload, uint8_t source)
|
||||||
|
{
|
||||||
|
StaticJsonDocument<512> json;
|
||||||
|
|
||||||
|
// Note: Deserialization needs to be (const char *) so the objects WILL be copied
|
||||||
|
// this uses more memory but otherwise the mqtt receive buffer can get overwritten by the send buffer !!
|
||||||
|
DeserializationError jsonError = deserializeJson(json, payload);
|
||||||
|
// json.shrinkToFit();
|
||||||
|
|
||||||
|
if(!jsonError && json.is<JsonObject>()) { // Only JsonObject is valid
|
||||||
|
JsonVariant action;
|
||||||
|
|
||||||
|
const char* cmd = json["cmd"].as<const char*>();
|
||||||
|
const char* src = json["src"].as<const char*>();
|
||||||
|
const char* dst = json["dst"].as<const char*>();
|
||||||
|
int res = 0;
|
||||||
|
|
||||||
|
if(String(cmd) == "stat") {
|
||||||
|
res = filesystem_vfs_file_exists(src);
|
||||||
|
}
|
||||||
|
if(String(cmd) == "rm") {
|
||||||
|
res = filesystem_vfs_delete_file(src);
|
||||||
|
}
|
||||||
|
if(String(cmd) == "cp") {
|
||||||
|
res = filesystem_vfs_copy_file(src, dst);
|
||||||
|
}
|
||||||
|
if(String(cmd) == "ls") {
|
||||||
|
filesystem_list_path(src);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(res) {
|
||||||
|
LOG_WARNING(TAG_MSGR, "Succes");
|
||||||
|
} else {
|
||||||
|
LOG_WARNING(TAG_MSGR, "Failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
#if HASP_TARGET_PC
|
#if HASP_TARGET_PC
|
||||||
static void shell_command_thread(char* cmdline)
|
static void shell_command_thread(char* cmdline)
|
||||||
{
|
{
|
||||||
@ -1251,7 +1295,7 @@ void dispatch_send_sensordata(const char*, const char*, uint8_t source)
|
|||||||
|
|
||||||
haspDevice.get_sensors(doc);
|
haspDevice.get_sensors(doc);
|
||||||
|
|
||||||
#if defined(HASP_USE_CUSTOM)
|
#if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
|
||||||
custom_get_sensors(doc);
|
custom_get_sensors(doc);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1318,9 +1362,10 @@ void dispatch_get_discovery_data(JsonDocument& doc)
|
|||||||
JsonArray relay = doc.createNestedArray(F("power"));
|
JsonArray relay = doc.createNestedArray(F("power"));
|
||||||
JsonArray led = doc.createNestedArray(F("light"));
|
JsonArray led = doc.createNestedArray(F("light"));
|
||||||
JsonArray dimmer = doc.createNestedArray(F("dim"));
|
JsonArray dimmer = doc.createNestedArray(F("dim"));
|
||||||
|
JsonArray event = doc.createNestedArray(F("event"));
|
||||||
|
|
||||||
#if HASP_USE_GPIO > 0
|
#if HASP_USE_GPIO > 0
|
||||||
gpio_discovery(input, relay, led, dimmer);
|
gpio_discovery(input, relay, led, dimmer, event);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1592,6 +1637,7 @@ void dispatchSetup()
|
|||||||
dispatch_add_command(PSTR("sensors"), dispatch_send_sensordata);
|
dispatch_add_command(PSTR("sensors"), dispatch_send_sensordata);
|
||||||
dispatch_add_command(PSTR("theme"), dispatch_theme);
|
dispatch_add_command(PSTR("theme"), dispatch_theme);
|
||||||
dispatch_add_command(PSTR("run"), dispatch_run_script);
|
dispatch_add_command(PSTR("run"), dispatch_run_script);
|
||||||
|
// dispatch_add_command(PSTR("fs"), dispatch_fs);
|
||||||
#if HASP_TARGET_PC
|
#if HASP_TARGET_PC
|
||||||
dispatch_add_command(PSTR("shell"), dispatch_shell_execute);
|
dispatch_add_command(PSTR("shell"), dispatch_shell_execute);
|
||||||
#endif
|
#endif
|
||||||
|
@ -99,6 +99,10 @@ void delete_event_handler(lv_obj_t* obj, lv_event_t event)
|
|||||||
my_obj_del_task(obj);
|
my_obj_del_task(obj);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case LV_HASP_DROPDOWN:
|
||||||
|
lv_mem_free(lv_dropdown_get_text(obj));
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -302,8 +306,8 @@ static void event_object_selection_changed(lv_obj_t* obj, uint8_t eventid, int16
|
|||||||
char eventname[8];
|
char eventname[8];
|
||||||
Parser::get_event_name(eventid, eventname, sizeof(eventname));
|
Parser::get_event_name(eventid, eventname, sizeof(eventname));
|
||||||
if(const char* tag = my_obj_get_tag(obj))
|
if(const char* tag = my_obj_get_tag(obj))
|
||||||
snprintf_P(data, sizeof(data), PSTR("{\"event\":\"%s\",\"val\":%d,\"text\":%s,\"tag\":%s}"), eventname,
|
snprintf_P(data, sizeof(data), PSTR("{\"event\":\"%s\",\"val\":%d,\"text\":%s,\"tag\":%s}"), eventname, val,
|
||||||
val, serialized_text, tag);
|
serialized_text, tag);
|
||||||
else
|
else
|
||||||
snprintf_P(data, sizeof(data), PSTR("{\"event\":\"%s\",\"val\":%d,\"text\":%s}"), eventname, val,
|
snprintf_P(data, sizeof(data), PSTR("{\"event\":\"%s\",\"val\":%d,\"text\":%s}"), eventname, val,
|
||||||
serialized_text);
|
serialized_text);
|
||||||
|
@ -640,6 +640,7 @@ void hasp_new_object(const JsonObject& config, uint8_t& saved_page_id)
|
|||||||
case HASP_OBJ_DROPDOWN:
|
case HASP_OBJ_DROPDOWN:
|
||||||
obj = lv_dropdown_create(parent_obj, NULL);
|
obj = lv_dropdown_create(parent_obj, NULL);
|
||||||
if(obj) {
|
if(obj) {
|
||||||
|
lv_dropdown_set_text(obj, NULL); // Clear default text
|
||||||
lv_dropdown_set_draw_arrow(obj, true);
|
lv_dropdown_set_draw_arrow(obj, true);
|
||||||
// lv_dropdown_set_anim_time(obj, 200);
|
// lv_dropdown_set_anim_time(obj, 200);
|
||||||
lv_obj_set_top(obj, true);
|
lv_obj_set_top(obj, true);
|
||||||
|
@ -197,23 +197,26 @@ bool Parser::is_only_digits(const char* s)
|
|||||||
return strlen(s) == digits;
|
return strlen(s) == digits;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Parser::format_bytes(size_t filesize, char* buf, size_t len)
|
int Parser::format_bytes(uint64_t filesize, char* buf, size_t len)
|
||||||
{
|
{
|
||||||
if(filesize < D_FILE_SIZE_DIVIDER) return snprintf_P(buf, len, PSTR("%d " D_FILE_SIZE_BYTES), filesize);
|
const char* suffix[] = {D_FILE_SIZE_BYTES, D_FILE_SIZE_KILOBYTES, D_FILE_SIZE_MEGABYTES, D_FILE_SIZE_GIGABYTES,
|
||||||
filesize = filesize * 100;
|
D_FILE_SIZE_TERABYTES};
|
||||||
|
uint32_t factor;
|
||||||
|
uint16_t remainder = 0;
|
||||||
|
uint8_t i = 0;
|
||||||
|
uint8_t last_index = (sizeof(suffix) / sizeof(suffix[0])) - 1;
|
||||||
|
|
||||||
filesize = filesize / D_FILE_SIZE_DIVIDER; // multiply by 100 for 2 decimal place
|
while(filesize >= D_FILE_SIZE_DIVIDER && i < last_index) {
|
||||||
if(filesize < D_FILE_SIZE_DIVIDER * 100)
|
i += 1;
|
||||||
return snprintf_P(buf, len, PSTR("%d" D_DECIMAL_POINT "%02d " D_FILE_SIZE_KILOBYTES), filesize / 100,
|
remainder = filesize % D_FILE_SIZE_DIVIDER;
|
||||||
filesize % 100);
|
filesize /= D_FILE_SIZE_DIVIDER;
|
||||||
|
}
|
||||||
|
|
||||||
filesize = filesize / D_FILE_SIZE_DIVIDER; // multiply by 100 for 2 decimal place
|
factor = (uint32_t)filesize;
|
||||||
if(filesize < D_FILE_SIZE_DIVIDER * 100)
|
if(i == 0) return snprintf_P(buf, len, PSTR("%u %s"), factor, suffix[i]);
|
||||||
return snprintf_P(buf, len, PSTR("%d" D_DECIMAL_POINT "%02d " D_FILE_SIZE_MEGABYTES), filesize / 100,
|
|
||||||
filesize % 100);
|
|
||||||
|
|
||||||
return snprintf_P(buf, len, PSTR("%d" D_DECIMAL_POINT "%02d " D_FILE_SIZE_GIGABYTES), filesize / 100,
|
remainder = remainder * 100 / D_FILE_SIZE_DIVIDER;
|
||||||
filesize % 100);
|
return snprintf_P(buf, len, PSTR("%u" D_DECIMAL_POINT "%02u %s"), factor, remainder, suffix[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t Parser::get_action_id(const char* action)
|
uint8_t Parser::get_action_id(const char* action)
|
||||||
|
@ -19,7 +19,7 @@ class Parser {
|
|||||||
static bool is_true(const char* s);
|
static bool is_true(const char* s);
|
||||||
static bool is_true(JsonVariant json);
|
static bool is_true(JsonVariant json);
|
||||||
static bool is_only_digits(const char* s);
|
static bool is_only_digits(const char* s);
|
||||||
static int format_bytes(size_t filesize, char* buf, size_t len);
|
static int format_bytes(uint64_t filesize, char* buf, size_t len);
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef ARDUINO
|
#ifndef ARDUINO
|
||||||
|
@ -24,11 +24,15 @@ void task_every_second_cb(lv_task_t* task)
|
|||||||
{
|
{
|
||||||
haspEverySecond(); // sleep timer & statusupdate
|
haspEverySecond(); // sleep timer & statusupdate
|
||||||
|
|
||||||
|
#if HASP_MQTT_TELNET > 0
|
||||||
|
mqttEverySecond();
|
||||||
|
#endif
|
||||||
|
|
||||||
#if HASP_USE_TELNET > 0
|
#if HASP_USE_TELNET > 0
|
||||||
telnetEverySecond();
|
telnetEverySecond();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HASP_USE_CUSTOM)
|
#if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
|
||||||
custom_every_second();
|
custom_every_second();
|
||||||
#endif
|
#endif
|
||||||
// debugEverySecond();
|
// debugEverySecond();
|
||||||
@ -49,7 +53,7 @@ void task_every_second_cb(lv_task_t* task)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
#if defined(HASP_USE_CUSTOM)
|
#if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
|
||||||
custom_every_5seconds();
|
custom_every_5seconds();
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
@ -180,7 +180,7 @@ void filesystemList()
|
|||||||
#else
|
#else
|
||||||
if(!HASP_FS.begin(true)) { // default vfs path: /littlefs
|
if(!HASP_FS.begin(true)) { // default vfs path: /littlefs
|
||||||
#endif
|
#endif
|
||||||
LOG_ERROR(TAG_FILE, F("Flash file system not mouted."));
|
LOG_ERROR(TAG_FILE, F("Flash file system not mounted."));
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
LOG_VERBOSE(TAG_FILE, F("Listing files on the internal flash:"));
|
LOG_VERBOSE(TAG_FILE, F("Listing files on the internal flash:"));
|
||||||
|
@ -341,7 +341,7 @@ void guiSetup()
|
|||||||
#endif
|
#endif
|
||||||
gui_hide_pointer(false);
|
gui_hide_pointer(false);
|
||||||
if(mouse_indev != NULL) {
|
if(mouse_indev != NULL) {
|
||||||
lv_indev_set_cursor(mouse_indev, cursor); /*Connect the image object to the driver*/
|
lv_indev_set_cursor(mouse_indev, cursor); /*Connect the image object to the driver*/
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HASP_TARGET_ARDUINO
|
#if HASP_TARGET_ARDUINO
|
||||||
|
@ -70,6 +70,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HASP_USE_CUSTOM)
|
#if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
|
||||||
#include "custom/my_custom.h"
|
#include "custom/my_custom.h"
|
||||||
#endif
|
#endif
|
@ -30,6 +30,7 @@
|
|||||||
#define D_FILE_SIZE_KILOBYTES "KiB"
|
#define D_FILE_SIZE_KILOBYTES "KiB"
|
||||||
#define D_FILE_SIZE_MEGABYTES "MiB"
|
#define D_FILE_SIZE_MEGABYTES "MiB"
|
||||||
#define D_FILE_SIZE_GIGABYTES "GiB"
|
#define D_FILE_SIZE_GIGABYTES "GiB"
|
||||||
|
#define D_FILE_SIZE_TERABYTES "TiB"
|
||||||
#define D_FILE_SIZE_DIVIDER 1024 // kibi or kilo bytes
|
#define D_FILE_SIZE_DIVIDER 1024 // kibi or kilo bytes
|
||||||
#define D_DECIMAL_POINT "." // decimal comma or point
|
#define D_DECIMAL_POINT "." // decimal comma or point
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#define D_FILE_SIZE_KILOBYTES "KiB"
|
#define D_FILE_SIZE_KILOBYTES "KiB"
|
||||||
#define D_FILE_SIZE_MEGABYTES "MiB"
|
#define D_FILE_SIZE_MEGABYTES "MiB"
|
||||||
#define D_FILE_SIZE_GIGABYTES "GiB"
|
#define D_FILE_SIZE_GIGABYTES "GiB"
|
||||||
|
#define D_FILE_SIZE_TERABYTES "TiB"
|
||||||
#define D_FILE_SIZE_DIVIDER 1024 // kibi or kilo bytes
|
#define D_FILE_SIZE_DIVIDER 1024 // kibi or kilo bytes
|
||||||
#define D_DECIMAL_POINT "," // decimal comma or point
|
#define D_DECIMAL_POINT "," // decimal comma or point
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#define D_FILE_SIZE_KILOBYTES "KiB"
|
#define D_FILE_SIZE_KILOBYTES "KiB"
|
||||||
#define D_FILE_SIZE_MEGABYTES "MiB"
|
#define D_FILE_SIZE_MEGABYTES "MiB"
|
||||||
#define D_FILE_SIZE_GIGABYTES "GiB"
|
#define D_FILE_SIZE_GIGABYTES "GiB"
|
||||||
|
#define D_FILE_SIZE_TERABYTES "TiB"
|
||||||
#define D_FILE_SIZE_DIVIDER 1024 // kibi or kilo bytes
|
#define D_FILE_SIZE_DIVIDER 1024 // kibi or kilo bytes
|
||||||
#define D_DECIMAL_POINT "." // decimal comma or point
|
#define D_DECIMAL_POINT "." // decimal comma or point
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#define D_NO "No" // New
|
#define D_NO "No" // New
|
||||||
|
|
||||||
#define D_ERROR_OUT_OF_MEMORY "Memory llena"
|
#define D_ERROR_OUT_OF_MEMORY "Memory llena"
|
||||||
#define D_ERROR_UNKNOWN "Unknown error"
|
#define D_ERROR_UNKNOWN "Error desconocido"
|
||||||
|
|
||||||
#define D_CONFIG_NOT_CHANGED "No hay cambios en la configuración"
|
#define D_CONFIG_NOT_CHANGED "No hay cambios en la configuración"
|
||||||
#define D_CONFIG_CHANGED "Configuración cambiada"
|
#define D_CONFIG_CHANGED "Configuración cambiada"
|
||||||
@ -30,6 +30,7 @@
|
|||||||
#define D_FILE_SIZE_KILOBYTES "KiB" // new
|
#define D_FILE_SIZE_KILOBYTES "KiB" // new
|
||||||
#define D_FILE_SIZE_MEGABYTES "MiB" // new
|
#define D_FILE_SIZE_MEGABYTES "MiB" // new
|
||||||
#define D_FILE_SIZE_GIGABYTES "GiB" // new
|
#define D_FILE_SIZE_GIGABYTES "GiB" // new
|
||||||
|
#define D_FILE_SIZE_TERABYTES "TiB"
|
||||||
#define D_FILE_SIZE_DIVIDER 1024 // new, kibi or kilo bytes
|
#define D_FILE_SIZE_DIVIDER 1024 // new, kibi or kilo bytes
|
||||||
#define D_DECIMAL_POINT "," // new, decimal comma or point
|
#define D_DECIMAL_POINT "," // new, decimal comma or point
|
||||||
|
|
||||||
@ -127,7 +128,7 @@
|
|||||||
#define D_HTTP_HTTP_SETTINGS "Ajustes HTTP"
|
#define D_HTTP_HTTP_SETTINGS "Ajustes HTTP"
|
||||||
#define D_HTTP_HTTP_SETTINGS "Ajustes FTP"
|
#define D_HTTP_HTTP_SETTINGS "Ajustes FTP"
|
||||||
#define D_HTTP_WIFI_SETTINGS "Ajustes Wifi"
|
#define D_HTTP_WIFI_SETTINGS "Ajustes Wifi"
|
||||||
#define D_HTTP_WIREGUARD_SETTINGS "WireGuard Settings"
|
#define D_HTTP_GUI_SETTINGS "Ajustes WireGuard"
|
||||||
#define D_HTTP_MQTT_SETTINGS "Ajustes MQTT"
|
#define D_HTTP_MQTT_SETTINGS "Ajustes MQTT"
|
||||||
#define D_HTTP_GPIO_SETTINGS "Ajustes GPIO"
|
#define D_HTTP_GPIO_SETTINGS "Ajustes GPIO"
|
||||||
#define D_HTTP_MDNS_SETTINGS "Ajustes mDNS"
|
#define D_HTTP_MDNS_SETTINGS "Ajustes mDNS"
|
||||||
@ -202,8 +203,8 @@
|
|||||||
#define D_INFO_MAC_ADDRESS "Dirección MAC"
|
#define D_INFO_MAC_ADDRESS "Dirección MAC"
|
||||||
#define D_INFO_GATEWAY "Gateway"
|
#define D_INFO_GATEWAY "Gateway"
|
||||||
#define D_INFO_DNS_SERVER "Servidor DNS"
|
#define D_INFO_DNS_SERVER "Servidor DNS"
|
||||||
#define D_INFO_ENDPOINT_IP "Endpoint IP"
|
#define D_INFO_ENDPOINT_IP "IP de punto final"
|
||||||
#define D_INFO_ENDPOINT_PORT "Endpoint Port"
|
#define D_INFO_ENDPOINT_PORT "Puerto de punto final"
|
||||||
|
|
||||||
#define D_OOBE_MSG "Toque la pantalla para ajustar WiFi o conectarse a un punto de acceso"
|
#define D_OOBE_MSG "Toque la pantalla para ajustar WiFi o conectarse a un punto de acceso"
|
||||||
#define D_OOBE_SCAN_TO_CONNECT "Scanee para conectar"
|
#define D_OOBE_SCAN_TO_CONNECT "Scanee para conectar"
|
||||||
@ -216,8 +217,8 @@
|
|||||||
#define D_WIFI_RSSI_WEAK "Débil"
|
#define D_WIFI_RSSI_WEAK "Débil"
|
||||||
#define D_WIFI_RSSI_BAD "Muy baka"
|
#define D_WIFI_RSSI_BAD "Muy baka"
|
||||||
|
|
||||||
#define D_WG_INITIALIZED "Initialized"
|
#define D_WG_INITIALIZED "Inicializado"
|
||||||
#define D_WG_BAD_CONFIG "Missing or bad configuration"
|
#define D_WG_BAD_CONFIG "Falta o mala configuración"
|
||||||
|
|
||||||
#define D_GPIO_SWITCH "Switch"
|
#define D_GPIO_SWITCH "Switch"
|
||||||
#define D_GPIO_BUTTON "Botón"
|
#define D_GPIO_BUTTON "Botón"
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#define D_FILE_SIZE_KILOBYTES "Kio"
|
#define D_FILE_SIZE_KILOBYTES "Kio"
|
||||||
#define D_FILE_SIZE_MEGABYTES "Mio"
|
#define D_FILE_SIZE_MEGABYTES "Mio"
|
||||||
#define D_FILE_SIZE_GIGABYTES "Gio"
|
#define D_FILE_SIZE_GIGABYTES "Gio"
|
||||||
|
#define D_FILE_SIZE_TERABYTES "Tio"
|
||||||
#define D_FILE_SIZE_DIVIDER 1024 // kibi or kilo bytes
|
#define D_FILE_SIZE_DIVIDER 1024 // kibi or kilo bytes
|
||||||
#define D_DECIMAL_POINT "," // decimal comma or point
|
#define D_DECIMAL_POINT "," // decimal comma or point
|
||||||
|
|
||||||
@ -127,7 +128,7 @@
|
|||||||
#define D_HTTP_HTTP_SETTINGS "Paramètres HTTP"
|
#define D_HTTP_HTTP_SETTINGS "Paramètres HTTP"
|
||||||
#define D_HTTP_FTP_SETTINGS "Paramètres FTP"
|
#define D_HTTP_FTP_SETTINGS "Paramètres FTP"
|
||||||
#define D_HTTP_WIFI_SETTINGS "Paramètres Wifi"
|
#define D_HTTP_WIFI_SETTINGS "Paramètres Wifi"
|
||||||
#define D_HTTP_WIREGUARD_SETTINGS "WireGuard Settings"
|
#define D_HTTP_WIREGUARD_SETTINGS "Paramètres WireGuard"
|
||||||
#define D_HTTP_MQTT_SETTINGS "Paramètres MQTT"
|
#define D_HTTP_MQTT_SETTINGS "Paramètres MQTT"
|
||||||
#define D_HTTP_GPIO_SETTINGS "Paramètres GPIO"
|
#define D_HTTP_GPIO_SETTINGS "Paramètres GPIO"
|
||||||
#define D_HTTP_MDNS_SETTINGS "Paramètres mDNS"
|
#define D_HTTP_MDNS_SETTINGS "Paramètres mDNS"
|
||||||
@ -202,8 +203,8 @@
|
|||||||
#define D_INFO_MAC_ADDRESS "Adresse MAC"
|
#define D_INFO_MAC_ADDRESS "Adresse MAC"
|
||||||
#define D_INFO_GATEWAY "Passerelle"
|
#define D_INFO_GATEWAY "Passerelle"
|
||||||
#define D_INFO_DNS_SERVER "Serveur DNS"
|
#define D_INFO_DNS_SERVER "Serveur DNS"
|
||||||
#define D_INFO_ENDPOINT_IP "Endpoint IP"
|
#define D_INFO_ENDPOINT_IP "Adresse IP du point final"
|
||||||
#define D_INFO_ENDPOINT_PORT "Endpoint Port"
|
#define D_INFO_ENDPOINT_IP "Port du point final"
|
||||||
|
|
||||||
#define D_OOBE_MSG "Touchez l'écran pour configurer le WiFi ou branchez ce point d'accès:"
|
#define D_OOBE_MSG "Touchez l'écran pour configurer le WiFi ou branchez ce point d'accès:"
|
||||||
#define D_OOBE_SCAN_TO_CONNECT "Scanner pour se connecter"
|
#define D_OOBE_SCAN_TO_CONNECT "Scanner pour se connecter"
|
||||||
@ -216,8 +217,8 @@
|
|||||||
#define D_WIFI_RSSI_WEAK "Faible"
|
#define D_WIFI_RSSI_WEAK "Faible"
|
||||||
#define D_WIFI_RSSI_BAD "Très mauvais"
|
#define D_WIFI_RSSI_BAD "Très mauvais"
|
||||||
|
|
||||||
#define D_WG_INITIALIZED "Initialized"
|
#define D_WG_INITIALIZED "Initialisé"
|
||||||
#define D_WG_BAD_CONFIG "Missing or bad configuration"
|
#define D_WG_BAD_CONFIG "Configuration manquante ou incorrecte"
|
||||||
|
|
||||||
#define D_GPIO_SWITCH "Interrupteur"
|
#define D_GPIO_SWITCH "Interrupteur"
|
||||||
#define D_GPIO_BUTTON "Bouton"
|
#define D_GPIO_BUTTON "Bouton"
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#define D_FILE_SIZE_KILOBYTES "KiB"
|
#define D_FILE_SIZE_KILOBYTES "KiB"
|
||||||
#define D_FILE_SIZE_MEGABYTES "MiB"
|
#define D_FILE_SIZE_MEGABYTES "MiB"
|
||||||
#define D_FILE_SIZE_GIGABYTES "GiB"
|
#define D_FILE_SIZE_GIGABYTES "GiB"
|
||||||
|
#define D_FILE_SIZE_TERABYTES "TiB"
|
||||||
#define D_FILE_SIZE_DIVIDER 1024 // kibi or kilo bytes
|
#define D_FILE_SIZE_DIVIDER 1024 // kibi or kilo bytes
|
||||||
#define D_DECIMAL_POINT "." // decimal comma or point
|
#define D_DECIMAL_POINT "." // decimal comma or point
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#define D_FILE_SIZE_KILOBYTES "KiB"
|
#define D_FILE_SIZE_KILOBYTES "KiB"
|
||||||
#define D_FILE_SIZE_MEGABYTES "MiB"
|
#define D_FILE_SIZE_MEGABYTES "MiB"
|
||||||
#define D_FILE_SIZE_GIGABYTES "GiB"
|
#define D_FILE_SIZE_GIGABYTES "GiB"
|
||||||
|
#define D_FILE_SIZE_TERABYTES "TiB"
|
||||||
#define D_FILE_SIZE_DIVIDER 1024 // kibi or kilo bytes
|
#define D_FILE_SIZE_DIVIDER 1024 // kibi or kilo bytes
|
||||||
#define D_DECIMAL_POINT "," // decimal comma or point
|
#define D_DECIMAL_POINT "," // decimal comma or point
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#define D_FILE_SIZE_KILOBYTES "KiB"
|
#define D_FILE_SIZE_KILOBYTES "KiB"
|
||||||
#define D_FILE_SIZE_MEGABYTES "MiB"
|
#define D_FILE_SIZE_MEGABYTES "MiB"
|
||||||
#define D_FILE_SIZE_GIGABYTES "GiB"
|
#define D_FILE_SIZE_GIGABYTES "GiB"
|
||||||
|
#define D_FILE_SIZE_TERABYTES "TiB"
|
||||||
#define D_FILE_SIZE_DIVIDER 1024 // kibi or kilo bytes
|
#define D_FILE_SIZE_DIVIDER 1024 // kibi or kilo bytes
|
||||||
#define D_DECIMAL_POINT "." // decimal comma or point
|
#define D_DECIMAL_POINT "." // decimal comma or point
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#define D_FILE_SIZE_KILOBYTES "KiB" // new
|
#define D_FILE_SIZE_KILOBYTES "KiB" // new
|
||||||
#define D_FILE_SIZE_MEGABYTES "MiB" // new
|
#define D_FILE_SIZE_MEGABYTES "MiB" // new
|
||||||
#define D_FILE_SIZE_GIGABYTES "GiB" // new
|
#define D_FILE_SIZE_GIGABYTES "GiB" // new
|
||||||
|
#define D_FILE_SIZE_TERABYTES "TiB"
|
||||||
#define D_FILE_SIZE_DIVIDER 1024 // new, kibi or kilo bytes
|
#define D_FILE_SIZE_DIVIDER 1024 // new, kibi or kilo bytes
|
||||||
#define D_DECIMAL_POINT "." // new, decimal comma or point
|
#define D_DECIMAL_POINT "." // new, decimal comma or point
|
||||||
|
|
||||||
@ -127,7 +128,7 @@
|
|||||||
#define D_HTTP_HTTP_SETTINGS "Configurar HTTP"
|
#define D_HTTP_HTTP_SETTINGS "Configurar HTTP"
|
||||||
#define D_HTTP_FTP_SETTINGS "Configurar FTP"
|
#define D_HTTP_FTP_SETTINGS "Configurar FTP"
|
||||||
#define D_HTTP_WIFI_SETTINGS "Configurar Wifi"
|
#define D_HTTP_WIFI_SETTINGS "Configurar Wifi"
|
||||||
#define D_HTTP_WIREGUARD_SETTINGS "WireGuard Settings"
|
#define D_HTTP_WIREGUARD_SETTINGS "Configurar WireGuard"
|
||||||
#define D_HTTP_MQTT_SETTINGS "Configurar MQTT"
|
#define D_HTTP_MQTT_SETTINGS "Configurar MQTT"
|
||||||
#define D_HTTP_GPIO_SETTINGS "Configurar GPIO"
|
#define D_HTTP_GPIO_SETTINGS "Configurar GPIO"
|
||||||
#define D_HTTP_MDNS_SETTINGS "Configurar mDNS"
|
#define D_HTTP_MDNS_SETTINGS "Configurar mDNS"
|
||||||
@ -216,8 +217,8 @@
|
|||||||
#define D_WIFI_RSSI_BAD "Muito baixo"
|
#define D_WIFI_RSSI_BAD "Muito baixo"
|
||||||
#define D_WIFI_RSSI_FAIR "Decente"
|
#define D_WIFI_RSSI_FAIR "Decente"
|
||||||
|
|
||||||
#define D_WG_INITIALIZED "Initialized"
|
#define D_WG_INITIALIZED "Inicializado"
|
||||||
#define D_WG_BAD_CONFIG "Missing or bad configuration"
|
#define D_WG_BAD_CONFIG "Configuração ausente ou ruim"
|
||||||
|
|
||||||
#define D_GPIO_SWITCH "Interruptor"
|
#define D_GPIO_SWITCH "Interruptor"
|
||||||
#define D_GPIO_BUTTON "Botão"
|
#define D_GPIO_BUTTON "Botão"
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#define D_FILE_SIZE_KILOBYTES "KiB"
|
#define D_FILE_SIZE_KILOBYTES "KiB"
|
||||||
#define D_FILE_SIZE_MEGABYTES "MiB"
|
#define D_FILE_SIZE_MEGABYTES "MiB"
|
||||||
#define D_FILE_SIZE_GIGABYTES "GiB"
|
#define D_FILE_SIZE_GIGABYTES "GiB"
|
||||||
|
#define D_FILE_SIZE_TERABYTES "TiB"
|
||||||
#define D_FILE_SIZE_DIVIDER 1024 // kibi or kilo bytes
|
#define D_FILE_SIZE_DIVIDER 1024 // kibi or kilo bytes
|
||||||
#define D_DECIMAL_POINT "." // decimal comma or point
|
#define D_DECIMAL_POINT "." // decimal comma or point
|
||||||
|
|
||||||
|
242
src/lang/ru_RU.h
Normal file
242
src/lang/ru_RU.h
Normal file
@ -0,0 +1,242 @@
|
|||||||
|
// This translation file is maintained on https://crowdin.com/project/openhasp/
|
||||||
|
// Do not edit directly!
|
||||||
|
|
||||||
|
#ifndef HASP_LANG_RU_RU_H
|
||||||
|
#define HASP_LANG_RU_RU_H
|
||||||
|
|
||||||
|
#define D_ISO_LANG_CODE "ru-RU"
|
||||||
|
|
||||||
|
#define D_USERNAME "Имя пользователя:"
|
||||||
|
#define D_PASSWORD "Пароль:"
|
||||||
|
#define D_SSID "Ssid:"
|
||||||
|
#define D_YES "Да"
|
||||||
|
#define D_NO "Нет"
|
||||||
|
|
||||||
|
#define D_ERROR_OUT_OF_MEMORY "Не хватает памяти"
|
||||||
|
#define D_ERROR_UNKNOWN "Неизвестная ошибка"
|
||||||
|
|
||||||
|
#define D_CONFIG_NOT_CHANGED "Настройки не изменены"
|
||||||
|
#define D_CONFIG_CHANGED "Настройки изменены"
|
||||||
|
#define D_CONFIG_LOADED "Настройки загружены"
|
||||||
|
|
||||||
|
#define D_FILE_LOADING "Загружается %s"
|
||||||
|
#define D_FILE_LOADED "Загружено %s"
|
||||||
|
#define D_FILE_LOAD_FAILED "Ошибка загрузки %s"
|
||||||
|
#define D_FILE_SAVING "Сохранение %s"
|
||||||
|
#define D_FILE_SAVED "Сохранено %s"
|
||||||
|
#define D_FILE_SAVE_FAILED "Ошибка сохранения %s"
|
||||||
|
#define D_FILE_NOT_FOUND "Файл не найден"
|
||||||
|
#define D_FILE_SIZE_BYTES "байт"
|
||||||
|
#define D_FILE_SIZE_KILOBYTES "KiB"
|
||||||
|
#define D_FILE_SIZE_MEGABYTES "MiB"
|
||||||
|
#define D_FILE_SIZE_GIGABYTES "GiB"
|
||||||
|
#define D_FILE_SIZE_TERABYTES "TiB"
|
||||||
|
#define D_FILE_SIZE_DIVIDER 1024 // kibi or kilo bytes
|
||||||
|
#define D_DECIMAL_POINT "." // decimal comma or point
|
||||||
|
|
||||||
|
#define D_SERVICE_STARTING "Запуск..."
|
||||||
|
#define D_SERVICE_STARTED "Запущено"
|
||||||
|
#define D_SERVICE_START_FAILED "Ошибка запуска"
|
||||||
|
#define D_SERVICE_STOPPED "Остановлено"
|
||||||
|
#define D_SERVICE_DISABLED "Отключено"
|
||||||
|
#define D_SERVICE_CONNECTED "Подключен"
|
||||||
|
#define D_SERVICE_DISCONNECTED "Отключен"
|
||||||
|
|
||||||
|
#define D_SETTING_ENABLED "Включено"
|
||||||
|
#define D_SETTING_DISABLED "Выключено"
|
||||||
|
#define D_SETTING_DEFAULT "По умолчанию"
|
||||||
|
|
||||||
|
#define D_NETWORK_IP_ADDRESS_RECEIVED "Получен IP адрес %s"
|
||||||
|
#define D_NETWORK_ONLINE "онлайн"
|
||||||
|
#define D_NETWORK_OFFLINE "оффлайн"
|
||||||
|
#define D_NETWORK_CONNECTION_FAILED "Ошибка подключения"
|
||||||
|
#define D_NETWORK_CONNECTION_UNAUTHORIZED "Ошибка авторизации"
|
||||||
|
|
||||||
|
#define D_MQTT_DEFAULT_NAME "plate_%s"
|
||||||
|
#define D_MQTT_CONNECTING "Подключение..."
|
||||||
|
#define D_MQTT_CONNECTED "Подключен к брокеру %s с clientID %s"
|
||||||
|
#define D_MQTT_NOT_CONNECTED "Не подключен ???"
|
||||||
|
#define D_MQTT_DISCONNECTING "Отключение..."
|
||||||
|
#define D_MQTT_DISCONNECTED "Отключен"
|
||||||
|
#define D_MQTT_RECONNECTING "Отключен от брокера, переподключение..."
|
||||||
|
#define D_MQTT_NOT_CONFIGURED "Брокер не настроен"
|
||||||
|
#define D_MQTT_STARTED "Запущен: %d байт"
|
||||||
|
#define D_MQTT_FAILED "Не удалось:"
|
||||||
|
#define D_MQTT_INVALID_TOPIC "Сообщение имеет недопустимую тему"
|
||||||
|
#define D_MQTT_SUBSCRIBED "Подписан на %s"
|
||||||
|
#define D_MQTT_NOT_SUBSCRIBED "Не удалось подписаться на %s"
|
||||||
|
#define D_MQTT_HA_AUTO_DISCOVERY "Зарегистрирован в HA auto-discovery"
|
||||||
|
#define D_MQTT_PAYLOAD_TOO_LONG "Пейлоад слишком длинный(%u байт)"
|
||||||
|
|
||||||
|
#define D_TELNET_CLOSING_CONNECTION "Закрытие сессии от %s"
|
||||||
|
#define D_TELNET_CLIENT_LOGIN_FROM "Клиент авторизовался от %s"
|
||||||
|
#define D_TELNET_CLIENT_CONNECT_FROM "Клиент подключился от %s"
|
||||||
|
#define D_TELNET_CLIENT_NOT_CONNECTED "Клиент НЕ подключен"
|
||||||
|
#define D_TELNET_INCORRECT_LOGIN_ATTEMPT "Неверная попытка входа в систему %s"
|
||||||
|
#define D_TELNET_STARTED "Telnet консоль запущена"
|
||||||
|
#define D_TELNET_FAILED "Ошибка запуска telnet консоли"
|
||||||
|
#define D_TELNET_CLIENT_CONNECTED "Клиент подключен"
|
||||||
|
#define D_TELNET_CLIENT_REJECTED "Клиент отклонен"
|
||||||
|
|
||||||
|
#define D_HASP_INVALID_PAGE "Неверная страница %u"
|
||||||
|
#define D_HASP_INVALID_LAYER "Невозможно очистить системный уровень"
|
||||||
|
#define D_HASP_CHANGE_PAGE "Изменение страницы на %u"
|
||||||
|
#define D_HASP_CLEAR_PAGE "Очистка страницы %u"
|
||||||
|
|
||||||
|
#define D_OBJECT_DELETED "Объект удален"
|
||||||
|
#define D_OBJECT_UNKNOWN "Неизвестный объект"
|
||||||
|
#define D_OBJECT_MISMATCH "Объекты НЕ совпадают!"
|
||||||
|
#define D_OBJECT_LOST "Потерянный объект!"
|
||||||
|
#define D_OBJECT_CREATE_FAILED "Ошибка создания объета с id %u"
|
||||||
|
#define D_OBJECT_PAGE_UNKNOWN "Страница с ID %u не определена"
|
||||||
|
#define D_OBJECT_EVENT_UNKNOWN "Неизвестное событие %d"
|
||||||
|
|
||||||
|
#define D_ATTRIBUTE_UNKNOWN "Неизвестное свойство %s"
|
||||||
|
// D_ATTRIBUTE_OBSOLETE D_ATTRIBUTE_INSTEAD can be used together or just D_ATTRIBUTE_OBSOLETE alone
|
||||||
|
#define D_ATTRIBUTE_OBSOLETE "%s это устарело"
|
||||||
|
#define D_ATTRIBUTE_INSTEAD ", используйте %s вместо него"
|
||||||
|
#define D_ATTRIBUTE_READ_ONLY "%s только для чтения"
|
||||||
|
#define D_ATTRIBUTE_PAGE_METHOD_INVALID "Невозможно вызвать %s на странице"
|
||||||
|
#define D_ATTRIBUTE_ALIGN_INVALID "Недопустимое свойство выравнивания: %s"
|
||||||
|
#define D_ATTRIBUTE_COLOR_INVALID "Недопустимое свойство цвета: %s"
|
||||||
|
#define D_ATTRIBUTE_LONG_MODE_INVALID "Недопустимый режим длины: %s"
|
||||||
|
|
||||||
|
#define D_OOBE_SSID_VALIDATED "SSID %s подтвержден"
|
||||||
|
#define D_OOBE_AUTO_CALIBRATE "Автокалибровка включена"
|
||||||
|
#define D_OOBE_CALIBRATED "Уже откалиброван"
|
||||||
|
|
||||||
|
#define D_DISPATCH_COMMAND_NOT_FOUND "Команда '%s' не найдена"
|
||||||
|
#define D_DISPATCH_INVALID_PAGE "Неверная страница %s"
|
||||||
|
#define D_DISPATCH_REBOOT "Перезагружаем устройство!"
|
||||||
|
|
||||||
|
#define D_JSON_FAILED "Парсинг JSON не удался:"
|
||||||
|
#define D_JSONL_FAILED "JSONL ошибка парсинга на строке %u"
|
||||||
|
#define D_JSONL_SUCCEEDED "Jsonl полностью прочтен"
|
||||||
|
|
||||||
|
#define D_OTA_CHECK_UPDATE "Проверяем URL с обновлением: %s"
|
||||||
|
#define D_OTA_CHECK_COMPLETE "Проверка обновлений завершена"
|
||||||
|
#define D_OTA_CHECK_FAILED "Ошибка проверки обновлений: %s"
|
||||||
|
#define D_OTA_UPDATE_FIRMWARE "OTA обновление прошивки"
|
||||||
|
#define D_OTA_UPDATE_COMPLETE "OTA обновление завершено"
|
||||||
|
#define D_OTA_UPDATE_APPLY "Установка прошивки и перезагрузка"
|
||||||
|
#define D_OTA_UPDATE_FAILED "Ошибка OTA обновления"
|
||||||
|
#define D_OTA_UPDATING_FIRMWARE "Обновление прошивка..."
|
||||||
|
#define D_OTA_UPDATING_FILESYSTEM "Обновление файловой системы..."
|
||||||
|
|
||||||
|
#define D_HTTP_HASP_DESIGN "HASP оформление"
|
||||||
|
#define D_HTTP_INFORMATION "Информация"
|
||||||
|
#define D_HTTP_HTTP_SETTINGS "Настройки HTTP"
|
||||||
|
#define D_HTTP_FTP_SETTINGS "Настройки FTP"
|
||||||
|
#define D_HTTP_WIFI_SETTINGS "Настройки Wifi"
|
||||||
|
#define D_HTTP_WIREGUARD_SETTINGS "Настройки WireGuard"
|
||||||
|
#define D_HTTP_MQTT_SETTINGS "Настройки MQTT"
|
||||||
|
#define D_HTTP_GPIO_SETTINGS "Настройки GPIO"
|
||||||
|
#define D_HTTP_MDNS_SETTINGS "Настройки mDNS"
|
||||||
|
#define D_HTTP_TELNET_SETTINGS "Настройки Telnet"
|
||||||
|
#define D_HTTP_DEBUG_SETTINGS "Настройки отладки"
|
||||||
|
#define D_HTTP_GUI_SETTINGS "Настройки дисплея"
|
||||||
|
#define D_HTTP_SAVE_SETTINGS "Сохранить настройки"
|
||||||
|
#define D_HTTP_UPLOAD_FILE "Загрузить файл"
|
||||||
|
#define D_HTTP_ERASE_DEVICE "Сброс всех настроек"
|
||||||
|
#define D_HTTP_ADD_GPIO "Добавить новый пин"
|
||||||
|
#define D_HTTP_BACK "Назад"
|
||||||
|
#define D_HTTP_REFRESH "Обновить"
|
||||||
|
#define D_HTTP_PREV_PAGE "Предыдущая страница"
|
||||||
|
#define D_HTTP_NEXT_PAGE "Следующая страница"
|
||||||
|
#define D_HTTP_CALIBRATE "Калибровка"
|
||||||
|
#define D_HTTP_ANTIBURN "Запуск Anti Burn-in"
|
||||||
|
#define D_HTTP_SCREENSHOT "Скриншот"
|
||||||
|
#define D_HTTP_FILE_BROWSER "Файловый редактор"
|
||||||
|
#define D_HTTP_FIRMWARE_UPGRADE "Обновление прошивки"
|
||||||
|
#define D_HTTP_UPDATE_FIRMWARE "Обновление прошивки"
|
||||||
|
#define D_HTTP_FACTORY_RESET "Сброс на заводские настройки"
|
||||||
|
#define D_HTTP_MAIN_MENU "Главное меню"
|
||||||
|
#define D_HTTP_REBOOT "Перезапуск"
|
||||||
|
#define D_HTTP_CONFIGURATION "Конфигурацияя"
|
||||||
|
#define D_HTTP_CONFIG_CHANGED \
|
||||||
|
"Конфигурация изменена, пожалуйста кликните на <a href='/reboot'>Перезагрузка</a> для сохранения изменений в память устройства."
|
||||||
|
#define D_HTTP_SENDING_PAGE "Отправлена %S страница на %s"
|
||||||
|
#define D_HTTP_FOOTER "by Francis Van Roie"
|
||||||
|
|
||||||
|
#define D_INFO_VERSION "Version"
|
||||||
|
#define D_INFO_BUILD_DATETIME "Build DateTime"
|
||||||
|
#define D_INFO_ENVIRONMENT "Environment"
|
||||||
|
#define D_INFO_UPTIME "Uptime"
|
||||||
|
#define D_INFO_FREE_HEAP "Free Heap"
|
||||||
|
#define D_INFO_FREE_BLOCK "Free Block"
|
||||||
|
#define D_INFO_DEVICE_MEMORY "Device Memory"
|
||||||
|
#define D_INFO_LVGL_MEMORY "LVGL Memory"
|
||||||
|
#define D_INFO_TOTAL_MEMORY "Total"
|
||||||
|
#define D_INFO_FREE_MEMORY "Free"
|
||||||
|
#define D_INFO_FRAGMENTATION "Fragmentation"
|
||||||
|
#define D_INFO_PSRAM_FREE "PSRam Free"
|
||||||
|
#define D_INFO_PSRAM_SIZE "PSRam Size"
|
||||||
|
#define D_INFO_FLASH_SIZE "Flash Size"
|
||||||
|
#define D_INFO_SKETCH_USED "Program Size Used"
|
||||||
|
#define D_INFO_SKETCH_FREE "Program Size Free"
|
||||||
|
#define D_INFO_FS_SIZE "Filesystem Size"
|
||||||
|
#define D_INFO_FS_USED "Filesystem Used"
|
||||||
|
#define D_INFO_FS_FREE "Filesystem Free"
|
||||||
|
#define D_INFO_MODULE "Module"
|
||||||
|
#define D_INFO_MODEL "Model"
|
||||||
|
#define D_INFO_FREQUENCY "Frequency"
|
||||||
|
#define D_INFO_CORE_VERSION "Core Version"
|
||||||
|
#define D_INFO_RESET_REASON "Reset Reason"
|
||||||
|
#define D_INFO_STATUS "Status"
|
||||||
|
#define D_INFO_SERVER "Server"
|
||||||
|
#define D_INFO_USERNAME "Username"
|
||||||
|
#define D_INFO_CLIENTID "Client ID"
|
||||||
|
// #define D_INFO_CONNECTED "Connected"
|
||||||
|
// #define D_INFO_DISCONNECTED "Disconnected"
|
||||||
|
#define D_INFO_RECEIVED "Received"
|
||||||
|
#define D_INFO_PUBLISHED "Published"
|
||||||
|
#define D_INFO_FAILED "Failed"
|
||||||
|
#define D_INFO_ETHERNET "Ethernet"
|
||||||
|
#define D_INFO_WIFI "Wifi"
|
||||||
|
#define D_INFO_WIREGUARD "WireGuard"
|
||||||
|
#define D_INFO_LINK_SPEED "Link Speed"
|
||||||
|
#define D_INFO_FULL_DUPLEX "Full Duplex"
|
||||||
|
#define D_INFO_BSSID "BSSID"
|
||||||
|
#define D_INFO_SSID "SSID"
|
||||||
|
#define D_INFO_RSSI "Signal Strength"
|
||||||
|
#define D_INFO_IP_ADDRESS "IP Address"
|
||||||
|
#define D_INFO_MAC_ADDRESS "MAC Address"
|
||||||
|
#define D_INFO_GATEWAY "Gateway"
|
||||||
|
#define D_INFO_DNS_SERVER "DNS Server"
|
||||||
|
#define D_INFO_ENDPOINT_IP "Endpoint IP"
|
||||||
|
#define D_INFO_ENDPOINT_PORT "Endpoint Port"
|
||||||
|
|
||||||
|
#define D_OOBE_MSG "Тапните по акрану для настройки WiFi или подключитесь к этой Точке Доступа:"
|
||||||
|
#define D_OOBE_SCAN_TO_CONNECT "Сканируте для подключения"
|
||||||
|
|
||||||
|
#define D_WIFI_CONNECTING_TO "Подключение к %s"
|
||||||
|
#define D_WIFI_CONNECTED_TO "Подключено к %s, запрашиваем IP..."
|
||||||
|
#define D_WIFI_RSSI_EXCELLENT "Отлично"
|
||||||
|
#define D_WIFI_RSSI_GOOD "Хорошо"
|
||||||
|
#define D_WIFI_RSSI_FAIR "Нормально"
|
||||||
|
#define D_WIFI_RSSI_WEAK "Слабо"
|
||||||
|
#define D_WIFI_RSSI_BAD "Очень плохо"
|
||||||
|
|
||||||
|
#define D_WG_INITIALIZED "Инициализирован"
|
||||||
|
#define D_WG_BAD_CONFIG "Отсутствует или неверная конфигурация"
|
||||||
|
|
||||||
|
#define D_GPIO_SWITCH "Switch"
|
||||||
|
#define D_GPIO_BUTTON "Push Button"
|
||||||
|
#define D_GPIO_TOUCH "Capacitive Touch"
|
||||||
|
#define D_GPIO_LED "Led"
|
||||||
|
#define D_GPIO_LED_R "Mood Red"
|
||||||
|
#define D_GPIO_LED_G "Mood Green"
|
||||||
|
#define D_GPIO_LED_B "Mood Blue"
|
||||||
|
#define D_GPIO_POWER_RELAY "Power Relay"
|
||||||
|
#define D_GPIO_LIGHT_RELAY "Light Relay"
|
||||||
|
#define D_GPIO_PWM "PWM"
|
||||||
|
#define D_GPIO_DAC "DAC"
|
||||||
|
#define D_GPIO_SERIAL_DIMMER "Serial Dimmer"
|
||||||
|
#define D_GPIO_UNKNOWN "Unknown"
|
||||||
|
#define D_GPIO_PIN "Pin"
|
||||||
|
#define D_GPIO_GROUP "Group"
|
||||||
|
#define D_GPIO_GROUP_NONE "None"
|
||||||
|
#define D_GPIO_STATE_NORMAL "Normal"
|
||||||
|
#define D_GPIO_STATE_INVERTED "Inverted"
|
||||||
|
|
||||||
|
#endif
|
242
src/lang/sv_SE.h
Normal file
242
src/lang/sv_SE.h
Normal file
@ -0,0 +1,242 @@
|
|||||||
|
// This translation file is maintained on https://crowdin.com/project/openhasp/
|
||||||
|
// Do not edit directly!
|
||||||
|
|
||||||
|
#ifndef HASP_LANG_SV_SE_H
|
||||||
|
#define HASP_LANG_SV_SE_H
|
||||||
|
|
||||||
|
#define D_ISO_LANG_CODE "sv-SE"
|
||||||
|
|
||||||
|
#define D_USERNAME "Användarnamn:"
|
||||||
|
#define D_PASSWORD "Lösenord:"
|
||||||
|
#define D_SSID "Ssid:"
|
||||||
|
#define D_YES "Ja"
|
||||||
|
#define D_NO "Nej"
|
||||||
|
|
||||||
|
#define D_ERROR_OUT_OF_MEMORY "Slut minne"
|
||||||
|
#define D_ERROR_UNKNOWN "Okänt fel"
|
||||||
|
|
||||||
|
#define D_CONFIG_NOT_CHANGED "Inställningar ändrades inte"
|
||||||
|
#define D_CONFIG_CHANGED "Inställningar ändrade"
|
||||||
|
#define D_CONFIG_LOADED "Inställningarna inlästa"
|
||||||
|
|
||||||
|
#define D_FILE_LOADING "Läser %s"
|
||||||
|
#define D_FILE_LOADED "Läst %s"
|
||||||
|
#define D_FILE_LOAD_FAILED "Misslyckades att läsa %s"
|
||||||
|
#define D_FILE_SAVING "Sparar %s"
|
||||||
|
#define D_FILE_SAVED "Sparat %s"
|
||||||
|
#define D_FILE_SAVE_FAILED "Kunde inte spara %s"
|
||||||
|
#define D_FILE_NOT_FOUND "Filen hittades inte"
|
||||||
|
#define D_FILE_SIZE_BYTES "bytes"
|
||||||
|
#define D_FILE_SIZE_KILOBYTES "KiB"
|
||||||
|
#define D_FILE_SIZE_MEGABYTES "MiB"
|
||||||
|
#define D_FILE_SIZE_GIGABYTES "GiB"
|
||||||
|
#define D_FILE_SIZE_TERABYTES "TiB"
|
||||||
|
#define D_FILE_SIZE_DIVIDER 1024 // kibi eller kilo bytes
|
||||||
|
#define D_DECIMAL_POINT "." // kommatecken eller punkt
|
||||||
|
|
||||||
|
#define D_SERVICE_STARTING "Startar..."
|
||||||
|
#define D_SERVICE_STARTED "Startat"
|
||||||
|
#define D_SERVICE_START_FAILED "Misslyckades att starta"
|
||||||
|
#define D_SERVICE_STOPPED "Stoppat"
|
||||||
|
#define D_SERVICE_DISABLED "Inaktiverad"
|
||||||
|
#define D_SERVICE_CONNECTED "Ansluten"
|
||||||
|
#define D_SERVICE_DISCONNECTED "Frånkopplad"
|
||||||
|
|
||||||
|
#define D_SETTING_ENABLED "Aktiverad"
|
||||||
|
#define D_SETTING_DISABLED "Inaktiverad"
|
||||||
|
#define D_SETTING_DEFAULT "Standard"
|
||||||
|
|
||||||
|
#define D_NETWORK_IP_ADDRESS_RECEIVED "Mottagen IP-adress %s"
|
||||||
|
#define D_NETWORK_ONLINE "online"
|
||||||
|
#define D_NETWORK_OFFLINE "offline"
|
||||||
|
#define D_NETWORK_CONNECTION_FAILED "Anslutning misslyckades"
|
||||||
|
#define D_NETWORK_CONNECTION_UNAUTHORIZED "Auktorisering misslyckades"
|
||||||
|
|
||||||
|
#define D_MQTT_DEFAULT_NAME "plate_%s"
|
||||||
|
#define D_MQTT_CONNECTING "Ansluter..."
|
||||||
|
#define D_MQTT_CONNECTED "Ansluten till broker %s som clientID %s"
|
||||||
|
#define D_MQTT_NOT_CONNECTED "Inte ansluten ???"
|
||||||
|
#define D_MQTT_DISCONNECTING "Kopplar från..."
|
||||||
|
#define D_MQTT_DISCONNECTED "Frånkopplad"
|
||||||
|
#define D_MQTT_RECONNECTING "Frånkopplad från broker, återansluter..."
|
||||||
|
#define D_MQTT_NOT_CONFIGURED "Broker är inte konfigurerad"
|
||||||
|
#define D_MQTT_STARTED "Startat: %d bytes"
|
||||||
|
#define D_MQTT_FAILED "Misslyckades:"
|
||||||
|
#define D_MQTT_INVALID_TOPIC "Meddelande har ogiltigt topic"
|
||||||
|
#define D_MQTT_SUBSCRIBED "Prenumererade på %s"
|
||||||
|
#define D_MQTT_NOT_SUBSCRIBED "Misslyckades att prenumerera på %s"
|
||||||
|
#define D_MQTT_HA_AUTO_DISCOVERY "Registrera HA auto-discovery"
|
||||||
|
#define D_MQTT_PAYLOAD_TOO_LONG "Payload för lång (%u bytes)"
|
||||||
|
|
||||||
|
#define D_TELNET_CLOSING_CONNECTION "Stänger session från %s"
|
||||||
|
#define D_TELNET_CLIENT_LOGIN_FROM "Klientinloggning från %s"
|
||||||
|
#define D_TELNET_CLIENT_CONNECT_FROM "Klient ansluten från %s"
|
||||||
|
#define D_TELNET_CLIENT_NOT_CONNECTED "Klient INTE ansluten"
|
||||||
|
#define D_TELNET_INCORRECT_LOGIN_ATTEMPT "Felaktigt inloggningsförsök från %s"
|
||||||
|
#define D_TELNET_STARTED "Telnet-konsol startad"
|
||||||
|
#define D_TELNET_FAILED "Misslyckades att starta telnet-konsolen"
|
||||||
|
#define D_TELNET_CLIENT_CONNECTED "Klient ansluten"
|
||||||
|
#define D_TELNET_CLIENT_REJECTED "Klient avvisad"
|
||||||
|
|
||||||
|
#define D_HASP_INVALID_PAGE "Ogiltig sida %u"
|
||||||
|
#define D_HASP_INVALID_LAYER "Kan inte rensa systemlager"
|
||||||
|
#define D_HASP_CHANGE_PAGE "Byter sida till %u"
|
||||||
|
#define D_HASP_CLEAR_PAGE "Rensar sida %u"
|
||||||
|
|
||||||
|
#define D_OBJECT_DELETED "Objektet borttaget"
|
||||||
|
#define D_OBJECT_UNKNOWN "Okänt objekt"
|
||||||
|
#define D_OBJECT_MISMATCH "Objekt matchar INTE!"
|
||||||
|
#define D_OBJECT_LOST "Förlorat objekt!"
|
||||||
|
#define D_OBJECT_CREATE_FAILED "Misslyckades att skapa objekt-id %u"
|
||||||
|
#define D_OBJECT_PAGE_UNKNOWN "Sida ID %u inte skapad"
|
||||||
|
#define D_OBJECT_EVENT_UNKNOWN "Okänd händelse %d"
|
||||||
|
|
||||||
|
#define D_ATTRIBUTE_UNKNOWN "Okänd egenskap %s"
|
||||||
|
// D_ATTRIBUTE_OBSOLETE D_ATTRIBUTE_INSTEAD kan användas tillsammans eller bara D_ATTRIBUTE_OBSOLETE ensam
|
||||||
|
#define D_ATTRIBUTE_OBSOLETE "%s är föråldrad"
|
||||||
|
#define D_ATTRIBUTE_INSTEAD ", använd %s istället"
|
||||||
|
#define D_ATTRIBUTE_READ_ONLY "%s är skrivskyddad"
|
||||||
|
#define D_ATTRIBUTE_PAGE_METHOD_INVALID "Kan inte anropa %s på en sida"
|
||||||
|
#define D_ATTRIBUTE_ALIGN_INVALID "Ogiltig align-värde: %s"
|
||||||
|
#define D_ATTRIBUTE_COLOR_INVALID "Ogiltig färg-värde: %s"
|
||||||
|
#define D_ATTRIBUTE_LONG_MODE_INVALID "Ogiltigt long-läge: %s"
|
||||||
|
|
||||||
|
#define D_OOBE_SSID_VALIDATED "SSID %s validerat"
|
||||||
|
#define D_OOBE_AUTO_CALIBRATE "Automatisk kalibrering aktiverad"
|
||||||
|
#define D_OOBE_CALIBRATED "Redan kalibrerad"
|
||||||
|
|
||||||
|
#define D_DISPATCH_COMMAND_NOT_FOUND "Kommando '%s' hittades inte
|
||||||
|
#define D_DISPATCH_INVALID_PAGE "Ogiltig sida %s"
|
||||||
|
#define D_DISPATCH_REBOOT "Startar om MCU nu!"
|
||||||
|
|
||||||
|
#define D_JSON_FAILED "JSON parsning misslyckades:"
|
||||||
|
#define D_JSONL_FAILED "JSONL parsning misslyckades på rad %u"
|
||||||
|
#define D_JSONL_SUCCEEDED "Jsonl helt tolkad"
|
||||||
|
|
||||||
|
#define D_OTA_CHECK_UPDATE "Försöker uppdatera URL: %s"
|
||||||
|
#define D_OTA_CHECK_COMPLETE "Uppdateringskontroll slutförd"
|
||||||
|
#define D_OTA_CHECK_FAILED "Uppdateringskontroll misslyckades: %s"
|
||||||
|
#define D_OTA_UPDATE_FIRMWARE "OTA Uppdatering"
|
||||||
|
#define D_OTA_UPDATE_COMPLETE "OTA Uppdatering klar"
|
||||||
|
#define D_OTA_UPDATE_APPLY "Sparar fast programvara och startar om"
|
||||||
|
#define D_OTA_UPDATE_FAILED "OTA Uppdatering misslyckades"
|
||||||
|
#define D_OTA_UPDATING_FIRMWARE "Uppdatera den inbyggda programvaran..."
|
||||||
|
#define D_OTA_UPDATING_FILESYSTEM "Uppdaterar filsystemet..."
|
||||||
|
|
||||||
|
#define D_HTTP_HASP_DESIGN "HASP Design"
|
||||||
|
#define D_HTTP_INFORMATION "Information"
|
||||||
|
#define D_HTTP_HTTP_SETTINGS "HTTP-inställningar"
|
||||||
|
#define D_HTTP_FTP_SETTINGS "FTP-inställningar"
|
||||||
|
#define D_HTTP_WIFI_INSTÄLLNINGAR "Wifi-inställningar"
|
||||||
|
#define D_HTTP_WIREGUARD_INSTÄLLNINGAR "WireGuard inställningar"
|
||||||
|
#define D_HTTP_MQTT_INSTÄLLNINGAR "MQTT-inställningar"
|
||||||
|
#define D_HTTP_GPIO_SETTINGS "GPIO-inställningar"
|
||||||
|
#define D_HTTP_MDNS_INSTÄLLNINGAR "mDNS-inställningar"
|
||||||
|
#define D_HTTP_TELNET_INSTÄLLNINGAR "Telnet-inställningar"
|
||||||
|
#define D_HTTP_DEBUG_INSTÄLLNINGAR "Debug-inställningar"
|
||||||
|
#define D_HTTP_GUI_INSTÄLLNINGAR "Visningsinställningar"
|
||||||
|
#define D_HTTP_SAVE_SETTINGS "Spara inställningar"
|
||||||
|
#define D_HTTP_UPLOAD_FILE "Ladda upp fil"
|
||||||
|
#define D_HTTP_ERASE_DEVICE "Återställ alla inställningar"
|
||||||
|
#define D_HTTP_ADD_GPIO "Lägg till ny GPIO"
|
||||||
|
#define D_HTTP_BACK "Tillbaka"
|
||||||
|
#define D_HTTP_REFRESH "Uppdatera"
|
||||||
|
#define D_HTTP_PREV_PAGE "Föregående sida"
|
||||||
|
#define D_HTTP_NEXT_PAGE "Nästa sida"
|
||||||
|
#define D_HTTP_CALIBRATE "Kalibrera"
|
||||||
|
#define D_HTTP_ANTIBURN "Kör Anti Burn-in"
|
||||||
|
#define D_HTTP_SCREENSHOT "Skärmdump"
|
||||||
|
#define D_HTTP_FILE_BROWSER "Filredigerare"
|
||||||
|
#define D_HTTP_FIRMWARE_UPGRADE "Uppgradering av fast programvara"
|
||||||
|
#define D_HTTP_UPDATE_FIRMWARE "Uppdatera fast programvara"
|
||||||
|
#define D_HTTP_FACTORY_RESET "Fabriksåterställning"
|
||||||
|
#define D_HTTP_MAIN_MENU "Huvudmeny"
|
||||||
|
#define D_HTTP_REBOOT "Omstart"
|
||||||
|
#define D_HTTP_CONFIGURATION "Konfiguration"
|
||||||
|
#define D_HTTP_CONFIG_CHANGED \
|
||||||
|
"Konfigurationen har ändrats, klicka på <a href='/reboot'>Starta om</a> för att spara ändringar."
|
||||||
|
#define D_HTTP_SENDING_PAGE "Skickat %S sida till %s"
|
||||||
|
#define D_HTTP_FOOTER "av Francis Van Roie"
|
||||||
|
|
||||||
|
#define D_INFO_VERSION "Version"
|
||||||
|
#define D_INFO_BUILD_DATETIME "Byggd datum/tid"
|
||||||
|
#define D_INFO_ENVIRONMENT "Miljö"
|
||||||
|
#define D_INFO_UPTIME "Uptime"
|
||||||
|
#define D_INFO_FREE_HEAP "Ledig Heap"
|
||||||
|
#define D_INFO_FREE_BLOCK "Lediga Block"
|
||||||
|
#define D_INFO_DEVICE_MEMORY "Enhetsminne"
|
||||||
|
#define D_INFO_LVGL_MEMORY "LVGL-minne"
|
||||||
|
#define D_INFO_TOTAL_MEMORY "Totalt"
|
||||||
|
#define D_INFO_FREE_MEMORY "Ledigt"
|
||||||
|
#define D_INFO_FRAGMENTATION "Fragmentering"
|
||||||
|
#define D_INFO_PSRAM_FREE "Ledigt PSRam"
|
||||||
|
#define D_INFO_PSRAM_SIZE "PSRam storlek"
|
||||||
|
#define D_INFO_FLASH_SIZE "Flash storlek"
|
||||||
|
#define D_INFO_SKETCH_USED "Använd programstorlek"
|
||||||
|
#define D_INFO_SKETCH_FREE "Ledig programstorlek"
|
||||||
|
#define D_INFO_FS_SIZE "Storlek på filsystem"
|
||||||
|
#define D_INFO_FS_USED "Använt av filsystem"
|
||||||
|
#define D_INFO_FS_FREE "Filsystem ledigt"
|
||||||
|
#define D_INFO_MODULE "Modul"
|
||||||
|
#define D_INFO_MODEL "Modell"
|
||||||
|
#define D_INFO_FREQUENCY "Frekvens"
|
||||||
|
#define D_INFO_CORE_VERSION "Core version"
|
||||||
|
#define D_INFO_RESET_REASON "Omstartsorsak"
|
||||||
|
#define D_INFO_STATUS "Status"
|
||||||
|
#define D_INFO_SERVER "Server"
|
||||||
|
#define D_INFO_USERNAME "Username"
|
||||||
|
#define D_INFO_CLIENTID "Klient-ID"
|
||||||
|
// #define D_INFO_CONNECTED "Ansluten"
|
||||||
|
// #define D_INFO_DISCONNECTED "Frånkopplad"
|
||||||
|
#define D_INFO_RECEIVED "Mottaget"
|
||||||
|
#define D_INFO_PUBLISHED "Publicerat"
|
||||||
|
#define D_INFO_FAILED "Misslyckade"
|
||||||
|
#define D_INFO_ETHERNET "Ethernet"
|
||||||
|
#define D_INFO_WIFI "Wifi"
|
||||||
|
#define D_INFO_WIREGUARD "WireGuard"
|
||||||
|
#define D_INFO_LINK_SPEED "Länkhastighet"
|
||||||
|
#define D_INFO_FULL_DUPLEX "Full duplex"
|
||||||
|
#define D_INFO_BSSID "BSSID"
|
||||||
|
#define D_INFO_SSID "SSID"
|
||||||
|
#define D_INFO_RSSI "Signalstyrka"
|
||||||
|
#define D_INFO_IP_ADDRESS "IP-adress"
|
||||||
|
#define D_INFO_MAC_ADDRESS "MAC-adress"
|
||||||
|
#define D_INFO_GATEWAY "Gateway"
|
||||||
|
#define D_INFO_DNS_SERVER "DNS-server"
|
||||||
|
#define D_INFO_ENDPOINT_IP "Slutpunkt IP"
|
||||||
|
#define D_INFO_ENDPOINT_PORT "Slutpunkt port"
|
||||||
|
|
||||||
|
#define D_OOBE_MSG "Tryck på skärmen för att konfigurera WiFi eller ansluta till denna accesspunkt:"
|
||||||
|
#define D_OOBE_SCAN_TO_CONNECT "Skanna för att ansluta"
|
||||||
|
|
||||||
|
#define D_WIFI_CONNECTING_TO "Ansluter till %s"
|
||||||
|
#define D_WIFI_CONNECTED_TO "Ansluten till %s, begär IP..."
|
||||||
|
#define D_WIFI_RSSI_EXCELLENT "Utmärkt"
|
||||||
|
#define D_WIFI_RSSI_GOOD "Bra"
|
||||||
|
#define D_WIFI_RSSI_FAIR "Hygglig"
|
||||||
|
#define D_WIFI_RSSI_WEAK "Svag"
|
||||||
|
#define D_WIFI_RSSI_BAD "Mycket dålig"
|
||||||
|
|
||||||
|
#define D_WG_INITIALIZED "Initierad"
|
||||||
|
#define D_WG_BAD_CONFIG "Saknad eller felaktig konfiguration"
|
||||||
|
|
||||||
|
#define D_GPIO_SWITCH "Omkopplare"
|
||||||
|
#define D_GPIO_BUTTON "Tryckknapp"
|
||||||
|
#define D_GPIO_TOUCH "Kapacitiv beröring"
|
||||||
|
#define D_GPIO_LED "Lysdiod"
|
||||||
|
#define D_GPIO_LED_R "Stämning röd"
|
||||||
|
#define D_GPIO_LED_G "Stämning grön"
|
||||||
|
#define D_GPIO_LED_B "Stämning blå"
|
||||||
|
#define D_GPIO_POWER_RELAY "Effektrelä"
|
||||||
|
#define D_GPIO_LIGHT_RELAY "Relä"
|
||||||
|
#define D_GPIO_PWM "PWM"
|
||||||
|
#define D_GPIO_DAC "DAC"
|
||||||
|
#define D_GPIO_SERIAL_DIMMER "Seriell dimmer"
|
||||||
|
#define D_GPIO_UNKNOWN "Okänt"
|
||||||
|
#define D_GPIO_PIN "GPIO"
|
||||||
|
#define D_GPIO_GROUP "Grupp"
|
||||||
|
#define D_GPIO_GROUP_NONE "Ingen"
|
||||||
|
#define D_GPIO_STATE_NORMAL "Normal"
|
||||||
|
#define D_GPIO_STATE_INVERTED "Inverterad"
|
||||||
|
|
||||||
|
#endif
|
@ -30,6 +30,7 @@
|
|||||||
#define D_FILE_SIZE_KILOBYTES "KiB"
|
#define D_FILE_SIZE_KILOBYTES "KiB"
|
||||||
#define D_FILE_SIZE_MEGABYTES "MiB"
|
#define D_FILE_SIZE_MEGABYTES "MiB"
|
||||||
#define D_FILE_SIZE_GIGABYTES "GiB"
|
#define D_FILE_SIZE_GIGABYTES "GiB"
|
||||||
|
#define D_FILE_SIZE_TERABYTES "TiB"
|
||||||
#define D_FILE_SIZE_DIVIDER 1024 // kibi or kilo bytes
|
#define D_FILE_SIZE_DIVIDER 1024 // kibi or kilo bytes
|
||||||
#define D_DECIMAL_POINT "." // decimal comma or point
|
#define D_DECIMAL_POINT "." // decimal comma or point
|
||||||
|
|
||||||
|
12
src/main.cpp
12
src/main.cpp
@ -136,7 +136,7 @@ void setup()
|
|||||||
slaveSetup();
|
slaveSetup();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HASP_USE_CUSTOM)
|
#if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
|
||||||
custom_setup();
|
custom_setup();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ IRAM_ATTR void loop()
|
|||||||
consoleLoop();
|
consoleLoop();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HASP_USE_CUSTOM)
|
#if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
|
||||||
custom_loop();
|
custom_loop();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -210,6 +210,10 @@ IRAM_ATTR void loop()
|
|||||||
/* Runs Every Second */
|
/* Runs Every Second */
|
||||||
haspEverySecond(); // sleep timer & statusupdate
|
haspEverySecond(); // sleep timer & statusupdate
|
||||||
|
|
||||||
|
#if HASP_USE_MQTT > 0
|
||||||
|
mqttEverySecond();
|
||||||
|
#endif
|
||||||
|
|
||||||
#if HASP_USE_FTP > 0
|
#if HASP_USE_FTP > 0
|
||||||
ftpEverySecond();
|
ftpEverySecond();
|
||||||
#endif
|
#endif
|
||||||
@ -218,7 +222,7 @@ IRAM_ATTR void loop()
|
|||||||
telnetEverySecond();
|
telnetEverySecond();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HASP_USE_CUSTOM)
|
#if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
|
||||||
custom_every_second();
|
custom_every_second();
|
||||||
#endif
|
#endif
|
||||||
// debugEverySecond();
|
// debugEverySecond();
|
||||||
@ -239,7 +243,7 @@ IRAM_ATTR void loop()
|
|||||||
// gpioEvery5Seconds();
|
// gpioEvery5Seconds();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HASP_USE_CUSTOM)
|
#if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
|
||||||
custom_every_5seconds();
|
custom_every_5seconds();
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
@ -18,12 +18,13 @@ typedef enum {
|
|||||||
|
|
||||||
void mqttSetup();
|
void mqttSetup();
|
||||||
IRAM_ATTR void mqttLoop();
|
IRAM_ATTR void mqttLoop();
|
||||||
|
void mqttEverySecond();
|
||||||
void mqttEvery5Seconds(bool wifiIsConnected);
|
void mqttEvery5Seconds(bool wifiIsConnected);
|
||||||
void mqttStart();
|
void mqttStart();
|
||||||
void mqttStop();
|
void mqttStop();
|
||||||
|
|
||||||
// int mqtt_send_object_state(uint8_t pageid, uint8_t btnid, const char* payload);
|
// int mqtt_send_object_state(uint8_t pageid, uint8_t btnid, const char* payload);
|
||||||
int mqtt_send_state(const char* subtopic, const char* payload);
|
int mqtt_send_state(const char* subtopic, const char* payload, bool retain=false);
|
||||||
int mqtt_send_discovery(const char* payload, size_t len);
|
int mqtt_send_discovery(const char* payload, size_t len);
|
||||||
int mqttPublish(const char* topic, const char* payload, size_t len, bool retain);
|
int mqttPublish(const char* topic, const char* payload, size_t len, bool retain);
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ bool last_mqtt_state = false;
|
|||||||
bool current_mqtt_state = false;
|
bool current_mqtt_state = false;
|
||||||
uint16_t mqtt_reconnect_counter = 0;
|
uint16_t mqtt_reconnect_counter = 0;
|
||||||
|
|
||||||
void mqtt_run_scripts()
|
static inline void mqtt_run_scripts()
|
||||||
{
|
{
|
||||||
if(last_mqtt_state != current_mqtt_state) {
|
if(last_mqtt_state != current_mqtt_state) {
|
||||||
// mqtt_message_t data;
|
// mqtt_message_t data;
|
||||||
@ -104,8 +104,8 @@ void mqtt_run_scripts()
|
|||||||
void mqtt_disconnected()
|
void mqtt_disconnected()
|
||||||
{
|
{
|
||||||
current_mqtt_state = false; // now we are disconnected
|
current_mqtt_state = false; // now we are disconnected
|
||||||
// mqtt_run_scripts();
|
|
||||||
mqtt_reconnect_counter++;
|
mqtt_reconnect_counter++;
|
||||||
|
// mqtt_run_scripts(); // must happen in LVGL loop
|
||||||
}
|
}
|
||||||
|
|
||||||
void mqtt_connected()
|
void mqtt_connected()
|
||||||
@ -115,7 +115,7 @@ void mqtt_connected()
|
|||||||
current_mqtt_state = true; // now we are connected
|
current_mqtt_state = true; // now we are connected
|
||||||
LOG_VERBOSE(TAG_MQTT, F("%s"), current_mqtt_state ? PSTR(D_SERVICE_CONNECTED) : PSTR(D_SERVICE_DISCONNECTED));
|
LOG_VERBOSE(TAG_MQTT, F("%s"), current_mqtt_state ? PSTR(D_SERVICE_CONNECTED) : PSTR(D_SERVICE_DISCONNECTED));
|
||||||
}
|
}
|
||||||
// mqtt_run_scripts();
|
// mqtt_run_scripts(); // must happen in LVGL loop
|
||||||
}
|
}
|
||||||
|
|
||||||
int mqttPublish(const char* topic, const char* payload, size_t len, bool retain)
|
int mqttPublish(const char* topic, const char* payload, size_t len, bool retain)
|
||||||
@ -165,7 +165,7 @@ bool mqtt_send_lwt(bool online)
|
|||||||
// return mqttPublish(tmp_topic, payload, false);
|
// return mqttPublish(tmp_topic, payload, false);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
int mqtt_send_state(const char* subtopic, const char* payload)
|
int mqtt_send_state(const char* subtopic, const char* payload, bool retain)
|
||||||
{
|
{
|
||||||
String tmp_topic((char*)0);
|
String tmp_topic((char*)0);
|
||||||
tmp_topic.reserve(128);
|
tmp_topic.reserve(128);
|
||||||
@ -174,7 +174,7 @@ int mqtt_send_state(const char* subtopic, const char* payload)
|
|||||||
// tmp_topic += "/";
|
// tmp_topic += "/";
|
||||||
tmp_topic += subtopic;
|
tmp_topic += subtopic;
|
||||||
|
|
||||||
return mqttPublish(tmp_topic.c_str(), payload, false);
|
return mqttPublish(tmp_topic.c_str(), payload, retain);
|
||||||
}
|
}
|
||||||
|
|
||||||
int mqtt_send_discovery(const char* payload, size_t len)
|
int mqtt_send_discovery(const char* payload, size_t len)
|
||||||
@ -337,7 +337,7 @@ String mqttGetTopic(Preferences preferences, String subtopic, String key, String
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void mqttParseTopic(String *topic, String subtopic, bool add_slash)
|
void mqttParseTopic(String* topic, String subtopic, bool add_slash)
|
||||||
{
|
{
|
||||||
|
|
||||||
topic->replace(F("%hostname%"), haspDevice.get_hostname());
|
topic->replace(F("%hostname%"), haspDevice.get_hostname());
|
||||||
@ -371,7 +371,7 @@ void onMqttConnect(esp_mqtt_client_handle_t client)
|
|||||||
// mqttSubscribeTo(mqttGroupTopic + subtopic);
|
// mqttSubscribeTo(mqttGroupTopic + subtopic);
|
||||||
// mqttSubscribeTo(mqttNodeTopic + subtopic);
|
// mqttSubscribeTo(mqttNodeTopic + subtopic);
|
||||||
|
|
||||||
#if defined(HASP_USE_CUSTOM)
|
#if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
|
||||||
String subtopic = F(MQTT_TOPIC_CUSTOM "/#");
|
String subtopic = F(MQTT_TOPIC_CUSTOM "/#");
|
||||||
mqttSubscribeTo(mqttGroupCommandTopic + subtopic);
|
mqttSubscribeTo(mqttGroupCommandTopic + subtopic);
|
||||||
mqttSubscribeTo(mqttNodeCommandTopic + subtopic);
|
mqttSubscribeTo(mqttNodeCommandTopic + subtopic);
|
||||||
@ -509,10 +509,14 @@ IRAM_ATTR void mqttLoop(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void mqttEvery5Seconds(bool networkIsConnected)
|
void mqttEverySecond()
|
||||||
{
|
{
|
||||||
mqtt_run_scripts();
|
mqtt_run_scripts();
|
||||||
// if(mqttEnabled && networkIsConnected && !mqttClientConnected) {
|
}
|
||||||
|
|
||||||
|
void mqttEvery5Seconds(bool networkIsConnected)
|
||||||
|
{
|
||||||
|
// if(mqttEnabled && networkIsConnected && !current_mqtt_state) {
|
||||||
// LOG_TRACE(TAG_MQTT, F(D_MQTT_RECONNECTING));
|
// LOG_TRACE(TAG_MQTT, F(D_MQTT_RECONNECTING));
|
||||||
// mqttStart();
|
// mqttStart();
|
||||||
// }
|
// }
|
||||||
@ -535,7 +539,7 @@ void mqttStart()
|
|||||||
nvsOldGroup += preferences.getString(FP_CONFIG_GROUP, MQTT_GROUPNAME);
|
nvsOldGroup += preferences.getString(FP_CONFIG_GROUP, MQTT_GROUPNAME);
|
||||||
nvsOldGroup += "/%topic%";
|
nvsOldGroup += "/%topic%";
|
||||||
|
|
||||||
subtopic = F(MQTT_TOPIC_COMMAND);
|
subtopic = F(MQTT_TOPIC_COMMAND);
|
||||||
mqttNodeCommandTopic = preferences.getString(FP_CONFIG_NODE_TOPIC, MQTT_DEFAULT_NODE_TOPIC);
|
mqttNodeCommandTopic = preferences.getString(FP_CONFIG_NODE_TOPIC, MQTT_DEFAULT_NODE_TOPIC);
|
||||||
mqttParseTopic(&mqttNodeCommandTopic, subtopic, false);
|
mqttParseTopic(&mqttNodeCommandTopic, subtopic, false);
|
||||||
mqttGroupCommandTopic = preferences.getString(FP_CONFIG_GROUP_TOPIC, nvsOldGroup.c_str());
|
mqttGroupCommandTopic = preferences.getString(FP_CONFIG_GROUP_TOPIC, nvsOldGroup.c_str());
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
|
|
||||||
/* Multi threaded asynchronous paho client */
|
/* Multi threaded asynchronous paho client */
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include "hasp_conf.h"
|
#include "hasp_conf.h"
|
||||||
|
|
||||||
#if HASP_USE_MQTT_ASYNC > 0
|
#if HASP_USE_MQTT_ASYNC > 0
|
||||||
@ -47,7 +45,7 @@ const char FP_CONFIG_GROUP[] PROGMEM = "group";
|
|||||||
#include "hasp_mqtt.h" // functions to implement here
|
#include "hasp_mqtt.h" // functions to implement here
|
||||||
|
|
||||||
#include "hasp/hasp_dispatch.h" // for dispatch_topic_payload
|
#include "hasp/hasp_dispatch.h" // for dispatch_topic_payload
|
||||||
#include "hasp_debug.h" // for logging
|
#include "hasp_debug.h" // for logging
|
||||||
|
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -286,11 +284,11 @@ bool mqttIsConnected()
|
|||||||
return mqttConnected; // MQTTAsync_isConnected(mqtt_client); // <- deadlocking on Linux
|
return mqttConnected; // MQTTAsync_isConnected(mqtt_client); // <- deadlocking on Linux
|
||||||
}
|
}
|
||||||
|
|
||||||
int mqtt_send_state(const __FlashStringHelper* subtopic, const char* payload)
|
int mqtt_send_state(const __FlashStringHelper* subtopic, const char* payload, bool retain)
|
||||||
{
|
{
|
||||||
char tmp_topic[mqttNodeTopic.length() + 20];
|
char tmp_topic[mqttNodeTopic.length() + 20];
|
||||||
snprintf_P(tmp_topic, sizeof(tmp_topic), ("%s" MQTT_TOPIC_STATE "/%s"), mqttNodeTopic.c_str(), subtopic);
|
snprintf_P(tmp_topic, sizeof(tmp_topic), ("%s" MQTT_TOPIC_STATE "/%s"), mqttNodeTopic.c_str(), subtopic);
|
||||||
return mqttPublish(tmp_topic, payload, strlen(payload), false);
|
return mqttPublish(tmp_topic, payload, strlen(payload), retain);
|
||||||
}
|
}
|
||||||
|
|
||||||
int mqtt_send_discovery(const char* payload, size_t len)
|
int mqtt_send_discovery(const char* payload, size_t len)
|
||||||
@ -330,7 +328,7 @@ static void onConnect(void* context, MQTTAsync_successData* response)
|
|||||||
topic = mqttNodeTopic + "config/#";
|
topic = mqttNodeTopic + "config/#";
|
||||||
mqtt_subscribe(mqtt_client, topic.c_str());
|
mqtt_subscribe(mqtt_client, topic.c_str());
|
||||||
|
|
||||||
#if defined(HASP_USE_CUSTOM)
|
#if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
|
||||||
topic = mqttGroupTopic + MQTT_TOPIC_CUSTOM "/#";
|
topic = mqttGroupTopic + MQTT_TOPIC_CUSTOM "/#";
|
||||||
mqtt_subscribe(mqtt_client, topic.c_str());
|
mqtt_subscribe(mqtt_client, topic.c_str());
|
||||||
|
|
||||||
@ -438,7 +436,10 @@ void mqttSetup()
|
|||||||
mqttLwtTopic += MQTT_TOPIC_LWT;
|
mqttLwtTopic += MQTT_TOPIC_LWT;
|
||||||
}
|
}
|
||||||
|
|
||||||
IRAM_ATTR void mqttLoop(){};
|
IRAM_ATTR void mqttLoop() {};
|
||||||
|
|
||||||
|
void mqttEverySecond()
|
||||||
|
{}
|
||||||
|
|
||||||
void mqttEvery5Seconds(bool wifiIsConnected)
|
void mqttEvery5Seconds(bool wifiIsConnected)
|
||||||
{
|
{
|
||||||
|
@ -226,11 +226,11 @@ bool mqttIsConnected()
|
|||||||
return MQTTClient_isConnected(mqtt_client);
|
return MQTTClient_isConnected(mqtt_client);
|
||||||
}
|
}
|
||||||
|
|
||||||
int mqtt_send_state(const __FlashStringHelper* subtopic, const char* payload)
|
int mqtt_send_state(const __FlashStringHelper* subtopic, const char* payload, bool retain)
|
||||||
{
|
{
|
||||||
char tmp_topic[mqttNodeTopic.length() + 20];
|
char tmp_topic[mqttNodeTopic.length() + 20];
|
||||||
snprintf_P(tmp_topic, sizeof(tmp_topic), ("%s" MQTT_TOPIC_STATE "/%s"), mqttNodeTopic.c_str(), subtopic);
|
snprintf_P(tmp_topic, sizeof(tmp_topic), ("%s" MQTT_TOPIC_STATE "/%s"), mqttNodeTopic.c_str(), subtopic);
|
||||||
return mqttPublish(tmp_topic, payload, strlen(payload), false);
|
return mqttPublish(tmp_topic, payload, strlen(payload), retain);
|
||||||
}
|
}
|
||||||
|
|
||||||
int mqtt_send_discovery(const char* payload, size_t len)
|
int mqtt_send_discovery(const char* payload, size_t len)
|
||||||
@ -269,7 +269,7 @@ static void onConnect(void* context)
|
|||||||
topic = mqttNodeTopic + "config/#";
|
topic = mqttNodeTopic + "config/#";
|
||||||
mqtt_subscribe(mqtt_client, topic.c_str());
|
mqtt_subscribe(mqtt_client, topic.c_str());
|
||||||
|
|
||||||
#if defined(HASP_USE_CUSTOM)
|
#if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
|
||||||
topic = mqttGroupTopic + MQTT_TOPIC_CUSTOM "/#";
|
topic = mqttGroupTopic + MQTT_TOPIC_CUSTOM "/#";
|
||||||
mqtt_subscribe(mqtt_client, topic.c_str());
|
mqtt_subscribe(mqtt_client, topic.c_str());
|
||||||
|
|
||||||
@ -391,6 +391,9 @@ IRAM_ATTR void mqttLoop()
|
|||||||
if(rc == MQTTCLIENT_SUCCESS && message) mqtt_message_arrived(mqtt_client, topicName, topicLen, message);
|
if(rc == MQTTCLIENT_SUCCESS && message) mqtt_message_arrived(mqtt_client, topicName, topicLen, message);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void mqttEverySecond()
|
||||||
|
{}
|
||||||
|
|
||||||
void mqttEvery5Seconds(bool wifiIsConnected)
|
void mqttEvery5Seconds(bool wifiIsConnected)
|
||||||
{
|
{
|
||||||
if(!mqttIsConnected()) {
|
if(!mqttIsConnected()) {
|
||||||
|
@ -14,10 +14,10 @@
|
|||||||
|
|
||||||
#if defined(ARDUINO_ARCH_ESP32)
|
#if defined(ARDUINO_ARCH_ESP32)
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
#include <WiFiClientSecure.h>
|
// #include <WiFiClientSecure.h>
|
||||||
WiFiClient mqttNetworkClient;
|
WiFiClient mqttNetworkClient;
|
||||||
// WiFiClientSecure mqttNetworkClient;
|
// WiFiClientSecure mqttNetworkClient;
|
||||||
extern const uint8_t rootca_crt_bundle_start[] asm("_binary_data_cert_x509_crt_bundle_bin_start");
|
// extern const uint8_t rootca_crt_bundle_start[] asm("_binary_data_cert_x509_crt_bundle_bin_start");
|
||||||
#elif defined(ARDUINO_ARCH_ESP8266)
|
#elif defined(ARDUINO_ARCH_ESP8266)
|
||||||
#include <ESP8266WiFi.h>
|
#include <ESP8266WiFi.h>
|
||||||
#include <EEPROM.h>
|
#include <EEPROM.h>
|
||||||
@ -117,11 +117,11 @@ bool mqtt_send_lwt(bool online)
|
|||||||
// return mqttPublish(tmp_topic, payload, false);
|
// return mqttPublish(tmp_topic, payload, false);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
int mqtt_send_state(const char* subtopic, const char* payload)
|
int mqtt_send_state(const char* subtopic, const char* payload, bool retain)
|
||||||
{
|
{
|
||||||
char tmp_topic[strlen(mqttNodeTopic) + strlen(subtopic) + 16];
|
char tmp_topic[strlen(mqttNodeTopic) + strlen(subtopic) + 16];
|
||||||
snprintf_P(tmp_topic, sizeof(tmp_topic), PSTR("%s" MQTT_TOPIC_STATE "/%s"), mqttNodeTopic, subtopic);
|
snprintf_P(tmp_topic, sizeof(tmp_topic), PSTR("%s" MQTT_TOPIC_STATE "/%s"), mqttNodeTopic, subtopic);
|
||||||
return mqttPublish(tmp_topic, payload, false);
|
return mqttPublish(tmp_topic, payload, retain);
|
||||||
}
|
}
|
||||||
|
|
||||||
int mqtt_send_discovery(const char* payload, size_t len)
|
int mqtt_send_discovery(const char* payload, size_t len)
|
||||||
@ -311,7 +311,7 @@ void mqttStart()
|
|||||||
snprintf_P(topic, sizeof(topic), PSTR("%s" MQTT_TOPIC_CONFIG "/#"), mqttNodeTopic);
|
snprintf_P(topic, sizeof(topic), PSTR("%s" MQTT_TOPIC_CONFIG "/#"), mqttNodeTopic);
|
||||||
mqttSubscribeTo(topic);
|
mqttSubscribeTo(topic);
|
||||||
|
|
||||||
#if defined(HASP_USE_CUSTOM)
|
#if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
|
||||||
snprintf_P(topic, sizeof(topic), PSTR("%s" MQTT_TOPIC_CUSTOM "/#"), mqttGroupTopic);
|
snprintf_P(topic, sizeof(topic), PSTR("%s" MQTT_TOPIC_CUSTOM "/#"), mqttGroupTopic);
|
||||||
mqttSubscribeTo(topic);
|
mqttSubscribeTo(topic);
|
||||||
snprintf_P(topic, sizeof(topic), PSTR("%s" MQTT_TOPIC_CUSTOM "/#"), mqttNodeTopic);
|
snprintf_P(topic, sizeof(topic), PSTR("%s" MQTT_TOPIC_CUSTOM "/#"), mqttNodeTopic);
|
||||||
|
@ -123,7 +123,7 @@ static void gpio_event_handler(AceButton* button, uint8_t eventType, uint8_t but
|
|||||||
bool state = false;
|
bool state = false;
|
||||||
switch(eventType) {
|
switch(eventType) {
|
||||||
case AceButton::kEventPressed:
|
case AceButton::kEventPressed:
|
||||||
if(gpioConfig[btnid].type != hasp_gpio_type_t::BUTTON) {
|
if(gpioConfig[btnid].type != hasp_gpio_type_t::BUTTON_TYPE) {
|
||||||
eventid = HASP_EVENT_ON;
|
eventid = HASP_EVENT_ON;
|
||||||
} else {
|
} else {
|
||||||
eventid = HASP_EVENT_DOWN;
|
eventid = HASP_EVENT_DOWN;
|
||||||
@ -146,7 +146,7 @@ static void gpio_event_handler(AceButton* button, uint8_t eventType, uint8_t but
|
|||||||
// state = true; // do not repeat DOWN + LONG + HOLD
|
// state = true; // do not repeat DOWN + LONG + HOLD
|
||||||
// break;
|
// break;
|
||||||
case AceButton::kEventReleased:
|
case AceButton::kEventReleased:
|
||||||
if(gpioConfig[btnid].type != hasp_gpio_type_t::BUTTON) {
|
if(gpioConfig[btnid].type != hasp_gpio_type_t::BUTTON_TYPE) {
|
||||||
eventid = HASP_EVENT_OFF;
|
eventid = HASP_EVENT_OFF;
|
||||||
} else {
|
} else {
|
||||||
eventid = HASP_EVENT_RELEASE;
|
eventid = HASP_EVENT_RELEASE;
|
||||||
@ -253,7 +253,7 @@ static void gpio_setup_pin(uint8_t index)
|
|||||||
pinMode(gpio->pin, input_mode);
|
pinMode(gpio->pin, input_mode);
|
||||||
gpio->max = 0;
|
gpio->max = 0;
|
||||||
break;
|
break;
|
||||||
case hasp_gpio_type_t::BUTTON:
|
case hasp_gpio_type_t::BUTTON_TYPE:
|
||||||
if(gpio->btn) delete gpio->btn;
|
if(gpio->btn) delete gpio->btn;
|
||||||
gpio->btn = new AceButton(&buttonConfig, gpio->pin, default_state, index);
|
gpio->btn = new AceButton(&buttonConfig, gpio->pin, default_state, index);
|
||||||
gpio->power = gpio->btn->isPressedRaw();
|
gpio->power = gpio->btn->isPressedRaw();
|
||||||
@ -776,7 +776,7 @@ bool gpioIsSystemPin(uint8_t gpio)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HASP_USE_CUSTOM)
|
#if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
|
||||||
if(custom_pin_in_use(gpio)) {
|
if(custom_pin_in_use(gpio)) {
|
||||||
LOG_DEBUG(TAG_GPIO, F(D_BULLET D_GPIO_PIN " %d => Custom"), gpio);
|
LOG_DEBUG(TAG_GPIO, F(D_BULLET D_GPIO_PIN " %d => Custom"), gpio);
|
||||||
return true;
|
return true;
|
||||||
@ -835,7 +835,7 @@ hasp_gpio_config_t gpioGetPinConfig(uint8_t num)
|
|||||||
return gpioConfig[num];
|
return gpioConfig[num];
|
||||||
}
|
}
|
||||||
|
|
||||||
void gpio_discovery(JsonObject& input, JsonArray& relay, JsonArray& light, JsonArray& dimmer)
|
void gpio_discovery(JsonObject& input, JsonArray& relay, JsonArray& light, JsonArray& dimmer, JsonArray& event)
|
||||||
{
|
{
|
||||||
char description[20] = "";
|
char description[20] = "";
|
||||||
|
|
||||||
@ -848,6 +848,10 @@ void gpio_discovery(JsonObject& input, JsonArray& relay, JsonArray& light, JsonA
|
|||||||
case hasp_gpio_type_t::POWER_RELAY:
|
case hasp_gpio_type_t::POWER_RELAY:
|
||||||
relay.add(gpioConfig[i].pin);
|
relay.add(gpioConfig[i].pin);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case BUTTON_TYPE ... TOUCH:
|
||||||
|
event.add(gpioConfig[i].pin);
|
||||||
|
break;
|
||||||
|
|
||||||
case hasp_gpio_type_t::HASP_DAC:
|
case hasp_gpio_type_t::HASP_DAC:
|
||||||
case hasp_gpio_type_t::LED: // Don't include the moodlight
|
case hasp_gpio_type_t::LED: // Don't include the moodlight
|
||||||
@ -857,8 +861,8 @@ void gpio_discovery(JsonObject& input, JsonArray& relay, JsonArray& light, JsonA
|
|||||||
dimmer.add(gpioConfig[i].pin);
|
dimmer.add(gpioConfig[i].pin);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// case BUTTON_TYPE ... TOUCH:
|
||||||
case SWITCH:
|
case SWITCH:
|
||||||
case BUTTON ... TOUCH:
|
|
||||||
strcpy_P(description, PSTR("none"));
|
strcpy_P(description, PSTR("none"));
|
||||||
break;
|
break;
|
||||||
case BATTERY:
|
case BATTERY:
|
||||||
@ -950,8 +954,8 @@ void gpio_discovery(JsonObject& input, JsonArray& relay, JsonArray& light, JsonA
|
|||||||
strcpy_P(description, PSTR("unknown"));
|
strcpy_P(description, PSTR("unknown"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if((gpioConfig[i].type >= hasp_gpio_type_t::SWITCH && gpioConfig[i].type <= hasp_gpio_type_t::WINDOW) ||
|
if((gpioConfig[i].type >= hasp_gpio_type_t::SWITCH && gpioConfig[i].type <= hasp_gpio_type_t::WINDOW)) {
|
||||||
(gpioConfig[i].type >= hasp_gpio_type_t::BUTTON && gpioConfig[i].type <= hasp_gpio_type_t::TOUCH)) {
|
// || (gpioConfig[i].type >= hasp_gpio_type_t::BUTTON_TYPE && gpioConfig[i].type <= hasp_gpio_type_t::TOUCH)) {
|
||||||
JsonArray arr = input[description];
|
JsonArray arr = input[description];
|
||||||
if(arr.isNull()) arr = input.createNestedArray(description);
|
if(arr.isNull()) arr = input.createNestedArray(description);
|
||||||
arr.add(gpioConfig[i].pin);
|
arr.add(gpioConfig[i].pin);
|
||||||
@ -1036,4 +1040,4 @@ bool gpioSetConfig(const JsonObject& settings)
|
|||||||
|
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
#endif // HASP_USE_CONFIG
|
#endif // HASP_USE_CONFIG
|
||||||
|
@ -47,7 +47,7 @@ bool gpio_set_pin_state(uint8_t pin, bool power, int32_t val);
|
|||||||
|
|
||||||
void gpio_set_moodlight(moodlight_t& moodlight);
|
void gpio_set_moodlight(moodlight_t& moodlight);
|
||||||
|
|
||||||
void gpio_discovery(JsonObject& input, JsonArray& relay, JsonArray& light, JsonArray& dimmer);
|
void gpio_discovery(JsonObject& input, JsonArray& relay, JsonArray& light, JsonArray& dimmer, JsonArray& event);
|
||||||
|
|
||||||
bool gpioSavePinConfig(uint8_t config_num, uint8_t pin, uint8_t type, uint8_t group, uint8_t pinfunc, bool inverted);
|
bool gpioSavePinConfig(uint8_t config_num, uint8_t pin, uint8_t type, uint8_t group, uint8_t pinfunc, bool inverted);
|
||||||
bool gpioIsSystemPin(uint8_t gpio);
|
bool gpioIsSystemPin(uint8_t gpio);
|
||||||
@ -134,7 +134,7 @@ enum hasp_gpio_type_t {
|
|||||||
TAMPER = 0xBB,
|
TAMPER = 0xBB,
|
||||||
UPDATE = 0xBC,
|
UPDATE = 0xBC,
|
||||||
|
|
||||||
BUTTON = 0xF0,
|
BUTTON_TYPE = 0xF0,
|
||||||
BUTTON_TOGGLE_UP = 0xF1,
|
BUTTON_TOGGLE_UP = 0xF1,
|
||||||
BUTTON_TOGGLE_DOWN = 0xF2,
|
BUTTON_TOGGLE_DOWN = 0xF2,
|
||||||
BUTTON_TOGGLE_BOTH = 0xF3,
|
BUTTON_TOGGLE_BOTH = 0xF3,
|
||||||
@ -153,4 +153,4 @@ enum hasp_gpio_type_t {
|
|||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -266,18 +266,18 @@ static void webSendFooter()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void http_send_cache_header(int size, int age = 3600)
|
static void http_send_cache_header(int age = 3600)
|
||||||
{
|
{
|
||||||
webServer.sendHeader("Content-Length", (String)(size));
|
|
||||||
webServer.sendHeader("Cache-Control", (String)(F("public, max-age=")) + (String)(age));
|
webServer.sendHeader("Cache-Control", (String)(F("public, max-age=")) + (String)(age));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int http_send_cached(int statuscode, const char* contenttype, const char* data, size_t size, int age = 3600)
|
static int http_send_cached(int statuscode, const char* contenttype, const char* data, size_t size, int age = 3600)
|
||||||
{
|
{
|
||||||
http_send_cache_header(size, age);
|
http_send_cache_header(age);
|
||||||
#if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266)
|
#if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266)
|
||||||
webServer.send_P(statuscode, contenttype, data, size);
|
webServer.send_P(statuscode, contenttype, data, size);
|
||||||
#else
|
#else
|
||||||
|
webServer.sendHeader("Content-Length", (String)(size));
|
||||||
webServer.send(statuscode, contenttype, data);
|
webServer.send(statuscode, contenttype, data);
|
||||||
#endif
|
#endif
|
||||||
return statuscode;
|
return statuscode;
|
||||||
@ -1806,7 +1806,7 @@ static void webHandleGpioConfig()
|
|||||||
|
|
||||||
switch(conf.type) {
|
switch(conf.type) {
|
||||||
|
|
||||||
case hasp_gpio_type_t::BUTTON:
|
case hasp_gpio_type_t::BUTTON_TYPE:
|
||||||
httpMessage += D_GPIO_BUTTON;
|
httpMessage += D_GPIO_BUTTON;
|
||||||
break;
|
break;
|
||||||
case hasp_gpio_type_t::SWITCH:
|
case hasp_gpio_type_t::SWITCH:
|
||||||
@ -2051,7 +2051,7 @@ static void webHandleGpioInput()
|
|||||||
httpMessage += F("</select></p>");
|
httpMessage += F("</select></p>");
|
||||||
|
|
||||||
httpMessage += F("<p><b>Type</b> <select id='type' name='type'>");
|
httpMessage += F("<p><b>Type</b> <select id='type' name='type'>");
|
||||||
httpMessage += getOption(hasp_gpio_type_t::BUTTON, D_GPIO_BUTTON, conf.type);
|
httpMessage += getOption(hasp_gpio_type_t::BUTTON_TYPE, D_GPIO_BUTTON, conf.type);
|
||||||
httpMessage += getOption(hasp_gpio_type_t::SWITCH, D_GPIO_SWITCH, conf.type);
|
httpMessage += getOption(hasp_gpio_type_t::SWITCH, D_GPIO_SWITCH, conf.type);
|
||||||
httpMessage += getOption(hasp_gpio_type_t::DOOR, "door", conf.type);
|
httpMessage += getOption(hasp_gpio_type_t::DOOR, "door", conf.type);
|
||||||
httpMessage += getOption(hasp_gpio_type_t::GARAGE_DOOR, "garage_door", conf.type);
|
httpMessage += getOption(hasp_gpio_type_t::GARAGE_DOOR, "garage_door", conf.type);
|
||||||
|
@ -1311,7 +1311,7 @@ void webHandleGuiConfig(AsyncWebServerRequest* request)
|
|||||||
httpMessage += getOption(-1, F("None"), bcklpin == -1);
|
httpMessage += getOption(-1, F("None"), bcklpin == -1);
|
||||||
#if defined(ARDUINO_ARCH_ESP32)
|
#if defined(ARDUINO_ARCH_ESP32)
|
||||||
add_gpio_select_option(httpMessage, 5, bcklpin); // D8 on ESP32 for D1 mini 32
|
add_gpio_select_option(httpMessage, 5, bcklpin); // D8 on ESP32 for D1 mini 32
|
||||||
add_gpio_select_option(httpMessage, 12, bcklpin); // TFT_LED on the Liligo Pi
|
add_gpio_select_option(httpMessage, 12, bcklpin); // TFT_LED on the Lilygo Pi
|
||||||
add_gpio_select_option(httpMessage, 13, bcklpin); // TFT_LED on the D1 R32 + Waveshare
|
add_gpio_select_option(httpMessage, 13, bcklpin); // TFT_LED on the D1 R32 + Waveshare
|
||||||
add_gpio_select_option(httpMessage, 15, bcklpin); // TFT_LED on the AZ Touch
|
add_gpio_select_option(httpMessage, 15, bcklpin); // TFT_LED on the AZ Touch
|
||||||
add_gpio_select_option(httpMessage, 16, bcklpin); // D4 on ESP32 for D1 mini 32
|
add_gpio_select_option(httpMessage, 16, bcklpin); // D4 on ESP32 for D1 mini 32
|
||||||
@ -1479,7 +1479,7 @@ void webHandleGpioConfig(AsyncWebServerRequest* request)
|
|||||||
|
|
||||||
switch(conf.type) {
|
switch(conf.type) {
|
||||||
|
|
||||||
case hasp_gpio_type_t::BUTTON:
|
case hasp_gpio_type_t::BUTTON_TYPE:
|
||||||
httpMessage += F(D_GPIO_BUTTON);
|
httpMessage += F(D_GPIO_BUTTON);
|
||||||
break;
|
break;
|
||||||
case hasp_gpio_type_t::SWITCH:
|
case hasp_gpio_type_t::SWITCH:
|
||||||
@ -1757,8 +1757,8 @@ void webHandleGpioInput(AsyncWebServerRequest* request)
|
|||||||
bool selected;
|
bool selected;
|
||||||
httpMessage += F("<p><b>Type</b> <select id='type' name='type'>");
|
httpMessage += F("<p><b>Type</b> <select id='type' name='type'>");
|
||||||
|
|
||||||
selected = (conf.type == hasp_gpio_type_t::BUTTON);
|
selected = (conf.type == hasp_gpio_type_t::BUTTON_TYPE);
|
||||||
httpMessage += getOption(hasp_gpio_type_t::BUTTON, F(D_GPIO_BUTTON), selected);
|
httpMessage += getOption(hasp_gpio_type_t::BUTTON_TYPE, F(D_GPIO_BUTTON), selected);
|
||||||
|
|
||||||
selected = (conf.type == hasp_gpio_type_t::SWITCH);
|
selected = (conf.type == hasp_gpio_type_t::SWITCH);
|
||||||
httpMessage += getOption(hasp_gpio_type_t::SWITCH, F(D_GPIO_SWITCH), selected);
|
httpMessage += getOption(hasp_gpio_type_t::SWITCH, F(D_GPIO_SWITCH), selected);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
Import('env')
|
Import('env')
|
||||||
import os
|
import os, sys, json
|
||||||
import sys
|
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
@ -106,6 +105,53 @@ def copy_merge_bins(source, target, env):
|
|||||||
print(stdout.decode("utf-8") )
|
print(stdout.decode("utf-8") )
|
||||||
print(stderr.decode("utf-8") )
|
print(stderr.decode("utf-8") )
|
||||||
|
|
||||||
|
def create_manifest(source, target, env):
|
||||||
|
short_version = 'v' + str(HASP_VER_MAJ) + '.' + str(HASP_VER_MIN) + '.' + str(HASP_VER_REV)
|
||||||
|
long_version = short_version + '_' + get_firmware_commit_hash()
|
||||||
|
name = str(target[0]).split(os.path.sep)[2]
|
||||||
|
name = name.replace('_4MB', '').replace('_8MB', '').replace('_16MB', '').replace('_32MB', '')
|
||||||
|
flash_size = env.GetProjectOption("board_upload.flash_size")
|
||||||
|
board = env.BoardConfig()
|
||||||
|
filename = "{}_full_{}_{}.json".format(name, flash_size, long_version)
|
||||||
|
output_json ="{}firmware{}{}".format(OUTPUT_DIR, os.path.sep, filename)
|
||||||
|
|
||||||
|
data = {"name":"openHASP", "version": short_version, "home_assistant_domain": "openhasp", "funding_url": "https://ko-fi.com/openhasp", "new_install_prompt_erase": True, "builds": "d"}
|
||||||
|
builds = []
|
||||||
|
parts = []
|
||||||
|
parts.append({ "path": filename, "offset": 0 })
|
||||||
|
|
||||||
|
mcu = board.get("build.mcu", "esp32")
|
||||||
|
if (mcu == 'esp32'):
|
||||||
|
builds.append({ "chipFamily": "ESP32", "improv": False })
|
||||||
|
elif (mcu == 'esp32s2'):
|
||||||
|
builds.append({ "chipFamily": "ESP32-S2", "improv": False })
|
||||||
|
elif (mcu == 'esp32s3'):
|
||||||
|
builds.append({ "chipFamily": "ESP32-S3", "improv": False })
|
||||||
|
elif (mcu == 'esp32c3'):
|
||||||
|
builds.append({ "chipFamily": "ESP32-C3", "improv": False })
|
||||||
|
elif (mcu == 'esp32c6'):
|
||||||
|
builds.append({ "chipFamily": "ESP32-C6", "improv": False })
|
||||||
|
builds[0]["parts"] = parts
|
||||||
|
data["builds"] = builds
|
||||||
|
json_data = json.dumps(data, indent=4, sort_keys=False)
|
||||||
|
print(json_data)
|
||||||
|
|
||||||
|
# check if output directories exist and create if necessary
|
||||||
|
if not os.path.isdir(OUTPUT_DIR):
|
||||||
|
os.mkdir(OUTPUT_DIR)
|
||||||
|
|
||||||
|
for d in ['firmware', 'map']:
|
||||||
|
if not os.path.isdir("{}{}".format(OUTPUT_DIR, d)):
|
||||||
|
os.mkdir("{}{}".format(OUTPUT_DIR, d))
|
||||||
|
|
||||||
|
# check if new target files exist and remove if necessary
|
||||||
|
for f in [output_json]:
|
||||||
|
if os.path.isfile(f):
|
||||||
|
os.remove(f)
|
||||||
|
|
||||||
|
with open(output_json, "w") as outfile:
|
||||||
|
outfile.write(json_data)
|
||||||
|
|
||||||
def copy_ota(source, target, env):
|
def copy_ota(source, target, env):
|
||||||
version = 'v' + str(HASP_VER_MAJ) + '.' + str(HASP_VER_MIN) + '.' + str(HASP_VER_REV) + '_' + get_firmware_commit_hash()
|
version = 'v' + str(HASP_VER_MAJ) + '.' + str(HASP_VER_MIN) + '.' + str(HASP_VER_REV) + '_' + get_firmware_commit_hash()
|
||||||
name =str(target[0]).split(os.path.sep)[2]
|
name =str(target[0]).split(os.path.sep)[2]
|
||||||
@ -135,4 +181,5 @@ def copy_ota(source, target, env):
|
|||||||
|
|
||||||
env.AddPreAction("$BUILD_DIR/${PROGNAME}.bin", [get_fw_version])
|
env.AddPreAction("$BUILD_DIR/${PROGNAME}.bin", [get_fw_version])
|
||||||
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", [copy_merge_bins])
|
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", [copy_merge_bins])
|
||||||
|
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", [create_manifest])
|
||||||
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", [copy_ota])
|
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", [copy_ota])
|
||||||
|
@ -45,7 +45,7 @@ build_flags =
|
|||||||
-D LV_ATTRIBUTE_FAST_MEM=IRAM_ATTR
|
-D LV_ATTRIBUTE_FAST_MEM=IRAM_ATTR
|
||||||
-D LV_ATTRIBUTE_TASK_HANDLER=IRAM_ATTR
|
-D LV_ATTRIBUTE_TASK_HANDLER=IRAM_ATTR
|
||||||
-D LV_USE_FS_IF=1
|
-D LV_USE_FS_IF=1
|
||||||
;-D LV_FS_PC_PATH="//littlefs" ; this needs to match the vfs mount pount
|
-D LV_FS_PC_PATH='"/littlefs"' ; this needs to match the vfs mount pount
|
||||||
; -- ArduinoJson build options ----------------------------
|
; -- ArduinoJson build options ----------------------------
|
||||||
-D ARDUINOJSON_ENABLE_PROGMEM=1 ; for PROGMEM arguments
|
-D ARDUINOJSON_ENABLE_PROGMEM=1 ; for PROGMEM arguments
|
||||||
; -- tft_espi build options ------------------------
|
; -- tft_espi build options ------------------------
|
||||||
@ -146,7 +146,7 @@ framework = arduino
|
|||||||
;platform = https://github.com/tasmota/platform-espressif32/releases/download/2023.10.03/platform-espressif32.zip
|
;platform = https://github.com/tasmota/platform-espressif32/releases/download/2023.10.03/platform-espressif32.zip
|
||||||
;;;platform = https://github.com/tasmota/platform-espressif32/releases/download/2023.11.01/platform-espressif32.zip
|
;;;platform = https://github.com/tasmota/platform-espressif32/releases/download/2023.11.01/platform-espressif32.zip
|
||||||
platform = https://github.com/tasmota/platform-espressif32/releases/download/2023.10.03/platform-espressif32.zip
|
platform = https://github.com/tasmota/platform-espressif32/releases/download/2023.10.03/platform-espressif32.zip
|
||||||
;platform = espressif32@5.3.0
|
;platform = espressif32@5.4.0
|
||||||
lib_ignore =
|
lib_ignore =
|
||||||
${esp32.lib_ignore}
|
${esp32.lib_ignore}
|
||||||
LittleFS_esp32 ; Not needed for Arduino v2
|
LittleFS_esp32 ; Not needed for Arduino v2
|
||||||
|
64
user_setups/esp32/esp32-2432s022c.ini
Normal file
64
user_setups/esp32/esp32-2432s022c.ini
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
[env:esp32-2432s022c_4MB]
|
||||||
|
extends = arduino_esp32_v2, flash_4mb
|
||||||
|
board = esp32dev
|
||||||
|
upload_speed = 921600
|
||||||
|
|
||||||
|
build_flags =
|
||||||
|
${arduino_esp32_v2.build_flags}
|
||||||
|
${esp32.no_ps_ram}
|
||||||
|
|
||||||
|
;region -- TFT_eSPI build options ------------------------
|
||||||
|
-D ESP32_2432S022C=1
|
||||||
|
-D LGFX_USE_V1=1
|
||||||
|
; -D USER_SETUP_LOADED=1
|
||||||
|
-D ST7789_DRIVER=1
|
||||||
|
; -D CGRAM_OFFSET=1
|
||||||
|
; -DSUPPORT_TRANSACTIONS
|
||||||
|
-D TFT_INVERSION_OFF
|
||||||
|
-D TFT_PARALLEL_8_BIT
|
||||||
|
-D TFT_ROTATION=0 ; 0=0, 1=90, 2=180 or 3=270 degree
|
||||||
|
-D TFT_WIDTH=240
|
||||||
|
-D TFT_HEIGHT=320
|
||||||
|
-D TFT_CS=17 ; Chip select control pin=library pulls permanently low
|
||||||
|
-D TFT_DC=16 ; Data Command control pin
|
||||||
|
-D TFT_RST=-1 ; Reset pin, toggles on startup
|
||||||
|
-D TFT_WR=4 ; Write strobe control pin
|
||||||
|
-D TFT_RD=2 ; Read strobe control pin
|
||||||
|
-D TFT_D0=15
|
||||||
|
-D TFT_D1=13
|
||||||
|
-D TFT_D2=12
|
||||||
|
-D TFT_D3=14
|
||||||
|
-D TFT_D4=27
|
||||||
|
-D TFT_D5=25
|
||||||
|
-D TFT_D6=33
|
||||||
|
-D TFT_D7=32
|
||||||
|
-D TFT_BCKL=0 ; LED back-light
|
||||||
|
|
||||||
|
;CST816S driver
|
||||||
|
-D TOUCH_DRIVER=0x816
|
||||||
|
-D HASP_USE_LGFX_TOUCH=1
|
||||||
|
-D I2C_TOUCH_PORT=I2C_NUM_0
|
||||||
|
-D TOUCH_SDA=21
|
||||||
|
-D TOUCH_SCL=22
|
||||||
|
-D TOUCH_IRQ=-1
|
||||||
|
-D TOUCH_RST=-1
|
||||||
|
-D I2C_TOUCH_FREQUENCY=400000
|
||||||
|
-D I2C_TOUCH_ADDRESS=0x15
|
||||||
|
|
||||||
|
|
||||||
|
-D SD_MISO=19
|
||||||
|
-D SD_MOSI=23
|
||||||
|
-D SD_SCLK=18
|
||||||
|
-D SD_CS=5
|
||||||
|
|
||||||
|
; sound output is on IO26, through an SC8002B IC
|
||||||
|
|
||||||
|
; -- Debugging options -----------------------------
|
||||||
|
; -D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
|
||||||
|
;endregion
|
||||||
|
|
||||||
|
lib_deps =
|
||||||
|
${arduino_esp32_v2.lib_deps}
|
||||||
|
${lovyangfx.lib_deps}
|
||||||
|
;${tft_espi.lib_deps}
|
||||||
|
|
@ -26,6 +26,7 @@ build_flags =
|
|||||||
-D SUPPORT_TRANSACTIONS
|
-D SUPPORT_TRANSACTIONS
|
||||||
-D SPI_READ_FREQUENCY=20000000
|
-D SPI_READ_FREQUENCY=20000000
|
||||||
-D TOUCH_OFFSET_ROTATION=0 ; 1=swap xy, 2=invert x, 4=inverty
|
-D TOUCH_OFFSET_ROTATION=0 ; 1=swap xy, 2=invert x, 4=inverty
|
||||||
|
-D TFT_RGB_ORDER=0 ; Colour order Red-Green-Blue
|
||||||
|
|
||||||
-D ESP32_2432S028R=1
|
-D ESP32_2432S028R=1
|
||||||
;endregion
|
;endregion
|
||||||
@ -128,3 +129,77 @@ lib_deps =
|
|||||||
;${tft_espi.lib_deps}
|
;${tft_espi.lib_deps}
|
||||||
${lovyangfx.lib_deps}
|
${lovyangfx.lib_deps}
|
||||||
;${goodix.lib_deps}
|
;${goodix.lib_deps}
|
||||||
|
|
||||||
|
[esp32-2432s028_v2]
|
||||||
|
extends = arduino_esp32_v2
|
||||||
|
board = esp32dev
|
||||||
|
upload_speed = 921600
|
||||||
|
|
||||||
|
build_flags =
|
||||||
|
${arduino_esp32_v2.build_flags}
|
||||||
|
${esp32.no_ps_ram}
|
||||||
|
|
||||||
|
; TFT_ROTATION values:
|
||||||
|
; 0 - 0 deg (= default when not set)
|
||||||
|
; 1 - 90 deg anti-clockwise (from 0 deg)
|
||||||
|
; 2 - 180 deg anti-clockwise
|
||||||
|
; 3 - 270 deg anti-clockwise
|
||||||
|
; 4 - mirror content, and rotate 180 deg anti-clockwise
|
||||||
|
; 5 - mirror content, and rotate 270 deg anti-clockwise
|
||||||
|
; 6 - mirror content, and rotate 0 deg anti-clockwise
|
||||||
|
; 7 - mirror content, and rotate 90 deg anti-clockwise
|
||||||
|
|
||||||
|
;region -- TFT_eSPI build options ------------------------
|
||||||
|
; -D USER_SETUP_LOADED=1
|
||||||
|
-D LGFX_USE_V1=1
|
||||||
|
-D ILI9341_DRIVER=1 ;
|
||||||
|
-D INVERT_COLORS=0
|
||||||
|
-D TFT_ROTATION=6 ; 0=0, 1=90, 2=180 or 3=270 degree, Mirrors: 6, 5, 4, 3
|
||||||
|
-D TFT_WIDTH=320
|
||||||
|
-D TFT_HEIGHT=240
|
||||||
|
-D TFT_RST=-1
|
||||||
|
-D TFT_SCLK=14
|
||||||
|
-D TFT_DC=2
|
||||||
|
-D TFT_CS=15
|
||||||
|
-D TFT_MOSI=13
|
||||||
|
-D TFT_MISO=12
|
||||||
|
-D TFT_BCKL=21
|
||||||
|
-D SUPPORT_TRANSACTIONS
|
||||||
|
-D SPI_FREQUENCY=55000000
|
||||||
|
-D SPI_READ_FREQUENCY=20000000
|
||||||
|
-D TOUCH_OFFSET_ROTATION=2 ; 1=swap xy, 2=invert x, 4=inverty
|
||||||
|
-D TFT_RGB_ORDER=1 ; Colour order Red-Green-Blue
|
||||||
|
|
||||||
|
-D ESP32_2432S028R=1
|
||||||
|
;endregion
|
||||||
|
|
||||||
|
; -- Debugging options -----------------------------
|
||||||
|
; -D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
|
||||||
|
|
||||||
|
lib_deps =
|
||||||
|
${arduino_esp32_v2.lib_deps}
|
||||||
|
${lovyangfx.lib_deps}
|
||||||
|
|
||||||
|
[env:esp32-2432s028r_v2_4MB]
|
||||||
|
extends = esp32-2432s028_v2, flash_4mb
|
||||||
|
build_flags =
|
||||||
|
${esp32-2432s028_v2.build_flags}
|
||||||
|
-D TOUCH_DRIVER=0x2046 ; XPT2606 Resistive touch panel driver
|
||||||
|
-D HASP_USE_LGFX_TOUCH=1
|
||||||
|
-D TOUCH_CS=33
|
||||||
|
-D TOUCH_SCLK=25
|
||||||
|
-D TOUCH_MOSI=32
|
||||||
|
-D TOUCH_MISO=39
|
||||||
|
-D TOUCH_SDA=-1
|
||||||
|
-D TOUCH_SCL=-1
|
||||||
|
-D TOUCH_IRQ=36
|
||||||
|
-D SPI_TOUCH_FREQUENCY=2500000
|
||||||
|
|
||||||
|
; -- Debugging options -----------------------------
|
||||||
|
; -D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_VERBOSE
|
||||||
|
|
||||||
|
lib_deps =
|
||||||
|
${esp32-2432s028_v2.lib_deps}
|
||||||
|
;${tft_espi.lib_deps}
|
||||||
|
${lovyangfx.lib_deps}
|
||||||
|
;${goodix.lib_deps}
|
@ -6,8 +6,8 @@
|
|||||||
;***************************************************;
|
;***************************************************;
|
||||||
|
|
||||||
[env:huzzah32-v2-featherwing-35-v2]
|
[env:huzzah32-v2-featherwing-35-v2]
|
||||||
extends = arduino_esp32_v2, flash_4mb
|
extends = arduino_esp32_v2, flash_8mb
|
||||||
board = featheresp32
|
board = adafruit_feather_esp32_v2
|
||||||
|
|
||||||
build_flags =
|
build_flags =
|
||||||
-D HASP_MODEL="Adafruit HUZZAH32 V2 ESP32 Featherwing 3.5 V2"
|
-D HASP_MODEL="Adafruit HUZZAH32 V2 ESP32 Featherwing 3.5 V2"
|
||||||
@ -16,13 +16,14 @@ build_flags =
|
|||||||
-D LV_INDEV_DEF_READ_PERIOD=30
|
-D LV_INDEV_DEF_READ_PERIOD=30
|
||||||
;region -- TFT_eSPI build options ------------------------
|
;region -- TFT_eSPI build options ------------------------
|
||||||
${lcd.featherwing-35-v2}
|
${lcd.featherwing-35-v2}
|
||||||
-D TFT_MISO=19
|
-D TFT_MISO=21 ; GPIO21 / MISO
|
||||||
-D TFT_MOSI=18
|
-D TFT_MOSI=19 ; GPIO19 / MOSI
|
||||||
-D TFT_SCLK=5
|
-D TFT_SCLK=5 ; GPIO5 / SCK
|
||||||
-D TFT_DC=10
|
-D TFT_DC=33 ; GPIO33 / D33
|
||||||
-D TFT_CS=9
|
-D TFT_CS=15 ; GPIO15 / D15
|
||||||
-D TFT_RST=-1 ; RST
|
-D TFT_RST=-1 ; RST
|
||||||
-D TFT_BCKL=21 ; Solder the LITE pad to a PWM enabled pin of the ESP, like GPIO 21
|
|
||||||
|
-D TFT_BCKL=37 ; Solder the LITE pad to a PWM enabled pin of the ESP, like GPIO 21
|
||||||
;endregion
|
;endregion
|
||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
|
33
user_setups/esp32/huzzah32-v2-featherwing-35.ini
Normal file
33
user_setups/esp32/huzzah32-v2-featherwing-35.ini
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
;***************************************************;
|
||||||
|
; HUZZAH32 V2 ESP32 with Featherwing TFT 3.5" ;
|
||||||
|
; - HUZZAH32 V2 w/ 2 MB PSRAM board ;
|
||||||
|
; - HX8357D TFT Featherwing 3.5" V2 ;
|
||||||
|
; - STMPE610 touch controller ;
|
||||||
|
;***************************************************;
|
||||||
|
|
||||||
|
[env:huzzah32-v2-featherwing-35]
|
||||||
|
extends = arduino_esp32_v2, flash_8mb
|
||||||
|
board = adafruit_feather_esp32_v2
|
||||||
|
|
||||||
|
build_flags =
|
||||||
|
-D HASP_MODEL="Adafruit HUZZAH32 V2 ESP32 Featherwing 3.5"
|
||||||
|
${arduino_esp32_v2.build_flags}
|
||||||
|
${esp32.ps_ram}
|
||||||
|
-D LV_INDEV_DEF_READ_PERIOD=30
|
||||||
|
;region -- TFT_eSPI build options ------------------------
|
||||||
|
${lcd.featherwing-35}
|
||||||
|
-D TFT_MISO=21 ; GPIO21 / MISO
|
||||||
|
-D TFT_MOSI=19 ; GPIO19 / MOSI
|
||||||
|
-D TFT_SCLK=5 ; GPIO5 / SCK
|
||||||
|
-D TFT_DC=33 ; GPIO33 / D33
|
||||||
|
-D TFT_CS=15 ; GPIO15 / D15
|
||||||
|
-D TFT_RST=-1 ; RST
|
||||||
|
-D TOUCH_CS=32
|
||||||
|
|
||||||
|
-D TFT_BCKL=26 ; Solder the LITE pad to a PWM enabled pin of the ESP, like GPIO 26
|
||||||
|
;endregion
|
||||||
|
|
||||||
|
lib_deps =
|
||||||
|
${arduino_esp32_v2.lib_deps}
|
||||||
|
${tft_espi.lib_deps}
|
||||||
|
${stmpe610.lib_deps}
|
55
user_setups/esp32/ttgo-t-watch.ini
Normal file
55
user_setups/esp32/ttgo-t-watch.ini
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
[ttgo-t-watch]
|
||||||
|
|
||||||
|
extends = arduino_esp32_v2
|
||||||
|
board = esp32dev
|
||||||
|
|
||||||
|
build_flags =
|
||||||
|
${arduino_esp32_v2.build_flags}
|
||||||
|
${esp32.ps_ram}
|
||||||
|
|
||||||
|
;region -- TFT_eSPI build options ------------------------
|
||||||
|
-D LGFX_USE_V1=1
|
||||||
|
-D HASP_USE_LGFX_TOUCH=1
|
||||||
|
-D ST7789_DRIVER=1
|
||||||
|
-D TFT_HEIGHT=240
|
||||||
|
-D TFT_WIDTH=240
|
||||||
|
-D TFT_DC=27
|
||||||
|
-D TFT_CS=5
|
||||||
|
-D TFT_MOSI=19
|
||||||
|
-D TFT_RST=-1
|
||||||
|
-D TFT_SCLK=18
|
||||||
|
-D TFT_BCKL=12
|
||||||
|
-D SPI_FREQUENCY=40000000
|
||||||
|
-D I2C_TOUCH_ADDRESS=0x38
|
||||||
|
-D I2C_TOUCH_FREQUENCY=400000
|
||||||
|
-D TOUCH_DRIVER=0x6336
|
||||||
|
-D I2C_TOUCH_PORT=1
|
||||||
|
-D TOUCH_IRQ=38
|
||||||
|
-D TOUCH_RST=-1
|
||||||
|
-D TOUCH_SDA=23
|
||||||
|
-D TOUCH_SCL=32
|
||||||
|
-D TWATCH=1
|
||||||
|
;endregion
|
||||||
|
|
||||||
|
lib_deps =
|
||||||
|
${arduino_esp32_v2.lib_deps}
|
||||||
|
${lovyangfx.lib_deps}
|
||||||
|
${ft6336.lib_deps}
|
||||||
|
|
||||||
|
[env:ttgo-t-watch-2019]
|
||||||
|
extends = ttgo-t-watch, flash_16mb
|
||||||
|
|
||||||
|
build_flags =
|
||||||
|
${ttgo-t-watch.build_flags}
|
||||||
|
-D HASP_MODEL="TTGo T-Watch 2019"
|
||||||
|
-D INVERT_COLORS=1
|
||||||
|
|
||||||
|
[env:ttgo-t-watch-2020]
|
||||||
|
extends = ttgo-t-watch, flash_16mb
|
||||||
|
|
||||||
|
build_flags =
|
||||||
|
${ttgo-t-watch.build_flags}
|
||||||
|
-D HASP_MODEL="TTGo T-Watch 2020"
|
||||||
|
-D TFT_ROTATION=0
|
||||||
|
;-D TFT_ROTATION=2
|
||||||
|
-D TOUCH_OFFSET_ROTATION=4 ; 1=swap xy, 2=invert x, 4=inverty
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user