diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..70ada49 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,15 @@ +# trunk-ignore-all(trivy/DS026) +# trunk-ignore-all(trivy/DS002) +# trunk-ignore-all(checkov/CKV_DOCKER_2) +# trunk-ignore-all(checkov/CKV_DOCKER_3) +FROM mcr.microsoft.com/devcontainers/cpp:1-debian-12 + +# trunk-ignore(terrascan/AC_DOCKER_0002) +# trunk-ignore(hadolint/DL3008) +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends \ + ca-certificates \ + git \ + wget \ + zip \ + && apt-get clean && rm -rf /var/lib/apt/lists/* diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..d8a7e10 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,37 @@ +// For format details, see https://aka.ms/devcontainer.json. +{ + "name": "Meshtastic Device-UI Dev", + "build": { + "dockerfile": "Dockerfile" + }, + + // Features to add to the dev container. More info: https://containers.dev/features. + "features": { + "ghcr.io/trunk-io/devcontainer-feature/trunk:1": {}, + "ghcr.io/devcontainers/features/node:1": {} + }, + + // Configure tool-specific properties. + "customizations": { + "vscode": { + "extensions": [ + "Trunk.io", + "ms-vscode.cpptools-extension-pack", + "ms-azuretools.vscode-docker" + ], + "settings": { + "editor.formatOnSave": true, + "editor.defaultFormatter": "trunk.io", + "trunk.enableWindows": true, + "files.insertFinalNewline": false, + "files.trimFinalNewlines": false, + "cmake.configureOnOpen": false, + "[cpp]": { + "editor.defaultFormatter": "trunk.io" + } + } + } + }, + + "postCreateCommand": "npm install lv_i18n -g --no-fund" +} diff --git a/.github/workflows/trunk_check.yml b/.github/workflows/trunk_check.yml index 6ed905b..b4f5c7b 100644 --- a/.github/workflows/trunk_check.yml +++ b/.github/workflows/trunk_check.yml @@ -1,5 +1,7 @@ name: Pull Request -on: [pull_request] +on: + pull_request: + merge_group: concurrency: group: ${{ github.head_ref || github.run_id }} cancel-in-progress: true diff --git a/.trunk/configs/.prettierrc.yaml b/.trunk/configs/.prettierrc.yaml new file mode 100644 index 0000000..4635c2b --- /dev/null +++ b/.trunk/configs/.prettierrc.yaml @@ -0,0 +1,4 @@ +trailingComma: es5 +tabWidth: 2 +semi: false +singleQuote: true diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 86fc1ab..bfb41e1 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -2,44 +2,44 @@ # To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml version: 0.1 cli: - version: 1.21.0 + version: 1.22.8 plugins: sources: - id: trunk - ref: v1.4.5 + ref: v1.6.4 uri: https://github.com/trunk-io/plugins # Many linters and tools depend on runtimes - configure them here. (https://docs.trunk.io/runtimes) runtimes: -# enabled: -# - go@1.21.0 -# - node@18.12.1 -# - python@3.10.8 + enabled: + - go@1.21.0 + - node@18.12.1 + - python@3.10.8 # This is the section where you manage your linters. (https://docs.trunk.io/check/configuration) lint: enabled: - - trufflehog@3.71.0 + - trufflehog@3.83.4 - yamllint@1.35.1 - - bandit@1.7.8 - - checkov@3.2.60 - - terrascan@1.19.1 - - trivy@0.50.1 + - bandit@1.7.10 + - checkov@3.2.281 + - terrascan@1.19.9 + - trivy@0.56.2 #- trufflehog@3.63.2-rc0 - - taplo@0.8.1 - - ruff@0.3.5 + - taplo@0.9.3 + - ruff@0.7.2 - isort@5.13.2 - - markdownlint@0.39.0 - - oxipng@9.0.0 - - svgo@3.2.0 - - actionlint@1.6.27 - - flake8@7.0.0 + - markdownlint@0.42.0 + - oxipng@9.1.2 + - svgo@3.3.2 + - actionlint@1.7.4 + - flake8@7.1.1 - hadolint@2.12.0 - shfmt@3.6.0 - shellcheck@0.10.0 - - black@24.3.0 + - black@24.10.0 - git-diff-check - - gitleaks@8.18.2 + - gitleaks@8.21.1 - clang-format@16.0.3 - - prettier@3.2.5 + - prettier@3.3.3 ignore: - linters: [ALL] paths: diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..2746afa --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + // See http://go.microsoft.com/fwlink/?LinkId=827846 + // for the documentation about the extensions.json format. + "recommendations": ["Trunk.io"] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..395983e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,13 @@ +{ + // See https://code.visualstudio.com/docs/getstarted/settings#_settings-json-file + // for the documentation about the settings.json format. + "editor.formatOnSave": true, + "editor.defaultFormatter": "trunk.io", + "trunk.enableWindows": true, + "files.insertFinalNewline": false, + "files.trimFinalNewlines": false, + "cmake.configureOnOpen": false, + "[cpp]": { + "editor.defaultFormatter": "trunk.io" + } +} diff --git a/include/DisplayDriverConfig.h b/include/DisplayDriverConfig.h index b83d663..0574892 100644 --- a/include/DisplayDriverConfig.h +++ b/include/DisplayDriverConfig.h @@ -31,7 +31,8 @@ class DisplayDriverConfig WT32_SC01_PLUS, ESP2432S028RV1, ESP2432S028RV2, - ESP4848S040 + ESP4848S040, + MAKERFABS480X480 }; struct panel_config_t { diff --git a/include/LGFXDriver.h b/include/LGFXDriver.h index 688d56f..a636893 100644 --- a/include/LGFXDriver.h +++ b/include/LGFXDriver.h @@ -102,7 +102,7 @@ template void LGFXDriver::task_handler(void) } } if (powerSaving) { - int pin_int = 0; + int pin_int = -1; if (hasTouch()) { #ifndef CUSTOM_TOUCH_DRIVER pin_int = lgfx->touch()->config().pin_int; @@ -115,7 +115,7 @@ template void LGFXDriver::task_handler(void) pin_int = BUTTON_PIN; #endif } - if (DisplayDriver::view->sleep(pin_int) || + if ((pin_int >= 0 && DisplayDriver::view->sleep(pin_int)) || (screenTimeout > lv_display_get_inactive_time(NULL) && ((DisplayDriver::view->isScreenLocked() && lv_display_get_inactive_time(NULL) < defaultScreenLockTimeout) || diff --git a/include/LGFX_4848S040.h b/include/LGFX_4848S040.h index 48b1054..5e7eaec 100644 --- a/include/LGFX_4848S040.h +++ b/include/LGFX_4848S040.h @@ -6,49 +6,7 @@ #include #include -#ifdef CUSTOM_TOUCH_DRIVER -#include - -#define TOUCH_SDA 19 -#define TOUCH_SCL 45 -#define TOUCH_INT -1 -#define TOUCH_RST -1 - -// avoid lovyanGFX touch driver: -// custom class for redirecting getTouch() calls and to alternative implementation -class LGFX_Touch : public lgfx::LGFX_Device -{ - public: - bool init_impl(bool use_reset, bool use_clear) override - { - bool result = LGFX_Device::init_impl(use_reset, use_clear); - bbct.init(TOUCH_SDA, TOUCH_SCL); - bbct.setOrientation(0, 480, 480); - return result; - } - - int8_t getTouchInt(void) { return TOUCH_INT; } - - // unfortunately not declared as virtual in base class, need to choose a different name - bool getTouchXY(uint16_t* touchX, uint16_t* touchY) { - TOUCHINFO ti; - if (bbct.getSamples(&ti)) { - *touchX = ti.x[0]; - *touchY = ti.y[0]; - if (*touchX < 480 && *touchY < 480) - return true; - } - return false; - }; - - private: - BBCapTouch bbct; -}; - -class LGFX_4848S040 : public LGFX_Touch -#else class LGFX_4848S040 : public lgfx::LGFX_Device -#endif { lgfx::Panel_ST7701_guition_esp32_4848S040 _panel_instance; lgfx::Bus_RGB _bus_instance; @@ -59,7 +17,7 @@ class LGFX_4848S040 : public lgfx::LGFX_Device const uint16_t screenWidth = 480; const uint16_t screenHeight = 480; - bool hasButton(void) { return true; } + bool hasButton(void) { return false; } LGFX_4848S040(void) { @@ -134,7 +92,7 @@ class LGFX_4848S040 : public lgfx::LGFX_Device { auto cfg = _light_instance.config(); cfg.pin_bl = 38; - cfg.freq = 2000; + cfg.freq = 80; // higher value decrease brightness _light_instance.config(cfg); } _panel_instance.light(&_light_instance); @@ -149,17 +107,15 @@ class LGFX_4848S040 : public lgfx::LGFX_Device cfg.pin_int = GPIO_NUM_NC; cfg.pin_rst = GPIO_NUM_NC; cfg.bus_shared = false; - cfg.offset_rotation = 0; + cfg.offset_rotation = 3; - cfg.i2c_port = 1; + cfg.i2c_port = 0; cfg.i2c_addr = 0x5D; cfg.pin_sda = 19; cfg.pin_scl = 45; cfg.freq = 400000; _touch_instance.config(cfg); -#ifndef CUSTOM_TOUCH_DRIVER _panel_instance.setTouch(&_touch_instance); -#endif } setPanel(&_panel_instance); diff --git a/include/LGFX_MAKERFABS480X480.h b/include/LGFX_MAKERFABS480X480.h new file mode 100644 index 0000000..264d223 --- /dev/null +++ b/include/LGFX_MAKERFABS480X480.h @@ -0,0 +1,121 @@ +#pragma once +#define LGFX_USE_V1 + +#include +#include +#include + +class LGFX_MAKERFABS480X480 : public lgfx::LGFX_Device +{ + lgfx::Panel_ST7701 _panel_instance; + lgfx::Bus_RGB _bus_instance; + lgfx::Light_PWM _light_instance; + lgfx::Touch_GT911 _touch_instance; + + public: + const uint16_t screenWidth = 480; + const uint16_t screenHeight = 480; + + bool hasButton(void) { return false; } + + LGFX_MAKERFABS480X480(void) + { + { + auto cfg = _panel_instance.config(); + cfg.memory_width = 480; + cfg.memory_height = 480; + cfg.panel_width = screenWidth; + cfg.panel_height = screenHeight; + cfg.offset_x = 0; + cfg.offset_y = 0; + cfg.offset_rotation = 0; + _panel_instance.config(cfg); + } + + { + auto cfg = _panel_instance.config_detail(); + cfg.pin_cs = 1; + cfg.pin_sclk = 12; + cfg.pin_mosi = 11; + cfg.use_psram = 1; + _panel_instance.config_detail(cfg); + } + + { + auto cfg = _bus_instance.config(); + cfg.panel = &_panel_instance; + cfg.pin_d0 = GPIO_NUM_6; // B0 + cfg.pin_d1 = GPIO_NUM_7; // B1 + cfg.pin_d2 = GPIO_NUM_15; // B2 + cfg.pin_d3 = GPIO_NUM_16; // B3 + cfg.pin_d4 = GPIO_NUM_8; // B4 + cfg.pin_d5 = GPIO_NUM_0; // G0 + cfg.pin_d6 = GPIO_NUM_9; // G1 + cfg.pin_d7 = GPIO_NUM_14; // G2 + cfg.pin_d8 = GPIO_NUM_47; // G3 + cfg.pin_d9 = GPIO_NUM_48; // G4 + cfg.pin_d10 = GPIO_NUM_3; // G5 + cfg.pin_d11 = GPIO_NUM_39; // R0 + cfg.pin_d12 = GPIO_NUM_40; // R1 + cfg.pin_d13 = GPIO_NUM_41; // R2 + cfg.pin_d14 = GPIO_NUM_42; // R3 + cfg.pin_d15 = GPIO_NUM_2; // R4 + + cfg.pin_henable = GPIO_NUM_45; + cfg.pin_vsync = GPIO_NUM_4; + cfg.pin_hsync = GPIO_NUM_5; + cfg.pin_pclk = GPIO_NUM_21; + cfg.freq_write = 14000000; + + cfg.hsync_polarity = 0; + cfg.hsync_front_porch = 10; + cfg.hsync_pulse_width = 8; + cfg.hsync_back_porch = 50; + + cfg.vsync_polarity = 0; + cfg.vsync_front_porch = 10; + cfg.vsync_pulse_width = 8; + cfg.vsync_back_porch = 20; + + cfg.pclk_active_neg = 0; + cfg.pclk_idle_high = 0; + cfg.de_idle_high = 1; + + _bus_instance.config(cfg); + } + _panel_instance.setBus(&_bus_instance); + + { + auto cfg = _light_instance.config(); + cfg.pin_bl = 44; + //cfg.freq = 80; // higher value decrease brightness + _light_instance.config(cfg); + } + _panel_instance.light(&_light_instance); + + { + auto cfg = _touch_instance.config(); + cfg.pin_cs = GPIO_NUM_NC; + cfg.x_min = 0; + cfg.x_max = 479; + cfg.y_min = 0; + cfg.y_max = 479; + cfg.bus_shared = false; + cfg.offset_rotation = 0; + + cfg.i2c_port = 1; + cfg.i2c_addr = 0x5D; + cfg.pin_int = GPIO_NUM_NC; + cfg.pin_sda = GPIO_NUM_17; + cfg.pin_scl = GPIO_NUM_18; + cfg.pin_rst = GPIO_NUM_38; + + cfg.freq = 400000; + _touch_instance.config(cfg); + _panel_instance.setTouch(&_touch_instance); + + } + + setPanel(&_panel_instance); + } +}; diff --git a/locale/it.yml b/locale/it.yml index e5edfdb..d88980c 100644 --- a/locale/it.yml +++ b/locale/it.yml @@ -1,139 +1,143 @@ it: - no new messages: ~ - 1 of 1 nodes online: ~ - 'uptime 00:00:00': ~ - "Heap: 0\nLVGL: 0": ~ - DEL: ~ - 'User name: ': ~ - 'Modem Preset: LONG FAST': ~ - 'Channel: LongFast': ~ - 'Role: Client': ~ - 'Screen Timeout: 60s': ~ - 'Screen Lock: off': ~ - 'Screen Brightness: 60%': ~ - 'Theme: Dark': ~ - 'Screen Calibration: default': ~ - 'Input Control: none/none': ~ - 'Message Alert Buzzer: on': ~ - 'Language: English': ~ - Configuration Reset: ~ - Reboot / Shutdown: ~ - Mesh Detector: ~ - Signal Scanner: ~ - Trace Route: ~ - Neighbors: ~ - Statistics: ~ - Packet Log: ~ - Meshtastic: ~ - Group Channels: ~ - no messages: ~ - Settings & Tools: ~ - Settings (advanced): ~ - Locations Map: ~ - no chats: ~ - Node Search: ~ - Packet Statistics: ~ - Node Options: ~ - Short Name: ~ - Long Name: ~ - : ~ + no new messages: nessun messaggio + 1 of 1 nodes online: 1 di 1 nodi online + "uptime 00:00:00": "tempo di attività 00:00:00" + "Heap: 0\nLVGL: 0": "Heap: 0\nLVGL: 0" + DEL: CANC + "User name: ": "Nome utente: " + "Modem Preset: LONG FAST": "Modem: LONG FAST" + "Channel: LongFast": "Canale: LongFast" + "Role: Client": "Ruolo: Client" + "Screen Timeout: 60s": "Timeout schermo: 60s" + "Screen Lock: off": "Blocco schermo: disattivato" + "Screen Brightness: 60%": "Luminosità schermo: 60%" + "Theme: Dark": "Tema: Scuro" + "Screen Calibration: default": "Calibrazione schermo: predefinita" + "Input Control: none/none": "Controllo di input: nessuno/nessuno" + "Message Alert Buzzer: on": "Avviso messaggio cicalino: attivo" + "Language: English": "Lingua: Italiano" + Configuration Reset: Ripristino configurazione + Reboot / Shutdown: Riavvio / Spegnimento + Mesh Detector: Rilevatore Mesh + Signal Scanner: Scanner segnale + Trace Route: Traccia percorso + Neighbors: Vicini + Statistics: Statistiche + Packet Log: Registro pacchetti + Meshtastic: Meshtastic + Group Channels: Canali di gruppo + no messages: nessun messaggio + Settings & Tools: Impostazioni & Strumenti + Settings (advanced): Impostazioni (avanzate) + Locations Map: Mappa delle posizioni + no chats: nessuna chat + Node Search: Ricerca nodo + Packet Statistics: Statistiche pacchetti + Node Options: Opzioni nodo + Short Name: Nome breve + Long Name: Nome lungo + : "LONG FAST\nLONG SLOW\n-- deprecated --\nMEDIUM SLOW\nMEDIUM FAST\nSHORT SLOW\nSHORT FAST\nLONG MODERATE\nSHORT TURBO": ~ - "Client\nClient Mute\nRouter\n-- deprecated --\nRepeater\nTracker\nSensor\nTAK\nClient Hidden\nLost & Found\nTAK Tracker": ~ - 'Brightness: 60%': ~ - "Dark\nLight": ~ - 'Timeout: 60s': ~ - Screen Lock: ~ - Lock PIN: ~ + "Client\nClient Mute\nRouter\n-- deprecated --\nRepeater\nTracker\nSensor\nTAK\nClient Hidden\nLost & Found\nTAK Tracker": "Client\nClient Muto\nRouter\n-- deprecato --\nRipetitore\nTracker\nSensore\nTAK\nClient Nascosto\nOggetti Smarriti\nTAK Tracker" + "Brightness: 60%": "Luminosità: 60%" + "Dark\nLight": "Scuro\nChiaro" + "Timeout: 60s": ~ + Screen Lock: Blocco schermo + Lock PIN: Codice PIN Mouse: ~ - none: ~ - Keyboard: ~ - Message Alert: ~ - Ringtone: ~ - Default: ~ - Zone: ~ - City: ~ - "NodeDB Reset\nFactory Reset": ~ - Channel Name: ~ - Pre-shared Key: ~ - Unknown: ~ + none: nessuno + Keyboard: Tastiera + Message Alert: Avviso di messaggio + Ringtone: Suoneria + Default: Predefinito + Zone: Zona + City: Città + "NodeDB Reset\nFactory Reset": "Ripristino NodeDB\nRipristino di fabbrica" + Channel Name: Nome Canale + Pre-shared Key: Chiave Precondivisa + Unknown: Sconosciuto Offline: ~ - Public Key: ~ - Hops away: ~ + Public Key: Chiave Pubblica + Hops away: Salti di distanza MQTT: ~ - Position: ~ - Name: ~ - Active Chat: ~ - Telemetry: ~ + Position: Posizione + Name: Nome + Active Chat: Chat Attiva + Telemetry: Telemetria IAQ: ~ Start: ~ - "New Message from\n": ~ - Resynch...: ~ + "New Message from\n": "Nuovo messaggio da\n" + Resynch...: Risinc... OK: ~ - Cancel: ~ - 'FrequencySlot: %d (%g MHz)': ~ - 'Brightness: %d%%': ~ - 'Timeout: off': ~ - 'Timeout: %ds': ~ - 'Screen Calibration: %s': ~ - done: ~ - default: ~ + Cancel: Annulla + "FrequencySlot: %d (%g MHz)": "Slot di Frequenza: %d (%g MHz)" + "Brightness: %d%%": "Luminosità: %d%%" + "Timeout: off": "Timeout: disattivato" + "Timeout: %ds": "Timeout: %ds" + "Screen Calibration: %s": "Calibrazione Schermo: %s" + done: fatto + default: predefinito Stop: ~ - "choose\nnode": ~ - choose target node: ~ - 'heard: !%08x': ~ - 'Packet Log: %d': ~ - 'Language: %s': ~ - 'Screen Timeout: off': ~ - 'Screen Timeout: %ds': ~ - 'Screen Brightness: %d%%': ~ - 'Theme: %s': ~ - 'User name: %s': ~ - 'Device Role: %s': ~ - 'Region: %s': ~ - 'Modem Preset: %s': ~ - 'Channel: %s': ~ - 'Screen Lock: %s': ~ - 'on': ~ - 'off': ~ - 'Message Alert: %s': ~ - Util %0.1f%% Air %0.1f%%: ~ - 'hops: %d': ~ - unknown: ~ - : ~ - '%d active chat(s)': ~ - "New message from \n%s": ~ - 'Input Control: %s/%s': ~ - '%d of %d nodes online': ~ - Filtering ...: ~ - 'Filter: %d of %d nodes': ~ - now: ~ - '%d new message': ~ - '%d new messages': ~ - 'uptime: %02d:%02d:%02d': ~ - "Heap: %d (%d%%)\nLVGL: %d (%d%%)": ~ - Settings: ~ - Tools: ~ - Filter: ~ - Highlight: ~ - Primary Channel: ~ - Secondary Channels: ~ - Resynch ...: ~ - Rebooting ...: ~ - Shutting down ...: ~ - silent: ~ - 'WiFi: ': ~ - 'Lock: off/off': ~ - LoRa TX off!: ~ - WiFi SSID: ~ - WiFi pre-shared Key: ~ - Settings Lock: ~ - 'Lock: %s/%s': ~ - Enter Text ...: ~ - '!Enter Filter ...': ~ - Enter Filter ...: ~ - 'WiFi: %s': ~ - : ~ - region unset: ~ - Banner & Sound: ~ - Banner only: ~ - Sound only: ~ + "choose\nnode": "scegli\nnodo" + choose target node: scegli nodo di destinazione + "heard: !%08x": "sentito: !%08x" + "Packet Log: %d": "Registro Pacchetti: %d" + "Language: %s": "Lingua: %s" + "Screen Timeout: off": "Timeout Schermo: disattivato" + "Screen Timeout: %ds": "Timeout Schermo: %ds" + "Screen Brightness: %d%%": "Luminosità Schermo: %d%%" + "Theme: %s": "Tema: %s" + "User name: %s": "Nome Utente: %s" + "Device Role: %s": "Ruolo Dispositivo: %s" + "Region: %s": "Regione: %s" + "Modem Preset: %s": "Preset Modem: %s" + "Channel: %s": "Canale: %s" + "Screen Lock: %s": "Blocco Schermo: %s" + "on": "attivo" + "off": "disattivo" + "Message Alert: %s": "Avviso di messaggio: %s" + Util %0.1f%% Air %0.1f%%: Utilizzo %0.1f%% Aria %0.1f%% + "hops: %d": "salti: %d" + unknown: sconosciuto + : + "%d active chat(s)": + one: "%d chat attiva" + other: "%d chat attive" + "New message from \n%s": "Nuovo messaggio da \n%s" + "Input Control: %s/%s": "Controllo di Input: %s/%s" + "%d of %d nodes online": + one: 1 nodo online + other: "%d di %d nodi online" + Filtering ...: Filtraggio ... + "Filter: %d of %d nodes": "Filtro: %d di %d nodi" + now: ora + "%d new message": "%d nuovo messaggio" + "%d new messages": "%d nuovi messaggi" + "uptime: %02d:%02d:%02d": "tempo di attività:\n%02d:%02d:%02d" + "Heap: %d (%d%%)\nLVGL: %d (%d%%)": "Heap: %d (%d%%)\nLVGL: %d (%d%%)" + Settings: Impostazioni + Tools: Strumenti + Filter: Filtro + Highlight: Evidenzia + Primary Channel: Canale Primario + Secondary Channels: Canali Secondari + Resynch ...: Risinc ... + Rebooting ...: Riavvio ... + Shutting down ...: Spegnimento ... + silent: silenzioso + "WiFi: ": "WiFi: " + "Lock: off/off": "Blocco: disattivato/disattivato" + LoRa TX off!: LoRa TX disattivato! + WiFi SSID: SSID WiFi + WiFi pre-shared Key: Chiave Precondivisa WiFi + Settings Lock: Blocco Impostazioni + "Lock: %s/%s": "Blocco: %s/%s" + Enter Text ...: Inserisci Testo ... + "!Enter Filter ...": "!Inserisci Filtro ..." + Enter Filter ...: Inserisci Filtro ... + "WiFi: %s": "WiFi: %s" + : + region unset: regione non impostata + Banner & Sound: Banner e Suono + Banner only: Solo Banner + Sound only: Solo Suono diff --git a/locale/lv_i18n.c b/locale/lv_i18n.c index 61e7793..08cf0d3 100644 --- a/locale/lv_i18n.c +++ b/locale/lv_i18n.c @@ -1,6 +1,5 @@ #include "./lv_i18n.h" - //////////////////////////////////////////////////////////////////////////////// // Define plural operands // http://unicode.org/reports/tr35/tr35-numbers.html#Operands @@ -9,30 +8,53 @@ #define UNUSED(x) (void)(x) -static inline uint32_t op_n(int32_t val) { return (uint32_t)(val < 0 ? -val : val); } -static inline uint32_t op_i(uint32_t val) { return val; } +static inline uint32_t op_n(int32_t val) +{ + return (uint32_t)(val < 0 ? -val : val); +} +static inline uint32_t op_i(uint32_t val) +{ + return val; +} // always zero, when decimal part not exists. -static inline uint32_t op_v(uint32_t val) { UNUSED(val); return 0;} -static inline uint32_t op_w(uint32_t val) { UNUSED(val); return 0; } -static inline uint32_t op_f(uint32_t val) { UNUSED(val); return 0; } -static inline uint32_t op_t(uint32_t val) { UNUSED(val); return 0; } +static inline uint32_t op_v(uint32_t val) +{ + UNUSED(val); + return 0; +} +static inline uint32_t op_w(uint32_t val) +{ + UNUSED(val); + return 0; +} +static inline uint32_t op_f(uint32_t val) +{ + UNUSED(val); + return 0; +} +static inline uint32_t op_t(uint32_t val) +{ + UNUSED(val); + return 0; +} static uint8_t en_plural_fn(int32_t num) { - uint32_t n = op_n(num); UNUSED(n); - uint32_t i = op_i(n); UNUSED(i); - uint32_t v = op_v(n); UNUSED(v); - - if ((i == 1 && v == 0)) return LV_I18N_PLURAL_TYPE_ONE; + uint32_t n = op_n(num); + UNUSED(n); + uint32_t i = op_i(n); + UNUSED(i); + uint32_t v = op_v(n); + UNUSED(v); + + if ((i == 1 && v == 0)) + return LV_I18N_PLURAL_TYPE_ONE; return LV_I18N_PLURAL_TYPE_OTHER; } -static const lv_i18n_lang_t en_lang = { - .locale_name = "en", - +static const lv_i18n_lang_t en_lang = {.locale_name = "en", - .locale_plural_fn = en_plural_fn -}; + .locale_plural_fn = en_plural_fn}; static lv_i18n_phrase_t de_singulars[] = { {"User name: %s", "Benutzer: %s"}, @@ -155,34 +177,32 @@ static lv_i18n_phrase_t de_singulars[] = { }; static lv_i18n_phrase_t de_plurals_one[] = { - {"%d active chat(s)", "%d aktives Gespräch"}, - {"%d of %d nodes online", "1 Gerät online"}, - {NULL, NULL} // End mark + {"%d active chat(s)", "%d aktives Gespräch"}, {"%d of %d nodes online", "1 Gerät online"}, {NULL, NULL} // End mark }; static lv_i18n_phrase_t de_plurals_other[] = { - {"%d active chat(s)", "%d aktive Gespräche"}, - {"%d of %d nodes online", "%d / %d Geräte online"}, - {NULL, NULL} // End mark + {"%d active chat(s)", "%d aktive Gespräche"}, {"%d of %d nodes online", "%d / %d Geräte online"}, {NULL, NULL} // End mark }; static uint8_t de_plural_fn(int32_t num) { - uint32_t n = op_n(num); UNUSED(n); - uint32_t i = op_i(n); UNUSED(i); - uint32_t v = op_v(n); UNUSED(v); - - if ((i == 1 && v == 0)) return LV_I18N_PLURAL_TYPE_ONE; + uint32_t n = op_n(num); + UNUSED(n); + uint32_t i = op_i(n); + UNUSED(i); + uint32_t v = op_v(n); + UNUSED(v); + + if ((i == 1 && v == 0)) + return LV_I18N_PLURAL_TYPE_ONE; return LV_I18N_PLURAL_TYPE_OTHER; } -static const lv_i18n_lang_t de_lang = { - .locale_name = "de", - .singulars = de_singulars, - .plurals[LV_I18N_PLURAL_TYPE_ONE] = de_plurals_one, - .plurals[LV_I18N_PLURAL_TYPE_OTHER] = de_plurals_other, - .locale_plural_fn = de_plural_fn -}; +static const lv_i18n_lang_t de_lang = {.locale_name = "de", + .singulars = de_singulars, + .plurals[LV_I18N_PLURAL_TYPE_ONE] = de_plurals_one, + .plurals[LV_I18N_PLURAL_TYPE_OTHER] = de_plurals_other, + .locale_plural_fn = de_plural_fn}; static lv_i18n_phrase_t es_singulars[] = { {"no new messages", "Sin mensajes nuevos"}, @@ -250,8 +270,10 @@ static lv_i18n_phrase_t es_singulars[] = { {"Start", "Iniciar"}, {"Theme: %s", "Tema: %s"}, {"Packet Statistics", "Estadísticas"}, - {"LONG FAST\nLONG SLOW\n-- deprecated --\nMEDIUM SLOW\nMEDIUM FAST\nSHORT SLOW\nSHORT FAST\nLONG MODERATE\nSHORT TURBO", "LONG FAST\nLONG SLOW\n-- obsoleto --\nMEDIUM SLOW\nMEDIUM FAST\nSHORT SLOW\nSHORT FAST\nLONG MODERATE\nSHORT TURBO"}, - {"Client\nClient Mute\nRouter\n-- deprecated --\nRepeater\nTracker\nSensor\nTAK\nClient Hidden\nLost & Found\nTAK Tracker", "Client\nClient Mute\nRouter\n-- obsoleto --\nRepeater\nTracker\nSensor\nTAK\nClient Hidden\nLost & Found\nTAK Tracker"}, + {"LONG FAST\nLONG SLOW\n-- deprecated --\nMEDIUM SLOW\nMEDIUM FAST\nSHORT SLOW\nSHORT FAST\nLONG MODERATE\nSHORT TURBO", + "LONG FAST\nLONG SLOW\n-- obsoleto --\nMEDIUM SLOW\nMEDIUM FAST\nSHORT SLOW\nSHORT FAST\nLONG MODERATE\nSHORT TURBO"}, + {"Client\nClient Mute\nRouter\n-- deprecated --\nRepeater\nTracker\nSensor\nTAK\nClient Hidden\nLost & Found\nTAK Tracker", + "Client\nClient Mute\nRouter\n-- obsoleto --\nRepeater\nTracker\nSensor\nTAK\nClient Hidden\nLost & Found\nTAK Tracker"}, {"Dark\nLight", "Oscuro\nClaro"}, {"Cancel", "Cancelar"}, {"Brightness: %d%%", "Brillo : %d%%"}, @@ -307,23 +329,20 @@ static lv_i18n_phrase_t es_singulars[] = { {NULL, NULL} // End mark }; - - static uint8_t es_plural_fn(int32_t num) { - uint32_t n = op_n(num); UNUSED(n); - + uint32_t n = op_n(num); + UNUSED(n); - if ((n == 1)) return LV_I18N_PLURAL_TYPE_ONE; + if ((n == 1)) + return LV_I18N_PLURAL_TYPE_ONE; return LV_I18N_PLURAL_TYPE_OTHER; } -static const lv_i18n_lang_t es_lang = { - .locale_name = "es", - .singulars = es_singulars, +static const lv_i18n_lang_t es_lang = {.locale_name = "es", + .singulars = es_singulars, - .locale_plural_fn = es_plural_fn -}; + .locale_plural_fn = es_plural_fn}; static lv_i18n_phrase_t fi_singulars[] = { {"no new messages", "ei uusia viestejä"}, @@ -436,57 +455,201 @@ static lv_i18n_phrase_t fi_singulars[] = { {NULL, NULL} // End mark }; - - static uint8_t fi_plural_fn(int32_t num) { - uint32_t n = op_n(num); UNUSED(n); - uint32_t i = op_i(n); UNUSED(i); - uint32_t v = op_v(n); UNUSED(v); - - if ((i == 1 && v == 0)) return LV_I18N_PLURAL_TYPE_ONE; + uint32_t n = op_n(num); + UNUSED(n); + uint32_t i = op_i(n); + UNUSED(i); + uint32_t v = op_v(n); + UNUSED(v); + + if ((i == 1 && v == 0)) + return LV_I18N_PLURAL_TYPE_ONE; return LV_I18N_PLURAL_TYPE_OTHER; } -static const lv_i18n_lang_t fi_lang = { - .locale_name = "fi", - .singulars = fi_singulars, +static const lv_i18n_lang_t fi_lang = {.locale_name = "fi", + .singulars = fi_singulars, - .locale_plural_fn = fi_plural_fn -}; + .locale_plural_fn = fi_plural_fn}; static uint8_t fr_plural_fn(int32_t num) { - uint32_t n = op_n(num); UNUSED(n); - uint32_t i = op_i(n); UNUSED(i); + uint32_t n = op_n(num); + UNUSED(n); + uint32_t i = op_i(n); + UNUSED(i); - if ((((i == 0) || (i == 1)))) return LV_I18N_PLURAL_TYPE_ONE; + if ((((i == 0) || (i == 1)))) + return LV_I18N_PLURAL_TYPE_ONE; return LV_I18N_PLURAL_TYPE_OTHER; } -static const lv_i18n_lang_t fr_lang = { - .locale_name = "fr", +static const lv_i18n_lang_t fr_lang = {.locale_name = "fr", + .locale_plural_fn = fr_plural_fn}; - .locale_plural_fn = fr_plural_fn +static lv_i18n_phrase_t it_singulars[] = { + {"no new messages", "nessun messaggio"}, + {"1 of 1 nodes online", "1 di 1 nodi online"}, + {"uptime 00:00:00", "tempo di attività 00:00:00"}, + {"Heap: 0\nLVGL: 0", "Heap: 0\nLVGL: 0"}, + {"DEL", "CANC"}, + {"User name: ", "Nome utente: "}, + {"Modem Preset: LONG FAST", "Modem: LONG FAST"}, + {"Channel: LongFast", "Canale: LongFast"}, + {"Role: Client", "Ruolo: Client"}, + {"Screen Timeout: 60s", "Timeout schermo: 60s"}, + {"Screen Lock: off", "Blocco schermo: disattivato"}, + {"Screen Brightness: 60%", "Luminosità schermo: 60%"}, + {"Theme: Dark", "Tema: Scuro"}, + {"Screen Calibration: default", "Calibrazione schermo: predefinita"}, + {"Input Control: none/none", "Controllo di input: nessuno/nessuno"}, + {"Message Alert Buzzer: on", "Avviso messaggio cicalino: attivo"}, + {"Language: English", "Lingua: Italiano"}, + {"Configuration Reset", "Ripristino configurazione"}, + {"Reboot / Shutdown", "Riavvio / Spegnimento"}, + {"Mesh Detector", "Rilevatore Mesh"}, + {"Signal Scanner", "Scanner segnale"}, + {"Trace Route", "Traccia percorso"}, + {"Neighbors", "Vicini"}, + {"Statistics", "Statistiche"}, + {"Packet Log", "Registro pacchetti"}, + {"Meshtastic", "Meshtastic"}, + {"Group Channels", "Canali di gruppo"}, + {"no messages", "nessun messaggio"}, + {"Settings & Tools", "Impostazioni & strumenti"}, + {"Settings (advanced)", "Impostazioni (avanzate)"}, + {"Locations Map", "Mappa delle posizioni"}, + {"no chats", "nessuna chat"}, + {"Node Search", "Ricerca nodo"}, + {"Packet Statistics", "Statistiche pacchetti"}, + {"Node Options", "Opzioni nodo"}, + {"Short Name", "Nome breve"}, + {"Long Name", "Nome lungo"}, + {"", ""}, + {"Client\nClient Mute\nRouter\n-- deprecated --\nRepeater\nTracker\nSensor\nTAK\nClient Hidden\nLost & Found\nTAK Tracker", + "Client\nClient Muto\nRouter\n-- deprecato --\nRipetitore\nTracker\nSensore\nTAK\nClient Nascosto\nOggetti Smarriti\nTAK " + "Tracker"}, + {"Brightness: 60%", "Luminosità: 60%"}, + {"Dark\nLight", "Scuro\nChiaro"}, + {"Screen Lock", "Blocco schermo"}, + {"Lock PIN", "Codice PIN"}, + {"none", "nessuno"}, + {"Keyboard", "Tastiera"}, + {"Message Alert", "Avviso di messaggio"}, + {"Ringtone", "Suoneria"}, + {"Default", "Predefinito"}, + {"Zone", "Zona"}, + {"City", "Città"}, + {"NodeDB Reset\nFactory Reset", "Ripristino NodeDB\nRipristino di fabbrica"}, + {"Channel Name", "Nome Canale"}, + {"Pre-shared Key", "Chiave Precondivisa"}, + {"Unknown", "Sconosciuto"}, + {"Public Key", "Chiave Pubblica"}, + {"Hops away", "Salti di distanza"}, + {"Position", "Posizione"}, + {"Name", "Nome"}, + {"Active Chat", "Chat Attiva"}, + {"Telemetry", "Telemetria"}, + {"New Message from\n", "Nuovo messaggio da\n"}, + {"Resynch...", "Risinc..."}, + {"Cancel", "Annulla"}, + {"FrequencySlot: %d (%g MHz)", "Slot di Frequenza: %d (%g MHz)"}, + {"Brightness: %d%%", "Luminosità: %d%%"}, + {"Timeout: off", "Timeout: disattivato"}, + {"Timeout: %ds", "Timeout: %ds"}, + {"Screen Calibration: %s", "Calibrazione Schermo: %s"}, + {"done", "fatto"}, + {"default", "predefinito"}, + {"choose\nnode", "scegli\nnodo"}, + {"choose target node", "scegli nodo di destinazione"}, + {"heard: !%08x", "sentito: !%08x"}, + {"Packet Log: %d", "Registro Pacchetti: %d"}, + {"Language: %s", "Lingua: %s"}, + {"Screen Timeout: off", "Timeout Schermo: disattivato"}, + {"Screen Timeout: %ds", "Timeout Schermo: %ds"}, + {"Screen Brightness: %d%%", "Luminosità Schermo: %d%%"}, + {"Theme: %s", "Tema: %s"}, + {"User name: %s", "Nome Utente: %s"}, + {"Device Role: %s", "Ruolo Dispositivo: %s"}, + {"Region: %s", "Regione: %s"}, + {"Modem Preset: %s", "Preset Modem: %s"}, + {"Channel: %s", "Canale: %s"}, + {"Screen Lock: %s", "Blocco Schermo: %s"}, + {"on", "attivo"}, + {"off", "disattivo"}, + {"Message Alert: %s", "Avviso di messaggio: %s"}, + {"Util %0.1f%% Air %0.1f%%", "Utilizzo %0.1f%% Aria %0.1f%%"}, + {"hops: %d", "salti: %d"}, + {"unknown", "sconosciuto"}, + {"", ""}, + {"New message from \n%s", "Nuovo messaggio da \n%s"}, + {"Input Control: %s/%s", "Controllo di Input: %s/%s"}, + {"Filtering ...", "Filtraggio ..."}, + {"Filter: %d of %d nodes", "Filtro: %d di %d nodi"}, + {"now", "ora"}, + {"%d new message", "%d nuovo messaggio"}, + {"%d new messages", "%d nuovi messaggi"}, + {"uptime: %02d:%02d:%02d", "tempo di attività:\n%02d:%02d:%02d"}, + {"Heap: %d (%d%%)\nLVGL: %d (%d%%)", "Heap: %d (%d%%)\nLVGL: %d (%d%%)"}, + {"Settings", "Impostazioni"}, + {"Tools", "Strumenti"}, + {"Filter", "Filtro"}, + {"Highlight", "Evidenzia"}, + {"Primary Channel", "Canale Primario"}, + {"Secondary Channels", "Canali Secondari"}, + {"Resynch ...", "Risinc ..."}, + {"Rebooting ...", "Riavvio ..."}, + {"Shutting down ...", "Spegnimento ..."}, + {"silent", "silenzioso"}, + {"WiFi: ", "WiFi: "}, + {"Lock: off/off", "Blocco: disattivato/disattivato"}, + {"LoRa TX off!", "LoRa TX disattivato!"}, + {"WiFi SSID", "SSID WiFi"}, + {"WiFi pre-shared Key", "Chiave Precondivisa WiFi"}, + {"Settings Lock", "Blocco Impostazioni"}, + {"Lock: %s/%s", "Blocco: %s/%s"}, + {"Enter Text ...", "Inserisci Testo ..."}, + {"!Enter Filter ...", "!Inserisci Filtro ..."}, + {"Enter Filter ...", "Inserisci Filtro ..."}, + {"WiFi: %s", "WiFi: %s"}, + {"", ""}, + {"region unset", "regione non impostata"}, + {"Banner & Sound", "Banner e Suono"}, + {"Banner only", "Solo Banner"}, + {"Sound only", "Solo Suono"}, + {NULL, NULL} // End mark +}; + +static lv_i18n_phrase_t it_plurals_one[] = { + {"%d active chat(s)", "%d chat attiva"}, {"%d of %d nodes online", "1 nodo online"}, {NULL, NULL} // End mark +}; + +static lv_i18n_phrase_t it_plurals_other[] = { + {"%d active chat(s)", "%d chat attive"}, {"%d of %d nodes online", "%d di %d nodi online"}, {NULL, NULL} // End mark }; static uint8_t it_plural_fn(int32_t num) { - uint32_t n = op_n(num); UNUSED(n); - uint32_t i = op_i(n); UNUSED(i); - uint32_t v = op_v(n); UNUSED(v); - - if ((i == 1 && v == 0)) return LV_I18N_PLURAL_TYPE_ONE; + uint32_t n = op_n(num); + UNUSED(n); + uint32_t i = op_i(n); + UNUSED(i); + uint32_t v = op_v(n); + UNUSED(v); + + if ((i == 1 && v == 0)) + return LV_I18N_PLURAL_TYPE_ONE; return LV_I18N_PLURAL_TYPE_OTHER; } -static const lv_i18n_lang_t it_lang = { - .locale_name = "it", - - - .locale_plural_fn = it_plural_fn -}; +static const lv_i18n_lang_t it_lang = {.locale_name = "it", + .singulars = it_singulars, + .plurals[LV_I18N_PLURAL_TYPE_ONE] = it_plurals_one, + .plurals[LV_I18N_PLURAL_TYPE_OTHER] = it_plurals_other, + .locale_plural_fn = it_plural_fn}; static lv_i18n_phrase_t nl_singulars[] = { {"no new messages", "0 nieuwe berichten"}, @@ -527,8 +690,10 @@ static lv_i18n_phrase_t nl_singulars[] = { {"Short Name", "Korte Naam"}, {"Long Name", "Lange Naam"}, {"", ""}, - {"LONG FAST\nLONG SLOW\n-- deprecated --\nMEDIUM SLOW\nMEDIUM FAST\nSHORT SLOW\nSHORT FAST\nLONG MODERATE\nSHORT TURBO", "LONG FAST\nLONG SLOW\n-- deprecated --\nMEDIUM SLOW\nMEDIUM FAST\nSHORT SLOW\nSHORT FAST\nLONG MODERATE\nSHORT TURBO"}, - {"Client\nClient Mute\nRouter\n-- deprecated --\nRepeater\nTracker\nSensor\nTAK\nClient Hidden\nLost & Found\nTAK Tracker", "Client\nClient Mute\nRouter\n-- deprecated --\nRepeater\nTracker\nSensor\nTAK\nClient Hidden\nLost & Found\nTAK Tracker"}, + {"LONG FAST\nLONG SLOW\n-- deprecated --\nMEDIUM SLOW\nMEDIUM FAST\nSHORT SLOW\nSHORT FAST\nLONG MODERATE\nSHORT TURBO", + "LONG FAST\nLONG SLOW\n-- deprecated --\nMEDIUM SLOW\nMEDIUM FAST\nSHORT SLOW\nSHORT FAST\nLONG MODERATE\nSHORT TURBO"}, + {"Client\nClient Mute\nRouter\n-- deprecated --\nRepeater\nTracker\nSensor\nTAK\nClient Hidden\nLost & Found\nTAK Tracker", + "Client\nClient Mute\nRouter\n-- deprecated --\nRepeater\nTracker\nSensor\nTAK\nClient Hidden\nLost & Found\nTAK Tracker"}, {"Brightness: 60%", "Helderheid: 60%"}, {"Dark\nLight", "Donker\nLicht"}, {"Timeout: 60s", "Timeout: 60s"}, @@ -627,24 +792,24 @@ static lv_i18n_phrase_t nl_singulars[] = { {NULL, NULL} // End mark }; - - static uint8_t nl_plural_fn(int32_t num) { - uint32_t n = op_n(num); UNUSED(n); - uint32_t i = op_i(n); UNUSED(i); - uint32_t v = op_v(n); UNUSED(v); - - if ((i == 1 && v == 0)) return LV_I18N_PLURAL_TYPE_ONE; + uint32_t n = op_n(num); + UNUSED(n); + uint32_t i = op_i(n); + UNUSED(i); + uint32_t v = op_v(n); + UNUSED(v); + + if ((i == 1 && v == 0)) + return LV_I18N_PLURAL_TYPE_ONE; return LV_I18N_PLURAL_TYPE_OTHER; } -static const lv_i18n_lang_t nl_lang = { - .locale_name = "nl", - .singulars = nl_singulars, +static const lv_i18n_lang_t nl_lang = {.locale_name = "nl", + .singulars = nl_singulars, - .locale_plural_fn = nl_plural_fn -}; + .locale_plural_fn = nl_plural_fn}; static lv_i18n_phrase_t pl_singulars[] = { {"no new messages", "Brak wiadomości"}, @@ -750,27 +915,30 @@ static lv_i18n_phrase_t pl_singulars[] = { {NULL, NULL} // End mark }; - - static uint8_t pl_plural_fn(int32_t num) { - uint32_t n = op_n(num); UNUSED(n); - uint32_t i = op_i(n); UNUSED(i); - uint32_t v = op_v(n); UNUSED(v); + uint32_t n = op_n(num); + UNUSED(n); + uint32_t i = op_i(n); + UNUSED(i); + uint32_t v = op_v(n); + UNUSED(v); uint32_t i10 = i % 10; uint32_t i100 = i % 100; - if ((i == 1 && v == 0)) return LV_I18N_PLURAL_TYPE_ONE; - if ((v == 0 && (2 <= i10 && i10 <= 4) && (!(12 <= i100 && i100 <= 14)))) return LV_I18N_PLURAL_TYPE_FEW; - if ((v == 0 && i != 1 && (0 <= i10 && i10 <= 1)) || (v == 0 && (5 <= i10 && i10 <= 9)) || (v == 0 && (12 <= i100 && i100 <= 14))) return LV_I18N_PLURAL_TYPE_MANY; + if ((i == 1 && v == 0)) + return LV_I18N_PLURAL_TYPE_ONE; + if ((v == 0 && (2 <= i10 && i10 <= 4) && (!(12 <= i100 && i100 <= 14)))) + return LV_I18N_PLURAL_TYPE_FEW; + if ((v == 0 && i != 1 && (0 <= i10 && i10 <= 1)) || (v == 0 && (5 <= i10 && i10 <= 9)) || + (v == 0 && (12 <= i100 && i100 <= 14))) + return LV_I18N_PLURAL_TYPE_MANY; return LV_I18N_PLURAL_TYPE_OTHER; } -static const lv_i18n_lang_t pl_lang = { - .locale_name = "pl", - .singulars = pl_singulars, +static const lv_i18n_lang_t pl_lang = {.locale_name = "pl", + .singulars = pl_singulars, - .locale_plural_fn = pl_plural_fn -}; + .locale_plural_fn = pl_plural_fn}; static lv_i18n_phrase_t pt_singulars[] = { {"no new messages", "Nenhuma mensagem nova"}, @@ -810,8 +978,11 @@ static lv_i18n_phrase_t pt_singulars[] = { {"Short Name", "Nome Curto"}, {"Long Name", "Nome Longo"}, {"", ""}, - {"LONG FAST\nLONG SLOW\n-- deprecated --\nMEDIUM SLOW\nMEDIUM FAST\nSHORT SLOW\nSHORT FAST\nLONG MODERATE\nSHORT TURBO", "LONG FAST\nLONG SLOW\n-- desativado --\nMEDIUM SLOW\nMEDIUM FAST\nSHORT SLOW\nSHORT FAST\nLONG MODERATE\nSHORT TURBO"}, - {"Client\nClient Mute\nRouter\n-- deprecated --\nRepeater\nTracker\nSensor\nTAK\nClient Hidden\nLost & Found\nTAK Tracker", "Cliente\nCliente Mudo\nRoteador\n-- desativado --\nRepetidor\nRastreador\nSensor\nTAK\nCliente Oculto\nAchados e Perdidos\nRastreador TAK"}, + {"LONG FAST\nLONG SLOW\n-- deprecated --\nMEDIUM SLOW\nMEDIUM FAST\nSHORT SLOW\nSHORT FAST\nLONG MODERATE\nSHORT TURBO", + "LONG FAST\nLONG SLOW\n-- desativado --\nMEDIUM SLOW\nMEDIUM FAST\nSHORT SLOW\nSHORT FAST\nLONG MODERATE\nSHORT TURBO"}, + {"Client\nClient Mute\nRouter\n-- deprecated --\nRepeater\nTracker\nSensor\nTAK\nClient Hidden\nLost & Found\nTAK Tracker", + "Cliente\nCliente Mudo\nRoteador\n-- desativado --\nRepetidor\nRastreador\nSensor\nTAK\nCliente Oculto\nAchados e " + "Perdidos\nRastreador TAK"}, {"Brightness: 60%", "Brilho de Tela: 60%"}, {"Dark\nLight", "Escuro\nClaro"}, {"Timeout: 60s", "Tempo Máximo: 60s"}, @@ -895,41 +1066,42 @@ static lv_i18n_phrase_t pt_singulars[] = { {NULL, NULL} // End mark }; - - static uint8_t pt_plural_fn(int32_t num) { - uint32_t n = op_n(num); UNUSED(n); - uint32_t i = op_i(n); UNUSED(i); + uint32_t n = op_n(num); + UNUSED(n); + uint32_t i = op_i(n); + UNUSED(i); - if (((0 <= i && i <= 1))) return LV_I18N_PLURAL_TYPE_ONE; + if (((0 <= i && i <= 1))) + return LV_I18N_PLURAL_TYPE_ONE; return LV_I18N_PLURAL_TYPE_OTHER; } -static const lv_i18n_lang_t pt_lang = { - .locale_name = "pt", - .singulars = pt_singulars, +static const lv_i18n_lang_t pt_lang = {.locale_name = "pt", + .singulars = pt_singulars, - .locale_plural_fn = pt_plural_fn -}; + .locale_plural_fn = pt_plural_fn}; static uint8_t ro_plural_fn(int32_t num) { - uint32_t n = op_n(num); UNUSED(n); - uint32_t i = op_i(n); UNUSED(i); - uint32_t v = op_v(n); UNUSED(v); + uint32_t n = op_n(num); + UNUSED(n); + uint32_t i = op_i(n); + UNUSED(i); + uint32_t v = op_v(n); + UNUSED(v); uint32_t n100 = n % 100; - if ((i == 1 && v == 0)) return LV_I18N_PLURAL_TYPE_ONE; - if ((v != 0) || (n == 0) || (n != 1 && (1 <= n100 && n100 <= 19))) return LV_I18N_PLURAL_TYPE_FEW; + if ((i == 1 && v == 0)) + return LV_I18N_PLURAL_TYPE_ONE; + if ((v != 0) || (n == 0) || (n != 1 && (1 <= n100 && n100 <= 19))) + return LV_I18N_PLURAL_TYPE_FEW; return LV_I18N_PLURAL_TYPE_OTHER; } -static const lv_i18n_lang_t ro_lang = { - .locale_name = "ro", +static const lv_i18n_lang_t ro_lang = {.locale_name = "ro", - - .locale_plural_fn = ro_plural_fn -}; + .locale_plural_fn = ro_plural_fn}; static lv_i18n_phrase_t se_singulars[] = { {"no new messages", "inga nya meddelanden"}, @@ -967,8 +1139,12 @@ static lv_i18n_phrase_t se_singulars[] = { {"Short Name", "Kort Namn"}, {"Long Name", "Lånt Namn"}, {"", ""}, - {"LONG FAST\nLONG SLOW\n-- deprecated --\nMEDIUM SLOW\nMEDIUM FAST\nSHORT SLOW\nSHORT FAST\nLONG MODERATE\nSHORT TURBO", "Lång räckvidd / Snabb\nLång räckvidd / Långsam\n-- utfasad --\nMedium Räckvidd / Långsam\nMedium räckvidd / Snabb\nKort räckvidd / Långsam\nKort räckvidd / Snabb\nLång räckvidd / Måttlig\nKort räckvidd / Turbo"}, - {"Client\nClient Mute\nRouter\n-- deprecated --\nRepeater\nTracker\nSensor\nTAK\nClient Hidden\nLost & Found\nTAK Tracker", "Klient\nKlient Stum\nRouter\n-- utfasad --\nRelästation\nSpårare\nSensor\nTAK\nKlient Gömd\nFörlorad & hittad\nTAK Spårare"}, + {"LONG FAST\nLONG SLOW\n-- deprecated --\nMEDIUM SLOW\nMEDIUM FAST\nSHORT SLOW\nSHORT FAST\nLONG MODERATE\nSHORT TURBO", + "Lång räckvidd / Snabb\nLång räckvidd / Långsam\n-- utfasad --\nMedium Räckvidd / Långsam\nMedium räckvidd / Snabb\nKort " + "räckvidd / Långsam\nKort räckvidd / Snabb\nLång räckvidd / Måttlig\nKort räckvidd / Turbo"}, + {"Client\nClient Mute\nRouter\n-- deprecated --\nRepeater\nTracker\nSensor\nTAK\nClient Hidden\nLost & Found\nTAK Tracker", + "Klient\nKlient Stum\nRouter\n-- utfasad --\nRelästation\nSpårare\nSensor\nTAK\nKlient Gömd\nFörlorad & hittad\nTAK " + "Spårare"}, {"Brightness: 60%", "Ljusstyrka: 60%"}, {"Dark\nLight", "Mörkt\nLjust"}, {"Screen Lock", "Bildskärms Lås"}, @@ -1060,24 +1236,22 @@ static lv_i18n_phrase_t se_singulars[] = { {NULL, NULL} // End mark }; - - static uint8_t se_plural_fn(int32_t num) { - uint32_t n = op_n(num); UNUSED(n); - + uint32_t n = op_n(num); + UNUSED(n); - if ((n == 1)) return LV_I18N_PLURAL_TYPE_ONE; - if ((n == 2)) return LV_I18N_PLURAL_TYPE_TWO; + if ((n == 1)) + return LV_I18N_PLURAL_TYPE_ONE; + if ((n == 2)) + return LV_I18N_PLURAL_TYPE_TWO; return LV_I18N_PLURAL_TYPE_OTHER; } -static const lv_i18n_lang_t se_lang = { - .locale_name = "se", - .singulars = se_singulars, +static const lv_i18n_lang_t se_lang = {.locale_name = "se", + .singulars = se_singulars, - .locale_plural_fn = se_plural_fn -}; + .locale_plural_fn = se_plural_fn}; static lv_i18n_phrase_t sr_singulars[] = { {"no new messages", "nema novih poruka"}, @@ -1206,70 +1380,58 @@ static lv_i18n_phrase_t sr_singulars[] = { {NULL, NULL} // End mark }; - - static uint8_t sr_plural_fn(int32_t num) { - uint32_t n = op_n(num); UNUSED(n); - uint32_t v = op_v(n); UNUSED(v); - uint32_t i = op_i(n); UNUSED(i); - uint32_t f = op_f(n); UNUSED(f); + uint32_t n = op_n(num); + UNUSED(n); + uint32_t v = op_v(n); + UNUSED(v); + uint32_t i = op_i(n); + UNUSED(i); + uint32_t f = op_f(n); + UNUSED(f); uint32_t i10 = i % 10; uint32_t i100 = i % 100; uint32_t f10 = f % 10; uint32_t f100 = f % 100; - if ((v == 0 && i10 == 1 && i100 != 11) || (f10 == 1 && f100 != 11)) return LV_I18N_PLURAL_TYPE_ONE; - if ((v == 0 && (2 <= i10 && i10 <= 4) && (!(12 <= i100 && i100 <= 14))) || ((2 <= f10 && f10 <= 4) && (!(12 <= f100 && f100 <= 14)))) return LV_I18N_PLURAL_TYPE_FEW; + if ((v == 0 && i10 == 1 && i100 != 11) || (f10 == 1 && f100 != 11)) + return LV_I18N_PLURAL_TYPE_ONE; + if ((v == 0 && (2 <= i10 && i10 <= 4) && (!(12 <= i100 && i100 <= 14))) || + ((2 <= f10 && f10 <= 4) && (!(12 <= f100 && f100 <= 14)))) + return LV_I18N_PLURAL_TYPE_FEW; return LV_I18N_PLURAL_TYPE_OTHER; } -static const lv_i18n_lang_t sr_lang = { - .locale_name = "sr", - .singulars = sr_singulars, +static const lv_i18n_lang_t sr_lang = {.locale_name = "sr", + .singulars = sr_singulars, - .locale_plural_fn = sr_plural_fn -}; + .locale_plural_fn = sr_plural_fn}; static uint8_t tr_plural_fn(int32_t num) { - uint32_t n = op_n(num); UNUSED(n); - + uint32_t n = op_n(num); + UNUSED(n); - if ((n == 1)) return LV_I18N_PLURAL_TYPE_ONE; + if ((n == 1)) + return LV_I18N_PLURAL_TYPE_ONE; return LV_I18N_PLURAL_TYPE_OTHER; } -static const lv_i18n_lang_t tr_lang = { - .locale_name = "tr", +static const lv_i18n_lang_t tr_lang = {.locale_name = "tr", - - .locale_plural_fn = tr_plural_fn -}; + .locale_plural_fn = tr_plural_fn}; const lv_i18n_language_pack_t lv_i18n_language_pack[] = { - &en_lang, - &de_lang, - &es_lang, - &fi_lang, - &fr_lang, - &it_lang, - &nl_lang, - &pl_lang, - &pt_lang, - &ro_lang, - &se_lang, - &sr_lang, - &tr_lang, + &en_lang, &de_lang, &es_lang, &fi_lang, &fr_lang, &it_lang, &nl_lang, + &pl_lang, &pt_lang, &ro_lang, &se_lang, &sr_lang, &tr_lang, NULL // End mark }; //////////////////////////////////////////////////////////////////////////////// - // Internal state -static const lv_i18n_language_pack_t * current_lang_pack; -static const lv_i18n_lang_t * current_lang; - +static const lv_i18n_language_pack_t *current_lang_pack; +static const lv_i18n_lang_t *current_lang; /** * Reset internal state. For testing. @@ -1284,13 +1446,15 @@ void __lv_i18n_reset(void) * Set the languages for internationalization * @param langs pointer to the array of languages. (Last element has to be `NULL`) */ -int lv_i18n_init(const lv_i18n_language_pack_t * langs) +int lv_i18n_init(const lv_i18n_language_pack_t *langs) { - if(langs == NULL) return -1; - if(langs[0] == NULL) return -1; + if (langs == NULL) + return -1; + if (langs[0] == NULL) + return -1; current_lang_pack = langs; - current_lang = langs[0]; /*Automatically select the first language*/ + current_lang = langs[0]; /*Automatically select the first language*/ return 0; } @@ -1298,15 +1462,16 @@ int lv_i18n_init(const lv_i18n_language_pack_t * langs) * Change the localization (language) * @param l_name name of the translation locale to use. E.g. "en-GB" */ -int lv_i18n_set_locale(const char * l_name) +int lv_i18n_set_locale(const char *l_name) { - if(current_lang_pack == NULL) return -1; + if (current_lang_pack == NULL) + return -1; uint16_t i; - for(i = 0; current_lang_pack[i] != NULL; i++) { + for (i = 0; current_lang_pack[i] != NULL; i++) { // Found -> finish - if(strcmp(current_lang_pack[i]->locale_name, l_name) == 0) { + if (strcmp(current_lang_pack[i]->locale_name, l_name) == 0) { current_lang = current_lang_pack[i]; return 0; } @@ -1315,47 +1480,50 @@ int lv_i18n_set_locale(const char * l_name) return -1; } - -static const char * __lv_i18n_get_text_core(lv_i18n_phrase_t * trans, const char * msg_id) +static const char *__lv_i18n_get_text_core(lv_i18n_phrase_t *trans, const char *msg_id) { uint16_t i; - for(i = 0; trans[i].msg_id != NULL; i++) { - if(strcmp(trans[i].msg_id, msg_id) == 0) { + for (i = 0; trans[i].msg_id != NULL; i++) { + if (strcmp(trans[i].msg_id, msg_id) == 0) { /*The msg_id has found. Check the translation*/ - if(trans[i].translation) return trans[i].translation; + if (trans[i].translation) + return trans[i].translation; } } return NULL; } - /** * Get the translation from a message ID * @param msg_id message ID * @return the translation of `msg_id` on the set local */ -const char * lv_i18n_get_text(const char * msg_id) +const char *lv_i18n_get_text(const char *msg_id) { - if(current_lang == NULL) return msg_id; + if (current_lang == NULL) + return msg_id; - const lv_i18n_lang_t * lang = current_lang; - const void * txt; + const lv_i18n_lang_t *lang = current_lang; + const void *txt; // Search in current locale - if(lang->singulars != NULL) { + if (lang->singulars != NULL) { txt = __lv_i18n_get_text_core(lang->singulars, msg_id); - if (txt != NULL) return txt; + if (txt != NULL) + return txt; } // Try to fallback - if(lang == current_lang_pack[0]) return msg_id; + if (lang == current_lang_pack[0]) + return msg_id; lang = current_lang_pack[0]; // Repeat search for default locale - if(lang->singulars != NULL) { + if (lang->singulars != NULL) { txt = __lv_i18n_get_text_core(lang->singulars, msg_id); - if (txt != NULL) return txt; + if (txt != NULL) + return txt; } return msg_id; @@ -1367,35 +1535,39 @@ const char * lv_i18n_get_text(const char * msg_id) * @param num an integer to select the correct plural form * @return the translation of `msg_id` on the set local */ -const char * lv_i18n_get_text_plural(const char * msg_id, int32_t num) +const char *lv_i18n_get_text_plural(const char *msg_id, int32_t num) { - if(current_lang == NULL) return msg_id; + if (current_lang == NULL) + return msg_id; - const lv_i18n_lang_t * lang = current_lang; - const void * txt; + const lv_i18n_lang_t *lang = current_lang; + const void *txt; lv_i18n_plural_type_t ptype; // Search in current locale - if(lang->locale_plural_fn != NULL) { + if (lang->locale_plural_fn != NULL) { ptype = lang->locale_plural_fn(num); - if(lang->plurals[ptype] != NULL) { + if (lang->plurals[ptype] != NULL) { txt = __lv_i18n_get_text_core(lang->plurals[ptype], msg_id); - if (txt != NULL) return txt; + if (txt != NULL) + return txt; } } // Try to fallback - if(lang == current_lang_pack[0]) return msg_id; + if (lang == current_lang_pack[0]) + return msg_id; lang = current_lang_pack[0]; // Repeat search for default locale - if(lang->locale_plural_fn != NULL) { + if (lang->locale_plural_fn != NULL) { ptype = lang->locale_plural_fn(num); - if(lang->plurals[ptype] != NULL) { + if (lang->plurals[ptype] != NULL) { txt = __lv_i18n_get_text_core(lang->plurals[ptype], msg_id); - if (txt != NULL) return txt; + if (txt != NULL) + return txt; } } @@ -1406,8 +1578,9 @@ const char * lv_i18n_get_text_plural(const char * msg_id, int32_t num) * Get the name of the currently used locale. * @return name of the currently used locale. E.g. "en-GB" */ -const char * lv_i18n_get_current_locale(void) +const char *lv_i18n_get_current_locale(void) { - if(!current_lang) return NULL; + if (!current_lang) + return NULL; return current_lang->locale_name; } diff --git a/source/DisplayDriverFactory.cpp b/source/DisplayDriverFactory.cpp index aac28d5..9c41c9c 100644 --- a/source/DisplayDriverFactory.cpp +++ b/source/DisplayDriverFactory.cpp @@ -27,6 +27,9 @@ #ifdef ESP_4848S040 #include "LGFX_4848S040.h" #endif +#ifdef MAKERFABS_480X480 +#include "LGFX_MAKERFABS480X480.h" +#endif #ifdef T_DECK #include "LGFX_T_DECK.h" #endif @@ -117,6 +120,10 @@ DisplayDriver *DisplayDriverFactory::create(const DisplayDriverConfig &cfg) case DisplayDriverConfig::device_t::ESP4848S040: return new LGFXDriver(cfg.width(), cfg.height()); break; +#elif defined(MAKERFABS_480X480) + case DisplayDriverConfig::device_t::MAKERFABS480X480: + return new LGFXDriver(cfg.width(), cfg.height()); + break; #elif defined(PICOMPUTER_S3) case DisplayDriverConfig::device_t::BPICOMPUTER_S3: return new LGFXDriver(cfg.width(), cfg.height()); diff --git a/source/TFTView_320x240.cpp b/source/TFTView_320x240.cpp index 410353c..c272903 100644 --- a/source/TFTView_320x240.cpp +++ b/source/TFTView_320x240.cpp @@ -387,6 +387,11 @@ void TFTView_320x240::apply_hotfix(void) } } + // resize keyboard + if (v >= 480) { + lv_obj_set_size(objects.keyboard, LV_PCT(100), LV_PCT(50)); + } + // add event callback to to apply custom drawing for statistics table lv_obj_add_event_cb(objects.statistics_table, ui_event_statistics_table, LV_EVENT_DRAW_TASK_ADDED, NULL); lv_obj_add_flag(objects.statistics_table, LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS); @@ -4089,6 +4094,9 @@ void TFTView_320x240::packetReceived(const meshtastic_MeshPacket &p) void TFTView_320x240::notifyResync(bool show) { messageAlert(_("Resynch ..."), show); + if (!show) { + lv_screen_load_anim(objects.main_screen, LV_SCR_LOAD_ANIM_NONE, 0, 0, false); + } } void TFTView_320x240::notifyReboot(bool show)