diff --git a/AGENTS.md b/AGENTS.md index 43be9a34..fc8d9891 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,6 +1,6 @@ # Актуальная архитектура SHiNE -Начинать с [Blockchain](docs/Blockchain/README.md) и [общей архитектуры](docs/ARCHITECTURE.md). Активный runtime CORE/CONTENT, App=test5595. Прямая межсерверная репликация блоков не используется. Не менять протокол или независимые подсистемы без согласования. Интеграционную приёмку и production deploy выполнять отдельно с разрешения пользователя. +Начинать с [Blockchain](docs/Blockchain/README.md) и [общей архитектуры](docs/ARCHITECTURE.md). Активный runtime CORE/CONTENT, App=test5599. Прямая межсерверная репликация блоков не используется. Не менять протокол или независимые подсистемы без согласования. Интеграционную приёмку и production deploy выполнять отдельно с разрешения пользователя. --- diff --git a/ALPHA_NOTICE.md b/ALPHA_NOTICE.md new file mode 100644 index 00000000..0b1f528b --- /dev/null +++ b/ALPHA_NOTICE.md @@ -0,0 +1,27 @@ +# SHiNE 0.9 Alpha — Software Status / Статус программного обеспечения + +## Русский + +**SHiNE 0.9 Alpha — ранняя публичная версия программного обеспечения проекта SHiNE, находящегося в активной разработке. Это не стабильный релиз версии 1.0.** + +- Некоторые функции могут отсутствовать, быть реализованы частично или работать некорректно. Возможны ошибки, сбои, потеря данных и ещё не выявленные уязвимости безопасности. +- Протоколы, программные интерфейсы, форматы данных, пользовательский интерфейс и документация продолжают развиваться. Совместимость с будущими версиями и бесперебойная работа не гарантируются. +- Используйте программное обеспечение с учётом его текущего состояния. Храните резервные копии важных данных, безопасно храните пароли и ключи и не рискуйте значительными денежными средствами при использовании экспериментальных функций. + +Альфа-версия предназначена для раннего использования, тестирования, получения обратной связи и совместного развития экосистемы SHiNE. Сообщения об ошибках и предложения по улучшению приветствуются. + +**Статус Alpha не означает, что публичные записи являются временными или будут удалены при выходе следующей версии.** Перед публикацией ознакомьтесь с [предупреждением о публичных данных](PUBLIC_DATA_WARNING.md). + +--- + +## English + +**SHiNE 0.9 Alpha is an early public release of the SHiNE software, which is under active development. It is not the stable 1.0 release.** + +- Some features may be missing, partially implemented or may not work correctly. Errors, failures, data loss and undiscovered security vulnerabilities are possible. +- Protocols, APIs, data formats, the user interface and documentation continue to evolve. Compatibility with future versions and uninterrupted operation are not guaranteed. +- Use the software with due regard for its current state. Keep backups of important data, store passwords and keys securely, and avoid risking significant funds when using experimental features. + +The alpha release is intended for early use, testing, feedback and collaborative development of the SHiNE ecosystem. Bug reports and suggestions for improvement are welcome. + +**Alpha status does not mean that public records are temporary or will be deleted when the next version is released.** Before publishing, read the [public data warning](PUBLIC_DATA_WARNING.md). diff --git a/COPYRIGHT b/COPYRIGHT new file mode 100644 index 00000000..d3e240f6 --- /dev/null +++ b/COPYRIGHT @@ -0,0 +1,26 @@ +СИЯНИЕ SHiNE + +Русский + +Авторские права (C) 2026 Айдар Гареев (Aidar Gareev). + +Собственный исходный код SHiNE распространяется на условиях +GNU Affero General Public License версии 3 или любой последующей версии +(AGPL-3.0-or-later), опубликованной Free Software Foundation. + +Сторонние компоненты сохраняют свои соответствующие лицензии. +См. файлы LICENSE и THIRD_PARTY_NOTICES.md. + +---------------------------------------------------------------- + +English + +Copyright (C) 2026 Aidar Gareev (Айдар Гареев). + +The original SHiNE source code is licensed under the +GNU Affero General Public License, either version 3 of the License, or +(at your option) any later version published by the Free Software Foundation +(AGPL-3.0-or-later). + +Third-party components retain their respective licenses. +See LICENSE and THIRD_PARTY_NOTICES.md. diff --git a/ESP32/AGENTS.md b/ESP32/AGENTS.md index 0af21126..3c9d9e68 100644 --- a/ESP32/AGENTS.md +++ b/ESP32/AGENTS.md @@ -8,12 +8,12 @@ ## Синхронизация со спецификацией -- При изменении экранов, кнопок, переходов, статусов или текстов обязательно обновлять соответствующую спецификацию в `ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/reference/`. +- При изменении экранов, кнопок, переходов, статусов или текстов обновлять соответствующую спецификацию в `SKETCH/ESP32-S3-Touch-AMOLED-2.16/reference/`. ## Сборка ESP32 - Основной способ проверки и прошивки скетчей для `ESP32-S3-Touch-AMOLED-2.16` - `main-device/burn.sh`. -- Не собирать эти скетчи напрямую через `arduino-cli compile` без `burn.sh`, потому что скрипт добавляет нужные локальные библиотеки и конфиги из `official-demo/examples/Arduino-v3.3.5/libraries`. +- Не собирать эти скетчи напрямую через `arduino-cli compile` без `burn.sh`, потому что скрипт добавляет нужные библиотеки и конфиги из `SKETCH/ESP32-S3-Touch-AMOLED-2.16/official-demo/examples/Arduino-v3.3.5/libraries`. - Если сборка падает по `lv_conf.h` или `TouchDrvCSTXXX.hpp`, сначала проверять именно `burn.sh` и его `--library` пути, а не считать, что файл пропал из репозитория. ## Диагностика ESP32 diff --git a/ESP32/esp32/ESP32-S3-LCD-2/main-device/burn.sh b/ESP32/esp32/ESP32-S3-LCD-2/main-device/burn.sh deleted file mode 100755 index 95860551..00000000 --- a/ESP32/esp32/ESP32-S3-LCD-2/main-device/burn.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -MODE="${1:-potentiometer-adc-test}" -PORT="${PORT:-}" - -case "$MODE" in - potentiometer-adc-test) - SKETCH_DIR="$ROOT_DIR/test_sketches/potentiometer_adc_test" - BUILD_DIR="$ROOT_DIR/.arduino-build/build-potentiometer-adc-test" - ;; - buzzer-gpio6-test) - SKETCH_DIR="$ROOT_DIR/test_sketches/buzzer_gpio6_test" - BUILD_DIR="$ROOT_DIR/.arduino-build/build-buzzer-gpio6-test" - ;; - *) - echo "Unknown mode: $MODE" >&2 - echo "Known modes: potentiometer-adc-test, buzzer-gpio6-test" >&2 - exit 2 - ;; -esac - -if [[ -z "$PORT" ]]; then - PORT="$(arduino-cli board list | awk '/ttyACM|ttyUSB/ {print $1; exit}')" -fi - -if [[ -z "$PORT" ]]; then - echo "No serial port found. Set PORT=/dev/ttyACM0 explicitly." >&2 - exit 1 -fi - -FQBN="esp32:esp32:esp32s3:USBMode=hwcdc,CDCOnBoot=cdc,UploadSpeed=921600,CPUFreq=240,FlashMode=dio,FlashSize=16M,PartitionScheme=app3M_fat9M_16MB,PSRAM=opi" - -echo "== Mode: $MODE" -echo "== Sketch: $SKETCH_DIR" -echo "== Port: $PORT" -echo "== FQBN: $FQBN" - -arduino-cli compile \ - --fqbn "$FQBN" \ - --build-path "$BUILD_DIR" \ - "$SKETCH_DIR" - -arduino-cli upload \ - --fqbn "$FQBN" \ - -p "$PORT" \ - --input-dir "$BUILD_DIR" \ - "$SKETCH_DIR" - -echo -echo "== Done." diff --git a/ESP32/esp32/ESP32-S3-LCD-2/main-device/test_sketches/buzzer_gpio6_test/AGENTS.md b/ESP32/esp32/ESP32-S3-LCD-2/main-device/test_sketches/buzzer_gpio6_test/AGENTS.md deleted file mode 100644 index b89d2d96..00000000 --- a/ESP32/esp32/ESP32-S3-LCD-2/main-device/test_sketches/buzzer_gpio6_test/AGENTS.md +++ /dev/null @@ -1,3 +0,0 @@ -# AGENTS - -This folder contains a temporary GPIO6 buzzer diagnostic for ESP32-S3-LCD-2. Keep screen/serial strings in English. diff --git a/ESP32/esp32/ESP32-S3-LCD-2/main-device/test_sketches/buzzer_gpio6_test/buzzer_gpio6_test.ino b/ESP32/esp32/ESP32-S3-LCD-2/main-device/test_sketches/buzzer_gpio6_test/buzzer_gpio6_test.ino deleted file mode 100644 index cd8e65e2..00000000 --- a/ESP32/esp32/ESP32-S3-LCD-2/main-device/test_sketches/buzzer_gpio6_test/buzzer_gpio6_test.ino +++ /dev/null @@ -1,51 +0,0 @@ -#include - -// Buzzer module wiring: GND -> GND, VCC -> 3V3, I/O -> P1 IO6 / GPIO6. -static constexpr uint8_t PIN_BUZZER = 6; -static constexpr uint32_t STEP_MS = 1800; -static uint8_t gStep = 0; -static uint32_t gChangedMs = 0; - -static void applyStep(uint8_t step) { - ledcDetach(PIN_BUZZER); - pinMode(PIN_BUZZER, OUTPUT); - digitalWrite(PIN_BUZZER, LOW); - delay(80); - switch (step) { - case 0: - pinMode(PIN_BUZZER, OUTPUT); - digitalWrite(PIN_BUZZER, HIGH); - Serial.println("TEST 1: GPIO6 HIGH - active-high module should sound"); - break; - case 1: - pinMode(PIN_BUZZER, OUTPUT); - digitalWrite(PIN_BUZZER, LOW); - Serial.println("TEST 2: GPIO6 LOW - active-low module should sound"); - break; - case 2: - ledcAttach(PIN_BUZZER, 1800, 8); - ledcWriteTone(PIN_BUZZER, 1800); - ledcWrite(PIN_BUZZER, 180); - Serial.println("TEST 3: GPIO6 PWM 1800 Hz - passive module should sound"); - break; - default: - pinMode(PIN_BUZZER, OUTPUT); - digitalWrite(PIN_BUZZER, LOW); - Serial.println("SILENCE"); - break; - } -} - -void setup() { - Serial.begin(115200); - Serial.println("GPIO6 BUZZER TEST: HIGH, LOW, PWM, SILENCE. Each step lasts 1.8 seconds."); - applyStep(gStep); - gChangedMs = millis(); -} - -void loop() { - if (millis() - gChangedMs < STEP_MS) return; - gStep = (gStep + 1) % 4; - applyStep(gStep); - gChangedMs = millis(); -} diff --git a/ESP32/esp32/ESP32-S3-LCD-2/main-device/test_sketches/potentiometer_adc_test/AGENTS.md b/ESP32/esp32/ESP32-S3-LCD-2/main-device/test_sketches/potentiometer_adc_test/AGENTS.md deleted file mode 100644 index 9a2d4153..00000000 --- a/ESP32/esp32/ESP32-S3-LCD-2/main-device/test_sketches/potentiometer_adc_test/AGENTS.md +++ /dev/null @@ -1,17 +0,0 @@ -# AGENTS - -## Назначение папки - -Эта папка содержит отдельный тестовый Arduino-скетч `potentiometer_adc_test.ino` для Waveshare `ESP32-S3-LCD-2`. - -Скетч проверяет переменный резистор на обычных GPIO/ADC, без использования USB `D+ / D-`. - -## Обязательная синхронизация - -При любом изменении `potentiometer_adc_test.ino` обязательно обновлять рядом лежащий `README.md`. - -Если меняются экранные тексты, режимы, пины подключения, правила расчёта, touch-кнопки или serial-команды, описание в `README.md` должно быть обновлено в том же наборе изменений. - -## Язык экрана - -Экранные строки в скетче оставлять на английском языке. diff --git a/ESP32/esp32/ESP32-S3-LCD-2/main-device/test_sketches/potentiometer_adc_test/README.md b/ESP32/esp32/ESP32-S3-LCD-2/main-device/test_sketches/potentiometer_adc_test/README.md deleted file mode 100644 index 3abf07cc..00000000 --- a/ESP32/esp32/ESP32-S3-LCD-2/main-device/test_sketches/potentiometer_adc_test/README.md +++ /dev/null @@ -1,73 +0,0 @@ -# Potentiometer ADC Test for ESP32-S3-LCD-2 - -Тестовый скетч для Waveshare `ESP32-S3-LCD-2`. - -Назначение: проверить переменный резистор `RP 6045-B50K` через обычные GPIO/ADC, без использования USB `D+ / D-`. - -## Пины - -Используются пины с разъёма `P1` платы: - -- `GPIO2 / IO2` — ADC-вход, сюда подключается ползунок потенциометра. -- `GPIO6 / IO6` — DRIVE-выход для грубого 2-проводного режима. -- `3V3` — питание потенциометра для 3-проводного режима, находится на разъёме `P2`. -- `GND` — земля. - -Не подавать `5V` на `GPIO2` или `GPIO6`: GPIO ESP32-S3 не являются 5V tolerant. - -## Режимы - -Переключение: - -- touch-кнопка `3-WIRE`; -- touch-кнопка `2-WIRE`; -- серийная команда `m`; -- короткое нажатие `BOOT / GPIO0`. - -Сброс min/max: - -- touch-кнопка `RESET`; -- серийная команда `r`. - -## 3-Wire Mode - -Правильное подключение: - -- один край потенциометра -> `3V3`; -- второй край потенциометра -> `GND`; -- средний ползунок -> `GPIO2 / IO2`. - -Скетч показывает напряжение на ползунке, raw ADC, абсолютное положение от `0..3.3V`, калиброванное положение между найденными min/max и примерное сопротивление участка `0..50 kΩ`. - -## 2-Wire Mode - -Грубое подключение: - -- один край потенциометра -> `GPIO6 / IO6`; -- средний ползунок -> `GPIO2 / IO2`; -- второй край не подключать. - -`GPIO6` выдаёт `HIGH`, `GPIO2` читается как ADC с внутренней подтяжкой вниз. Такой режим показывает движение ползунка, но не даёт точного сопротивления: внутренняя подтяжка ESP32 имеет большой разброс. - -## Экранные данные - -На экране выводятся: - -- режим и схема пинов; -- raw ADC и millivolts; -- абсолютный процент от `0..3300 mV`; -- калиброванный процент по найденному min/max; -- min/max/span; -- EMA-сглаживание; -- примерная оценка сопротивления; -- статус `OPEN/LOW/MID/HIGH/SATURATED/NO SPAN`; -- координаты последнего touch; -- serial-подсказка. - -## Сборка - -Из папки `main-device`: - -```bash -./burn.sh potentiometer-adc-test -``` diff --git a/ESP32/esp32/ESP32-S3-LCD-2/main-device/test_sketches/potentiometer_adc_test/potentiometer_adc_test.ino b/ESP32/esp32/ESP32-S3-LCD-2/main-device/test_sketches/potentiometer_adc_test/potentiometer_adc_test.ino deleted file mode 100644 index 9b5039d2..00000000 --- a/ESP32/esp32/ESP32-S3-LCD-2/main-device/test_sketches/potentiometer_adc_test/potentiometer_adc_test.ino +++ /dev/null @@ -1,348 +0,0 @@ -#include -#include -#include -#include - -#define PIN_LCD_SCLK 39 -#define PIN_LCD_MOSI 38 -#define PIN_LCD_MISO 40 -#define PIN_LCD_DC 42 -#define PIN_LCD_RST -1 -#define PIN_LCD_CS 45 -#define PIN_LCD_BL 1 - -#define PIN_TP_SDA 48 -#define PIN_TP_SCL 47 - -#define PIN_ADC_WIPER 2 -#define PIN_DRIVE_2WIRE 6 -#define PIN_BOOT_BUTTON 0 - -static const uint16_t DISP_W = 320; -static const uint16_t DISP_H = 240; -static const uint32_t ADC_FULL_MV = 3300; -static const float POT_OHMS = 50000.0f; -static const float ROUGH_PULLDOWN_OHMS = 45000.0f; - -static const uint16_t C_BG = 0x0841; -static const uint16_t C_PANEL = 0x18E3; -static const uint16_t C_CARD = 0x2126; -static const uint16_t C_TEXT = 0xF7BE; -static const uint16_t C_MUTE = 0x8C71; -static const uint16_t C_ACCENT = 0x05DF; -static const uint16_t C_OK = 0x47E8; -static const uint16_t C_WARN = 0xFD20; -static const uint16_t C_BAD = 0xF986; -static const uint16_t C_BORDER = 0x4208; - -struct Rect { - int16_t x; - int16_t y; - int16_t w; - int16_t h; -}; - -enum class Mode : uint8_t { - ThreeWire, - TwoWire, -}; - -struct Sample { - uint16_t raw; - uint32_t mv; - uint16_t rawMinBurst; - uint16_t rawMaxBurst; -}; - -Arduino_DataBus *bus = new Arduino_ESP32SPI( - PIN_LCD_DC, PIN_LCD_CS, PIN_LCD_SCLK, PIN_LCD_MOSI, PIN_LCD_MISO); -Arduino_GFX *gfx = new Arduino_ST7789( - bus, PIN_LCD_RST, 1, true, 240, 320); - -static const Rect BTN_3WIRE = {10, 38, 94, 30}; -static const Rect BTN_2WIRE = {113, 38, 94, 30}; -static const Rect BTN_RESET = {216, 38, 94, 30}; - -static Mode gMode = Mode::ThreeWire; -static uint32_t gLastUiMs = 0; -static uint32_t gLastSerialMs = 0; -static uint32_t gMinMv = 0xFFFFFFFF; -static uint32_t gMaxMv = 0; -static float gEmaMv = 0.0f; -static bool gHasEma = false; -static bool gTouchOk = false; -static uint16_t gLastTouchX = 0; -static uint16_t gLastTouchY = 0; -static bool gBootWasDown = false; -static uint32_t gBootLastChangeMs = 0; - -static void drawText(int16_t x, int16_t y, const char *text, uint16_t color, uint8_t size = 1) { - gfx->setTextSize(size); - gfx->setTextColor(color); - gfx->setCursor(x, y); - gfx->print(text); -} - -static void drawButton(const Rect &r, const char *label, bool active) { - uint16_t fill = active ? C_ACCENT : C_CARD; - uint16_t text = active ? C_BG : C_TEXT; - gfx->fillRoundRect(r.x, r.y, r.w, r.h, 6, fill); - gfx->drawRoundRect(r.x, r.y, r.w, r.h, 6, active ? C_ACCENT : C_BORDER); - int16_t tx = r.x + 10; - int16_t ty = r.y + 10; - drawText(tx, ty, label, text, 1); -} - -static bool contains(const Rect &r, uint16_t x, uint16_t y) { - return x >= r.x && x < r.x + r.w && y >= r.y && y < r.y + r.h; -} - -static const char *modeName() { - return gMode == Mode::ThreeWire ? "3-WIRE" : "2-WIRE"; -} - -static void resetRange() { - gMinMv = 0xFFFFFFFF; - gMaxMv = 0; - gHasEma = false; -} - -static void configurePins() { - pinMode(PIN_ADC_WIPER, INPUT); - analogReadResolution(12); - analogSetPinAttenuation(PIN_ADC_WIPER, ADC_11db); - - if (gMode == Mode::TwoWire) { - pinMode(PIN_DRIVE_2WIRE, OUTPUT); - digitalWrite(PIN_DRIVE_2WIRE, HIGH); - pinMode(PIN_ADC_WIPER, INPUT_PULLDOWN); - } else { - pinMode(PIN_DRIVE_2WIRE, INPUT); - pinMode(PIN_ADC_WIPER, INPUT); - } -} - -static void setMode(Mode mode) { - if (gMode == mode) return; - gMode = mode; - configurePins(); - resetRange(); -} - -static Sample readSample() { - const uint8_t count = 32; - uint32_t rawSum = 0; - uint32_t mvSum = 0; - uint16_t rawMin = 4095; - uint16_t rawMax = 0; - - for (uint8_t i = 0; i < count; i++) { - uint16_t raw = analogRead(PIN_ADC_WIPER); - uint32_t mv = analogReadMilliVolts(PIN_ADC_WIPER); - rawSum += raw; - mvSum += mv; - if (raw < rawMin) rawMin = raw; - if (raw > rawMax) rawMax = raw; - delayMicroseconds(250); - } - - Sample s; - s.raw = rawSum / count; - s.mv = mvSum / count; - s.rawMinBurst = rawMin; - s.rawMaxBurst = rawMax; - return s; -} - -static uint8_t percentFromMv(uint32_t mv) { - if (mv >= ADC_FULL_MV) return 100; - return (uint8_t)((mv * 100UL + ADC_FULL_MV / 2) / ADC_FULL_MV); -} - -static uint8_t calibratedPercent(uint32_t mv, uint32_t span) { - if (span < 10 || gMinMv == 0xFFFFFFFF || mv <= gMinMv) return 0; - uint32_t pct = ((mv - gMinMv) * 100UL + span / 2) / span; - return (uint8_t)min(pct, 100); -} - -static const char *statusText(uint32_t mv, uint32_t span, uint8_t pctAbs) { - if (mv < 30) return "OPEN/GND"; - if (mv > 3250) return "SATURATED"; - if (span < 20) return "NO SPAN"; - if (pctAbs < 15) return "LOW"; - if (pctAbs > 85) return "HIGH"; - return "MID"; -} - -static float estimateOhms(uint32_t mv) { - if (gMode == Mode::ThreeWire) { - return POT_OHMS * ((float)percentFromMv(mv) / 100.0f); - } - if (mv < 5) return -1.0f; - if (mv >= ADC_FULL_MV) return 0.0f; - return ROUGH_PULLDOWN_OHMS * ((float)ADC_FULL_MV / (float)mv - 1.0f); -} - -static void drawStaticUi() { - gfx->fillScreen(C_BG); - drawText(10, 8, "POT ADC TEST", C_TEXT, 2); - drawText(210, 12, "ESP32-S3-LCD-2", C_MUTE, 1); - drawButton(BTN_3WIRE, "3-WIRE", gMode == Mode::ThreeWire); - drawButton(BTN_2WIRE, "2-WIRE", gMode == Mode::TwoWire); - drawButton(BTN_RESET, "RESET", false); - - gfx->drawRoundRect(8, 76, 304, 64, 8, C_BORDER); - gfx->drawRoundRect(8, 148, 304, 54, 8, C_BORDER); - gfx->drawRoundRect(8, 208, 304, 24, 6, C_BORDER); -} - -static void drawBar(uint8_t pct, uint16_t color) { - int x = 18; - int y = 123; - int w = 284; - int h = 10; - gfx->fillRect(x, y, w, h, C_BORDER); - gfx->fillRect(x, y, (w * pct) / 100, h, color); -} - -static void updateUi() { - Sample s = readSample(); - if (s.mv < gMinMv) gMinMv = s.mv; - if (s.mv > gMaxMv) gMaxMv = s.mv; - uint32_t span = (gMaxMv > gMinMv) ? (gMaxMv - gMinMv) : 0; - - if (!gHasEma) { - gEmaMv = (float)s.mv; - gHasEma = true; - } else { - gEmaMv = gEmaMv * 0.85f + (float)s.mv * 0.15f; - } - - uint8_t pctAbs = percentFromMv(s.mv); - uint8_t pctCal = calibratedPercent(s.mv, span); - float ohms = estimateOhms(s.mv); - const char *status = statusText(s.mv, span, pctAbs); - uint16_t statusColor = strcmp(status, "MID") == 0 ? C_OK : - strcmp(status, "NO SPAN") == 0 ? C_WARN : - strcmp(status, "SATURATED") == 0 ? C_BAD : C_ACCENT; - - char line[96]; - gfx->fillRect(9, 77, 302, 62, C_BG); - snprintf(line, sizeof(line), "%s ADC=IO2 DRIVE=IO6", modeName()); - drawText(16, 84, line, C_ACCENT, 1); - snprintf(line, sizeof(line), "raw:%4u mv:%4lu ema:%4lu", - s.raw, (unsigned long)s.mv, (unsigned long)(gEmaMv + 0.5f)); - drawText(16, 101, line, C_TEXT, 1); - snprintf(line, sizeof(line), "abs:%3u%% cal:%3u%% jitter:%u", - pctAbs, pctCal, (unsigned)(s.rawMaxBurst - s.rawMinBurst)); - drawText(16, 115, line, C_TEXT, 1); - drawBar(gMode == Mode::ThreeWire ? pctAbs : pctCal, statusColor); - - gfx->fillRect(9, 149, 302, 52, C_BG); - snprintf(line, sizeof(line), "min:%4lu max:%4lu span:%4lu mV", - (unsigned long)gMinMv, (unsigned long)gMaxMv, (unsigned long)span); - drawText(16, 156, line, C_TEXT, 1); - if (ohms < 0) { - snprintf(line, sizeof(line), "ohm: open/too high status:%s", status); - } else { - snprintf(line, sizeof(line), "ohm:%6.1fk%s status:%s", - ohms / 1000.0f, gMode == Mode::TwoWire ? " rough" : "", status); - } - drawText(16, 172, line, statusColor, 1); - snprintf(line, sizeof(line), "touch:%s x:%u y:%u serial:m/r", - gTouchOk ? "ok" : "off", gLastTouchX, gLastTouchY); - drawText(16, 188, line, C_MUTE, 1); - - gfx->fillRect(9, 209, 302, 22, C_BG); - if (gMode == Mode::ThreeWire) { - drawText(16, 216, "Wire: 3V3-edge GND-edge IO2-wiper", C_MUTE, 1); - } else { - drawText(16, 216, "Wire: IO6-edge IO2-wiper third pin open", C_MUTE, 1); - } - - Serial.printf("mode=%s raw=%u mv=%lu ema=%.1f abs=%u cal=%u min=%lu max=%lu span=%lu jitter=%u status=%s\n", - modeName(), s.raw, (unsigned long)s.mv, gEmaMv, pctAbs, pctCal, - (unsigned long)gMinMv, (unsigned long)gMaxMv, (unsigned long)span, - (unsigned)(s.rawMaxBurst - s.rawMinBurst), status); -} - -static void handleTouch() { - bsp_touch_read(); - uint16_t x = 0; - uint16_t y = 0; - if (!bsp_touch_get_coordinates(&x, &y)) return; - gLastTouchX = x; - gLastTouchY = y; - - if (contains(BTN_3WIRE, x, y)) { - setMode(Mode::ThreeWire); - drawStaticUi(); - } else if (contains(BTN_2WIRE, x, y)) { - setMode(Mode::TwoWire); - drawStaticUi(); - } else if (contains(BTN_RESET, x, y)) { - resetRange(); - } -} - -static void handleBootButton() { - bool down = digitalRead(PIN_BOOT_BUTTON) == LOW; - uint32_t now = millis(); - if (down != gBootWasDown && now - gBootLastChangeMs > 40) { - gBootWasDown = down; - gBootLastChangeMs = now; - if (!down) { - setMode(gMode == Mode::ThreeWire ? Mode::TwoWire : Mode::ThreeWire); - drawStaticUi(); - } - } -} - -static void handleSerial() { - while (Serial.available() > 0) { - char c = (char)Serial.read(); - if (c == 'm' || c == 'M') { - setMode(gMode == Mode::ThreeWire ? Mode::TwoWire : Mode::ThreeWire); - drawStaticUi(); - } else if (c == 'r' || c == 'R') { - resetRange(); - } - } -} - -void setup() { - Serial.begin(115200); - delay(100); - Serial.println("ESP32-S3-LCD-2 potentiometer ADC test"); - Serial.println("Commands: m=switch mode, r=reset min/max"); - - pinMode(PIN_BOOT_BUTTON, INPUT_PULLUP); - configurePins(); - - if (!gfx->begin()) { - Serial.println("gfx->begin() failed"); - } - pinMode(PIN_LCD_BL, OUTPUT); - digitalWrite(PIN_LCD_BL, HIGH); - - Wire.begin(PIN_TP_SDA, PIN_TP_SCL); - gTouchOk = bsp_touch_init(&Wire, 1, DISP_W, DISP_H); - - drawStaticUi(); -} - -void loop() { - handleSerial(); - handleBootButton(); - if (gTouchOk) handleTouch(); - - uint32_t now = millis(); - if (now - gLastUiMs >= 250) { - updateUi(); - gLastUiMs = now; - } - if (now - gLastSerialMs >= 5000) { - Serial.println("Hint: m switches 3-WIRE/2-WIRE, r resets min/max. Never feed 5V into IO2/IO6."); - gLastSerialMs = now; - } -} diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/CODEX_PORTING_GUIDE.md b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/CODEX_PORTING_GUIDE.md index a08a6002..e04d1774 100644 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/CODEX_PORTING_GUIDE.md +++ b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/CODEX_PORTING_GUIDE.md @@ -32,27 +32,24 @@ ls -l /dev/ttyACM0 ## 3) Структура подпроекта (эталон) -- `official-demo/` — официальный repo Waveshare (примеры+библиотеки) -- `original-firmware/` — backup/restore заводской прошивки -- `main-device/` — прошивки и `burn.sh` -- `reference/` — заметки и ссылки +- `main-device/` — актуальная прошивка регистрации и `burn.sh` +- `old_version/` — старые версии homeserver +- `SKETCH/ESP32-S3-Touch-AMOLED-2.16/official-demo/` — официальный repo Waveshare (примеры+библиотеки) +- `SKETCH/ESP32-S3-Touch-AMOLED-2.16/reference/` — заметки и спецификации ## 4) Бэкап перед любыми экспериментами ```bash -cd ESP32-S3-Touch-AMOLED-2.16/original-firmware -./backup_factory.sh +cd ESP32-S3-Touch-AMOLED-2.16/main-device +./burn.sh registration-signer ``` Ожидаемый результат: -- `factory-full-16mb.bin` -- `factory-full-16mb.bin.sha256` +- резервная копия заводской прошивки хранится отдельно от Git-проектов Восстановление: -```bash -./restore_factory_backup.sh -``` +Восстановление выполняется из локального каталога backup конкретной платы. ## 5) Деплой (прошивка) — стандарт @@ -67,7 +64,7 @@ cd ESP32-S3-Touch-AMOLED-2.16/main-device - `hello` — базовый экран - `widgets` — экран+touch+IMU (официальный пример) - `audio` — тест аудио тракта -- `simple` — кастомный интеграционный тест (экран, touch, запись/воспроизведение, VU, tilt) +- `registration-signer` — актуальный скетч регистрации SHiNE ## 6) Как писать код под эту плату (важно) diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/README.md b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/README.md index ad7db002..c2b3159a 100644 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/README.md +++ b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/README.md @@ -1,28 +1,26 @@ # ESP32-S3-Touch-AMOLED-2.16 -Подпроект для Waveshare `ESP32-S3-Touch-AMOLED-2.16`. +Подпроект SHiNE для платы Waveshare `ESP32-S3-Touch-AMOLED-2.16`. -Структура: +В основном проекте оставлен только актуальный рабочий скетч регистрации: -- `official-demo/` — официальный репозиторий примеров Waveshare -- `original-firmware/` — резервная копия заводской прошивки -- `main-device/` — скрипты быстрой проверки устройства и основной скетч `shine_homeserver_main/` -- `reference/` — локальные заметки по документации и железу -- `main-device/shine_homeserver_main/` — основной рабочий скетч ESP32-проекта `SHiNE` +- `main-device/shine_registration_signer/shine_registration_signer.ino` +- `main-device/burn.sh` — сборка и прошивка +- `old_version/` — две старые версии homeserver, сохранённые только для истории -Примечание по git: +Примеры Waveshare, библиотеки и справочные документы находятся в отдельном репозитории `SKETCH`: -- `official-demo/` держать как локальный внешний checkout из `https://github.com/waveshareteam/ESP32-S3-Touch-AMOLED-2.16`, в основной git его не добавлять. -- `original-firmware/*.bin` — локальный дамп конкретной платы, в git не добавлять. -- `.arduino-build/` и готовые `.bin/.elf/.map` — сборочные артефакты, в git не добавлять. +- `SKETCH/ESP32-S3-Touch-AMOLED-2.16/official-demo/` +- `SKETCH/ESP32-S3-Touch-AMOLED-2.16/reference/` + +Локальные сборочные артефакты (`.arduino-build/`, `.bin`, `.elf`, `.map`) в Git не добавляются. Быстрый старт: -1. Сделать backup текущей прошивки: - - `cd original-firmware && ./backup_factory.sh` -2. Залить тест экрана/тача: - - `cd ../main-device && ./burn.sh widgets` -3. Залить тест динамика: - - `cd ../main-device && ./burn.sh audio` -4. Залить основной UI: - - `cd ../main-device && ./burn.sh shine-homeserver-main` +1. Убедиться, что рядом с `SHiNE-product` существует `SKETCH/ESP32-S3-Touch-AMOLED-2.16/official-demo/`. +2. Перейти в `main-device`. +3. Собрать и прошить актуальный скетч: + + `./burn.sh registration-signer` + +Для тестового режима регистратора можно использовать `REGISTRAR_DEV_UNENCRYPTED=1`, но такой вариант нельзя использовать на рабочем устройстве. diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/README.md b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/README.md index b6993a71..9f7de3f0 100644 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/README.md +++ b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/README.md @@ -1,52 +1,14 @@ # Main Device -Основной скетч homeserver и старые тестовые скетчи для быстрой проверки платы. -`burn.sh` теперь: -- сам пытается найти USB-порт ESP32; -- сначала делает быструю инкрементальную сборку; -- если быстрая сборка не удалась, автоматически повторяет полную `clean`-сборку. +В этой папке оставлен только актуальный скетч `shine_registration_signer`. -Для режимов `widgets`, `audio` и `hello` рядом должен лежать локальный checkout `official-demo/` из официального репозитория Waveshare. В основной git он не добавляется, потому что это большой внешний набор примеров, библиотек, прошивок и артефактов. +`burn.sh` поддерживает режимы: -Режимы: -- `widgets` — экран + touch + IMU (пример `05_LVGL_Widgets`) -- `audio` — динамик/аудио-кодек (пример `07_ES8311`) -- `hello` — базовый тест экрана (пример `01_HelloWorld`) -- `simple` — простой кастомный тест: экран + touch + запись/проигрывание + наклон (IMU) -- `argon2` — генерация masterSecret через Argon2id с SD-картой как памятью (тест скорости) -- `homeserver-ui` — совместимый алиас, указывает на `shine_homeserver_main/` -- `shine-homeserver-main` — основной скетч проекта `SHiNE` для ESP32, текущая рабочая версия UI -- `shine-homeserver-ui-main` — старое имя основного скетча, оставлено как совместимый алиас -- `legacy-homeserver-ui` — старый UI-прототип `shine_homeserver_ui/`, оставлен как тестовый и не является основным -- `text-test` — диагностический экран рендера текста: default font, U8g2 ASCII, U8g2 кириллица, кнопки с подписями -- `gfx-text-test` — тот же тест рендера текста, но уже внутри новой папки `test_sketches/` -- `gfx-layout-test` — тест геометрии и нижних рядов кнопок -- `lvgl-basic-test` — минимальный экран на `LVGL` с текстом и кнопками -- `lvgl-interaction-test` — экран на `LVGL` с большим числом кнопок и сообщением о нажатой кнопке -- `lvgl-touch-debug-test` — точечная диагностика touch: сырые координаты, маркер точки и большая тест-кнопка `LVGL` -- `lvgl-official-based-test` — наш минимальный экран, но на максимально близкой к официальному `LVGL_Widgets` инициализации -- `lvgl-subserver-touch-test` — старый гибридный тест: `LVGL`-интерфейс, но display/touch init и raw touch-read взяты из старого `shine_homeserver_ui`; подтверждено на устройстве, touch работает, зелёных линий по краям нет -- `lvgl-russian-font-test` — тест кастомного `LVGL`-шрифта с кириллицей: русские кнопки, длинные подписи и статусы -- `lvgl-nav-minimal-test` — старое имя основного скетча, теперь ведёт на `shine_homeserver_main/` для совместимости +- `registration-signer` — рабочий скетч регистрации SHiNE; +- `hello`, `widgets`, `audio` — официальные тесты Waveshare из репозитория `SKETCH`. -Запуск: +Официальные библиотеки должны находиться в соседнем репозитории: -- `./burn.sh widgets` -- `./burn.sh audio` -- `./burn.sh hello` -- `./burn.sh simple` -- `./burn.sh homeserver-ui` -- `./burn.sh shine-homeserver-main` -- `./burn.sh shine-homeserver-ui-main` -- `./burn.sh legacy-homeserver-ui` -- `./burn.sh text-test` -- `./burn.sh gfx-text-test` -- `./burn.sh gfx-layout-test` -- `./burn.sh lvgl-basic-test` -- `./burn.sh lvgl-interaction-test` -- `./burn.sh lvgl-touch-debug-test` -- `./burn.sh lvgl-official-based-test` -- `./burn.sh lvgl-subserver-touch-test` -- `./burn.sh lvgl-russian-font-test` -- `./burn.sh lvgl-nav-minimal-test` -- `./flash_shine_homeserver_main.sh` - автоматически находит USB-порт и заливает `shine_homeserver_main` +`SKETCH/ESP32-S3-Touch-AMOLED-2.16/official-demo/` + +Если репозитории расположены иначе, перед запуском укажите путь через переменную `DEMO_BASE`. diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/argon2_sd_test/argon2_sd_test.ino b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/argon2_sd_test/argon2_sd_test.ino deleted file mode 100644 index 50dd4e2b..00000000 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/argon2_sd_test/argon2_sd_test.ino +++ /dev/null @@ -1,1066 +0,0 @@ -/* - * argon2_sd_test.ino v2 - * Генерация masterSecret (Argon2id) + 3 Ed25519 ключевых пары. - * Результат сохраняется в NVS (внутренняя flash ESP32). - * - * Алгоритм совпадает с JS crypto-utils.js: - * loginNorm = trim(lowercase(login)) - * salt = SHA256("shine-auth-v2|login=|suffix=master.secret")[0:16] - * passBytes = UTF8("\n") - * secret = Argon2id(passBytes, salt, t=2, m=65536 KB, p=1, dkLen=32) - * legacy(empty password): - * secret = SHA256(base64(SHA256(password)) + "master.secret") - * keyPair_i = Ed25519(SHA256(base64(secret) + "|" + suffix_i)) - * suffixes = ["root.key", "blockchain.key", "client.key"] - * - * Плата: Waveshare ESP32-S3-Touch-AMOLED-2.16 - * SD : SDMMC 1-bit CLK=GPIO2, CMD=GPIO1, D0=GPIO3 - */ - -#include -#include -#include -#include -#include "argon2_types.h" -#include "driver/gpio.h" -#include "Arduino_GFX_Library.h" -#include "TouchDrvCSTXXX.hpp" -#include "SD_MMC.h" -#include "mbedtls/sha256.h" -#include "mbedtls/base64.h" -#include -#include - -// ═══════════════════════════════════════════════════════════ -// PINS -// ═══════════════════════════════════════════════════════════ -#define PIN_LCD_CS 12 -#define PIN_LCD_SCLK 38 -#define PIN_LCD_D0 4 -#define PIN_LCD_D1 5 -#define PIN_LCD_D2 6 -#define PIN_LCD_D3 7 -#define PIN_LCD_RST 2 -#define PIN_I2C_SDA 15 -#define PIN_I2C_SCL 14 -#define PIN_TP_INT 11 -#define PIN_SD_CLK 2 -#define PIN_SD_CMD 1 -#define PIN_SD_D0 3 - -// ═══════════════════════════════════════════════════════════ -// DISPLAY -// ═══════════════════════════════════════════════════════════ -#define DISP_W 480 -#define DISP_H 480 - -Arduino_DataBus *gBus = new Arduino_ESP32QSPI( - PIN_LCD_CS, PIN_LCD_SCLK, - PIN_LCD_D0, PIN_LCD_D1, PIN_LCD_D2, PIN_LCD_D3); -Arduino_CO5300 *gfx = new Arduino_CO5300( - gBus, PIN_LCD_RST, 0, DISP_W, DISP_H, 0, 0, 0, 0); - -// ═══════════════════════════════════════════════════════════ -// TOUCH (полинг + прерывание) -// ═══════════════════════════════════════════════════════════ -TouchDrvCST92xx gTouch; -volatile bool gTouchIrq = false; -void IRAM_ATTR onTouchIrq() { gTouchIrq = true; } - -// Состояние свайпа -static bool gTouching = false; -static int16_t gTouchStartY = 0; -static int16_t gTouchPrevY = 0; -static int16_t gTouchCurY = 0; -static int16_t gTouchCurX = 0; - -// ═══════════════════════════════════════════════════════════ -// COLORS -// ═══════════════════════════════════════════════════════════ -#define C_BG 0x0000u -#define C_KEY 0x2104u -#define C_KEY_HL 0x4208u -#define C_TEXT 0xFFFFu -#define C_HINT 0x7BEFu -#define C_GREEN 0x07E0u -#define C_RED 0xF800u -#define C_FIELD 0x18C3u -#define C_BAR_BG 0x18C3u -#define C_BAR_FG 0xFFFFu -#define C_SEP 0x2945u -#define C_ACCENT 0x05FFu - -// ═══════════════════════════════════════════════════════════ -// APP STATE -// ═══════════════════════════════════════════════════════════ -enum AppState { - ST_LOGIN, // ввод логина - ST_PASS, // ввод пароля - ST_RUNNING, // вычисление - ST_DONE, // результат (только что посчитан) - ST_SAVED, // результат (загружен из NVS) - ST_CONFIRM, // диалог "сгенерировать новый?" - ST_ERROR -}; -static AppState gState = ST_LOGIN; - -static char gLogin[64] = {}; -static char gPass[64] = {}; -static uint8_t gSecret[32]; -static char gSecretHex[65]; -static char gInputStatus[96] = {}; -static bool gKbNums = false; - -// ═══════════════════════════════════════════════════════════ -// КЛЮЧЕВЫЕ ПАРЫ -// ═══════════════════════════════════════════════════════════ -struct KeyPair { uint8_t pub[32]; uint8_t priv[32]; }; -static KeyPair gKeys[3]; -static const char * KEY_SUFFIXES[3] = {"root.key", "blockchain.key", "client.key"}; -static const char * KEY_LABELS[3] = {"root.key", "blockchain.key", "client.key"}; -static uint32_t gElapsedSec = 0; - -// Base58 представления (43-44 символа для 32 байт + \0) -static char gSecretB58[50]; -static char gPubB58[3][50]; -static char gPrivB58[3][50]; - -// ═══════════════════════════════════════════════════════════ -// ARGON2 ПАРАМЕТРЫ -// ═══════════════════════════════════════════════════════════ -#define A2_T 2u -#define A2_M 65536u -#define A2_P 1u -#define A2_DKLEN 32u -#define A2_SYNC 4u -#define A2_SEG (A2_M / A2_SYNC) -#define A2_VERSION 0x13u -#define A2_TYPE 2u -#define A2_BLKSZ 1024u -#define TOTAL_FILLS (A2_T * A2_M - 2u) - -static uint32_t gDone = 0; -static uint32_t gStartMs = 0; - -// ─── прогресс-бар: антимерцание ─────────────────────────── -static int gBarFilledPx = 0; // сколько пикселей уже зелёных -static uint32_t gLastElSec = 0xFFFFFFFF; // последнее нарисованное время - -// ═══════════════════════════════════════════════════════════ -// ВЫЧИСЛИТЕЛЬНОЕ СОСТОЯНИЕ -// ═══════════════════════════════════════════════════════════ -static uint8_t gH0[64]; -static uint32_t gCurPass = 0; -static uint32_t gCurBlock = 2; -static bool gInitDone = false; - -static uint8_t *gBufPrev = nullptr; -static uint8_t *gBufRef = nullptr; -static uint8_t *gBufOut = nullptr; -static uint8_t *gBufZero = nullptr; -static uint8_t *gBufAddr = nullptr; -static uint32_t *gJ1Seg = nullptr; - -#define SD_MEM_FILE "/argon2.bin" -static File gSdFile; - -// ═══════════════════════════════════════════════════════════ -// РЕЗУЛЬТАТ — прокрутка -// ═══════════════════════════════════════════════════════════ -#define RES_BTN_H 52 // высота кнопки "Новый" внизу -#define RES_VIEW_H (DISP_H - RES_BTN_H) // 428 px -static int32_t gScrollY = 0; -static int32_t gScrollMax = 0; // рассчитывается при отрисовке - -// NVS -static Preferences gPrefs; - -// ═══════════════════════════════════════════════════════════ -// BLAKE2b -// ═══════════════════════════════════════════════════════════ -#define ROTR64(x,n) (((x)>>(n))|((x)<<(64-(n)))) - -static const uint64_t B2IV[8] = { - 0x6A09E667F3BCC908ULL,0xBB67AE8584CAA73BULL, - 0x3C6EF372FE94F82BULL,0xA54FF53A5F1D36F1ULL, - 0x510E527FADE682D1ULL,0x9B05688C2B3E6C1FULL, - 0x1F83D9ABFB41BD6BULL,0x5BE0CD19137E2179ULL -}; -static const uint8_t B2SIGMA[12][16] = { - {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}, - {14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3}, - {11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4}, - {7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8}, - {9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13}, - {2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9}, - {12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11}, - {13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10}, - {6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5}, - {10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0}, - {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}, - {14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3} -}; - -static B2State gB2S; - -static void b2_compress(B2State *S, const uint8_t *blk) { - uint64_t m[16],v[16]; - for (int i=0;i<16;i++) m[i]=((const uint64_t*)blk)[i]; - for (int i=0;i<8;i++) v[i]=S->h[i]; - v[8]=B2IV[0];v[9]=B2IV[1];v[10]=B2IV[2];v[11]=B2IV[3]; - v[12]=B2IV[4]^S->t[0];v[13]=B2IV[5]^S->t[1]; - v[14]=B2IV[6]^S->f[0];v[15]=B2IV[7]^S->f[1]; -#define BG(r,i,a,b,c,d) \ - v[a]+=v[b]+m[B2SIGMA[r][2*(i)]]; v[d]=ROTR64(v[d]^v[a],32); \ - v[c]+=v[d]; v[b]=ROTR64(v[b]^v[c],24); \ - v[a]+=v[b]+m[B2SIGMA[r][2*(i)+1]];v[d]=ROTR64(v[d]^v[a],16); \ - v[c]+=v[d]; v[b]=ROTR64(v[b]^v[c],63) - for (int r=0;r<12;r++){ - BG(r,0,0,4,8,12);BG(r,1,1,5,9,13);BG(r,2,2,6,10,14);BG(r,3,3,7,11,15); - BG(r,4,0,5,10,15);BG(r,5,1,6,11,12);BG(r,6,2,7,8,13);BG(r,7,3,4,9,14); - } -#undef BG - for (int i=0;i<8;i++) S->h[i]^=v[i]^v[i+8]; -} -static void b2_init(B2State *S,size_t outlen){ - memset(S,0,sizeof(*S));memcpy(S->h,B2IV,64); - S->h[0]^=0x01010000ULL|outlen;S->outlen=outlen; -} -static void b2_update(B2State *S,const uint8_t *in,size_t inlen){ - while(inlen>0){ - size_t fill=128-S->buflen,use=inlenbuf+S->buflen,in,use);S->buflen+=use;in+=use;inlen-=use; - if(S->buflen==128&&inlen>0){ - S->t[0]+=128;if(S->t[0]<128)S->t[1]++; - b2_compress(S,S->buf);S->buflen=0; - } - } -} -static void b2_final(B2State *S,uint8_t *digest){ - S->f[0]=~0ULL;S->t[0]+=S->buflen;if(S->t[0]buflen)S->t[1]++; - memset(S->buf+S->buflen,0,128-S->buflen);b2_compress(S,S->buf); - uint8_t tmp[64]; - for(int i=0;i<8;i++){uint64_t w=S->h[i];for(int j=0;j<8;j++)tmp[i*8+j]=(uint8_t)(w>>(j*8));} - memcpy(digest,tmp,S->outlen); -} -static void b2hash(const uint8_t *in,size_t inlen,uint8_t *digest,size_t outlen){ - b2_init(&gB2S,outlen);b2_update(&gB2S,in,inlen);b2_final(&gB2S,digest); -} -static void b2long(const uint8_t *in,size_t inlen,uint8_t *digest,uint32_t outlen){ - uint8_t lenle[4]={(uint8_t)outlen,(uint8_t)(outlen>>8),(uint8_t)(outlen>>16),(uint8_t)(outlen>>24)}; - if(outlen<=64){b2_init(&gB2S,outlen);b2_update(&gB2S,lenle,4);b2_update(&gB2S,in,inlen);b2_final(&gB2S,digest);return;} - uint8_t tmp[64]; - b2_init(&gB2S,64);b2_update(&gB2S,lenle,4);b2_update(&gB2S,in,inlen);b2_final(&gB2S,tmp); - memcpy(digest,tmp,32);digest+=32;uint32_t rem=outlen-32; - while(rem>64){b2hash(tmp,64,tmp,64);memcpy(digest,tmp,32);digest+=32;rem-=32;} - b2hash(tmp,64,tmp,rem);memcpy(digest,tmp,rem); -} - -// ═══════════════════════════════════════════════════════════ -// ARGON2ID — BLOCK FILL -// ═══════════════════════════════════════════════════════════ -#define A2G(a,b,c,d) do{ \ - (a)+=(b)+2*((a)&0xFFFFFFFFULL)*((b)&0xFFFFFFFFULL); \ - (d)=ROTR64((d)^(a),32); \ - (c)+=(d)+2*((c)&0xFFFFFFFFULL)*((d)&0xFFFFFFFFULL); \ - (b)=ROTR64((b)^(c),24); \ - (a)+=(b)+2*((a)&0xFFFFFFFFULL)*((b)&0xFFFFFFFFULL); \ - (d)=ROTR64((d)^(a),16); \ - (c)+=(d)+2*((c)&0xFFFFFFFFULL)*((d)&0xFFFFFFFFULL); \ - (b)=ROTR64((b)^(c),63); \ -}while(0) -#define A2P(v) do{ \ - A2G((v)[0],(v)[4],(v)[8],(v)[12]);A2G((v)[1],(v)[5],(v)[9],(v)[13]); \ - A2G((v)[2],(v)[6],(v)[10],(v)[14]);A2G((v)[3],(v)[7],(v)[11],(v)[15]); \ - A2G((v)[0],(v)[5],(v)[10],(v)[15]);A2G((v)[1],(v)[6],(v)[11],(v)[12]); \ - A2G((v)[2],(v)[7],(v)[8],(v)[13]);A2G((v)[3],(v)[4],(v)[9],(v)[14]); \ -}while(0) - -static void fillBlock(uint32_t prevIdx,uint32_t refIdx,uint32_t outIdx,bool xorMode){ - gSdFile.seek((uint64_t)prevIdx*A2_BLKSZ);gSdFile.read(gBufPrev,A2_BLKSZ); - gSdFile.seek((uint64_t)refIdx*A2_BLKSZ);gSdFile.read(gBufRef,A2_BLKSZ); - uint64_t *R=(uint64_t*)gBufOut,*P=(uint64_t*)gBufPrev,*F=(uint64_t*)gBufRef; - for(int i=0;i<128;i++)R[i]=P[i]^F[i]; - uint64_t *Q=(uint64_t*)gBufRef;memcpy(Q,R,A2_BLKSZ); - for(int j=0;j<8;j++)A2P(&Q[16*j]); - uint64_t row[16]; - for(int i=0;i<8;i++){ - for(int k=0;k<8;k++){row[2*k]=Q[2*i+16*k];row[2*k+1]=Q[2*i+16*k+1];} - A2P(row); - for(int k=0;k<8;k++){Q[2*i+16*k]=row[2*k];Q[2*i+16*k+1]=row[2*k+1];} - } - for(int i=0;i<128;i++)R[i]=Q[i]^R[i]; - if(xorMode){ - gSdFile.seek((uint64_t)outIdx*A2_BLKSZ);gSdFile.read(gBufPrev,A2_BLKSZ); - uint64_t *O=(uint64_t*)gBufPrev;for(int i=0;i<128;i++)R[i]^=O[i]; - } - gSdFile.seek((uint64_t)outIdx*A2_BLKSZ);gSdFile.write(gBufOut,A2_BLKSZ); -} - -static void generateAddresses(uint32_t pass,uint32_t slice){ - memset(gBufZero,0,A2_BLKSZ); - uint8_t inputBlk[A2_BLKSZ];memset(inputBlk,0,A2_BLKSZ); - uint64_t *iv=(uint64_t*)inputBlk; - iv[0]=pass;iv[1]=0;iv[2]=slice;iv[3]=A2_M;iv[4]=A2_T;iv[5]=A2_TYPE; - uint32_t count=0; - for(uint32_t b=0;b>32; - relPos=refAreaSize-1-((uint64_t)refAreaSize*relPos>>32); - uint32_t startPos=0; - if(pass!=0&&slice!=A2_SYNC-1)startPos=(slice+1)*A2_SEG; - return (startPos+relPos)%A2_M; -} - -// ═══════════════════════════════════════════════════════════ -// SHA-256 -// ═══════════════════════════════════════════════════════════ -static void sha256calc(const uint8_t *in,size_t len,uint8_t *out32){ - mbedtls_sha256_context ctx; - mbedtls_sha256_init(&ctx);mbedtls_sha256_starts(&ctx,0); - mbedtls_sha256_update(&ctx,in,len);mbedtls_sha256_finish(&ctx,out32); - mbedtls_sha256_free(&ctx); -} - -static void trimInPlace(char *text){ - if(!text)return; - size_t len=strlen(text); - size_t start=0; - while(startstart&&(text[end-1]==' '||text[end-1]=='\t'||text[end-1]=='\n'||text[end-1]=='\r'))end--; - if(start>0&&end>start)memmove(text,text+start,end-start); - if(end<=start){text[0]='\0';return;} - text[end-start]='\0'; -} - -static void lowercaseAsciiInPlace(char *text){ - if(!text)return; - for(int i=0;text[i];i++){ - if(text[i]>='A'&&text[i]<='Z')text[i]+=32; - } -} - -static void normalizeLoginInPlace(char *text){ - trimInPlace(text); - lowercaseAsciiInPlace(text); -} - -static void setInputStatus(const char *message){ - snprintf(gInputStatus,sizeof(gInputStatus),"%s",message?message:""); -} - -static void clearInputStatus(){ - gInputStatus[0]='\0'; -} - -static void bytesToBase64Std(const uint8_t *data,size_t len,char *out,size_t outSz){ - size_t b64len=0; - if(outSz==0)return; - if(mbedtls_base64_encode((uint8_t*)out,outSz,&b64len,data,len)!=0){ - out[0]='\0'; - return; - } - if(b64len>=outSz)b64len=outSz-1; - out[b64len]='\0'; -} - -static void deriveLegacyMasterSecret(const char *password,uint8_t *out32){ - uint8_t baseHash[32]; - sha256calc((const uint8_t*)password,strlen(password),baseHash); - - char baseB64[64]; - bytesToBase64Std(baseHash,32,baseB64,sizeof(baseB64)); - - char material[96]; - snprintf(material,sizeof(material),"%smaster.secret",baseB64); - sha256calc((const uint8_t*)material,strlen(material),out32); -} - -// ═══════════════════════════════════════════════════════════ -// BASE58 -// ═══════════════════════════════════════════════════════════ -static const char B58_ALPHA[] = - "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; - -static void bytesToBase58(const uint8_t *data,size_t len,char *out,size_t outSz){ - int zeros=0; - while(zeros<(int)len&&data[zeros]==0)zeros++; - uint8_t tmp[64]={};int tmpLen=0; - for(int i=zeros;i<(int)len;i++){ - int carry=data[i]; - for(int j=0;j=0&&n<(int)outSz-1;i--)out[n++]=B58_ALPHA[(int)tmp[i]]; - out[n]='\0'; -} - -// ═══════════════════════════════════════════════════════════ -// KEY DERIVATION (Ed25519 из masterSecret) -// ═══════════════════════════════════════════════════════════ -static void deriveKeyPairs(){ - // base64(masterSecret) — standard base64 с '+','/' - uint8_t b64buf[48];size_t b64len=0; - mbedtls_base64_encode(b64buf,sizeof(b64buf),&b64len,gSecret,32); - b64buf[b64len]='\0'; - - for(int i=0;i<3;i++){ - char material[96]; - snprintf(material,sizeof(material),"%s|%s",(char*)b64buf,KEY_SUFFIXES[i]); - uint8_t seed[32]; - sha256calc((uint8_t*)material,strlen(material),seed); - memcpy(gKeys[i].priv,seed,32); - Ed25519::derivePublicKey(gKeys[i].pub,seed); - } - // base58 для отображения - bytesToBase58(gSecret,32,gSecretB58,sizeof(gSecretB58)); - for(int i=0;i<3;i++){ - bytesToBase58(gKeys[i].pub,32,gPubB58[i],sizeof(gPubB58[i])); - bytesToBase58(gKeys[i].priv,32,gPrivB58[i],sizeof(gPrivB58[i])); - } -} - -// ═══════════════════════════════════════════════════════════ -// NVS -// ═══════════════════════════════════════════════════════════ -static void nvsSave(){ - gPrefs.begin("shine",false); - gPrefs.putString("login",gLogin); - gPrefs.putBytes("secret",gSecret,32); - for(int i=0;i<3;i++){ - char k[6]; - snprintf(k,sizeof(k),"pub%d",i); gPrefs.putBytes(k,gKeys[i].pub,32); - snprintf(k,sizeof(k),"prv%d",i); gPrefs.putBytes(k,gKeys[i].priv,32); - } - gPrefs.putUInt("tsec",gElapsedSec); - gPrefs.putBool("valid",true); - gPrefs.end(); -} - -static bool nvsLoad(){ - gPrefs.begin("shine",true); - bool valid=gPrefs.getBool("valid",false); - if(valid){ - gPrefs.getString("login",gLogin,sizeof(gLogin)); - gPrefs.getBytes("secret",gSecret,32); - for(int i=0;i<3;i++){ - char k[6]; - snprintf(k,sizeof(k),"pub%d",i); gPrefs.getBytes(k,gKeys[i].pub,32); - snprintf(k,sizeof(k),"prv%d",i); gPrefs.getBytes(k,gKeys[i].priv,32); - } - gElapsedSec=gPrefs.getUInt("tsec",0); - for(int i=0;i<32;i++)snprintf(gSecretHex+i*2,3,"%02x",gSecret[i]); - // base58 - bytesToBase58(gSecret,32,gSecretB58,sizeof(gSecretB58)); - for(int i=0;i<3;i++){ - bytesToBase58(gKeys[i].pub,32,gPubB58[i],sizeof(gPubB58[i])); - bytesToBase58(gKeys[i].priv,32,gPrivB58[i],sizeof(gPrivB58[i])); - } - } - gPrefs.end(); - return valid; -} - -static void nvsClear(){ - gPrefs.begin("shine",false); - gPrefs.clear(); - gPrefs.end(); -} - -// ═══════════════════════════════════════════════════════════ -// ARGON2ID INIT -// ═══════════════════════════════════════════════════════════ -static void argon2Init(const char *login,const char *password){ - char saltSrc[256]; - snprintf(saltSrc,sizeof(saltSrc),"shine-auth-v2|login=%s|suffix=master.secret",login); - uint8_t saltHash[32];sha256calc((uint8_t*)saltSrc,strlen(saltSrc),saltHash); - uint8_t salt[16];memcpy(salt,saltHash,16); - - char passBytes[128]; - snprintf(passBytes,sizeof(passBytes),"%s\n%s",login,password); - uint32_t passLen=strlen(passBytes),saltLen=16; - - b2_init(&gB2S,64); - uint8_t le4[4]; -#define B2LE32(val) do{uint32_t _v=(val);le4[0]=_v;le4[1]=_v>>8;le4[2]=_v>>16;le4[3]=_v>>24;b2_update(&gB2S,le4,4);}while(0) - B2LE32(A2_P);B2LE32(A2_DKLEN);B2LE32(A2_M);B2LE32(A2_T); - B2LE32(A2_VERSION);B2LE32(A2_TYPE); - B2LE32(passLen);b2_update(&gB2S,(const uint8_t*)passBytes,passLen); - B2LE32(saltLen);b2_update(&gB2S,salt,saltLen); - B2LE32(0);B2LE32(0); -#undef B2LE32 - b2_final(&gB2S,gH0); - - // Debug: print inputs and H0 to Serial for cross-check with reference - Serial.printf("[DBG] login='%s' passLen=%u saltLen=%u\n",login,passLen,saltLen); - Serial.print("[DBG] salt: "); - for(int i=0;i<16;i++)Serial.printf("%02x",salt[i]);Serial.println(); - Serial.print("[DBG] H0: "); - for(int i=0;i<64;i++)Serial.printf("%02x",gH0[i]);Serial.println(); - - uint8_t input[72];memcpy(input,gH0,64); - for(uint32_t i=0;i<2;i++){ - input[64]=i;input[65]=0;input[66]=0;input[67]=0; - input[68]=0;input[69]=0;input[70]=0;input[71]=0; - b2long(input,72,gBufOut,A2_BLKSZ); - gSdFile.seek((uint64_t)i*A2_BLKSZ);gSdFile.write(gBufOut,A2_BLKSZ); - } - gCurPass=0;gCurBlock=2;gDone=0;gStartMs=millis(); - gBarFilledPx=0;gLastElSec=0xFFFFFFFF; - gInitDone=true; - generateAddresses(0,0); -} - -// ═══════════════════════════════════════════════════════════ -// ARGON2ID STEP -// ═══════════════════════════════════════════════════════════ -static bool argon2Step(){ - if(gCurPass>=A2_T)return true; - uint32_t blk=gCurBlock; - uint32_t slice=blk/A2_SEG; - uint32_t posInSlice=blk-slice*A2_SEG; - bool xorMode=(gCurPass>0); - uint32_t J1; - bool useArgon2i=(gCurPass==0&&slice<2); - if(useArgon2i){ - J1=gJ1Seg[posInSlice]; - }else{ - uint32_t prevIdx=(blk==0)?A2_M-1:blk-1; - gSdFile.seek((uint64_t)prevIdx*A2_BLKSZ);gSdFile.read(gBufRef,8); - J1=((uint32_t*)gBufRef)[0]; - } - uint32_t prevIdx=(blk==0)?A2_M-1:blk-1; - uint32_t refIdx=indexAlpha(gCurPass,slice,posInSlice,J1); - fillBlock(prevIdx,refIdx,blk,xorMode); - gDone++; - gCurBlock++; - if(gCurBlock>=A2_M){ - gCurBlock=0;gCurPass++; - }else{ - uint32_t newSlice=gCurBlock/A2_SEG; - if(newSlice!=slice&&gCurPass==0&&newSlice<2) - generateAddresses(gCurPass,newSlice); - } - return(gCurPass>=A2_T); -} - -// ═══════════════════════════════════════════════════════════ -// ARGON2ID FINALIZE -// ═══════════════════════════════════════════════════════════ -static void argon2Finalize(){ - gSdFile.seek((uint64_t)(A2_M-1)*A2_BLKSZ); - gSdFile.read(gBufOut,A2_BLKSZ); - b2long(gBufOut,A2_BLKSZ,gSecret,A2_DKLEN); - for(int i=0;i<32;i++)snprintf(gSecretHex+i*2,3,"%02x",gSecret[i]); - gSecretHex[64]='\0'; - gElapsedSec=(millis()-gStartMs)/1000; - deriveKeyPairs(); - nvsSave(); - Serial.println("=== RESULT ==="); - Serial.printf("Login : %s\n",gLogin); - Serial.printf("Secret: %s\n",gSecretHex); - for(int i=0;i<3;i++){ - Serial.printf("%s pub : %s\n",KEY_LABELS[i],gPubB58[i]); - Serial.printf("%s priv: %s\n",KEY_LABELS[i],gPrivB58[i]); - } - Serial.println("=== END ==="); -} - -static void completeResultFromSecret(){ - for(int i=0;i<32;i++)snprintf(gSecretHex+i*2,3,"%02x",gSecret[i]); - gSecretHex[64]='\0'; - deriveKeyPairs(); - nvsSave(); -} - -// ═══════════════════════════════════════════════════════════ -// UI — HELPERS -// ═══════════════════════════════════════════════════════════ -static void uiText(int x,int y,const char *s,uint16_t color,uint8_t sz=2){ - gfx->setTextColor(color);gfx->setTextSize(sz);gfx->setCursor(x,y);gfx->print(s); -} -static void uiRect(int x,int y,int w,int h,uint16_t fill,uint16_t border=0,int r=4){ - gfx->fillRoundRect(x,y,w,h,r,fill); - if(border)gfx->drawRoundRect(x,y,w,h,r,border); -} - -// ═══════════════════════════════════════════════════════════ -// UI — KEYBOARD -// ═══════════════════════════════════════════════════════════ -static const char *KB_ROWS[3]={"qwertyuiop","asdfghjkl","zxcvbnm"}; -static const char *KB_NUMS[3]={"1234567890","@#$%^&*()-",".,:!?/;\"'="}; -#define KB_Y0 200 -#define KB_KH 44 -#define KB_KW 44 -#define KB_GAP 2 - -static void drawKeyboard(){ - gfx->fillRect(0,KB_Y0-4,DISP_W,DISP_H-KB_Y0+4,C_BG); - for(int row=0;row<3;row++){ - const char *keys=gKbNums?KB_NUMS[row]:KB_ROWS[row]; - int n=strlen(keys); - int totalW=n*(KB_KW+KB_GAP)-KB_GAP; - int x0=(DISP_W-totalW)/2,y=KB_Y0+row*(KB_KH+KB_GAP); - for(int k=0;kfillScreen(C_BG); - gfx->setTextSize(2);uiText(20,20,title,C_HINT); - uiRect(20,60,DISP_W-40,52,C_FIELD,C_KEY_HL); - char show[68]; - if(isMasked){int n=strlen(buf);if(n>64)n=64;for(int i=0;isetTextSize(2);gfx->setTextColor(C_TEXT);gfx->setCursor(30,78);gfx->print(show); - int cx=30+strlen(show)*12;gfx->drawFastVLine(cx,78,20,C_GREEN); - if(gInputStatus[0]){ - gfx->setTextSize(2);gfx->setTextColor(C_RED);gfx->setCursor(20,132);gfx->print(gInputStatus); - } - drawKeyboard(); -} - -static bool kbHit(int tx,int ty,int kx,int ky,int kw,int kh){ - return tx>=kx&&tx=ky&&tyfillRect(0,0,DISP_W,80,C_BG); - gfx->setTextSize(2);uiText(20,18,"Argon2id (SD)",C_GREEN); - char sub[80];snprintf(sub,sizeof(sub),"t=%u m=%u KB p=%u",A2_T,A2_M,A2_P); - uiText(20,46,sub,C_HINT); - // нарисовать пустую полосу один раз - int bx=20,by=90,bw=DISP_W-40,bh=36; - uiRect(bx,by,bw,bh,C_BAR_BG,C_SEP,4); - gfx->fillRect(bx+1,by+1,bw-2,bh-2,C_BG); -} - -static void drawProgress(){ - uint32_t elMs=millis()-gStartMs; - uint32_t elSec=elMs/1000; - - // Прогресс-бар: только дорисовываем новую зелёную часть - int bx=20,by=90,bw=DISP_W-40,bh=36; - int filled=(int)((uint64_t)bw*gDone/TOTAL_FILLS); - if(gDone>0&&filled==0)filled=1; // at least 1px once started - if(filled>gBarFilledPx){ - gfx->fillRect(bx+1+gBarFilledPx,by+1,filled-gBarFilledPx,bh-2,C_GREEN); - gBarFilledPx=filled; - } - - // Текст обновляем только раз в секунду - if(elSec==gLastElSec)return; - gLastElSec=elSec; - - float pct=(gDone>0)?((float)gDone/TOTAL_FILLS*100.0f):0.0f; - uint32_t etaSec=0; - if(gDone>10&&gDonefillRect(0,136,DISP_W,120,C_BG); - char line[64]; - snprintf(line,sizeof(line),"%.1f%% (%lu / %lu)",pct,(unsigned long)gDone,(unsigned long)TOTAL_FILLS); - uiText(20,136,line,C_TEXT,2); - - snprintf(line,sizeof(line),"Elapsed: %lus (%lum%lus)", - (unsigned long)elSec,(unsigned long)elSec/60,(unsigned long)elSec%60); - uiText(20,162,line,C_GREEN,2); - - if(gDone>10){ - if(etaSec>=3600) - snprintf(line,sizeof(line),"ETA: ~%lum%lus",(unsigned long)etaSec/60,(unsigned long)etaSec%60); - else - snprintf(line,sizeof(line),"ETA: ~%lus",(unsigned long)etaSec); - uiText(20,188,line,C_HINT,2); - } -} - -// ═══════════════════════════════════════════════════════════ -// UI — РЕЗУЛЬТАТ (с прокруткой свайпом) -// ═══════════════════════════════════════════════════════════ -// Контент рисуется в виртуальных координатах y_virt. -// На экран попадает только [gScrollY .. gScrollY+RES_VIEW_H). -// Кнопка "Новый" всегда внизу (фиксирована). - -#define RLH 20 // высота строки (textSize 2) -#define RLH1 12 // высота строки (textSize 1) -#define RSP 6 // маленький отступ -#define RPX 20 // отступ слева - -// Вспомогательный класс — рисует текст только если строка видима -struct RDraw { - int32_t scroll; - int32_t y; // текущая виртуальная Y - void line(const char *s, uint16_t col, uint8_t sz=2){ - int sy=(int)y-(int)scroll; - int lh=(sz==1)?RLH1:RLH; - if(sy>=-lh&&sysetTextSize(sz);gfx->setTextColor(col);gfx->setCursor(RPX,sy);gfx->print(s); - } - y+=lh+2; - } - void sep(){ - int sy=(int)y-(int)scroll; - if(sy>=0&&sydrawFastHLine(RPX,sy,DISP_W-2*RPX,C_SEP); - y+=10; - } - void gap(int px=4){y+=px;} - // Для длинных строк (base58): разбить на куски по 38 символов при textSize=2 - void longval(const char *s, uint16_t col){ - const int CPL=38; - int len=(int)strlen(s); - if(len==0){line("(empty)",C_HINT,2);return;} - for(int off=0;offCPL)take=CPL; - memcpy(tmp,s+off,take);tmp[take]='\0'; - line(tmp,col,2); - } - } -}; - -static void drawResultContent(){ - // очистить область прокрутки - gfx->fillRect(0,0,DISP_W,RES_VIEW_H,C_BG); - - RDraw d;d.scroll=gScrollY;d.y=8; - - char buf[96]; - - // — заголовок — - d.line(" RESULT",C_GREEN,2); - snprintf(buf,sizeof(buf),"Login: %s",gLogin); - d.line(buf,C_TEXT,2); - snprintf(buf,sizeof(buf),"Password: %s",gPass[0]?gPass:"(empty)"); - d.line(buf,C_TEXT,2); - d.gap(4); - d.line("Master secret (base58):",C_HINT,2); - d.longval(gSecretB58,C_GREEN); - snprintf(buf,sizeof(buf),"Time: %lum %lus", - (unsigned long)gElapsedSec/60,(unsigned long)gElapsedSec%60); - d.line(buf,C_HINT,2); - d.sep(); - - // — 3 ключевые пары — - for(int i=0;i<3;i++){ - d.line(KEY_LABELS[i],C_ACCENT,2); - d.line("Pub:",C_HINT,2); - d.longval(gPubB58[i],C_TEXT); - d.line("Priv:",C_HINT,2); - d.longval(gPrivB58[i],C_TEXT); - d.sep(); - } - - // запомним общую высоту контента для ограничения прокрутки - gScrollMax=(int32_t)d.y - RES_VIEW_H; - if(gScrollMax<0)gScrollMax=0; -} - -static void drawResultBtnBar(){ - // кнопка "Новый" — фиксирована внизу - gfx->fillRect(0,RES_VIEW_H,DISP_W,RES_BTN_H,C_BG); - uiRect(20,RES_VIEW_H+6,DISP_W-40,RES_BTN_H-12,C_RED,0,6); - gfx->setTextSize(2);gfx->setTextColor(C_TEXT); - gfx->setCursor(DISP_W/2-72,RES_VIEW_H+18); - gfx->print("Generate new"); -} - -static void drawResultFull(){ - drawResultContent(); - drawResultBtnBar(); -} - -// ═══════════════════════════════════════════════════════════ -// UI — ДИАЛОГ ПОДТВЕРЖДЕНИЯ -// ═══════════════════════════════════════════════════════════ -static void drawConfirmDialog(){ - gfx->fillRect(40,120,DISP_W-80,260,C_KEY); - gfx->drawRoundRect(40,120,DISP_W-80,260,8,C_KEY_HL); - gfx->setTextSize(2);gfx->setTextColor(C_TEXT); - gfx->setCursor(60,140);gfx->print("Generate new?"); - gfx->setTextSize(1);gfx->setTextColor(C_HINT); - gfx->setCursor(60,172);gfx->print("This will ERASE the saved"); - gfx->setCursor(60,184);gfx->print("secret and keys from memory."); - // кнопки - uiRect(60,240,140,56,C_RED,0,6); - gfx->setTextSize(2);gfx->setTextColor(C_TEXT);gfx->setCursor(106,260);gfx->print("Yes"); - uiRect(280,240,140,56,C_KEY_HL,C_SEP,6); - gfx->setCursor(316,260);gfx->print("No"); -} - -// ═══════════════════════════════════════════════════════════ -// TOUCH HANDLER -// ═══════════════════════════════════════════════════════════ -static void handleTap(int tx,int ty){ - if(gState==ST_LOGIN||gState==ST_PASS){ - bool isPass=(gState==ST_PASS); - char *buf=isPass?gPass:gLogin; - char c=kbTouch(tx,ty); - if(!c)return; - if(c=='\x03'){gKbNums=!gKbNums;clearInputStatus();drawInputScreen(isPass?"Password:":"Login:",buf,isPass);return;} - if(c=='\x08'){int n=strlen(buf);if(n>0)buf[n-1]='\0';clearInputStatus();} - else if(c=='\x0D'){ - if(gState==ST_LOGIN){ - normalizeLoginInPlace(buf); - if(!strlen(buf)){ - setInputStatus("Логин обязателен"); - drawInputScreen("Login:",gLogin,false); - return; - } - clearInputStatus(); - gState=ST_PASS;drawInputScreen("Password:",gPass,true);return; - } else { - clearInputStatus(); - gState=ST_RUNNING; - gfx->fillScreen(C_BG);drawProgressHeader(); - SD_MMC.remove(SD_MEM_FILE); - gSdFile=SD_MMC.open(SD_MEM_FILE,"w+"); - if(!gSdFile){ - gfx->setTextSize(2);gfx->setTextColor(C_RED); - gfx->setCursor(20,200);gfx->println("SD open failed"); - gState=ST_ERROR;return; - } - normalizeLoginInPlace(gLogin); - if(!gLogin[0]){ - gSdFile.close(); - SD_MMC.remove(SD_MEM_FILE); - gState=ST_LOGIN; - setInputStatus("Логин обязателен"); - drawInputScreen("Login:",gLogin,false); - return; - } - if(!gPass[0]){ - deriveLegacyMasterSecret(gPass,gSecret); - gElapsedSec=0; - completeResultFromSecret(); - gSdFile.close(); - SD_MMC.remove(SD_MEM_FILE); - gState=ST_DONE; - gScrollY=0; - drawResultFull(); - return; - } - argon2Init(gLogin,gPass); - drawProgress();return; - } - } else {int n=strlen(buf);if(n<63){buf[n]=c;buf[n+1]='\0';}clearInputStatus();} - drawInputScreen(isPass?"Password:":"Login:",buf,isPass); - return; - } - - if(gState==ST_DONE||gState==ST_SAVED){ - // Кнопка "Новый" внизу - if(ty>=RES_VIEW_H){ - gState=ST_CONFIRM; - drawConfirmDialog(); - } - return; - } - - if(gState==ST_CONFIRM){ - if(tx>=60&&tx<200&&ty>=240&&ty<296){ - // Да - nvsClear(); - memset(gLogin,0,sizeof(gLogin));memset(gPass,0,sizeof(gPass)); - gKbNums=false;gScrollY=0; - gState=ST_LOGIN; - drawInputScreen("Login:",gLogin,false); - } else if(tx>=280&&tx<420&&ty>=240&&ty<296){ - // Нет - gState=ST_DONE; - drawResultFull(); - } - return; - } -} - -// ═══════════════════════════════════════════════════════════ -// SETUP -// ═══════════════════════════════════════════════════════════ -void setup(){ - Serial.begin(115200); - Wire.begin(PIN_I2C_SDA,PIN_I2C_SCL); - - // Display - gfx->begin();gBus->writeC8D8(0x36,0xA0); - gfx->setBrightness(200);gfx->fillScreen(C_BG); - - // Touch - gTouch.setPins(PIN_TP_INT,-1); - gTouch.begin(Wire,CST92XX_SLAVE_ADDRESS,PIN_I2C_SDA,PIN_I2C_SCL); - gTouch.setMaxCoordinates(DISP_W,DISP_H); - gTouch.setSwapXY(true);gTouch.setMirrorXY(true,false); - attachInterrupt(PIN_TP_INT,onTouchIrq,FALLING); - - // SD - gpio_reset_pin(GPIO_NUM_2); - pinMode(PIN_SD_CMD,INPUT_PULLUP);pinMode(PIN_SD_D0,INPUT_PULLUP); - delay(20); - SD_MMC.setPins(PIN_SD_CLK,PIN_SD_CMD,PIN_SD_D0); - bool sdOk=SD_MMC.begin("/sdcard",true); - Serial.printf("SD: %s\n",sdOk?"OK":"FAIL"); - if(sdOk)Serial.printf("SD size: %llu MB\n",SD_MMC.cardSize()/(1024ULL*1024)); - if(!sdOk){ - gfx->setTextSize(2);gfx->setTextColor(C_RED); - gfx->setCursor(20,160);gfx->println("SD CARD ERROR"); - gfx->setTextSize(1);gfx->setTextColor(C_HINT); - gfx->setCursor(20,200);gfx->println("FAT32 card required."); - while(true)delay(1000); - } - - // BLAKE2b self-test: BLAKE2b-512("") = 786a02f7... - { - static const uint8_t EXP[64]={ - 0x78,0x6a,0x02,0xf7,0x42,0x01,0x59,0x03,0xc6,0xc6,0xfd,0x85,0x25,0x52,0xd2,0x72, - 0x91,0x2f,0x47,0x40,0xe1,0x58,0x47,0x61,0x8a,0x86,0xe2,0x17,0xf7,0x1f,0x54,0x19, - 0xd2,0x5e,0x10,0x31,0xaf,0xee,0x58,0x53,0x13,0x89,0x64,0x44,0x93,0x4e,0xb0,0x4b, - 0x90,0x3a,0x68,0x5b,0x14,0x48,0xb7,0x55,0xd5,0x6f,0x70,0x1a,0xfe,0x9b,0xe2,0xce - }; - uint8_t got[64]; - b2_init(&gB2S,64);b2_final(&gB2S,got); - bool ok=(memcmp(got,EXP,64)==0); - Serial.printf("BLAKE2b-512('') : %s\n",ok?"PASS":"FAIL"); - if(!ok){ - Serial.print("got: "); - for(int i=0;i<64;i++)Serial.printf("%02x",got[i]); - Serial.println(); - } - } - - // PSRAM буферы - gBufPrev=(uint8_t*)ps_malloc(A2_BLKSZ);gBufRef=(uint8_t*)ps_malloc(A2_BLKSZ); - gBufOut=(uint8_t*)ps_malloc(A2_BLKSZ);gBufZero=(uint8_t*)ps_calloc(1,A2_BLKSZ); - gBufAddr=(uint8_t*)ps_malloc(A2_BLKSZ); - gJ1Seg=(uint32_t*)ps_malloc(A2_SEG*sizeof(uint32_t)); - if(!gBufPrev||!gBufRef||!gBufOut||!gBufZero||!gBufAddr||!gJ1Seg){ - gfx->setTextSize(2);gfx->setTextColor(C_RED); - gfx->setCursor(20,200);gfx->println("PSRAM alloc failed"); - while(true)delay(1000); - } - - // Попытка загрузить сохранённый результат из NVS - if(nvsLoad()){ - gState=ST_SAVED; - drawResultFull(); - }else{ - drawInputScreen("Login:",gLogin,false); - } -} - -// ═══════════════════════════════════════════════════════════ -// LOOP -// ═══════════════════════════════════════════════════════════ -#define BLOCKS_PER_TICK 4 - -void loop(){ - // ── Touch polling (для свайпа + обычных нажатий) ────── - int16_t tx=0,ty=0; - bool nowTouching=(gTouch.getPoint(&tx,&ty,1)>0); - - if(nowTouching&&!gTouching){ - // начало касания - gTouchStartY=ty;gTouchPrevY=ty;gTouchCurY=ty;gTouchCurX=tx; - gTouching=true; - } else if(nowTouching&&gTouching){ - int16_t delta=gTouchPrevY-ty; - gTouchCurY=ty;gTouchPrevY=ty;gTouchCurX=tx; - // живая прокрутка результата - if((gState==ST_DONE||gState==ST_SAVED)&&abs(delta)>0){ - gScrollY+=delta; - if(gScrollY<0)gScrollY=0; - if(gScrollY>gScrollMax)gScrollY=gScrollMax; - drawResultContent(); // перерисовать только контент (без кнопки) - } - } else if(!nowTouching&&gTouching){ - // конец касания: если почти не скроллили — считаем нажатием - int16_t swipeDelta=abs(gTouchStartY-gTouchCurY); - if(swipeDelta<15)handleTap(gTouchCurX,gTouchCurY); - gTouching=false; - } - - // ── Argon2id вычисление ──────────────────────────────── - if(gState==ST_RUNNING&&gInitDone){ - bool done=false; - for(int i=0;i -#include - -// BLAKE2b state -struct B2State { - uint64_t h[8], t[2], f[2]; - uint8_t buf[128]; - size_t buflen, outlen; -}; diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/burn.sh b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/burn.sh index 0c775da7..f93c9e49 100755 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/burn.sh +++ b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/burn.sh @@ -3,7 +3,7 @@ set -euo pipefail ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" BOARD_DIR="$(cd "${ROOT_DIR}/.." && pwd)" -DEMO_BASE="${BOARD_DIR}/official-demo/examples/Arduino-v3.3.5" +DEMO_BASE="${DEMO_BASE:-${BOARD_DIR}/../../../../SKETCH/ESP32-S3-Touch-AMOLED-2.16/official-demo/examples/Arduino-v3.3.5}" MODE="${1:-widgets}" PORT="${PORT:-}" FQBN="${FQBN:-esp32:esp32:esp32s3:USBMode=hwcdc,CDCOnBoot=cdc,UploadSpeed=921600,CPUFreq=240,FlashMode=dio,FlashSize=16M,PartitionScheme=app3M_fat9M_16MB,PSRAM=opi}" @@ -32,29 +32,10 @@ case "${MODE}" in hello) SKETCH_DIR="${DEMO_BASE}/examples/01_HelloWorld" ;; widgets) SKETCH_DIR="${DEMO_BASE}/examples/05_LVGL_Widgets" ;; audio) SKETCH_DIR="${DEMO_BASE}/examples/07_ES8311" ;; - simple) SKETCH_DIR="${ROOT_DIR}/simple_av_test" ;; - argon2) SKETCH_DIR="${ROOT_DIR}/argon2_sd_test" ;; - homeserver-ui) SKETCH_DIR="${ROOT_DIR}/shine_homeserver_main" ;; - shine-homeserver-main) SKETCH_DIR="${ROOT_DIR}/shine_homeserver_main" ;; - shine-homeserver-ui-main) SKETCH_DIR="${ROOT_DIR}/shine_homeserver_main" ;; - legacy-homeserver-ui) SKETCH_DIR="${ROOT_DIR}/shine_homeserver_ui" ;; - text-test) SKETCH_DIR="${ROOT_DIR}/text_render_test" ;; - gfx-text-test) SKETCH_DIR="${ROOT_DIR}/test_sketches/gfx_text_render_test" ;; - gfx-layout-test) SKETCH_DIR="${ROOT_DIR}/test_sketches/gfx_button_layout_test" ;; - lvgl-basic-test) SKETCH_DIR="${ROOT_DIR}/test_sketches/lvgl_basic_test" ;; - lvgl-interaction-test) SKETCH_DIR="${ROOT_DIR}/test_sketches/lvgl_interaction_test" ;; - lvgl-touch-debug-test) SKETCH_DIR="${ROOT_DIR}/test_sketches/lvgl_touch_debug_test" ;; - lvgl-official-based-test) SKETCH_DIR="${ROOT_DIR}/test_sketches/lvgl_official_based_test" ;; - lvgl-subserver-touch-test) SKETCH_DIR="${ROOT_DIR}/test_sketches/lvgl_subserver_touch_test" ;; - lvgl-russian-font-test) SKETCH_DIR="${ROOT_DIR}/test_sketches/lvgl_russian_font_test" ;; - usb-contact-test) SKETCH_DIR="${ROOT_DIR}/test_sketches/usb_contact_sensor_test" ;; - usb-contact-debug-test) SKETCH_DIR="${ROOT_DIR}/test_sketches/usb_contact_sensor_debug_test" ;; - usb-contact-resistance-test) SKETCH_DIR="${ROOT_DIR}/test_sketches/usb_contact_resistance_test" ;; - usb-contact-screen-start-stub) SKETCH_DIR="${ROOT_DIR}/test_sketches/usb_contact_screen_start_stub" ;; - lvgl-nav-minimal-test) SKETCH_DIR="${ROOT_DIR}/shine_homeserver_main" ;; + registration-signer) SKETCH_DIR="${ROOT_DIR}/shine_registration_signer" ;; *) echo "Unknown mode: ${MODE}" >&2 - echo "Use one of: hello, widgets, audio, simple, argon2, homeserver-ui, shine-homeserver-main, shine-homeserver-ui-main, legacy-homeserver-ui, text-test, gfx-text-test, gfx-layout-test, lvgl-basic-test, lvgl-interaction-test, lvgl-touch-debug-test, lvgl-official-based-test, lvgl-subserver-touch-test, lvgl-russian-font-test, usb-contact-test, usb-contact-debug-test, usb-contact-resistance-test, usb-contact-screen-start-stub" >&2 + echo "Use one of: registration-signer, hello, widgets, audio" >&2 exit 2 ;; esac @@ -74,10 +55,14 @@ compile_args=( --library "${DEMO_BASE}/libraries/XPowersLib" --library "${DEMO_BASE}/libraries/lvgl" --library "${DEMO_BASE}/libraries/Mylibrary" - --library "${ROOT_DIR}/simple_av_test" "${SKETCH_DIR}" ) +if [[ "${MODE}" == "registration-signer" && "${REGISTRAR_DEV_UNENCRYPTED:-0}" == "1" ]]; then + echo "WARNING: test-only registrar build; plaintext NVS, never provision a production key" >&2 + compile_args=(--build-property "compiler.cpp.extra_flags=-DSHINE_REGISTRAR_INSECURE_DEV" "${compile_args[@]}") +fi + echo "== Compile: fast incremental build" if ! arduino-cli compile "${compile_args[@]}"; then echo "== Compile: fast build failed, retrying clean build" diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_registration_signer/README.md b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_registration_signer/README.md new file mode 100644 index 00000000..8d650180 --- /dev/null +++ b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_registration_signer/README.md @@ -0,0 +1,39 @@ +# SHiNE Registration Signer 1.0 + +Самостоятельный скетч для Waveshare ESP32-S3-Touch-AMOLED-2.16, не использует старые функции homeserver или кошелька. Сохраняет только подписанные сертификаты, а не произвольные сообщения. LVGL 8, тот же драйвер CO5300, CST92xx, AXP2101 и распиновка SDMMC 1-bit (CLK 2, CMD 1, D0 3) из старого скетча. GPIO2 освобождается после запуска дисплея. + +## Сборка + +В окружении разработчика с уже установленными библиотеками платы (Arduino ESP32 core 3.3.5, официальный demo libraries, LVGL, sodium) установить дополнительные Arduino-библиотеки `WebSockets` (Links2004) и `ArduinoJson` 7.x: + +```sh +arduino-cli lib install WebSockets ArduinoJson +cd ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device +NO_UPLOAD=1 ./burn.sh registration-signer +``` + +Сертификаты TLS проверяются через встроенный публичный CA `registrar_ca.h` (ISRG Root X1). Если endpoint использует другой CA, заменить trust anchor на проверенный корень, пересобрать. Не отключать проверку. `wss://host[:port]/ws`, без `ws://`. Для действительного TLS нужен SNTP. Неверный сертификат должен приводить к отказу соединения. + +### Хранение ключа в прототипе + +32-байтный secret seed Ed25519 в Base58 и сохранённые пароли Wi-Fi записываются во внутреннюю NVS ESP32 без требования Secure Boot, Flash Encryption или NVS Encryption. Экран VIEW KEYS показывает приватный ключ. Устройство следует использовать только как прототип с тестовым ключом, пока не настроено защищённое хранение. + +## Установка + +1. Вставить новую SD-карту FAT, включить устройство, открыть SETTINGS. В WI-FI выбрать доступную сеть и ввести пароль; сеть сохраняется только после успешного подключения. Настроить SERVER URL (достаточно хоста `t2.shineup.me`, прошивка добавит `wss://` и `/ws`) и NAMESPACE (без @). В SECRET KEY BASE58 ввести 32-байтный Ed25519 seed в Base58; прошивка сама восстанавливает полный секретный и публичный ключи. VIEW KEYS показывает публичный ключ и 32-байтный seed в Base58. Для настройки Solana registrar_pubkey использовать показанный публичный ключ. Все поля отображаются открытым текстом, а при повторном редактировании прежнее значение сохраняется целиком. +2. В Solana установить соответствующий публичный ключ нового namespace; в серверном конфиге выбрать external, настроить Resend и Turbo как раньше. Подключить устройство; проверить `/status`. +3. Главный экран показывает состояние Wi-Fi и авторизованного подключения к серверу, причину OFFLINE и время после последнего успешного Ping. Кнопка PING отправляет внеочередной запрос. + +## SD формат 1.0 + +`/registrations/example.free.txt` — бинарный файл: major=1 (u8), minor=0 (u8), длина полного логина (u8), ASCII логин с @, Unix ms (u64 BE), длина raw signed DataItem (u32 BE), raw ANS-104. Имя в lowercase, оригинальный регистр сохраняется внутри. Внутренний и внешний Ed25519 уже в DataItem. SD не содержит приватного ключа. Email SHA-256 — часть публичного сертификата. + +При совпадении всех полей включая оригинальный регистр, ключи и email hash возвращаются сохранённые bytes после проверки обеих подписей; при несовпадении 409. Новая выдача: файл .tmp, flush/close, rename, повторное чтение и сравнение, обновление NVS учёта, только затем отправка. Незавершённый .tmp блокирует выдачу до ручного разбора. Не удалять ранее выданные записи. Утрата истории относительно счётчика NVS блокирует выдачу. Перед каждой выдачей пересчитывается история; большие SD-архивы потребуют оптимизации индекса, иначе возможно превышение серверного тайм-аута. Не извлекать SD во время работы. + +Лимит: 10 новых сертификатов за скользящие 5 часов. Время выдачи хранится на SD, в NVS — максимальная отметка и счётчик. При откате часов выдача блокируется. Повтор сохранённого сертификата не расходует квоту. Это защита от скомпрометированного сервера, а не полноценная защита от физического удаления/подмены SD или подмены NTP; не давать посторонним физический доступ. + +`App=test5599` — текущая эпоха проекта, `certificate_v1.h` должен изменяться согласованно с `ShineProtocolTags.CORE_NAMESPACE`, если эпоха будет изменена. Ранее подписанная запись для login остаётся неизменной; новый сертификат для того же login автоматически не создаётся. + +## Приёмка + +До production проверить: сборку обеих частей, экран/клавиатуру и SD после инициализации AMOLED, WSS и отклонение неверной CA/hostname, авторизацию верного/чужого ключа, перезагрузку, повтор запроса с теми же данными, конфликт регистра, лимит 10/5ч после перезапуска, отключение сети/SD и потерю ответа, ошибку NVS, Pause, публикацию Turbo и импорт, статус. `host-tests/run.sh` сравнивает сертификат с Java reference vector. Host-тест не заменяет сборку ESP/проверку реального устройства. diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_registration_signer/base58_key.h b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_registration_signer/base58_key.h new file mode 100644 index 00000000..96a3c3ef --- /dev/null +++ b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_registration_signer/base58_key.h @@ -0,0 +1,54 @@ +#pragma once + +#include +#include +#include +#include +#include + +namespace regkey { +static constexpr char ALPHABET[] = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; + +inline std::string encode(const uint8_t *data, size_t length) { + size_t zeros = 0; + while (zeros < length && data[zeros] == 0) ++zeros; + std::vector digits; + for (size_t i = zeros; i < length; ++i) { + unsigned carry = data[i]; + for (auto &digit : digits) { + carry += 256U * digit; + digit = carry % 58U; + carry /= 58U; + } + while (carry) { digits.push_back(carry % 58U); carry /= 58U; } + } + std::string result(zeros, '1'); + for (auto it = digits.rbegin(); it != digits.rend(); ++it) result += ALPHABET[*it]; + return result; +} + +inline bool decode32(const char *text, uint8_t out[32]) { + if (!text || !*text) return false; + const size_t length = strlen(text); + if (length > 45) return false; + size_t zeros = 0; + while (zeros < length && text[zeros] == '1') ++zeros; + std::vector bytes; + for (size_t i = zeros; i < length; ++i) { + const char *found = strchr(ALPHABET, text[i]); + if (!found) return false; + unsigned carry = found - ALPHABET; + for (auto &byte : bytes) { + carry += 58U * byte; + byte = carry & 255U; + carry >>= 8U; + } + while (carry) { bytes.push_back(carry & 255U); carry >>= 8U; } + if (zeros + bytes.size() > 32) return false; + } + if (zeros + bytes.size() != 32) return false; + memset(out, 0, 32); + for (size_t i = 0; i < bytes.size(); ++i) out[31 - i] = bytes[i]; + return encode(out, 32) == text; +} +} // namespace regkey diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_registration_signer/certificate_v1.h b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_registration_signer/certificate_v1.h new file mode 100644 index 00000000..6cae4912 --- /dev/null +++ b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_registration_signer/certificate_v1.h @@ -0,0 +1,29 @@ +#pragma once +#include +#include +#include +#include +#include +#include + +// Точное соответствие FreeRegistrationCertificateV1.java / Ans104DataItem.java. +namespace regv1 { +using Bytes=std::vector; +inline Bytes bytes(const std::string &s){return Bytes(s.begin(),s.end());} +inline void append(Bytes &a,const Bytes &b){a.insert(a.end(),b.begin(),b.end());} +inline void append(Bytes &a,const uint8_t *p,size_t n){a.insert(a.end(),p,p+n);} +inline void integer(Bytes &a,uint64_t n,unsigned count,bool little){for(unsigned i=0;i>(8*(little?i:count-1-i))));} +inline Bytes sha384(const Bytes &a){uint8_t digest[64]={};mbedtls_sha512(a.data(),a.size(),digest,1);return Bytes(digest,digest+48);} +inline Bytes combineHash(const Bytes &a,const Bytes &b){Bytes t=a;append(t,b);return sha384(t);} +inline Bytes blob(const Bytes &a){return combineHash(sha384(bytes("blob"+std::to_string(a.size()))),sha384(a));} +inline void avro(Bytes &a,uint64_t n){n*=2;while(n>127){a.push_back((n&127)|128);n>>=7;}a.push_back(n);} +inline void avroString(Bytes &a,const std::string &s){avro(a,s.size());append(a,bytes(s));} +inline Bytes tags(){Bytes a;avro(a,3);avroString(a,"App");avroString(a,"test5599");avroString(a,"t");avroString(a,"reg");avroString(a,"Protocol");avroString(a,"SHiNE-Free-Registration-V1");avro(a,0);return a;} +inline Bytes outerMessage(const Bytes &owner,const Bytes &data){Bytes a=sha384(bytes("list8"));for(const auto &v:std::vector{bytes("dataitem"),bytes("1"),bytes("2"),owner,{}, {},tags(),data})a=combineHash(a,blob(v));return a;} +inline bool validLogin(const std::string &login){auto at=login.find('@');if(login.size()>30||at==0||at==std::string::npos||at+1==login.size())return false;for(size_t i=0;i='a'&&c<='z')||(c>='0'&&c<='9')||c=='_'||(i='A'&&c<='Z')))return false;}return true;} +inline Bytes identity(const std::string &login,const Bytes &root,const Bytes &chain,const Bytes &client){if(!validLogin(login)||root.size()!=32||chain.size()!=32||client.size()!=32)return {};Bytes a={1,0,uint8_t(login.size())};append(a,bytes(login));append(a,root);append(a,chain);append(a,client);return a;} +inline Bytes innerMessage(const Bytes &fields){Bytes a=bytes("SHiNE_FREE_REG_V1");a.push_back(0);append(a,fields);return a;} +inline Bytes sign(const Bytes &msg,const uint8_t secret[64]){Bytes sig(64);if(crypto_sign_detached(sig.data(),nullptr,msg.data(),msg.size(),secret)!=0)return {};return sig;} +inline Bytes issue(const Bytes &fields,const Bytes &emailHash,const uint8_t owner[32],const uint8_t secret[64]){if(fields.empty()||emailHash.size()!=32)return {};Bytes inner=sign(innerMessage(fields),secret);if(inner.size()!=64)return {};Bytes data=fields;append(data,inner);append(data,emailHash);Bytes pub(owner,owner+32),outer=sign(outerMessage(pub,data),secret);if(outer.size()!=64)return {};Bytes result={2,0};append(result,outer);append(result,pub);result.push_back(0);result.push_back(0);integer(result,3,8,true);Bytes t=tags();integer(result,t.size(),8,true);append(result,t);append(result,data);return result;} +inline bool matches(const Bytes &raw,const Bytes &fields,const Bytes &emailHash,const uint8_t owner[32]){Bytes t=tags();size_t off=116+t.size();if(fields.empty()||emailHash.size()!=32||raw.size()!=off+fields.size()+96||raw[0]!=2||raw[1]!=0||memcmp(raw.data()+66,owner,32))return false;Bytes head={0,0};integer(head,3,8,true);integer(head,t.size(),8,true);append(head,t);if(memcmp(raw.data()+98,head.data(),head.size())||memcmp(raw.data()+off,fields.data(),fields.size())||memcmp(raw.data()+off+fields.size()+64,emailHash.data(),32))return false;Bytes inner=innerMessage(fields),data(raw.begin()+off,raw.end()),pub(owner,owner+32),outer=outerMessage(pub,data);return crypto_sign_verify_detached(raw.data()+off+fields.size(),inner.data(),inner.size(),owner)==0&&crypto_sign_verify_detached(raw.data()+2,outer.data(),outer.size(),owner)==0;} +} diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_registration_signer/host-tests/certificate_v1.hex b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_registration_signer/host-tests/certificate_v1.hex new file mode 100644 index 00000000..a7fca1e8 --- /dev/null +++ b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_registration_signer/host-tests/certificate_v1.hex @@ -0,0 +1 @@ +02003830de5c252e8d4da7dab6de28fdc2f8693dc709f4688895c2e92e2092113f4172cd21a1c7e9842c4cac6fd0cb0537c958d8ad22a00f0297082275df4edf730e03a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b800000300000000000000390000000000000006064170701074657374353539390274067265671050726f746f636f6c345348694e452d467265652d526567697374726174696f6e2d56310001000c4578616d706c654066726565202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f779d957dfe14d4d4097cfcb567944a1a3b4ee04024b71c189d95cfe15ed1bba8a5cf7b7a314e264437a0361f7422c287da24e70d785a0e7c2b1f8cc7073e6d05808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_registration_signer/host-tests/certificate_vector.cpp b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_registration_signer/host-tests/certificate_vector.cpp new file mode 100644 index 00000000..6ddc262e --- /dev/null +++ b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_registration_signer/host-tests/certificate_vector.cpp @@ -0,0 +1,4 @@ +#include "certificate_v1.h" +#include +#include +int main(){using namespace regv1;assert(sodium_init()>=0);uint8_t seed[32],pub[32],secret[64];Bytes r(32),b(32),c(32),e(32);for(int i=0;i<32;i++){seed[i]=i;r[i]=i+32;b[i]=i+64;c[i]=i+96;e[i]=i+128;}assert(crypto_sign_seed_keypair(pub,secret,seed)==0);auto fields=identity("Example@free",r,b,c);auto raw=issue(fields,e,pub,secret);assert(matches(raw,fields,e,pub));auto bad=raw;bad[2]^=1;assert(!matches(bad,fields,e,pub));bad=raw;bad.back()^=1;assert(!matches(bad,fields,e,pub));assert(!validLogin("../evil@free"));assert(!validLogin("Example@Free"));for(auto v:raw)printf("%02x",v);puts("");} diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_registration_signer/host-tests/run.sh b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_registration_signer/host-tests/run.sh new file mode 100755 index 00000000..4a5c9b22 --- /dev/null +++ b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_registration_signer/host-tests/run.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +set -euo pipefail +HERE=$(cd "$(dirname "$0")" && pwd) +TMP=$(mktemp -d) +trap 'rm -rf "$TMP"' EXIT +# Linux: g++, libsodium-dev, libmbedtls-dev (mbedTLS 3.x). +g++ -std=c++17 -I"$HERE/.." "$HERE/certificate_vector.cpp" -lsodium -lmbedcrypto -o "$TMP/vector" +"$TMP/vector" > "$TMP/actual.hex" +cmp "$HERE/certificate_v1.hex" "$TMP/actual.hex" +echo 'PASS: ESP32 certificate equals Java reference vector, tamper rejection' diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_registration_signer/registrar_ca.h b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_registration_signer/registrar_ca.h new file mode 100644 index 00000000..c2577f11 --- /dev/null +++ b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_registration_signer/registrar_ca.h @@ -0,0 +1,35 @@ +#pragma once +// Публичный trust anchor ISRG Root X1. Заменить при использовании другой доверенной CA. +static const char REGISTRAR_CA[] = R"PEM( +-----BEGIN CERTIFICATE----- +MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw +TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh +cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4 +WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu +ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY +MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc +h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+ +0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U +A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW +T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH +B5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ4Q7e2RCOFvu396j3x+UC +B5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf1b0SHzUv +KBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWn +OlFuhjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTn +jh8BCNAw1FtxNrQHusEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbw +qHyGO0aoSCqI3Haadr8faqU9GY/rOPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CI +rU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV +HRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY9umbbjANBgkq +hkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL +ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ +3BebYhtF8GaV0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KK +NFtY2PwByVS5uCbMiogziUwthDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5 +ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur +TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC +jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc +oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq +4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA +mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d +emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc= +-----END CERTIFICATE----- +)PEM"; diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_registration_signer/shine_registration_signer.ino b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_registration_signer/shine_registration_signer.ino new file mode 100644 index 00000000..9d7ecbe7 --- /dev/null +++ b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_registration_signer/shine_registration_signer.ino @@ -0,0 +1,377 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#define XPOWERS_CHIP_AXP2101 +#include "XPowersLib.h" +#include "certificate_v1.h" +#include "registrar_ca.h" +#include "base58_key.h" + +enum Screen {HOME,MENU,WIFI_OVERVIEW,WIFI_SCAN,EDITOR,KEYS}; +enum EditKind {EDIT_WIFI,EDIT_URL,EDIT_NAMESPACE,EDIT_SECRET}; +using regv1::Bytes; +static constexpr uint64_t WINDOW_MS=5ULL*60*60*1000; +static constexpr size_t LIMIT=10; +static Preferences prefs; +static WebSocketsClient ws; +static String ssid,wifiPass,endpoint,ns,host,path,lastLogin="-",lastError=""; +static uint16_t port=443; +static uint8_t seed[32]={},owner[32]={},secret[64]={}; +static bool uiReady=false,keyReady=false,sdReady=false,paused=false,authorized=false,connecting=false,secureStorage=false; +static uint32_t seq=0,pingAt=0,pingSent=0,authAt=0,wifiAt=0,refreshAt=0; +static String pingId,authId,serverReason="Waiting for Wi-Fi"; +static uint32_t lastPingAckAt=0,wsAttemptAt=0; +static std::vector recent; +static uint64_t total=0,lastRecorded=0; +static Arduino_DataBus *bus=new Arduino_ESP32QSPI(12,38,4,5,6,7); +static Arduino_CO5300 *gfx=new Arduino_CO5300(bus,2,0,480,480,0,0,0,0); +static TouchDrvCST92xx touch; +static XPowersPMU power; +static bool powerReady=false; +static lv_disp_draw_buf_t drawBuf; + +static String b64(const uint8_t *p,size_t n){size_t len=0;std::vector b(4*((n+2)/3)+1);if(mbedtls_base64_encode(b.data(),b.size(),&len,p,n))return "";b[len]=0;return String((char*)b.data());} +static bool decode(const String &s,Bytes &b,size_t expected){if(s.length()>4*((expected+2)/3))return false;b.resize(expected);size_t n=0;return !mbedtls_base64_decode(b.data(),b.size(),&n,(const uint8_t*)s.c_str(),s.length())&&n==expected;} +static uint64_t nowMs(){struct timeval tv;gettimeofday(&tv,nullptr);return tv.tv_sec>1700000000LL?uint64_t(tv.tv_sec)*1000+tv.tv_usec/1000:0;} +static bool safeTime(){uint64_t t=nowMs();return t&&t>=lastRecorded;} +static bool validNamespace(const String &s){return regv1::validLogin(std::string("x@")+s.c_str());} +static String filename(const String &login){String f=login;f.toLowerCase();f.replace('@','.');return "/registrations/"+f+".txt";} +static uint64_t readInt(const Bytes &b,size_t off,size_t n){uint64_t v=0;for(size_t i=0;iLIMIT)recent.erase(recent.begin());lastRecorded=std::max(lastRecorded,t);} +static size_t used(){uint64_t t=nowMs();size_t n=0;for(auto v:recent)if(v>t||t-v8192)return false; + Bytes b(f.size());if(f.read(b.data(),b.size())!=b.size())return false;f.close(); + size_t n=b[2];if(b[0]!=1||b[1]!=0||n==0||n>30||b.size()<15+n)return false; + login="";for(size_t i=0;i4096||b.size()!=15+n+len)return false; + raw.assign(b.begin()+15+n,b.end());return true; +} +static bool loadHistory(){ + recent.clear();total=0;lastRecorded=prefs.getULong64("lastIssue",0); + if(!SD_MMC.exists("/registrations")&&!SD_MMC.mkdir("/registrations"))return false; + File dir=SD_MMC.open("/registrations");if(!dir||!dir.isDirectory())return false; + for(File f=dir.openNextFile();f;f=dir.openNextFile()){ + String name=f.name();bool isDir=f.isDirectory();f.close();if(isDir)continue; + if(name.endsWith(".tmp")){lastError="Interrupted SD write; inspect card";return false;} + if(!name.endsWith(".txt"))continue; + String p=name.startsWith("/")?name:String("/registrations/")+name; + String login;uint64_t t;Bytes raw;if(!readRecord(p,login,t,raw))return false;keepTime(t);total++; + } + // NVS сохраняет минимальный счётчик; утрата файлов не сбрасывает лимит молча. + if(total();if(status==200)d["payload"]["dataItemB64"]=b64(raw.data(),raw.size());request("RegistrarSignResult",id,d);} +static void signRegistration(const String &id,JsonObjectConst p){ + if(!authorized||!keyReady||!sdReady){result(id,503);return;} + String login=p["login"]|"";if(!regv1::validLogin(login.c_str())){result(id,400);return;} + if(login.substring(login.indexOf('@')+1)!=ns){result(id,403);return;} + Bytes root,chain,client,email; + if(!decode(p["rootPublicKey"]|"",root,32)||!decode(p["blockchainPublicKey"]|"",chain,32)||!decode(p["clientPublicKey"]|"",client,32)||!decode(p["emailSha256"]|"",email,32)){result(id,400);return;} + if(!loadHistory()){sdReady=false;lastError="SD history unavailable";result(id,500);return;} + Bytes identity=regv1::identity(login.c_str(),root,chain,client);String file=filename(login); + if(SD_MMC.exists(file)){ + String old;uint64_t when;Bytes raw;if(!readRecord(file,old,when,raw)){sdReady=false;result(id,500);return;} + if(old!=login||!regv1::matches(raw,identity,email,owner)){result(id,409);return;} + result(id,200,raw);return; + } + uint64_t issuedAt=nowMs();if(!issuedAt||issuedAt=LIMIT){result(id,429);return;} + // Проверка SD перед подписанием: карта не должна быть извлечена или заменена незаметно. + if(!SD_MMC.exists("/registrations")){sdReady=false;result(id,500);return;} + Bytes raw=regv1::issue(identity,email,owner,secret); + if(raw.empty()||!storeRecord(login,issuedAt,raw)){sdReady=false;lastError="SD/NVS commit failed";result(id,500);return;} + result(id,200,raw); +} +static void event(WStype_t type,uint8_t *payload,size_t len){ + if(type==WStype_DISCONNECTED){authorized=false;pingId="";if(WiFi.status()==WL_CONNECTED&&(serverReason.startsWith("Connecting")||serverReason=="Connected and authorized"))serverReason="WebSocket disconnected; retrying";return;} + if(type==WStype_ERROR){authorized=false;serverReason="TLS/WebSocket connection error";return;} + if(type==WStype_CONNECTED){authorized=false;pingId="";authAt=millis();serverReason="Requesting registrar challenge";authId=nextId();JsonDocument d;d["payload"]["namespace"]=ns;request("RegistrarChallenge",authId,d);return;} + if(type!=WStype_TEXT||len>8192)return; + JsonDocument d;if(deserializeJson(d,payload,len))return; + String op=d["op"]|"",id=d["requestId"]|"";int status=d["status"]|0;JsonObjectConst p=d["payload"].as(); + if(op=="RegistrarChallenge"&&id==authId&&!authorized){ + String nonce=p["nonce"]|"",server=p["serverLogin"]|"";if(status!=200||nonce.length()!=43||server.isEmpty()||server.length()>128||!safeTime()){serverReason=status!=200?"Challenge rejected: "+String(status):"Invalid server challenge";ws.disconnect();return;} + for(size_t i=0;i65535||host.isEmpty())return false;for(size_t i=0;i=0){ssid=knownSsids[wifiCandidate];wifiPass=knownPasswords[wifiCandidate];prefs.putString("ssid",ssid);prefs.putString("wifiPass",wifiPass);}wifiTrying=false;wifiScanning=false;return;} + if(wifiTrying){ + if(millis()-wifiConnectAt<12000)return; + wifiTrying=false;WiFi.disconnect(false,false); + if(++wifiOrderPos0){ + for(int pass=0;pass<2;pass++)for(int i=0;i15000&&(serverReason.startsWith("Connecting")||serverReason.startsWith("WebSocket disconnected")))serverReason="Cannot reach "+host+" (DNS/TLS/port)"; + if(ws.isConnected()&&!authorized&&millis()-authAt>12000){serverReason="Registrar auth timed out";ws.disconnect();return;} + if(authorized&&!pingId.isEmpty()&&millis()-pingSent>10000){serverReason="Ping timed out";ws.disconnect();return;} + if(authorized&&pingId.isEmpty()&&millis()-pingAt>=45000){JsonDocument d;d["payload"]["ts"]=nowMs();pingId=nextId();pingAt=pingSent=millis();request("Ping",pingId,d);} +} +static void flushDisplay(lv_disp_drv_t *d,const lv_area_t *a,lv_color_t *c){ +#if LV_COLOR_16_SWAP + gfx->draw16bitBeRGBBitmap(a->x1,a->y1,(uint16_t*)&c->full,a->x2-a->x1+1,a->y2-a->y1+1); +#else + gfx->draw16bitRGBBitmap(a->x1,a->y1,(uint16_t*)&c->full,a->x2-a->x1+1,a->y2-a->y1+1); +#endif + lv_disp_flush_ready(d); +} +static void readTouch(lv_indev_drv_t *,lv_indev_data_t *d){int16_t x=0,y=0;d->state=touch.getPoint(&x,&y,1)>0?LV_INDEV_STATE_PR:LV_INDEV_STATE_REL;d->point.x=x;d->point.y=y;} +static void tick(void *){lv_tick_inc(2);} +static void home(); +static void settings(); +static lv_obj_t *button(lv_obj_t *parent,const char *label,lv_event_cb_t cb){lv_obj_t *b=lv_btn_create(parent);lv_obj_t *l=lv_label_create(b);lv_label_set_text(l,label);lv_obj_center(l);lv_obj_add_event_cb(b,cb,LV_EVENT_CLICKED,nullptr);return b;} +static Screen screen=HOME; +static EditKind editKind=EDIT_URL; +static int menuIndex=0,scanCount=0,keyboardPage=0; +static String scanNames[20],selectedWifi,editValue,uiMessage; +static bool keyboardSymbols=false,keyboardShift=false; +static lv_obj_t *editorInput=nullptr,*keyboard=nullptr,*statusLabel=nullptr,*editorHint=nullptr; +static void drawScreen(); +static void baseScreen(Screen next){screen=next;lv_obj_clean(lv_scr_act());statusLabel=nullptr;editorInput=nullptr;keyboard=nullptr;editorHint=nullptr;lv_obj_set_style_bg_color(lv_scr_act(),lv_color_hex(0x101820),0);lv_obj_set_style_text_color(lv_scr_act(),lv_color_hex(0xe4f0ef),0);} +static void title(const char *s){auto l=lv_label_create(lv_scr_act());lv_label_set_text(l,s);lv_obj_align(l,LV_ALIGN_TOP_MID,0,14);} +static void message(const String &s,int y){auto l=lv_label_create(lv_scr_act());lv_obj_set_width(l,440);lv_label_set_long_mode(l,LV_LABEL_LONG_WRAP);lv_label_set_text(l,s.c_str());lv_obj_set_pos(l,20,y);} +static void updateHome(); +static void sendPingNow(){ + if(!authorized||!ws.isConnected()){serverReason="Ping unavailable: server offline";updateHome();return;} + if(!pingId.isEmpty()){serverReason="Ping already pending";updateHome();return;} + JsonDocument d;d["payload"]["ts"]=nowMs();pingId=nextId();pingAt=pingSent=millis();serverReason="Ping sent; awaiting reply";request("Ping",pingId,d);updateHome(); +} +static void updateHome(){ + if(!statusLabel)return; + bool wifiOnline=WiFi.status()==WL_CONNECTED,serverOnline=authorized&&ws.isConnected(); + String s="Wi-Fi: "+String(wifiOnline?"#28B463 ONLINE#":"#E74C3C OFFLINE#"); + if(wifiOnline)s+=" ("+WiFi.SSID()+")"; + s+="\nServer: "+String(serverOnline?"#28B463 ONLINE#":"#E74C3C OFFLINE#"); + s+="\n"+serverReason; + s+="\nLast ping: "+String(lastPingAckAt?String((millis()-lastPingAckAt)/1000)+"s ago":"never"); + s+="\nSD card: "+String(sdReady?"OK":"ERROR")+"\nNamespace: @"+ns; + s+="\nKey: "+String(keyReady?"SET":"NOT SET")+"\nIssued: "+String((unsigned long long)total); + s+="\nLast 5 hours: "+String(used())+"/10\nLast: "+lastLogin; + s+="\n"+String(serverOnline&&sdReady&&safeTime()?"READY":"NOT READY"); + if(!lastError.isEmpty())s+="\n"+lastError; + if(powerReady&&power.isBatteryConnect())s+="\nBattery: "+String(power.getBatteryPercent())+"%"; + lv_label_set_text(statusLabel,s.c_str()); +} +static void home(){ + baseScreen(HOME);title("SHiNE REGISTRAR 1.0");statusLabel=lv_label_create(lv_scr_act()); + lv_obj_set_width(statusLabel,440);lv_label_set_long_mode(statusLabel,LV_LABEL_LONG_WRAP);lv_obj_set_pos(statusLabel,20,60); + lv_label_set_recolor(statusLabel,true);lv_obj_set_style_text_font(statusLabel,&lv_font_montserrat_16,0); + lv_obj_set_style_text_line_space(statusLabel,3,0); + auto b=button(lv_scr_act(),"SETTINGS",[](lv_event_t*){settings();});lv_obj_set_size(b,190,54);lv_obj_align(b,LV_ALIGN_BOTTOM_LEFT,20,-20); + b=button(lv_scr_act(),"PING",[](lv_event_t*){sendPingNow();});lv_obj_set_size(b,190,54);lv_obj_align(b,LV_ALIGN_BOTTOM_RIGHT,-20,-20);updateHome(); +} +static void menuItem(lv_obj_t *parent,const char *label,int y,lv_event_cb_t cb){auto b=button(parent,label,cb);lv_obj_set_size(b,436,96);lv_obj_set_pos(b,22,y);lv_obj_set_style_bg_color(b,lv_color_hex(0x355C7D),0);} +static void openEditor(EditKind kind,const String &value){editKind=kind;editValue=value;uiMessage="";keyboardSymbols=false;keyboardShift=false;keyboardPage=0;drawScreen();} +static void settings(){screen=MENU;menuIndex=0;drawScreen();} +static void wifiOverview(){screen=WIFI_OVERVIEW;drawScreen();} +static void wifiScan(){ + uiMessage="Scanning networks...";scanCount=0; + wifiScanning=false;wifiTrying=false;WiFi.scanDelete();WiFi.mode(WIFI_STA);int count=WiFi.scanNetworks(); + for(int i=0;i"){saveEditor();return;}if(key==""){if(editKind==EDIT_WIFI)wifiOverview();else settings();return;}if(key==""){lv_textarea_del_char(editorInput);return;}if(key==""){lv_textarea_set_text(editorInput,"");return;}if(key==""){editValue=lv_textarea_get_text(editorInput);keyboardSymbols=!keyboardSymbols;keyboardPage=0;drawScreen();return;}if(key==""){editValue=lv_textarea_get_text(editorInput);keyboardShift=!keyboardShift;drawScreen();return;}if(key==""){editValue=lv_textarea_get_text(editorInput);keyboardPage=1-keyboardPage;drawScreen();return;}if(key=="")key=" ";if(keyboardShift&&!keyboardSymbols)key.toUpperCase();lv_textarea_set_cursor_pos(editorInput,LV_TEXTAREA_CURSOR_LAST);lv_textarea_add_text(editorInput,key.c_str());} +static void keyButton(const char *label,const char *token,int x,int y,int w,int h){auto b=lv_btn_create(lv_scr_act());lv_obj_set_pos(b,x,y);lv_obj_set_size(b,w,h);lv_obj_set_style_bg_color(b,lv_color_hex(0x2A6F97),0);auto l=lv_label_create(b);lv_label_set_text(l,label);lv_obj_center(l);lv_obj_add_event_cb(b,keyCb,LV_EVENT_CLICKED,(void*)token);} +static void keyRow(const char *const *tokens,int count,int y){for(int i=0;i")label="SPACE";if(keyboardShift&&!keyboardSymbols)label.toUpperCase();keyButton(label.c_str(),tokens[i],20+i*92,y,84,62);}} +static void drawKeyboard(){ + static const char *a0[]={"q","w","e","r","t"},*a1[]={"a","s","d","f","g"},*a2[]={"z","x","c","v","b"}; + static const char *b0[]={"y","u","i","o","p"},*b1[]={"h","j","k","l"},*b2[]={"n","m",".","-"}; + static const char *s0[]={"1","2","3","4","5"},*s1[]={"://","/",":","_","@"},*s2[]={".com",".net",".org",".me",".io"}; + static const char *t0[]={"6","7","8","9","0"},*t1[]={"?","!","=","+","-"},*t2[]={"","#","~",":","/"}; + if(!keyboardSymbols){if(!keyboardPage){keyRow(a0,5,120);keyRow(a1,5,188);keyRow(a2,5,256);}else{keyRow(b0,5,120);keyRow(b1,4,188);keyRow(b2,4,256);}} + else{if(!keyboardPage){keyRow(s0,5,120);keyRow(s1,5,188);keyRow(s2,5,256);}else{keyRow(t0,5,120);keyRow(t1,5,188);keyRow(t2,5,256);}} + keyButton(keyboardSymbols?"ABC":"123","",20,328,84,62);keyButton(keyboardShift?"SHIFT*":"SHIFT","",112,328,84,62);keyButton("DEL","",204,328,76,62);keyButton("SAVE","",288,328,76,62);keyButton("CANCEL","",372,328,88,62); + keyButton("OTHER KEYS", "",20,400,150,55); + editorHint=lv_label_create(lv_scr_act());lv_obj_set_width(editorHint,280);lv_obj_set_pos(editorHint,185,405);lv_label_set_text(editorHint,uiMessage.isEmpty()?"Page 1 / 2":uiMessage.c_str()); +} +static void menuSelectCb(lv_event_t *e){ + int item=(int)(intptr_t)lv_event_get_user_data(e); + if(item==0){screen=WIFI_OVERVIEW;drawScreen();} + else if(item==1){String display=endpoint;if(display.startsWith("wss://"))display.remove(0,6);if(display.endsWith("/ws"))display.remove(display.length()-3);screen=EDITOR;openEditor(EDIT_URL,display);} + else if(item==2){screen=EDITOR;openEditor(EDIT_NAMESPACE,ns);} + else if(item==3){screen=EDITOR;openEditor(EDIT_SECRET,keyReady?String(regkey::encode(seed,32).c_str()):String(""));} + else {screen=KEYS;drawScreen();} +} +static void wifiSelectCb(lv_event_t *e){ + int i=(int)(intptr_t)lv_event_get_user_data(e); + if(i<0||i>=scanCount)return; + selectedWifi=scanNames[i];String saved; + for(int j=0;j0){menuIndex--;drawScreen();}});lv_obj_set_size(up,115,96);lv_obj_set_pos(up,345,120); + auto down=button(lv_scr_act(),"DOWN",[](lv_event_t*){if(menuIndex<3){menuIndex++;drawScreen();}});lv_obj_set_size(down,115,96);lv_obj_set_pos(down,345,246); + message(String("Items ")+String(menuIndex+1)+"-"+String(menuIndex+2)+" of 5",365); + auto back=button(lv_scr_act(),"BACK",[](lv_event_t*){home();});lv_obj_set_size(back,200,60);lv_obj_align(back,LV_ALIGN_BOTTOM_MID,0,-8);return; + } + if(screen==WIFI_OVERVIEW){ + baseScreen(WIFI_OVERVIEW);title("WI-FI");message(WiFi.status()==WL_CONNECTED?String("ONLINE: ")+WiFi.SSID():"OFFLINE",65); + int saved=0;for(int i=0;ibegin();bus->writeC8D8(0x36,0xA0);gfx->setBrightness(180);gfx->fillScreen(0);touch.setPins(11,-1);touch.begin(Wire,CST92XX_SLAVE_ADDRESS,15,14);touch.setMaxCoordinates(480,480);touch.setSwapXY(true);touch.setMirrorXY(true,false); + lv_init();const uint32_t count=480*40;auto a=(lv_color_t*)heap_caps_malloc(count*sizeof(lv_color_t),MALLOC_CAP_DMA);auto b=(lv_color_t*)heap_caps_malloc(count*sizeof(lv_color_t),MALLOC_CAP_DMA);if(!a||!b)return;lv_disp_draw_buf_init(&drawBuf,a,b,count);static lv_disp_drv_t disp;lv_disp_drv_init(&disp);disp.hor_res=480;disp.ver_res=480;disp.flush_cb=flushDisplay;disp.draw_buf=&drawBuf;lv_disp_drv_register(&disp);static lv_indev_drv_t input;lv_indev_drv_init(&input);input.type=LV_INDEV_TYPE_POINTER;input.read_cb=readTouch;lv_indev_drv_register(&input);const esp_timer_create_args_t args={.callback=tick,.name="registrar_tick"};esp_timer_handle_t timer;esp_timer_create(&args,&timer);esp_timer_start_periodic(timer,2000); + #if defined(CONFIG_NVS_ENCRYPTION) && CONFIG_NVS_ENCRYPTION + secureStorage=esp_flash_encryption_enabled()&&esp_secure_boot_enabled(); +#else + secureStorage=false; +#endif + if(!prefs.begin("shine-reg-v1",false)){home();lastError="NVS unavailable";uiReady=true;return;}ssid=prefs.getString("ssid","");wifiPass=prefs.getString("wifiPass","");endpoint=prefs.getString("endpoint","");ns=prefs.getString("namespace","free");paused=false;prefs.remove("paused");for(int i=0;i1000){refreshAt=millis();updateHome();}delay(5);} diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/simple_av_test/audio_hal.h b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/simple_av_test/audio_hal.h deleted file mode 100644 index 7ed0f898..00000000 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/simple_av_test/audio_hal.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - * ESPRESSIF MIT License - * - * Copyright (c) 2018 - * - * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in which case, - * it is 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: - * - * The above copyright notice and this permission notice shall be included in all copies or - * substantial portions of the Software. - * - * 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. - * - */ - -#ifndef _AUDIO_HAL_H_ -#define _AUDIO_HAL_H_ - -#define AUDIO_HAL_VOL_DEFAULT 60 - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Select media hal codec mode - */ -typedef enum { - AUDIO_HAL_CODEC_MODE_ENCODE = 1, /*!< select adc */ - AUDIO_HAL_CODEC_MODE_DECODE, /*!< select dac */ - AUDIO_HAL_CODEC_MODE_BOTH, /*!< select both adc and dac */ - AUDIO_HAL_CODEC_MODE_LINE_IN, /*!< set adc channel */ -} audio_hal_codec_mode_t; - -/** - * @brief Select adc channel for input mic signal - */ -typedef enum { - AUDIO_HAL_ADC_INPUT_LINE1 = 0x00, /*!< mic input to adc channel 1 */ - AUDIO_HAL_ADC_INPUT_LINE2, /*!< mic input to adc channel 2 */ - AUDIO_HAL_ADC_INPUT_ALL, /*!< mic input to both channels of adc */ - AUDIO_HAL_ADC_INPUT_DIFFERENCE, /*!< mic input to adc difference channel */ -} audio_hal_adc_input_t; - -/** - * @brief Select channel for dac output - */ -typedef enum { - AUDIO_HAL_DAC_OUTPUT_LINE1 = 0x00, /*!< dac output signal to channel 1 */ - AUDIO_HAL_DAC_OUTPUT_LINE2, /*!< dac output signal to channel 2 */ - AUDIO_HAL_DAC_OUTPUT_ALL, /*!< dac output signal to both channels */ -} audio_hal_dac_output_t; - -/** - * @brief Select operating mode i.e. start or stop for audio codec chip - */ -typedef enum { - AUDIO_HAL_CTRL_STOP = 0x00, /*!< set stop mode */ - AUDIO_HAL_CTRL_START = 0x01, /*!< set start mode */ -} audio_hal_ctrl_t; - -/** - * @brief Select I2S interface operating mode i.e. master or slave for audio codec chip - */ -typedef enum { - AUDIO_HAL_MODE_SLAVE = 0x00, /*!< set slave mode */ - AUDIO_HAL_MODE_MASTER = 0x01, /*!< set master mode */ -} audio_hal_iface_mode_t; - -/** - * @brief Select I2S interface samples per second - */ -typedef enum { - AUDIO_HAL_08K_SAMPLES, /*!< set to 8k samples per second */ - AUDIO_HAL_11K_SAMPLES, /*!< set to 11.025k samples per second */ - AUDIO_HAL_16K_SAMPLES, /*!< set to 16k samples in per second */ - AUDIO_HAL_22K_SAMPLES, /*!< set to 22.050k samples per second */ - AUDIO_HAL_24K_SAMPLES, /*!< set to 24k samples in per second */ - AUDIO_HAL_32K_SAMPLES, /*!< set to 32k samples in per second */ - AUDIO_HAL_44K_SAMPLES, /*!< set to 44.1k samples per second */ - AUDIO_HAL_48K_SAMPLES, /*!< set to 48k samples per second */ -} audio_hal_iface_samples_t; - -/** - * @brief Select I2S interface number of bits per sample - */ -typedef enum { - AUDIO_HAL_BIT_LENGTH_16BITS = 1, /*!< set 16 bits per sample */ - AUDIO_HAL_BIT_LENGTH_24BITS, /*!< set 24 bits per sample */ - AUDIO_HAL_BIT_LENGTH_32BITS, /*!< set 32 bits per sample */ -} audio_hal_iface_bits_t; - -/** - * @brief Select I2S interface format for audio codec chip - */ -typedef enum { - AUDIO_HAL_I2S_NORMAL = 0, /*!< set normal I2S format */ - AUDIO_HAL_I2S_LEFT, /*!< set all left format */ - AUDIO_HAL_I2S_RIGHT, /*!< set all right format */ - AUDIO_HAL_I2S_DSP, /*!< set dsp/pcm format */ -} audio_hal_iface_format_t; - -/** - * @brief I2s interface configuration for audio codec chip - */ -typedef struct { - audio_hal_iface_mode_t mode; /*!< audio codec chip mode */ - audio_hal_iface_format_t fmt; /*!< I2S interface format */ - audio_hal_iface_samples_t samples; /*!< I2S interface samples per second */ - audio_hal_iface_bits_t bits; /*!< i2s interface number of bits per sample */ -} audio_hal_codec_i2s_iface_t; - -/** - * @brief Configure media hal for initialization of audio codec chip - */ -typedef struct { - audio_hal_adc_input_t adc_input; /*!< set adc channel */ - audio_hal_dac_output_t dac_output; /*!< set dac channel */ - audio_hal_codec_mode_t codec_mode; /*!< select codec mode: adc, dac or both */ - audio_hal_codec_i2s_iface_t i2s_iface; /*!< set I2S interface configuration */ -} audio_hal_codec_config_t; - -#ifdef __cplusplus -} -#endif - -#endif //__AUDIO_HAL_H__ diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/simple_av_test/es7210.cpp b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/simple_av_test/es7210.cpp deleted file mode 100644 index c0569ccf..00000000 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/simple_av_test/es7210.cpp +++ /dev/null @@ -1,549 +0,0 @@ -/* - * ESPRESSIF MIT License - * - * Copyright (c) 2021 - * - * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in which case, - * it is 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: - * - * The above copyright notice and this permission notice shall be included in all copies or - * substantial portions of the Software. - * - * 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. - * - */ - -#ifdef ESP32 - -#include -#include -#include "esp_log.h" -#include "es7210.h" - - -#define I2S_DSP_MODE_A 0 -#define MCLK_DIV_FRE 256 - - -#define ES7210_MCLK_SOURCE FROM_CLOCK_DOUBLE_PIN /* In master mode, 0 : MCLK from pad 1 : MCLK from clock doubler */ -#define FROM_PAD_PIN 0 -#define FROM_CLOCK_DOUBLE_PIN 1 - - -static TwoWire *es7210wire; -static es7210_gain_value_t gain; - -/* - * Clock coefficient structer - */ -struct _coeff_div_es7210 { - uint32_t mclk; /* mclk frequency */ - uint32_t lrck; /* lrck */ - uint8_t ss_ds; - uint8_t adc_div; /* adcclk divider */ - uint8_t dll; /* dll_bypass */ - uint8_t doubler; /* doubler enable */ - uint8_t osr; /* adc osr */ - uint8_t mclk_src; /* select mclk source */ - uint32_t lrck_h; /* The high 4 bits of lrck */ - uint32_t lrck_l; /* The low 8 bits of lrck */ -}; - -static const char *TAG = "ES7210"; - -static es7210_input_mics_t mic_select = (es7210_input_mics_t)(ES7210_INPUT_MIC1 | ES7210_INPUT_MIC2 | ES7210_INPUT_MIC3 | ES7210_INPUT_MIC4); - -/* Codec hifi mclk clock divider coefficients - * MEMBER REG - * mclk: 0x03 - * lrck: standard - * ss_ds: -- - * adc_div: 0x02 - * dll: 0x06 - * doubler: 0x02 - * osr: 0x07 - * mclk_src: 0x03 - * lrckh: 0x04 - * lrckl: 0x05 -*/ -static const struct _coeff_div_es7210 coeff_div[] = { - //mclk lrck ss_ds adc_div dll doubler osr mclk_src lrckh lrckl - /* 8k */ - {12288000, 8000 , 0x00, 0x03, 0x01, 0x00, 0x20, 0x00, 0x06, 0x00}, - {16384000, 8000 , 0x00, 0x04, 0x01, 0x00, 0x20, 0x00, 0x08, 0x00}, - {19200000, 8000 , 0x00, 0x1e, 0x00, 0x01, 0x28, 0x00, 0x09, 0x60}, - {4096000, 8000 , 0x00, 0x01, 0x01, 0x00, 0x20, 0x00, 0x02, 0x00}, - - /* 11.025k */ - {11289600, 11025, 0x00, 0x02, 0x01, 0x00, 0x20, 0x00, 0x01, 0x00}, - - /* 12k */ - {12288000, 12000, 0x00, 0x02, 0x01, 0x00, 0x20, 0x00, 0x04, 0x00}, - {19200000, 12000, 0x00, 0x14, 0x00, 0x01, 0x28, 0x00, 0x06, 0x40}, - - /* 16k */ - {4096000, 16000, 0x00, 0x01, 0x01, 0x01, 0x20, 0x00, 0x01, 0x00}, - {19200000, 16000, 0x00, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x04, 0x80}, - {16384000, 16000, 0x00, 0x02, 0x01, 0x00, 0x20, 0x00, 0x04, 0x00}, - {12288000, 16000, 0x00, 0x03, 0x01, 0x01, 0x20, 0x00, 0x03, 0x00}, - - /* 22.05k */ - {11289600, 22050, 0x00, 0x01, 0x01, 0x00, 0x20, 0x00, 0x02, 0x00}, - - /* 24k */ - {12288000, 24000, 0x00, 0x01, 0x01, 0x00, 0x20, 0x00, 0x02, 0x00}, - {19200000, 24000, 0x00, 0x0a, 0x00, 0x01, 0x28, 0x00, 0x03, 0x20}, - - /* 32k */ - {12288000, 32000, 0x00, 0x03, 0x00, 0x00, 0x20, 0x00, 0x01, 0x80}, - {16384000, 32000, 0x00, 0x01, 0x01, 0x00, 0x20, 0x00, 0x02, 0x00}, - {19200000, 32000, 0x00, 0x05, 0x00, 0x00, 0x1e, 0x00, 0x02, 0x58}, - - /* 44.1k */ - {11289600, 44100, 0x00, 0x01, 0x01, 0x01, 0x20, 0x00, 0x01, 0x00}, - - /* 48k */ - {12288000, 48000, 0x00, 0x01, 0x01, 0x01, 0x20, 0x00, 0x01, 0x00}, - {19200000, 48000, 0x00, 0x05, 0x00, 0x01, 0x28, 0x00, 0x01, 0x90}, - - /* 64k */ - {16384000, 64000, 0x01, 0x01, 0x01, 0x00, 0x20, 0x00, 0x01, 0x00}, - {19200000, 64000, 0x00, 0x05, 0x00, 0x01, 0x1e, 0x00, 0x01, 0x2c}, - - /* 88.2k */ - {11289600, 88200, 0x01, 0x01, 0x01, 0x01, 0x20, 0x00, 0x00, 0x80}, - - /* 96k */ - {12288000, 96000, 0x01, 0x01, 0x01, 0x01, 0x20, 0x00, 0x00, 0x80}, - {19200000, 96000, 0x01, 0x05, 0x00, 0x01, 0x28, 0x00, 0x00, 0xc8}, -}; - -static esp_err_t es7210_write_reg(uint8_t reg_addr, uint8_t data) -{ - - es7210wire->beginTransmission(ES7210_ADDR); - es7210wire->write(reg_addr); - es7210wire->write(data); - return es7210wire->endTransmission(); - -} - -static esp_err_t es7210_update_reg_bit(uint8_t reg_addr, uint8_t update_bits, uint8_t data) -{ - uint8_t regv; - regv = es7210_read_reg(reg_addr); - regv = (regv & (~update_bits)) | (update_bits & data); - return es7210_write_reg(reg_addr, regv); -} - -static int get_coeff(uint32_t mclk, uint32_t lrck) -{ - for (int i = 0; i < (sizeof(coeff_div) / sizeof(coeff_div[0])); i++) { - if (coeff_div[i].lrck == lrck && coeff_div[i].mclk == mclk) - return i; - } - return -1; -} - -int8_t get_es7210_mclk_src(void) -{ - return ES7210_MCLK_SOURCE; -} - -int es7210_read_reg(uint8_t reg_addr) -{ - uint8_t data; - es7210wire->beginTransmission(ES7210_ADDR); - es7210wire->write(reg_addr); - es7210wire->endTransmission(false); - es7210wire->requestFrom(ES7210_ADDR, (size_t)1); - data = es7210wire->read(); - return (int)data; -} - -esp_err_t es7210_config_sample(audio_hal_iface_samples_t sample) -{ - uint8_t regv; - int coeff; - int sample_fre = 0; - int mclk_fre = 0; - esp_err_t ret = ESP_OK; - switch (sample) { - case AUDIO_HAL_08K_SAMPLES: - sample_fre = 8000; - break; - case AUDIO_HAL_11K_SAMPLES: - sample_fre = 11025; - break; - case AUDIO_HAL_16K_SAMPLES: - sample_fre = 16000; - break; - case AUDIO_HAL_22K_SAMPLES: - sample_fre = 22050; - break; - case AUDIO_HAL_24K_SAMPLES: - sample_fre = 24000; - break; - case AUDIO_HAL_32K_SAMPLES: - sample_fre = 32000; - break; - case AUDIO_HAL_44K_SAMPLES: - sample_fre = 44100; - break; - case AUDIO_HAL_48K_SAMPLES: - sample_fre = 48000; - break; - default: - ESP_LOGE(TAG, "Unable to configure sample rate %dHz", sample_fre); - break; - } - mclk_fre = sample_fre * MCLK_DIV_FRE; - coeff = get_coeff(mclk_fre, sample_fre); - if (coeff < 0) { - ESP_LOGE(TAG, "Unable to configure sample rate %dHz with %dHz MCLK", sample_fre, mclk_fre); - return ESP_FAIL; - } - /* Set clock parammeters */ - if (coeff >= 0) { - /* Set adc_div & doubler & dll */ - regv = es7210_read_reg(ES7210_MAINCLK_REG02) & 0x00; - regv |= coeff_div[coeff].adc_div; - regv |= coeff_div[coeff].doubler << 6; - regv |= coeff_div[coeff].dll << 7; - ret |= es7210_write_reg(ES7210_MAINCLK_REG02, regv); - /* Set osr */ - regv = coeff_div[coeff].osr; - ret |= es7210_write_reg(ES7210_OSR_REG07, regv); - /* Set lrck */ - regv = coeff_div[coeff].lrck_h; - ret |= es7210_write_reg(ES7210_LRCK_DIVH_REG04, regv); - regv = coeff_div[coeff].lrck_l; - ret |= es7210_write_reg(ES7210_LRCK_DIVL_REG05, regv); - } - return ret; -} - -esp_err_t es7210_mic_select(es7210_input_mics_t mic) -{ - esp_err_t ret = ESP_OK; - mic_select = mic; - if (mic_select & (ES7210_INPUT_MIC1 | ES7210_INPUT_MIC2 | ES7210_INPUT_MIC3 | ES7210_INPUT_MIC4)) { - for (int i = 0; i < 4; i++) { - ret |= es7210_update_reg_bit(ES7210_MIC1_GAIN_REG43 + i, 0x10, 0x00); - } - ret |= es7210_write_reg(ES7210_MIC12_POWER_REG4B, 0xff); - ret |= es7210_write_reg(ES7210_MIC34_POWER_REG4C, 0xff); - if (mic_select & ES7210_INPUT_MIC1) { - ESP_LOGI(TAG, "Enable ES7210_INPUT_MIC1"); - ret |= es7210_update_reg_bit(ES7210_CLOCK_OFF_REG01, 0x0b, 0x00); - ret |= es7210_write_reg(ES7210_MIC12_POWER_REG4B, 0x00); - ret |= es7210_update_reg_bit(ES7210_MIC1_GAIN_REG43, 0x10, 0x10); - } - if (mic_select & ES7210_INPUT_MIC2) { - ESP_LOGI(TAG, "Enable ES7210_INPUT_MIC2"); - ret |= es7210_update_reg_bit(ES7210_CLOCK_OFF_REG01, 0x0b, 0x00); - ret |= es7210_write_reg(ES7210_MIC12_POWER_REG4B, 0x00); - ret |= es7210_update_reg_bit(ES7210_MIC2_GAIN_REG44, 0x10, 0x10); - } - if (mic_select & ES7210_INPUT_MIC3) { - ESP_LOGI(TAG, "Enable ES7210_INPUT_MIC3"); - ret |= es7210_update_reg_bit(ES7210_CLOCK_OFF_REG01, 0x15, 0x00); - ret |= es7210_write_reg(ES7210_MIC34_POWER_REG4C, 0x00); - ret |= es7210_update_reg_bit(ES7210_MIC3_GAIN_REG45, 0x10, 0x10); - } - if (mic_select & ES7210_INPUT_MIC4) { - ESP_LOGI(TAG, "Enable ES7210_INPUT_MIC4"); - ret |= es7210_update_reg_bit(ES7210_CLOCK_OFF_REG01, 0x15, 0x00); - ret |= es7210_write_reg(ES7210_MIC34_POWER_REG4C, 0x00); - ret |= es7210_update_reg_bit(ES7210_MIC4_GAIN_REG46, 0x10, 0x10); - } - } else { - ESP_LOGE(TAG, "Microphone selection error"); - return ESP_FAIL; - } - return ret; -} - -esp_err_t es7210_adc_init(TwoWire *tw, audio_hal_codec_config_t *codec_cfg) -{ - esp_err_t ret = ESP_OK; - - es7210wire = tw; - - ret |= es7210_write_reg(ES7210_RESET_REG00, 0xff); - ret |= es7210_write_reg(ES7210_RESET_REG00, 0x41); - ret |= es7210_write_reg(ES7210_CLOCK_OFF_REG01, 0x1f); - ret |= es7210_write_reg(ES7210_TIME_CONTROL0_REG09, 0x30); /* Set chip state cycle */ - ret |= es7210_write_reg(ES7210_TIME_CONTROL1_REG0A, 0x30); /* Set power on state cycle */ - // ret |= es7210_write_reg(ES7210_ADC12_HPF2_REG23, 0x2a); /* Quick setup */ - // ret |= es7210_write_reg(ES7210_ADC12_HPF1_REG22, 0x0a); - // ret |= es7210_write_reg(ES7210_ADC34_HPF2_REG20, 0x0a); - // ret |= es7210_write_reg(ES7210_ADC34_HPF1_REG21, 0x2a); - /* Set master/slave audio interface */ - audio_hal_codec_i2s_iface_t *i2s_cfg = & (codec_cfg->i2s_iface); - switch (i2s_cfg->mode) { - case AUDIO_HAL_MODE_MASTER: /* MASTER MODE */ - ESP_LOGI(TAG, "ES7210 in Master mode"); - // ret |= es7210_update_reg_bit(ES7210_MODE_CONFIG_REG08, 0x01, 0x01); - ret |= es7210_write_reg(ES7210_MODE_CONFIG_REG08, 0x20); - /* Select clock source for internal mclk */ - switch (get_es7210_mclk_src()) { - case FROM_PAD_PIN: - ret |= es7210_update_reg_bit(ES7210_MASTER_CLK_REG03, 0x80, 0x00); - break; - case FROM_CLOCK_DOUBLE_PIN: - ret |= es7210_update_reg_bit(ES7210_MASTER_CLK_REG03, 0x80, 0x80); - break; - default: - ret |= es7210_update_reg_bit(ES7210_MASTER_CLK_REG03, 0x80, 0x00); - break; - } - break; - case AUDIO_HAL_MODE_SLAVE: /* SLAVE MODE */ - ESP_LOGI(TAG, "ES7210 in Slave mode"); - break; - default: - break; - } - ret |= es7210_write_reg(ES7210_ANALOG_REG40, 0xC3); /* Select power off analog, vdda = 3.3V, close vx20ff, VMID select 5KΩ start */ - ret |= es7210_write_reg(ES7210_MIC12_BIAS_REG41, 0x70); /* Select 2.87v */ - ret |= es7210_write_reg(ES7210_MIC34_BIAS_REG42, 0x70); /* Select 2.87v */ - ret |= es7210_write_reg(ES7210_OSR_REG07, 0x20); - ret |= es7210_write_reg(ES7210_MAINCLK_REG02, 0xc1); /* Set the frequency division coefficient and use dll except clock doubler, and need to set 0xc1 to clear the state */ - ret |= es7210_config_sample(i2s_cfg->samples); - ret |= es7210_mic_select(mic_select); - ret |= es7210_adc_set_gain_all(GAIN_0DB); - return ESP_OK; -} - -esp_err_t es7210_adc_deinit() -{ - return ESP_OK; -} - -esp_err_t es7210_config_fmt(audio_hal_iface_format_t fmt) -{ - esp_err_t ret = ESP_OK; - uint8_t adc_iface = 0; - adc_iface = es7210_read_reg(ES7210_SDP_INTERFACE1_REG11); - adc_iface &= 0xfc; - switch (fmt) { - case AUDIO_HAL_I2S_NORMAL: - ESP_LOGD(TAG, "ES7210 in I2S Format"); - adc_iface |= 0x00; - break; - case AUDIO_HAL_I2S_LEFT: - case AUDIO_HAL_I2S_RIGHT: - ESP_LOGD(TAG, "ES7210 in LJ Format"); - adc_iface |= 0x01; - break; - case AUDIO_HAL_I2S_DSP: - if (I2S_DSP_MODE_A) { - ESP_LOGD(TAG, "ES7210 in DSP-A Format"); - adc_iface |= 0x03; - } else { - ESP_LOGD(TAG, "ES7210 in DSP-B Format"); - adc_iface |= 0x13; - } - break; - default: - adc_iface &= 0xfc; - break; - } - ret |= es7210_write_reg(ES7210_SDP_INTERFACE1_REG11, adc_iface); - /* Force ADC1/2 output to SDOUT1 and ADC3/4 output to SDOUT2 */ - ret |= es7210_write_reg(ES7210_SDP_INTERFACE2_REG12, 0x00); - return ret; -} - -esp_err_t es7210_set_bits(audio_hal_iface_bits_t bits) -{ - esp_err_t ret = ESP_OK; - uint8_t adc_iface = 0; - adc_iface = es7210_read_reg(ES7210_SDP_INTERFACE1_REG11); - adc_iface &= 0x1f; - switch (bits) { - case AUDIO_HAL_BIT_LENGTH_16BITS: - adc_iface |= 0x60; - break; - case AUDIO_HAL_BIT_LENGTH_24BITS: - adc_iface |= 0x00; - break; - case AUDIO_HAL_BIT_LENGTH_32BITS: - adc_iface |= 0x80; - break; - default: - adc_iface |= 0x60; - break; - } - ret |= es7210_write_reg(ES7210_SDP_INTERFACE1_REG11, adc_iface); - return ret; -} - -esp_err_t es7210_adc_config_i2s(audio_hal_codec_mode_t mode, audio_hal_codec_i2s_iface_t *iface) -{ - esp_err_t ret = ESP_OK; - ret |= es7210_set_bits(iface->bits); - ret |= es7210_config_fmt(iface->fmt); - ret |= es7210_config_sample(iface->samples); - return ret; -} - -esp_err_t es7210_start(uint8_t clock_reg_value) -{ - esp_err_t ret = ESP_OK; - ret |= es7210_write_reg(ES7210_CLOCK_OFF_REG01, clock_reg_value); - ret |= es7210_write_reg(ES7210_POWER_DOWN_REG06, 0x00); - // ret |= es7210_write_reg(ES7210_ANALOG_REG40, 0x40); - ret |= es7210_write_reg(ES7210_MIC1_POWER_REG47, 0x00); - ret |= es7210_write_reg(ES7210_MIC2_POWER_REG48, 0x00); - ret |= es7210_write_reg(ES7210_MIC3_POWER_REG49, 0x00); - ret |= es7210_write_reg(ES7210_MIC4_POWER_REG4A, 0x00); - ret |= es7210_mic_select(mic_select); - return ret; -} - -esp_err_t es7210_stop(void) -{ - esp_err_t ret = ESP_OK; - ret |= es7210_write_reg(ES7210_MIC1_POWER_REG47, 0xff); - ret |= es7210_write_reg(ES7210_MIC2_POWER_REG48, 0xff); - ret |= es7210_write_reg(ES7210_MIC3_POWER_REG49, 0xff); - ret |= es7210_write_reg(ES7210_MIC4_POWER_REG4A, 0xff); - ret |= es7210_write_reg(ES7210_MIC12_POWER_REG4B,0xff); - ret |= es7210_write_reg(ES7210_MIC34_POWER_REG4C, 0xff); - // ret |= es7210_write_reg(ES7210_ANALOG_REG40, 0xc0); - ret |= es7210_write_reg(ES7210_CLOCK_OFF_REG01, 0x7f); - ret |= es7210_write_reg(ES7210_POWER_DOWN_REG06, 0x07); - return ret; -} - -esp_err_t es7210_adc_ctrl_state(audio_hal_codec_mode_t mode, audio_hal_ctrl_t ctrl_state) -{ - static uint8_t regv; - esp_err_t ret = ESP_OK; - // ESP_LOGW(TAG, "ES7210 only supports ADC mode"); - ret = es7210_read_reg(ES7210_CLOCK_OFF_REG01); - if ((ret != 0x7f) && (ret != 0xff)) { - regv = es7210_read_reg(ES7210_CLOCK_OFF_REG01); - } - if (ctrl_state == AUDIO_HAL_CTRL_START) { - ESP_LOGI(TAG, "The ES7210_CLOCK_OFF_REG01 value before stop is %x",regv); - ret |= es7210_start(regv); - } else { - ESP_LOGW(TAG, "The codec is about to stop"); - regv = es7210_read_reg(ES7210_CLOCK_OFF_REG01); - ret |= es7210_stop(); - } - return ESP_OK; -} - -esp_err_t es7210_adc_set_gain(es7210_input_mics_t mic_mask, es7210_gain_value_t gain) -{ - esp_err_t ret_val = ESP_OK; - - if (gain < GAIN_0DB) { - gain = GAIN_0DB; - } - - if (gain > GAIN_37_5DB) { - gain = GAIN_37_5DB; - } - - if (mic_mask & ES7210_INPUT_MIC1) { - ret_val |= es7210_update_reg_bit(ES7210_MIC1_GAIN_REG43, 0x0f, gain); - } - if (mic_mask & ES7210_INPUT_MIC2) { - ret_val |= es7210_update_reg_bit(ES7210_MIC2_GAIN_REG44, 0x0f, gain); - } - if (mic_mask & ES7210_INPUT_MIC3) { - ret_val |= es7210_update_reg_bit(ES7210_MIC3_GAIN_REG45, 0x0f, gain); - } - if (mic_mask & ES7210_INPUT_MIC4) { - ret_val |= es7210_update_reg_bit(ES7210_MIC4_GAIN_REG46, 0x0f, gain); - } - - return ret_val; -} - -esp_err_t es7210_adc_set_gain_all(es7210_gain_value_t gain) -{ - esp_err_t ret = ESP_OK; - uint32_t max_gain_vaule = 14; - if (gain < 0) { - gain = (es7210_gain_value_t) 0; - } else if (gain > max_gain_vaule) { - gain = (es7210_gain_value_t) max_gain_vaule; - } - ESP_LOGD(TAG, "SET: gain:%d", gain); - if (mic_select & ES7210_INPUT_MIC1) { - ret |= es7210_update_reg_bit(ES7210_MIC1_GAIN_REG43, 0x0f, gain); - } - if (mic_select & ES7210_INPUT_MIC2) { - ret |= es7210_update_reg_bit(ES7210_MIC2_GAIN_REG44, 0x0f, gain); - } - if (mic_select & ES7210_INPUT_MIC3) { - ret |= es7210_update_reg_bit(ES7210_MIC3_GAIN_REG45, 0x0f, gain); - } - if (mic_select & ES7210_INPUT_MIC4) { - ret |= es7210_update_reg_bit(ES7210_MIC4_GAIN_REG46, 0x0f, gain); - } - return ret; -} - -esp_err_t es7210_adc_get_gain(es7210_input_mics_t mic_mask, es7210_gain_value_t *gain) -{ - int regv = 0; - uint8_t gain_value; - if (mic_mask & ES7210_INPUT_MIC1) { - regv = es7210_read_reg(ES7210_MIC1_GAIN_REG43); - } else if (mic_mask & ES7210_INPUT_MIC2) { - regv = es7210_read_reg(ES7210_MIC2_GAIN_REG44); - } else if (mic_mask & ES7210_INPUT_MIC3) { - regv = es7210_read_reg(ES7210_MIC3_GAIN_REG45); - } else if (mic_mask & ES7210_INPUT_MIC4) { - regv = es7210_read_reg(ES7210_MIC4_GAIN_REG46); - } else { - ESP_LOGE(TAG, "No MIC selected"); - return ESP_FAIL; - } - if (regv == ESP_FAIL) { - return regv; - } - gain_value = (regv & 0x0f); /* Retain the last four bits for gain */ - *gain = (es7210_gain_value_t) gain_value; - ESP_LOGI(TAG, "GET: gain_value:%d", gain_value); - return ESP_OK; -} - -esp_err_t es7210_adc_set_volume(int volume) -{ - esp_err_t ret = ESP_OK; - ESP_LOGD(TAG, "ADC can adjust gain"); - return ret; -} - -esp_err_t es7210_set_mute(bool enable) -{ - ESP_LOGD(TAG, "ES7210 SetMute :%d", enable); - return ESP_OK; -} - -void es7210_read_all(void) -{ - for (int i = 0; i <= 0x4E; i++) { - uint8_t reg = es7210_read_reg(i); - ets_printf("REG:%02x, %02x\n", reg, i); - } -} - -#endif diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/simple_av_test/es7210.h b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/simple_av_test/es7210.h deleted file mode 100644 index 58efe86d..00000000 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/simple_av_test/es7210.h +++ /dev/null @@ -1,260 +0,0 @@ -/* - * ESPRESSIF MIT License - * - * Copyright (c) 2021 - * - * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in which case, - * it is 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: - * - * The above copyright notice and this permission notice shall be included in all copies or - * substantial portions of the Software. - * - * 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. - * - */ - -#ifndef _ES7210_H -#define _ES7210_H - -#include "audio_hal.h" -#include - -typedef enum { - ES7210_AD1_AD0_00 = 0x40, - ES7210_AD1_AD0_01 = 0x41, - ES7210_AD1_AD0_10 = 0x42, - ES7210_AD1_AD0_11 = 0x43, -} es7210_address_t; - -/* ES7210 address*/ -#define ES7210_ADDR ES7210_AD1_AD0_00 - -#ifdef __cplusplus -extern "C" { -#endif - -#define ES7210_RESET_REG00 0x00 /* Reset control */ -#define ES7210_CLOCK_OFF_REG01 0x01 /* Used to turn off the ADC clock */ -#define ES7210_MAINCLK_REG02 0x02 /* Set ADC clock frequency division */ -#define ES7210_MASTER_CLK_REG03 0x03 /* MCLK source $ SCLK division */ -#define ES7210_LRCK_DIVH_REG04 0x04 /* lrck_divh */ -#define ES7210_LRCK_DIVL_REG05 0x05 /* lrck_divl */ -#define ES7210_POWER_DOWN_REG06 0x06 /* power down */ -#define ES7210_OSR_REG07 0x07 -#define ES7210_MODE_CONFIG_REG08 0x08 /* Set master/slave & channels */ -#define ES7210_TIME_CONTROL0_REG09 0x09 /* Set Chip intial state period*/ -#define ES7210_TIME_CONTROL1_REG0A 0x0A /* Set Power up state period */ -#define ES7210_SDP_INTERFACE1_REG11 0x11 /* Set sample & fmt */ -#define ES7210_SDP_INTERFACE2_REG12 0x12 /* Pins state */ -#define ES7210_ADC_AUTOMUTE_REG13 0x13 /* Set mute */ -#define ES7210_ADC34_MUTERANGE_REG14 0x14 /* Set mute range */ -#define ES7210_ADC34_HPF2_REG20 0x20 /* HPF */ -#define ES7210_ADC34_HPF1_REG21 0x21 -#define ES7210_ADC12_HPF1_REG22 0x22 -#define ES7210_ADC12_HPF2_REG23 0x23 -#define ES7210_ANALOG_REG40 0x40 /* ANALOG Power */ -#define ES7210_MIC12_BIAS_REG41 0x41 -#define ES7210_MIC34_BIAS_REG42 0x42 -#define ES7210_MIC1_GAIN_REG43 0x43 -#define ES7210_MIC2_GAIN_REG44 0x44 -#define ES7210_MIC3_GAIN_REG45 0x45 -#define ES7210_MIC4_GAIN_REG46 0x46 -#define ES7210_MIC1_POWER_REG47 0x47 -#define ES7210_MIC2_POWER_REG48 0x48 -#define ES7210_MIC3_POWER_REG49 0x49 -#define ES7210_MIC4_POWER_REG4A 0x4A -#define ES7210_MIC12_POWER_REG4B 0x4B /* MICBias & ADC & PGA Power */ -#define ES7210_MIC34_POWER_REG4C 0x4C - - - -typedef enum { - ES7210_INPUT_MIC1 = 0x01, - ES7210_INPUT_MIC2 = 0x02, - ES7210_INPUT_MIC3 = 0x04, - ES7210_INPUT_MIC4 = 0x08 -} es7210_input_mics_t; - -typedef enum gain_value{ - GAIN_0DB = 0, - GAIN_3DB, - GAIN_6DB, - GAIN_9DB, - GAIN_12DB, - GAIN_15DB, - GAIN_18DB, - GAIN_21DB, - GAIN_24DB, - GAIN_27DB, - GAIN_30DB, - GAIN_33DB, - GAIN_34_5DB, - GAIN_36DB, - GAIN_37_5DB, -} es7210_gain_value_t; - -/* - * @brief Initialize ES7210 ADC chip - * - * @param[in] codec_cfg: configuration of ES7210 - * - * @return - * - ESP_OK - * - ESP_FAIL - */ -esp_err_t es7210_adc_init(TwoWire *tw, audio_hal_codec_config_t *codec_cfg); - -/** - * @brief Deinitialize ES7210 ADC chip - * - * @return - * - ESP_OK - * - ESP_FAIL - */ -esp_err_t es7210_adc_deinit(); - -/** - * @brief Configure ES7210 ADC mode and I2S interface - * - * @param[in] mode: codec mode - * @param[in] iface: I2S config - * - * @return - * - ESP_FAIL Parameter error - * - ESP_OK Success - */ -esp_err_t es7210_adc_config_i2s(audio_hal_codec_mode_t mode, audio_hal_codec_i2s_iface_t *iface); - -/** - * @brief Control ES7210 ADC chip - * - * @param[in] mode: codec mode - * @param[in] ctrl_state: start or stop progress - * - * @return - * - ESP_FAIL Parameter error - * - ESP_OK Success - */ -esp_err_t es7210_adc_ctrl_state(audio_hal_codec_mode_t mode, audio_hal_ctrl_t ctrl_state); - -/** - * @brief Set gain of given mask - * - * @param[in] mic_mask Mask of MIC channel - * - * @param[in] gain: gain - * - * gain : value - * GAIN_0DB : 1 - * GAIN_3DB : 2 - * GAIN_6DB : 3 - * · - * · - * · - * GAIN_30DB : 10 - * GAIN_33DB : 11 - * GAIN_34_5DB : 12 - * GAIN_36DB : 13 - * GAIN_37_5DB : 14 - * - * @return - * - ESP_OK - * - ESP_FAIL - */ -esp_err_t es7210_adc_set_gain(es7210_input_mics_t mic_mask, es7210_gain_value_t gain); - -/** - * @brief Set gain (Note: the enabled microphone sets the same gain) - * - * @param[in] gain: gain - * - * gain : value - * GAIN_0DB : 1 - * GAIN_3DB : 2 - * GAIN_6DB : 3 - * · - * · - * · - * GAIN_30DB : 10 - * GAIN_33DB : 11 - * GAIN_34_5DB : 12 - * GAIN_36DB : 13 - * GAIN_37_5DB : 14 - * - * @return - * - ESP_OK - * - ESP_FAIL - */ -esp_err_t es7210_adc_set_gain_all(es7210_gain_value_t gain); - -/** - * @brief Get MIC gain - * - * @param mic_mask Selected MIC - * @param gain Pointer to `es7210_gain_value_t` - * @return - * - ESP_OK - * - ESP_FAIL - */ -esp_err_t es7210_adc_get_gain(es7210_input_mics_t mic_mask, es7210_gain_value_t *gain); - -/** - * @brief Set volume - * - * @param[in] volume: volume - * - * @return - * - ESP_OK - */ -esp_err_t es7210_adc_set_volume(int volume); - -/** - * @brief Set ES7210 ADC mute status - * - * @return - * - ESP_FAIL - * - ESP_OK - */ -esp_err_t es7210_set_mute(bool enable); - -/** - * @brief Select ES7210 mic - * - * @param[in] mic: mics - * - * @return - * - ESP_FAIL - * - ESP_OK - */ -esp_err_t es7210_mic_select(es7210_input_mics_t mic); - -/** - * @brief Read regs of ES7210 - * - * @param[in] reg_addr: reg_addr - * - * @return - * - ESP_FAIL - * - ESP_OK - */ -int es7210_read_reg(uint8_t reg_addr); - -/** - * @brief Read all regs of ES7210 - */ -void es7210_read_all(void); - -#ifdef __cplusplus -} -#endif - -#endif /* _ES7210_H_ */ diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/simple_av_test/es8311.c b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/simple_av_test/es8311.c deleted file mode 100644 index 6b83860c..00000000 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/simple_av_test/es8311.c +++ /dev/null @@ -1,443 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include "es8311.h" -#include "driver/gpio.h" -#include "esp_log.h" -#include "esp_err.h" -#include "esp_check.h" -#include "es8311_reg.h" -#include "esp32-hal-i2c.h" - - -typedef struct { - unsigned int port; - uint16_t dev_addr; -} es8311_dev_t; - -/* - * Clock coefficient structure - */ -struct _coeff_div { - uint32_t mclk; /* mclk frequency */ - uint32_t rate; /* sample rate */ - uint8_t pre_div; /* the pre divider with range from 1 to 8 */ - uint8_t pre_multi; /* the pre multiplier with 0: 1x, 1: 2x, 2: 4x, 3: 8x selection */ - uint8_t adc_div; /* adcclk divider */ - uint8_t dac_div; /* dacclk divider */ - uint8_t fs_mode; /* double speed or single speed, =0, ss, =1, ds */ - uint8_t lrck_h; /* adclrck divider and daclrck divider */ - uint8_t lrck_l; - uint8_t bclk_div; /* sclk divider */ - uint8_t adc_osr; /* adc osr */ - uint8_t dac_osr; /* dac osr */ -}; - -/* codec hifi mclk clock divider coefficients */ -static const struct _coeff_div coeff_div[] = { - /*!port, es->dev_addr, write_buf, sizeof(write_buf), 1000); -} - -static inline esp_err_t es8311_read_reg(es8311_handle_t dev, uint8_t reg_addr, uint8_t *reg_value) -{ - es8311_dev_t *es = (es8311_dev_t *) dev; - size_t readCount = 0; - return i2cWriteReadNonStop(es->port, es->dev_addr, ®_addr, 1, reg_value, 1, 1000, &readCount); -} - -/* -* look for the coefficient in coeff_div[] table -*/ -static int get_coeff(uint32_t mclk, uint32_t rate) -{ - for (int i = 0; i < (sizeof(coeff_div) / sizeof(coeff_div[0])); i++) { - if (coeff_div[i].rate == rate && coeff_div[i].mclk == mclk) { - return i; - } - } - - return -1; -} - -esp_err_t es8311_sample_frequency_config(es8311_handle_t dev, int mclk_frequency, int sample_frequency) -{ - uint8_t regv; - - /* Get clock coefficients from coefficient table */ - int coeff = get_coeff(mclk_frequency, sample_frequency); - - if (coeff < 0) { - ESP_LOGE(TAG, "Unable to configure sample rate %dHz with %dHz MCLK", sample_frequency, mclk_frequency); - return ESP_ERR_INVALID_ARG; - } - - const struct _coeff_div *const selected_coeff = &coeff_div[coeff]; - - /* register 0x02 */ - ESP_RETURN_ON_ERROR(es8311_read_reg(dev, ES8311_CLK_MANAGER_REG02, ®v), TAG, "I2C read/write error"); - regv &= 0x07; - regv |= (selected_coeff->pre_div - 1) << 5; - regv |= selected_coeff->pre_multi << 3; - ESP_RETURN_ON_ERROR(es8311_write_reg(dev, ES8311_CLK_MANAGER_REG02, regv), TAG, "I2C read/write error"); - - /* register 0x03 */ - const uint8_t reg03 = (selected_coeff->fs_mode << 6) | selected_coeff->adc_osr; - ESP_RETURN_ON_ERROR(es8311_write_reg(dev, ES8311_CLK_MANAGER_REG03, reg03), TAG, "I2C read/write error"); - - /* register 0x04 */ - ESP_RETURN_ON_ERROR(es8311_write_reg(dev, ES8311_CLK_MANAGER_REG04, selected_coeff->dac_osr), TAG, "I2C read/write error"); - - /* register 0x05 */ - const uint8_t reg05 = ((selected_coeff->adc_div - 1) << 4) | (selected_coeff->dac_div - 1); - ESP_RETURN_ON_ERROR(es8311_write_reg(dev, ES8311_CLK_MANAGER_REG05, reg05), TAG, "I2C read/write error"); - - /* register 0x06 */ - ESP_RETURN_ON_ERROR(es8311_read_reg(dev, ES8311_CLK_MANAGER_REG06, ®v), TAG, "I2C read/write error"); - regv &= 0xE0; - - if (selected_coeff->bclk_div < 19) { - regv |= (selected_coeff->bclk_div - 1) << 0; - } else { - regv |= (selected_coeff->bclk_div) << 0; - } - - ESP_RETURN_ON_ERROR(es8311_write_reg(dev, ES8311_CLK_MANAGER_REG06, regv), TAG, "I2C read/write error"); - - /* register 0x07 */ - ESP_RETURN_ON_ERROR(es8311_read_reg(dev, ES8311_CLK_MANAGER_REG07, ®v), TAG, "I2C read/write error"); - regv &= 0xC0; - regv |= selected_coeff->lrck_h << 0; - ESP_RETURN_ON_ERROR(es8311_write_reg(dev, ES8311_CLK_MANAGER_REG07, regv), TAG, "I2C read/write error"); - - /* register 0x08 */ - ESP_RETURN_ON_ERROR(es8311_write_reg(dev, ES8311_CLK_MANAGER_REG08, selected_coeff->lrck_l), TAG, "I2C read/write error"); - - return ESP_OK; -} - -static esp_err_t es8311_clock_config(es8311_handle_t dev, const es8311_clock_config_t *const clk_cfg, es8311_resolution_t res) -{ - uint8_t reg06; - uint8_t reg01 = 0x3F; // Enable all clocks - int mclk_hz; - - /* Select clock source for internal MCLK and determine its frequency */ - if (clk_cfg->mclk_from_mclk_pin) { - mclk_hz = clk_cfg->mclk_frequency; - } else { - mclk_hz = clk_cfg->sample_frequency * (int)res * 2; - reg01 |= BIT(7); // Select BCLK (a.k.a. SCK) pin - } - - if (clk_cfg->mclk_inverted) { - reg01 |= BIT(6); // Invert MCLK pin - } - ESP_RETURN_ON_ERROR(es8311_write_reg(dev, ES8311_CLK_MANAGER_REG01, reg01), TAG, "I2C read/write error"); - - ESP_RETURN_ON_ERROR(es8311_read_reg(dev, ES8311_CLK_MANAGER_REG06, ®06), TAG, "I2C read/write error"); - if (clk_cfg->sclk_inverted) { - reg06 |= BIT(5); - } else { - reg06 &= ~BIT(5); - } - ESP_RETURN_ON_ERROR(es8311_write_reg(dev, ES8311_CLK_MANAGER_REG06, reg06), TAG, "I2C read/write error"); - - /* Configure clock dividers */ - return es8311_sample_frequency_config(dev, mclk_hz, clk_cfg->sample_frequency); -} - -static esp_err_t es8311_resolution_config(const es8311_resolution_t res, uint8_t *reg) -{ - switch (res) { - case ES8311_RESOLUTION_16: - *reg |= (3 << 2); - break; - case ES8311_RESOLUTION_18: - *reg |= (2 << 2); - break; - case ES8311_RESOLUTION_20: - *reg |= (1 << 2); - break; - case ES8311_RESOLUTION_24: - *reg |= (0 << 2); - break; - case ES8311_RESOLUTION_32: - *reg |= (4 << 2); - break; - default: - return ESP_ERR_INVALID_ARG; - } - return ESP_OK; -} - -static esp_err_t es8311_fmt_config(es8311_handle_t dev, const es8311_resolution_t res_in, const es8311_resolution_t res_out) -{ - uint8_t reg09 = 0; // SDP In - uint8_t reg0a = 0; // SDP Out - - ESP_LOGI(TAG, "ES8311 in Slave mode and I2S format"); - uint8_t reg00; - ESP_RETURN_ON_ERROR(es8311_read_reg(dev, ES8311_RESET_REG00, ®00), TAG, "I2C read/write error"); - reg00 &= 0xBF; - ESP_RETURN_ON_ERROR(es8311_write_reg(dev, ES8311_RESET_REG00, reg00), TAG, "I2C read/write error"); // Slave serial port - default - - /* Setup SDP In and Out resolution */ - es8311_resolution_config(res_in, ®09); - es8311_resolution_config(res_out, ®0a); - - ESP_RETURN_ON_ERROR(es8311_write_reg(dev, ES8311_SDPIN_REG09, reg09), TAG, "I2C read/write error"); - ESP_RETURN_ON_ERROR(es8311_write_reg(dev, ES8311_SDPOUT_REG0A, reg0a), TAG, "I2C read/write error"); - - return ESP_OK; -} - -esp_err_t es8311_microphone_config(es8311_handle_t dev, bool digital_mic) -{ - uint8_t reg14 = 0x1A; // enable analog MIC and max PGA gain - - /* PDM digital microphone enable or disable */ - if (digital_mic) { - reg14 |= BIT(6); - } - es8311_write_reg(dev, ES8311_ADC_REG17, 0xC8); // Set ADC gain @todo move this to ADC config section - - return es8311_write_reg(dev, ES8311_SYSTEM_REG14, reg14); -} - -esp_err_t es8311_init(es8311_handle_t dev, const es8311_clock_config_t *const clk_cfg, const es8311_resolution_t res_in, const es8311_resolution_t res_out) -{ - ESP_RETURN_ON_FALSE( - (clk_cfg->sample_frequency >= 8000) && (clk_cfg->sample_frequency <= 96000), - ESP_ERR_INVALID_ARG, TAG, "ES8311 init needs frequency in interval [8000; 96000] Hz" - ); - if (!clk_cfg->mclk_from_mclk_pin) { - ESP_RETURN_ON_FALSE(res_out == res_in, ESP_ERR_INVALID_ARG, TAG, "Resolution IN/OUT must be equal if MCLK is taken from SCK pin"); - } - - - /* Reset ES8311 to its default */ - ESP_RETURN_ON_ERROR(es8311_write_reg(dev, ES8311_RESET_REG00, 0x1F), TAG, "I2C read/write error"); - ESP_RETURN_ON_ERROR(es8311_write_reg(dev, ES8311_RESET_REG00, 0x00), TAG, "I2C read/write error"); - ESP_RETURN_ON_ERROR(es8311_write_reg(dev, ES8311_RESET_REG00, 0x80), TAG, "I2C read/write error"); // Power-on command - - /* Setup clock: source, polarity and clock dividers */ - ESP_RETURN_ON_ERROR(es8311_clock_config(dev, clk_cfg, res_out), TAG, ""); - - /* Setup audio format (fmt): master/slave, resolution, I2S */ - ESP_RETURN_ON_ERROR(es8311_fmt_config(dev, res_in, res_out), TAG, ""); - - ESP_RETURN_ON_ERROR(es8311_write_reg(dev, ES8311_SYSTEM_REG0D, 0x01), TAG, "I2C read/write error"); // Power up analog circuitry - NOT default - ESP_RETURN_ON_ERROR(es8311_write_reg(dev, ES8311_SYSTEM_REG0E, 0x02), TAG, "I2C read/write error"); // Enable analog PGA, enable ADC modulator - NOT default - ESP_RETURN_ON_ERROR(es8311_write_reg(dev, ES8311_SYSTEM_REG12, 0x00), TAG, "I2C read/write error"); // power-up DAC - NOT default - ESP_RETURN_ON_ERROR(es8311_write_reg(dev, ES8311_SYSTEM_REG13, 0x10), TAG, "I2C read/write error"); // Enable output to HP drive - NOT default - ESP_RETURN_ON_ERROR(es8311_write_reg(dev, ES8311_ADC_REG1C, 0x6A), TAG, "I2C read/write error"); // ADC Equalizer bypass, cancel DC offset in digital domain - ESP_RETURN_ON_ERROR(es8311_write_reg(dev, ES8311_DAC_REG37, 0x08), TAG, "I2C read/write error"); // Bypass DAC equalizer - NOT default - - return ESP_OK; -} - -void es8311_delete(es8311_handle_t dev) -{ - free(dev); -} - -esp_err_t es8311_voice_volume_set(es8311_handle_t dev, int volume, int *volume_set) -{ - if (volume < 0) { - volume = 0; - } else if (volume > 100) { - volume = 100; - } - - int reg32; - if (volume == 0) { - reg32 = 0; - } else { - reg32 = ((volume) * 256 / 100) - 1; - } - - // provide user with real volume set - if (volume_set != NULL) { - *volume_set = volume; - } - return es8311_write_reg(dev, ES8311_DAC_REG32, reg32); -} - -esp_err_t es8311_voice_volume_get(es8311_handle_t dev, int *volume) -{ - uint8_t reg32; - ESP_RETURN_ON_ERROR(es8311_read_reg(dev, ES8311_DAC_REG32, ®32), TAG, "I2C read/write error"); - - if (reg32 == 0) { - *volume = 0; - } else { - *volume = ((reg32 * 100) / 256) + 1; - } - return ESP_OK; -} - -esp_err_t es8311_voice_mute(es8311_handle_t dev, bool mute) -{ - uint8_t reg31; - ESP_RETURN_ON_ERROR(es8311_read_reg(dev, ES8311_DAC_REG31, ®31), TAG, "I2C read/write error"); - - if (mute) { - reg31 |= BIT(6) | BIT(5); - } else { - reg31 &= ~(BIT(6) | BIT(5)); - } - - return es8311_write_reg(dev, ES8311_DAC_REG31, reg31); -} - -esp_err_t es8311_microphone_gain_set(es8311_handle_t dev, es8311_mic_gain_t gain_db) -{ - return es8311_write_reg(dev, ES8311_ADC_REG16, gain_db); // ADC gain scale up -} - -esp_err_t es8311_voice_fade(es8311_handle_t dev, const es8311_fade_t fade) -{ - uint8_t reg37; - ESP_RETURN_ON_ERROR(es8311_read_reg(dev, ES8311_DAC_REG37, ®37), TAG, "I2C read/write error"); - reg37 &= 0x0F; - reg37 |= (fade << 4); - return es8311_write_reg(dev, ES8311_DAC_REG37, reg37); -} - -esp_err_t es8311_microphone_fade(es8311_handle_t dev, const es8311_fade_t fade) -{ - uint8_t reg15; - ESP_RETURN_ON_ERROR(es8311_read_reg(dev, ES8311_ADC_REG15, ®15), TAG, "I2C read/write error"); - reg15 &= 0x0F; - reg15 |= (fade << 4); - return es8311_write_reg(dev, ES8311_ADC_REG15, reg15); -} - -void es8311_register_dump(es8311_handle_t dev) -{ - for (int reg = 0; reg < 0x4A; reg++) { - uint8_t value; - ESP_ERROR_CHECK(es8311_read_reg(dev, reg, &value)); - printf("REG:%02x: %02x", reg, value); - } -} - -es8311_handle_t es8311_create(const unsigned int port, const uint16_t dev_addr) -{ - es8311_dev_t *sensor = (es8311_dev_t *) calloc(1, sizeof(es8311_dev_t)); - sensor->port = port; - sensor->dev_addr = dev_addr; - return (es8311_handle_t) sensor; -} diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/simple_av_test/es8311.h b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/simple_av_test/es8311.h deleted file mode 100644 index 2439d813..00000000 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/simple_av_test/es8311.h +++ /dev/null @@ -1,227 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * @file - * @brief ES8311 driver - */ - -#pragma once - -#include "esp_types.h" -#include "esp_err.h" - -/* ES8311 address: CE pin low - 0x18, CE pin high - 0x19 */ -#define ES8311_ADDRRES_0 0x18u // Leaving this here for backward compatibility -#define ES8311_ADDRESS_0 0x18u -#define ES8311_ADDRESS_1 0x19u - -#ifdef __cplusplus -extern "C" { -#endif - -typedef void *es8311_handle_t; - -typedef enum { - ES8311_MIC_GAIN_MIN = -1, - ES8311_MIC_GAIN_0DB, - ES8311_MIC_GAIN_6DB, - ES8311_MIC_GAIN_12DB, - ES8311_MIC_GAIN_18DB, - ES8311_MIC_GAIN_24DB, - ES8311_MIC_GAIN_30DB, - ES8311_MIC_GAIN_36DB, - ES8311_MIC_GAIN_42DB, - ES8311_MIC_GAIN_MAX -} es8311_mic_gain_t; - -typedef enum { - ES8311_FADE_OFF = 0, - ES8311_FADE_4LRCK, // 4LRCK means ramp 0.25dB/4LRCK - ES8311_FADE_8LRCK, - ES8311_FADE_16LRCK, - ES8311_FADE_32LRCK, - ES8311_FADE_64LRCK, - ES8311_FADE_128LRCK, - ES8311_FADE_256LRCK, - ES8311_FADE_512LRCK, - ES8311_FADE_1024LRCK, - ES8311_FADE_2048LRCK, - ES8311_FADE_4096LRCK, - ES8311_FADE_8192LRCK, - ES8311_FADE_16384LRCK, - ES8311_FADE_32768LRCK, - ES8311_FADE_65536LRCK -} es8311_fade_t; - -typedef enum es8311_resolution_t { - ES8311_RESOLUTION_16 = 16, - ES8311_RESOLUTION_18 = 18, - ES8311_RESOLUTION_20 = 20, - ES8311_RESOLUTION_24 = 24, - ES8311_RESOLUTION_32 = 32 -} es8311_resolution_t; - -typedef struct es8311_clock_config_t { - bool mclk_inverted; - bool sclk_inverted; - bool mclk_from_mclk_pin; // true: from MCLK pin (pin no. 2), false: from SCLK pin (pin no. 6) - int mclk_frequency; // This parameter is ignored if MCLK is taken from SCLK pin - int sample_frequency; // in Hz -} es8311_clock_config_t; - -/** - * @brief Initialize ES8311 - * - * There are two ways of providing Master Clock (MCLK) signal to ES8311 in Slave Mode: - * 1. From MCLK pin: - * For flexible scenarios. A clock signal from I2S master is routed to MCLK pin. - * Its frequency must be defined in clk_cfg->mclk_frequency parameter. - * 2. From SCLK pin: - * For simpler scenarios. ES8311 takes its clock from SCK pin. MCLK pin does not have to be connected. - * In this case, res_in must equal res_out; clk_cfg->mclk_frequency parameter is ignored - * and MCLK is calculated as MCLK = clk_cfg->sample_frequency * res_out * 2. - * Not all sampling frequencies are supported in this mode. - * - * @param dev ES8311 handle - * @param[in] clk_cfg Clock configuration - * @param[in] res_in Input serial port resolution - * @param[in] res_out Output serial port resolution - * @return - * - ESP_OK success - * - ESP_ERR_INVALID_ARG Sample frequency or resolution invalid - * - Else fail - */ -esp_err_t es8311_init(es8311_handle_t dev, const es8311_clock_config_t *const clk_cfg, const es8311_resolution_t res_in, - const es8311_resolution_t res_out); - -/** - * @brief Set output volume - * - * Volume paramter out of <0, 100> interval will be truncated. - * - * @param dev ES8311 handle - * @param[in] volume Set volume (0 ~ 100) - * @param[out] volume_set Volume that was set. Same as volume, unless volume is outside of <0, 100> interval. - * This parameter can be set to NULL, if user does not need this information. - * - * @return - * - ESP_OK success - * - Else fail - */ -esp_err_t es8311_voice_volume_set(es8311_handle_t dev, int volume, int *volume_set); - -/** - * @brief Get output volume - * - * @param dev ES8311 handle - * @param[out] volume get volume (0 ~ 100) - * - * @return - * - ESP_OK success - * - Else fail - */ -esp_err_t es8311_voice_volume_get(es8311_handle_t dev, int *volume); - -/** - * @brief Print out ES8311 register content - * - * @param dev ES8311 handle - */ -void es8311_register_dump(es8311_handle_t dev); - -/** - * @brief Mute ES8311 output - * - * @param dev ES8311 handle - * @param[in] enable true: mute, false: don't mute - * @return - * - ESP_OK success - * - Else fail - */ -esp_err_t es8311_voice_mute(es8311_handle_t dev, bool enable); - -/** - * @brief Set Microphone gain - * - * @param dev ES8311 handle - * @param[in] gain_db Microphone gain - * @return - * - ESP_OK success - * - Else fail - */ -esp_err_t es8311_microphone_gain_set(es8311_handle_t dev, es8311_mic_gain_t gain_db); - -/** - * @brief Configure microphone - * - * @param dev ES8311 handle - * @param[in] digital_mic Set to true for digital microphone - * @return - * - ESP_OK success - * - Else fail - */ -esp_err_t es8311_microphone_config(es8311_handle_t dev, bool digital_mic); - -/** - * @brief Configure sampling frequency - * - * @note This function is called by es8311_init(). - * Call this function explicitly only if you want to change sample frequency during runtime. - * @param dev ES8311 handle - * @param[in] mclk_frequency MCLK frequency in [Hz] (MCLK or SCLK pin, depending on bit register01[7]) - * @param[in] sample_frequency Required sample frequency in [Hz], e.g. 44100, 22050... - * @return - * - ESP_OK success - * - ESP_ERR_INVALID_ARG cannot set clock dividers for given MCLK and sampling frequency - * - Else I2C read/write error - */ -esp_err_t es8311_sample_frequency_config(es8311_handle_t dev, int mclk_frequency, int sample_frequency); - -/** - * @brief Configure fade in/out for ADC: voice - * - * @param dev ES8311 handle - * @param[in] fade Fade ramp rate - * @return - * - ESP_OK success - * - Else I2C read/write error - */ -esp_err_t es8311_voice_fade(es8311_handle_t dev, const es8311_fade_t fade); - -/** - * @brief Configure fade in/out for DAC: microphone - * - * @param dev ES8311 handle - * @param[in] fade Fade ramp rate - * @return - * - ESP_OK success - * - Else I2C read/write error - */ -esp_err_t es8311_microphone_fade(es8311_handle_t dev, const es8311_fade_t fade); - -/** - * @brief Create ES8311 object and return its handle - * - * @param[in] port I2C port number - * @param[in] dev_addr I2C device address of ES8311 - * - * @return - * - NULL Fail - * - Others Success - */ -es8311_handle_t es8311_create(const unsigned int port, const uint16_t dev_addr); - -/** - * @brief Delete ES8311 object - * - * @param dev ES8311 handle - */ -void es8311_delete(es8311_handle_t dev); - -#ifdef __cplusplus -} -#endif diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/simple_av_test/es8311_reg.h b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/simple_av_test/es8311_reg.h deleted file mode 100644 index 0ff8d5ed..00000000 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/simple_av_test/es8311_reg.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#pragma once - -/* - * ES8311_REGISTER NAME_REG_REGISTER ADDRESS - */ -#define ES8311_RESET_REG00 0x00 /*reset digital,csm,clock manager etc.*/ - -/* - * Clock Scheme Register definition - */ -#define ES8311_CLK_MANAGER_REG01 0x01 /* select clk src for mclk, enable clock for codec */ -#define ES8311_CLK_MANAGER_REG02 0x02 /* clk divider and clk multiplier */ -#define ES8311_CLK_MANAGER_REG03 0x03 /* adc fsmode and osr */ -#define ES8311_CLK_MANAGER_REG04 0x04 /* dac osr */ -#define ES8311_CLK_MANAGER_REG05 0x05 /* clk divier for adc and dac */ -#define ES8311_CLK_MANAGER_REG06 0x06 /* bclk inverter and divider */ -#define ES8311_CLK_MANAGER_REG07 0x07 /* tri-state, lrck divider */ -#define ES8311_CLK_MANAGER_REG08 0x08 /* lrck divider */ -/* - * SDP - */ -#define ES8311_SDPIN_REG09 0x09 /* dac serial digital port */ -#define ES8311_SDPOUT_REG0A 0x0A /* adc serial digital port */ -/* - * SYSTEM - */ -#define ES8311_SYSTEM_REG0B 0x0B /* system */ -#define ES8311_SYSTEM_REG0C 0x0C /* system */ -#define ES8311_SYSTEM_REG0D 0x0D /* system, power up/down */ -#define ES8311_SYSTEM_REG0E 0x0E /* system, power up/down */ -#define ES8311_SYSTEM_REG0F 0x0F /* system, low power */ -#define ES8311_SYSTEM_REG10 0x10 /* system */ -#define ES8311_SYSTEM_REG11 0x11 /* system */ -#define ES8311_SYSTEM_REG12 0x12 /* system, Enable DAC */ -#define ES8311_SYSTEM_REG13 0x13 /* system */ -#define ES8311_SYSTEM_REG14 0x14 /* system, select DMIC, select analog pga gain */ -/* - * ADC - */ -#define ES8311_ADC_REG15 0x15 /* ADC, adc ramp rate, dmic sense */ -#define ES8311_ADC_REG16 0x16 /* ADC */ -#define ES8311_ADC_REG17 0x17 /* ADC, volume */ -#define ES8311_ADC_REG18 0x18 /* ADC, alc enable and winsize */ -#define ES8311_ADC_REG19 0x19 /* ADC, alc maxlevel */ -#define ES8311_ADC_REG1A 0x1A /* ADC, alc automute */ -#define ES8311_ADC_REG1B 0x1B /* ADC, alc automute, adc hpf s1 */ -#define ES8311_ADC_REG1C 0x1C /* ADC, equalizer, hpf s2 */ -/* - * DAC - */ -#define ES8311_DAC_REG31 0x31 /* DAC, mute */ -#define ES8311_DAC_REG32 0x32 /* DAC, volume */ -#define ES8311_DAC_REG33 0x33 /* DAC, offset */ -#define ES8311_DAC_REG34 0x34 /* DAC, drc enable, drc winsize */ -#define ES8311_DAC_REG35 0x35 /* DAC, drc maxlevel, minilevel */ -#define ES8311_DAC_REG37 0x37 /* DAC, ramprate */ -/* - *GPIO - */ -#define ES8311_GPIO_REG44 0x44 /* GPIO, dac2adc for test */ -#define ES8311_GP_REG45 0x45 /* GP CONTROL */ -/* - * CHIP - */ -#define ES8311_CHD1_REGFD 0xFD /* CHIP ID1 */ -#define ES8311_CHD2_REGFE 0xFE /* CHIP ID2 */ -#define ES8311_CHVER_REGFF 0xFF /* VERSION */ -#define ES8311_CHD1_REGFD 0xFD /* CHIP ID1 */ - -#define ES8311_MAX_REGISTER 0xFF diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/simple_av_test/simple_av_test.ino b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/simple_av_test/simple_av_test.ino deleted file mode 100644 index 504f6bf9..00000000 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/simple_av_test/simple_av_test.ino +++ /dev/null @@ -1,272 +0,0 @@ -#include -#include -#include -#include "ESP_I2S.h" -#include "esp_check.h" -#include "Arduino_GFX_Library.h" -#include "pin_config.h" -#include "TouchDrvCSTXXX.hpp" -#include "SensorQMI8658.hpp" -#include "es8311.h" -#include "es7210.h" - -static const int DISP_W = 480; -static const int DISP_H = 480; -static const int SAFE = 20; -static const uint32_t SAMPLE_RATE = 16000; -static const size_t REC_SECONDS = 2; -static const size_t AUDIO_BYTES = SAMPLE_RATE * REC_SECONDS * 2 * 2; -static const int I2C_NUM = 0; - -I2SClass i2s; -TouchDrvCST92xx touch; -SensorQMI8658 qmi; -IMUdata acc; - -Arduino_DataBus *bus = new Arduino_ESP32QSPI(LCD_CS, LCD_SCLK, LCD_SDIO0, LCD_SDIO1, LCD_SDIO2, LCD_SDIO3); -Arduino_CO5300 *gfx = new Arduino_CO5300(bus, LCD_RESET, 0, DISP_W, DISP_H, 0, 0, 0, 0); - -uint8_t *audioBuf = nullptr; -size_t audioLen = 0; -bool touchIrq = false; -String statusLine = "Ready"; -String tiltLine = "Tilt: FLAT"; -String audioLine = "Audio: empty"; -uint32_t lastTiltMs = 0; -bool micReady = false; - -void IRAM_ATTR onTouchInt() { touchIrq = true; } - -esp_err_t codecInit() { - es8311_handle_t esHandle = es8311_create(I2C_NUM, ES8311_ADDRRES_0); - ESP_RETURN_ON_FALSE(esHandle, ESP_FAIL, "AV", "es8311 create failed"); - const es8311_clock_config_t clk = { - .mclk_inverted = false, - .sclk_inverted = false, - .mclk_from_mclk_pin = true, - .mclk_frequency = SAMPLE_RATE * 256, - .sample_frequency = SAMPLE_RATE, - }; - ESP_ERROR_CHECK(es8311_init(esHandle, &clk, ES8311_RESOLUTION_16, ES8311_RESOLUTION_16)); - ESP_RETURN_ON_ERROR(es8311_sample_frequency_config(esHandle, clk.mclk_frequency, clk.sample_frequency), "AV", "clock cfg failed"); - ESP_RETURN_ON_ERROR(es8311_microphone_config(esHandle, false), "AV", "mic cfg failed"); - ESP_RETURN_ON_ERROR(es8311_voice_volume_set(esHandle, 90, NULL), "AV", "volume failed"); - ESP_RETURN_ON_ERROR(es8311_microphone_gain_set(esHandle, (es8311_mic_gain_t)6), "AV", "mic gain failed"); - return ESP_OK; -} - -esp_err_t micInit() { - audio_hal_codec_config_t cfg = { - .adc_input = AUDIO_HAL_ADC_INPUT_ALL, - .codec_mode = AUDIO_HAL_CODEC_MODE_ENCODE, - .i2s_iface = { - .mode = AUDIO_HAL_MODE_SLAVE, - .fmt = AUDIO_HAL_I2S_NORMAL, - .samples = AUDIO_HAL_16K_SAMPLES, - .bits = AUDIO_HAL_BIT_LENGTH_16BITS, - }, - }; - esp_err_t ret = ESP_OK; - ret |= es7210_adc_init(&Wire, &cfg); - ret |= es7210_adc_config_i2s(cfg.codec_mode, &cfg.i2s_iface); - ret |= es7210_adc_set_gain( - (es7210_input_mics_t)(ES7210_INPUT_MIC1 | ES7210_INPUT_MIC2), - (es7210_gain_value_t)GAIN_24DB); - ret |= es7210_adc_set_gain( - (es7210_input_mics_t)(ES7210_INPUT_MIC3 | ES7210_INPUT_MIC4), - (es7210_gain_value_t)GAIN_24DB); - ret |= es7210_adc_ctrl_state(cfg.codec_mode, AUDIO_HAL_CTRL_START); - return ret; -} - -void drawStaticUi() { - gfx->fillScreen(RGB565_BLACK); - gfx->setTextSize(2); - gfx->setTextColor(RGB565_WHITE); - gfx->setCursor(SAFE + 16, SAFE + 10); - gfx->println("Simple AV + Tilt Test"); - - gfx->drawRect(24, 76, 132, 64, RGB565_GREEN); - gfx->setCursor(44, 100); - gfx->println("RECORD"); - - gfx->drawRect(174, 76, 132, 64, RGB565_YELLOW); - gfx->setCursor(212, 100); - gfx->println("PLAY"); - - gfx->drawRect(324, 76, 132, 64, RGB565_CYAN); - gfx->setCursor(360, 100); - gfx->println("BEEP"); -} - -void drawDynamic() { - gfx->fillRect(20, 166, 440, 140, RGB565_BLACK); - gfx->setTextSize(2); - gfx->setTextColor(RGB565_WHITE); - gfx->setCursor(28, 178); - gfx->println(statusLine); - gfx->setTextColor(RGB565_CYAN); - gfx->setCursor(28, 212); - gfx->println(tiltLine); - gfx->setTextColor(RGB565_ORANGE); - gfx->setCursor(28, 246); - gfx->println(audioLine); - gfx->drawRect(28, 278, 300, 20, RGB565_DARKGREY); -} - -void updateTilt() { - if (!qmi.getDataReady()) return; - if (!qmi.getAccelerometer(acc.x, acc.y, acc.z)) return; - String next = "Tilt: FLAT"; - if (acc.x > 0.8f) next = "Tilt: RIGHT"; - else if (acc.x < -0.8f) next = "Tilt: LEFT"; - else if (acc.y > 0.8f) next = "Tilt: UP"; - else if (acc.y < -0.8f) next = "Tilt: DOWN"; - if (next != tiltLine) { - tiltLine = next; - drawDynamic(); - } -} - -void playBeep() { - static int16_t tone[16000]; - for (int i = 0; i < 8000; ++i) { - float s = sinf(2.0f * 3.1415926f * 440.0f * ((float)i / SAMPLE_RATE)); - int16_t v = (int16_t)(s * 6000.0f); - tone[i * 2] = v; - tone[i * 2 + 1] = v; - } - statusLine = "Playing test beep..."; - drawDynamic(); - i2s.write((uint8_t *)tone, 8000 * 2 * sizeof(int16_t)); - statusLine = "Beep done"; - drawDynamic(); -} - -void recordAudio() { - if (!audioBuf || !micReady) { - statusLine = "No audio buffer"; - drawDynamic(); - return; - } - statusLine = "Recording 2 sec..."; - drawDynamic(); - size_t total = 0; - uint16_t peakAll = 0; - while (total < AUDIO_BYTES) { - size_t chunk = min((size_t)4096, AUDIO_BYTES - total); - size_t got = i2s.readBytes((char *)(audioBuf + total), chunk); - if (!got) break; - total += got; - - int16_t *s = (int16_t *)(audioBuf + total - got); - size_t n = got / sizeof(int16_t); - uint16_t peak = 0; - for (size_t i = 0; i < n; i++) { - uint16_t a = (uint16_t)abs((int)s[i]); - if (a > peak) peak = a; - } - if (peak > peakAll) peakAll = peak; - - int bar = map((int)peak, 0, 20000, 0, 296); - if (bar < 0) bar = 0; - if (bar > 296) bar = 296; - gfx->fillRect(30, 280, 296, 16, RGB565_BLACK); - uint16_t c = (peak > 12000) ? RGB565_RED : ((peak > 6000) ? RGB565_YELLOW : RGB565_GREEN); - gfx->fillRect(30, 280, bar, 16, c); - } - audioLen = total; - audioLine = (total > 0) ? "Audio: recorded" : "Audio: empty"; - if (total > 0) { - statusLine = String("Record done, peak=") + String((int)peakAll); - } else { - statusLine = "Record failed"; - } - drawDynamic(); -} - -void playAudio() { - if (!audioLen) { - statusLine = "No recording. Try BEEP."; - drawDynamic(); - return; - } - statusLine = "Playing recording..."; - drawDynamic(); - size_t wrote = i2s.write(audioBuf, audioLen); - statusLine = (wrote > 0) ? "Play done" : "Play failed"; - drawDynamic(); -} - -void handleTouch() { - if (!touchIrq) return; - touchIrq = false; - int16_t x[1]; - int16_t y[1]; - uint8_t touched = touch.getPoint(x, y, 1); - if (!touched) return; - - int px = x[0]; - int py = y[0]; - if (py < 76 || py > 140) return; - if (px >= 24 && px <= 156) recordAudio(); - else if (px >= 174 && px <= 306) playAudio(); - else if (px >= 324 && px <= 456) playBeep(); -} - -void setup() { - Serial.begin(115200); - Wire.begin(IIC_SDA, IIC_SCL); - - pinMode(PA, OUTPUT); - digitalWrite(PA, HIGH); - - if (!gfx->begin()) Serial.println("gfx begin failed"); - bus->writeC8D8(0x36, 0xA0); - gfx->setBrightness(200); - - pinMode(TP_RST, OUTPUT); - digitalWrite(TP_RST, LOW); - delay(30); - digitalWrite(TP_RST, HIGH); - delay(50); - touch.setPins(TP_RST, TP_INT); - touch.begin(Wire, 0x5A, IIC_SDA, IIC_SCL); - touch.setMaxCoordinates(480, 480); - touch.setSwapXY(true); - touch.setMirrorXY(true, false); - attachInterrupt(TP_INT, onTouchInt, FALLING); - - if (qmi.begin(Wire, QMI8658_L_SLAVE_ADDRESS, IIC_SDA, IIC_SCL)) { - qmi.configAccelerometer(SensorQMI8658::ACC_RANGE_4G, SensorQMI8658::ACC_ODR_1000Hz, SensorQMI8658::LPF_MODE_0); - qmi.enableAccelerometer(); - } else { - tiltLine = "Tilt: IMU not found"; - } - - i2s.setPins(9, 45, 8, 10, 42); - if (!i2s.begin(I2S_MODE_STD, SAMPLE_RATE, I2S_DATA_BIT_WIDTH_16BIT, I2S_SLOT_MODE_STEREO, I2S_STD_SLOT_BOTH)) { - statusLine = "I2S init failed"; - } else if (codecInit() != ESP_OK) { - statusLine = "ES8311 init failed"; - } else if (micInit() != ESP_OK) { - statusLine = "ES7210 init failed"; - } else { - micReady = true; - } - - audioBuf = (uint8_t *)ps_malloc(AUDIO_BYTES); - if (!audioBuf) statusLine = "No PSRAM buffer"; - - drawStaticUi(); - drawDynamic(); -} - -void loop() { - handleTouch(); - if (millis() - lastTiltMs > 120) { - lastTiltMs = millis(); - updateTilt(); - } - delay(5); -} diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/README.md b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/README.md deleted file mode 100644 index 3fcbc9fe..00000000 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# Test Sketches - -Набор старых отдельных диагностических скетчей для `Waveshare ESP32-S3-Touch-AMOLED-2.16`. - -Скетчи в этой папке нужны для быстрой проверки конкретных гипотез и не являются основным UI проекта. -Основной скетч сейчас лежит в `main-device/shine_homeserver_main/`. - -## Список - -- `gfx_text_render_test/` - проверка рендера текста через `Arduino_GFX` и сравнение с `U8g2` -- `gfx_button_layout_test/` - проверка геометрии кнопок, особенно нижних рядов и широких кнопок -- `lvgl_basic_test/` - минимальный тест `LVGL` с заголовком, текстом и кнопками -- `lvgl_interaction_test/` - расширенный тест `LVGL` с 9 кнопками, touch-вводом и статусом нажатия -- `lvgl_touch_debug_test/` - диагностика touch: сырые координаты, точка касания и одна большая кнопка `LVGL` -- `lvgl_official_based_test/` - минимальный наш экран поверх максимально близкой к официальному `05_LVGL_Widgets` инициализации -- `lvgl_subserver_touch_test/` - старый гибридный тест: `LVGL`-экран с инициализацией дисплея и чтением touch из старого `shine_homeserver_ui`; подтверждён на реальном устройстве -- `lvgl_russian_font_test/` - тест кастомного кириллического `LVGL`-шрифта с русскими кнопками, длинными строками и рабочим touch -- `usb_contact_sensor_test/` - тест переключения нативных USB D-/D+ (`GPIO19/20`) в режим простого замыкаемого контакта после нажатия Start; после перезагрузки снова обычный USB -- `usb_contact_sensor_debug_test/` - debug-версия теста замыкания контакта: экранная кнопка проверяет touch, а переход в sensor mode выполняется физической кнопкой BOOT -- `usb_contact_resistance_test/` - тест измерения сопротивления между USB D-/D+ через ADC на GPIO20; рассчитан на внешний известный резистор 10 kΩ с D+ на GND -- `lvgl_nav_minimal_test/` - старое тестовое имя, этот скетч перенесён в `shine_homeserver_main/` и теперь является основным - -## Запуск - -Использовать через `burn.sh`: - -- `./burn.sh gfx-text-test` -- `./burn.sh gfx-layout-test` -- `./burn.sh lvgl-basic-test` -- `./burn.sh lvgl-interaction-test` -- `./burn.sh lvgl-touch-debug-test` -- `./burn.sh lvgl-official-based-test` -- `./burn.sh lvgl-subserver-touch-test` -- `./burn.sh lvgl-russian-font-test` -- `./burn.sh usb-contact-test` -- `./burn.sh usb-contact-debug-test` -- `./burn.sh usb-contact-resistance-test` diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/gfx_button_layout_test/gfx_button_layout_test.ino b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/gfx_button_layout_test/gfx_button_layout_test.ino deleted file mode 100644 index 37585e66..00000000 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/gfx_button_layout_test/gfx_button_layout_test.ino +++ /dev/null @@ -1,93 +0,0 @@ -#include -#include -#include - -#define PIN_LCD_CS 12 -#define PIN_LCD_SCLK 38 -#define PIN_LCD_D0 4 -#define PIN_LCD_D1 5 -#define PIN_LCD_D2 6 -#define PIN_LCD_D3 7 -#define PIN_LCD_RST 2 -#define PIN_I2C_SDA 15 -#define PIN_I2C_SCL 14 - -#define DISP_W 480 -#define DISP_H 480 - -#define C_BG 0x0841u -#define C_PANEL 0x1082u -#define C_CARD 0x18C3u -#define C_BORDER 0x39C7u -#define C_TEXT 0xFFFFu -#define C_OK 0x3666u -#define C_WARN 0xECA0u -#define C_BUTTON 0x2145u -#define C_BUTTON2 0x3186u - -Arduino_DataBus *gBus = new Arduino_ESP32QSPI( - PIN_LCD_CS, PIN_LCD_SCLK, PIN_LCD_D0, PIN_LCD_D1, PIN_LCD_D2, PIN_LCD_D3); -Arduino_CO5300 *gfx = new Arduino_CO5300( - gBus, PIN_LCD_RST, 0, DISP_W, DISP_H, 0, 0, 0, 0); - -static void drawPanel(int x, int y, int w, int h, uint16_t fill, uint16_t border, int radius = 10) { - gfx->fillRoundRect(x, y, w, h, radius, fill); - gfx->drawRoundRect(x, y, w, h, radius, border); -} - -static void drawText(int x, int y, const char *text, uint16_t color, uint8_t size = 2) { - gfx->setFont(); - gfx->setTextSize(size); - gfx->setTextColor(color); - gfx->setCursor(x, y); - gfx->print(text); -} - -static void drawButton(int x, int y, int w, int h, uint16_t fill, const char *label, uint8_t size = 2) { - drawPanel(x, y, w, h, fill, C_BORDER, 12); - gfx->setFont(); - gfx->setTextSize(size); - gfx->setTextColor(C_TEXT); - int textW = strlen(label) * 6 * size; - int textX = x + (w - textW) / 2; - if (textX < x + 8) { - textX = x + 8; - } - int textY = y + (h + 8 * size) / 2 - 2; - gfx->setCursor(textX, textY); - gfx->print(label); -} - -static void drawScreen() { - gfx->fillScreen(C_BG); - drawPanel(12, 12, 456, 456, C_PANEL, C_BORDER, 16); - drawText(24, 42, "BUTTON LAYOUT TEST", C_TEXT, 2); - drawText(24, 70, "Check bottom and wide buttons", C_WARN, 1); - - drawButton(20, 110, 136, 52, C_BUTTON, "STATUS"); - drawButton(172, 110, 136, 52, C_BUTTON, "CONNECT"); - drawButton(324, 110, 136, 52, C_BUTTON, "ACCOUNT"); - - drawButton(20, 180, 136, 52, C_BUTTON, "WALLET"); - drawButton(172, 180, 136, 52, C_BUTTON, "REQUESTS"); - drawButton(324, 180, 136, 52, C_BUTTON, "SETTINGS"); - - drawButton(20, 270, 212, 48, C_BUTTON2, "BACK"); - drawButton(248, 270, 212, 48, C_OK, "REFRESH"); - - drawButton(20, 338, 440, 40, C_BUTTON2, "FULL WIDTH BUTTON", 2); - drawButton(20, 390, 440, 56, C_OK, "REGISTER DEVICE", 2); -} - -void setup() { - Serial.begin(115200); - Wire.begin(PIN_I2C_SDA, PIN_I2C_SCL); - gfx->begin(); - gBus->writeC8D8(0x36, 0xA0); - gfx->setBrightness(220); - drawScreen(); -} - -void loop() { - delay(1000); -} diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/gfx_text_render_test/gfx_text_render_test.ino b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/gfx_text_render_test/gfx_text_render_test.ino deleted file mode 100644 index 028bc982..00000000 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/gfx_text_render_test/gfx_text_render_test.ino +++ /dev/null @@ -1,104 +0,0 @@ -#include -#include -#include -#include - -#define PIN_LCD_CS 12 -#define PIN_LCD_SCLK 38 -#define PIN_LCD_D0 4 -#define PIN_LCD_D1 5 -#define PIN_LCD_D2 6 -#define PIN_LCD_D3 7 -#define PIN_LCD_RST 2 -#define PIN_I2C_SDA 15 -#define PIN_I2C_SCL 14 - -#define DISP_W 480 -#define DISP_H 480 - -#define C_BG 0x0841u -#define C_PANEL 0x1082u -#define C_CARD 0x18C3u -#define C_BORDER 0x39C7u -#define C_TEXT 0xFFFFu -#define C_MUTE 0xBDF7u -#define C_OK 0x3666u -#define C_WARN 0xECA0u -#define C_BUTTON 0x2145u -#define C_BUTTON2 0x3186u - -#define FONT_BODY u8g2_font_9x15_t_cyrillic -#define FONT_SMALL u8g2_font_6x13_t_cyrillic - -Arduino_DataBus *gBus = new Arduino_ESP32QSPI( - PIN_LCD_CS, PIN_LCD_SCLK, PIN_LCD_D0, PIN_LCD_D1, PIN_LCD_D2, PIN_LCD_D3); -Arduino_CO5300 *gfx = new Arduino_CO5300( - gBus, PIN_LCD_RST, 0, DISP_W, DISP_H, 0, 0, 0, 0); - -static void drawPanel(int x, int y, int w, int h, uint16_t fill, uint16_t border, int radius = 10) { - gfx->fillRoundRect(x, y, w, h, radius, fill); - gfx->drawRoundRect(x, y, w, h, radius, border); -} - -static void drawDefaultText(int x, int y, const char *text, uint16_t color, uint8_t size = 1) { - gfx->setFont(); - gfx->setTextSize(size); - gfx->setTextColor(color); - gfx->setCursor(x, y); - gfx->print(text); -} - -static void drawU8Text(int x, int y, const String &text, uint16_t color, const uint8_t *font) { - gfx->setTextSize(1); - gfx->setFont(font); - gfx->setTextColor(color); - gfx->setCursor(x, y); - gfx->print(text); -} - -static void drawButton(int x, int y, int w, int h, uint16_t fill, const String &label, const uint8_t *font, bool useDefaultFont = false) { - drawPanel(x, y, w, h, fill, C_BORDER, 12); - if (useDefaultFont) { - drawDefaultText(x + 14, y + 30, label.c_str(), C_TEXT, 2); - return; - } - drawU8Text(x + 14, y + 32, label, C_TEXT, font); -} - -static void drawScreen() { - gfx->fillScreen(C_BG); - - drawPanel(12, 12, 456, 456, C_PANEL, C_BORDER, 16); - drawDefaultText(28, 42, "TEXT TEST 123", C_TEXT, 2); - drawU8Text(28, 72, "Default ASCII above", C_MUTE, (const uint8_t *)FONT_SMALL); - - drawPanel(24, 90, 432, 72, C_CARD, C_BORDER, 12); - drawDefaultText(38, 118, "A: Default font ABC123", C_TEXT, 2); - drawDefaultText(38, 146, "Visible? then base path OK", C_WARN, 1); - - drawPanel(24, 174, 432, 84, C_CARD, C_BORDER, 12); - drawU8Text(38, 204, "B: U8g2 ASCII abc123", C_TEXT, (const uint8_t *)FONT_BODY); - drawU8Text(38, 230, "C: Русский текст 123", C_OK, (const uint8_t *)FONT_BODY); - - drawPanel(24, 270, 432, 84, C_CARD, C_BORDER, 12); - drawU8Text(38, 298, "D: Мелкий шрифт кнопок", C_TEXT, (const uint8_t *)FONT_SMALL); - drawU8Text(38, 320, "Если это видно, FONT_SMALL жив", C_MUTE, (const uint8_t *)FONT_SMALL); - - drawButton(24, 368, 128, 72, C_BUTTON, "BTN 1", nullptr, true); - drawButton(176, 368, 128, 72, C_OK, "abc123", (const uint8_t *)FONT_BODY); - drawButton(328, 368, 128, 72, C_BUTTON2, "Русский", (const uint8_t *)FONT_BODY); -} - -void setup() { - Serial.begin(115200); - Wire.begin(PIN_I2C_SDA, PIN_I2C_SCL); - gfx->begin(); - gBus->writeC8D8(0x36, 0xA0); - gfx->setBrightness(220); - gfx->setUTF8Print(true); - drawScreen(); -} - -void loop() { - delay(1000); -} diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/lvgl_basic_test/lvgl_basic_test.ino b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/lvgl_basic_test/lvgl_basic_test.ino deleted file mode 100644 index 42e3dd14..00000000 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/lvgl_basic_test/lvgl_basic_test.ino +++ /dev/null @@ -1,125 +0,0 @@ -#include -#include -#include -#include -#include "pin_config.h" - -#define EXAMPLE_LVGL_TICK_PERIOD_MS 2 - -static lv_disp_draw_buf_t gDrawBuf; -static lv_color_t *gBuf1 = nullptr; -static lv_color_t *gBuf2 = nullptr; - -Arduino_DataBus *gBus = new Arduino_ESP32QSPI( - LCD_CS, LCD_SCLK, LCD_SDIO0, LCD_SDIO1, LCD_SDIO2, LCD_SDIO3); -Arduino_CO5300 *gfx = new Arduino_CO5300( - gBus, LCD_RESET, 0, LCD_WIDTH, LCD_HEIGHT, 0, 0, 0, 0); - -static void lvglRounderCb(lv_disp_drv_t *dispDrv, lv_area_t *area) { - LV_UNUSED(dispDrv); - if (area->x1 % 2 != 0) area->x1--; - if (area->y1 % 2 != 0) area->y1--; - if (area->x2 % 2 == 0) area->x2++; - if (area->y2 % 2 == 0) area->y2++; -} - -static void lvglFlushCb(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *colorP) { - uint32_t w = area->x2 - area->x1 + 1; - uint32_t h = area->y2 - area->y1 + 1; -#if (LV_COLOR_16_SWAP != 0) - gfx->draw16bitBeRGBBitmap(area->x1, area->y1, (uint16_t *)&colorP->full, w, h); -#else - gfx->draw16bitRGBBitmap(area->x1, area->y1, (uint16_t *)&colorP->full, w, h); -#endif - lv_disp_flush_ready(disp); -} - -static void lvglTick(void *arg) { - LV_UNUSED(arg); - lv_tick_inc(EXAMPLE_LVGL_TICK_PERIOD_MS); -} - -static void createUi() { - lv_obj_set_style_bg_color(lv_scr_act(), lv_color_hex(0x0B1320), 0); - lv_obj_set_style_bg_opa(lv_scr_act(), LV_OPA_COVER, 0); - - lv_obj_t *title = lv_label_create(lv_scr_act()); - lv_label_set_text(title, "LVGL BASIC TEST"); - lv_obj_set_style_text_color(title, lv_color_hex(0xFFFFFF), 0); - lv_obj_set_style_text_font(title, &lv_font_montserrat_22, 0); - lv_obj_align(title, LV_ALIGN_TOP_MID, 0, 18); - - lv_obj_t *subtitle = lv_label_create(lv_scr_act()); - lv_label_set_text(subtitle, "If this text is visible, LVGL path works."); - lv_obj_set_width(subtitle, 420); - lv_label_set_long_mode(subtitle, LV_LABEL_LONG_WRAP); - lv_obj_set_style_text_color(subtitle, lv_color_hex(0xD5DCE5), 0); - lv_obj_set_style_text_font(subtitle, &lv_font_montserrat_16, 0); - lv_obj_align(subtitle, LV_ALIGN_TOP_MID, 0, 58); - - const char *labels[3] = {"Button One", "Second Button", "Bottom Action"}; - const lv_color_t colors[3] = { - lv_color_hex(0x2B4C7E), - lv_color_hex(0x2E8B57), - lv_color_hex(0xB45F06), - }; - const lv_coord_t ys[3] = {150, 236, 340}; - const lv_coord_t hs[3] = {58, 58, 64}; - - for (int i = 0; i < 3; i++) { - lv_obj_t *btn = lv_btn_create(lv_scr_act()); - lv_obj_set_size(btn, 360, hs[i]); - lv_obj_align(btn, LV_ALIGN_TOP_MID, 0, ys[i]); - lv_obj_set_style_radius(btn, 14, 0); - lv_obj_set_style_bg_color(btn, colors[i], 0); - lv_obj_set_style_border_width(btn, 2, 0); - lv_obj_set_style_border_color(btn, lv_color_hex(0x7F96B0), 0); - - lv_obj_t *label = lv_label_create(btn); - lv_label_set_text(label, labels[i]); - lv_obj_set_style_text_font(label, &lv_font_montserrat_20, 0); - lv_obj_set_style_text_color(label, lv_color_hex(0xFFFFFF), 0); - lv_obj_center(label); - } -} - -void setup() { - Serial.begin(115200); - Wire.begin(IIC_SDA, IIC_SCL); - - gfx->begin(); - gBus->writeC8D8(0x36, 0xA0); - gfx->setBrightness(220); - - lv_init(); - - uint32_t screenWidth = gfx->width(); - uint32_t screenHeight = gfx->height(); - gBuf1 = (lv_color_t *)heap_caps_malloc(screenWidth * screenHeight / 4 * sizeof(lv_color_t), MALLOC_CAP_DMA); - gBuf2 = (lv_color_t *)heap_caps_malloc(screenWidth * screenHeight / 4 * sizeof(lv_color_t), MALLOC_CAP_DMA); - lv_disp_draw_buf_init(&gDrawBuf, gBuf1, gBuf2, screenWidth * screenHeight / 4); - - static lv_disp_drv_t dispDrv; - lv_disp_drv_init(&dispDrv); - dispDrv.hor_res = screenWidth; - dispDrv.ver_res = screenHeight; - dispDrv.flush_cb = lvglFlushCb; - dispDrv.rounder_cb = lvglRounderCb; - dispDrv.draw_buf = &gDrawBuf; - lv_disp_drv_register(&dispDrv); - - const esp_timer_create_args_t lvglTickTimerArgs = { - .callback = &lvglTick, - .name = "lvgl_tick"}; - esp_timer_handle_t lvglTickTimer = nullptr; - esp_timer_create(&lvglTickTimerArgs, &lvglTickTimer); - esp_timer_start_periodic(lvglTickTimer, EXAMPLE_LVGL_TICK_PERIOD_MS * 1000); - - createUi(); - Serial.println("LVGL basic test ready"); -} - -void loop() { - lv_timer_handler(); - delay(5); -} diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/lvgl_interaction_test/lvgl_interaction_test.ino b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/lvgl_interaction_test/lvgl_interaction_test.ino deleted file mode 100644 index e4c458b4..00000000 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/lvgl_interaction_test/lvgl_interaction_test.ino +++ /dev/null @@ -1,214 +0,0 @@ -#include -#include -#include -#include -#include "pin_config.h" -#include "TouchDrvCSTXXX.hpp" - -#define EXAMPLE_LVGL_TICK_PERIOD_MS 2 - -static lv_disp_draw_buf_t gDrawBuf; -static lv_color_t *gBuf1 = nullptr; -static lv_color_t *gBuf2 = nullptr; -static lv_obj_t *gStatusLabel = nullptr; -static uint32_t gPressCount = 0; - -static TouchDrvCST92xx gTouch; -static int16_t gTouchX[5]; -static int16_t gTouchY[5]; - -Arduino_DataBus *gBus = new Arduino_ESP32QSPI( - LCD_CS, LCD_SCLK, LCD_SDIO0, LCD_SDIO1, LCD_SDIO2, LCD_SDIO3); -Arduino_CO5300 *gfx = new Arduino_CO5300( - gBus, LCD_RESET, 0, LCD_WIDTH, LCD_HEIGHT, 0, 0, 0, 0); - -static void lvglFlushCb(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *colorP) { - uint32_t w = area->x2 - area->x1 + 1; - uint32_t h = area->y2 - area->y1 + 1; -#if (LV_COLOR_16_SWAP != 0) - gfx->draw16bitBeRGBBitmap(area->x1, area->y1, (uint16_t *)&colorP->full, w, h); -#else - gfx->draw16bitRGBBitmap(area->x1, area->y1, (uint16_t *)&colorP->full, w, h); -#endif - lv_disp_flush_ready(disp); -} - -static void lvglTick(void *arg) { - LV_UNUSED(arg); - lv_tick_inc(EXAMPLE_LVGL_TICK_PERIOD_MS); -} - -static void lvglTouchRead(lv_indev_drv_t *indevDrv, lv_indev_data_t *data) { - LV_UNUSED(indevDrv); - uint8_t touched = gTouch.getPoint(gTouchX, gTouchY, gTouch.getSupportTouchPoint()); - if (touched > 0) { - data->state = LV_INDEV_STATE_PR; - data->point.x = gTouchX[0]; - data->point.y = gTouchY[0]; - return; - } - - data->state = LV_INDEV_STATE_REL; -} - -static void buttonEventCb(lv_event_t *event) { - if (lv_event_get_code(event) != LV_EVENT_CLICKED) { - return; - } - - lv_obj_t *btn = lv_event_get_target(event); - const char *name = (const char *)lv_event_get_user_data(event); - gPressCount++; - - lv_obj_set_style_outline_width(btn, 4, 0); - lv_obj_set_style_outline_color(btn, lv_color_hex(0xFFF3B0), 0); - lv_obj_set_style_outline_pad(btn, 2, 0); - - String status = "Pressed: "; - status += name; - status += " (#"; - status += String(gPressCount); - status += ")"; - lv_label_set_text(gStatusLabel, status.c_str()); - - Serial.println(status); -} - -static void createButton(lv_obj_t *parent, const char *labelText, lv_coord_t col, lv_coord_t row, uint32_t colorHex) { - static const lv_coord_t kStartX = 22; - static const lv_coord_t kStartY = 122; - static const lv_coord_t kButtonW = 134; - static const lv_coord_t kButtonH = 64; - static const lv_coord_t kGapX = 18; - static const lv_coord_t kGapY = 16; - - lv_obj_t *btn = lv_btn_create(parent); - lv_obj_set_size(btn, kButtonW, kButtonH); - lv_obj_set_pos(btn, kStartX + col * (kButtonW + kGapX), kStartY + row * (kButtonH + kGapY)); - lv_obj_set_style_radius(btn, 16, 0); - lv_obj_set_style_bg_color(btn, lv_color_hex(colorHex), 0); - lv_obj_set_style_border_width(btn, 2, 0); - lv_obj_set_style_border_color(btn, lv_color_hex(0x7F96B0), 0); - lv_obj_set_style_shadow_width(btn, 0, 0); - lv_obj_add_event_cb(btn, buttonEventCb, LV_EVENT_CLICKED, (void *)labelText); - - lv_obj_t *label = lv_label_create(btn); - lv_label_set_text(label, labelText); - lv_obj_set_style_text_font(label, &lv_font_montserrat_18, 0); - lv_obj_set_style_text_color(label, lv_color_hex(0xFFFFFF), 0); - lv_obj_center(label); -} - -static void createUi() { - lv_obj_t *screen = lv_scr_act(); - lv_obj_set_style_bg_color(screen, lv_color_hex(0x0B1320), 0); - lv_obj_set_style_bg_opa(screen, LV_OPA_COVER, 0); - - lv_obj_t *title = lv_label_create(screen); - lv_label_set_text(title, "LVGL INTERACTION TEST"); - lv_obj_set_style_text_color(title, lv_color_hex(0xFFFFFF), 0); - lv_obj_set_style_text_font(title, &lv_font_montserrat_22, 0); - lv_obj_align(title, LV_ALIGN_TOP_MID, 0, 14); - - lv_obj_t *subtitle = lv_label_create(screen); - lv_label_set_text(subtitle, "Tap buttons. Bottom label must change on every press."); - lv_obj_set_width(subtitle, 420); - lv_label_set_long_mode(subtitle, LV_LABEL_LONG_WRAP); - lv_obj_set_style_text_color(subtitle, lv_color_hex(0xD5DCE5), 0); - lv_obj_set_style_text_font(subtitle, &lv_font_montserrat_14, 0); - lv_obj_align(subtitle, LV_ALIGN_TOP_MID, 0, 48); - - createButton(screen, "Status", 0, 0, 0x355C7D); - createButton(screen, "Connect", 1, 0, 0x2A9D8F); - createButton(screen, "Wallet", 2, 0, 0x457B9D); - createButton(screen, "Requests", 0, 1, 0xE76F51); - createButton(screen, "Settings", 1, 1, 0x8D5A97); - createButton(screen, "Register", 2, 1, 0x6A994E); - createButton(screen, "Approve", 0, 2, 0xBC6C25); - createButton(screen, "Reject", 1, 2, 0xB56576); - createButton(screen, "Back", 2, 2, 0x6C757D); - - lv_obj_t *statusPanel = lv_obj_create(screen); - lv_obj_set_size(statusPanel, 436, 56); - lv_obj_align(statusPanel, LV_ALIGN_BOTTOM_MID, 0, -16); - lv_obj_set_style_radius(statusPanel, 14, 0); - lv_obj_set_style_bg_color(statusPanel, lv_color_hex(0x162033), 0); - lv_obj_set_style_border_width(statusPanel, 2, 0); - lv_obj_set_style_border_color(statusPanel, lv_color_hex(0x415A77), 0); - lv_obj_set_style_pad_all(statusPanel, 10, 0); - - gStatusLabel = lv_label_create(statusPanel); - lv_label_set_text(gStatusLabel, "Pressed: none"); - lv_obj_set_style_text_font(gStatusLabel, &lv_font_montserrat_18, 0); - lv_obj_set_style_text_color(gStatusLabel, lv_color_hex(0xFFFFFF), 0); - lv_obj_center(gStatusLabel); -} - -void setup() { - Serial.begin(115200); - Wire.begin(IIC_SDA, IIC_SCL); - - pinMode(TP_RST, OUTPUT); - pinMode(TP_INT, INPUT); - digitalWrite(TP_RST, LOW); - delay(30); - digitalWrite(TP_RST, HIGH); - delay(50); - delay(1000); - - gTouch.setPins(TP_RST, TP_INT); - bool touchOk = gTouch.begin(Wire, 0x5A, IIC_SDA, IIC_SCL); - if (!touchOk) { - Serial.println("Touch init failed"); - } else { - Serial.print("Touch model: "); - Serial.println(gTouch.getModelName()); - gTouch.sleep(); - gTouch.reset(); - gTouch.setMaxCoordinates(480, 480); - gTouch.setSwapXY(true); - gTouch.setMirrorXY(true, false); - } - - gfx->begin(); - gBus->writeC8D8(0x36, 0xA0); - gfx->setBrightness(220); - gfx->fillScreen(0x0000); - - lv_init(); - - uint32_t screenWidth = gfx->width(); - uint32_t screenHeight = gfx->height(); - gBuf1 = (lv_color_t *)heap_caps_malloc(screenWidth * screenHeight / 4 * sizeof(lv_color_t), MALLOC_CAP_DMA); - gBuf2 = (lv_color_t *)heap_caps_malloc(screenWidth * screenHeight / 4 * sizeof(lv_color_t), MALLOC_CAP_DMA); - lv_disp_draw_buf_init(&gDrawBuf, gBuf1, gBuf2, screenWidth * screenHeight / 4); - - static lv_disp_drv_t dispDrv; - lv_disp_drv_init(&dispDrv); - dispDrv.hor_res = screenWidth; - dispDrv.ver_res = screenHeight; - dispDrv.flush_cb = lvglFlushCb; - dispDrv.draw_buf = &gDrawBuf; - lv_disp_drv_register(&dispDrv); - - static lv_indev_drv_t indevDrv; - lv_indev_drv_init(&indevDrv); - indevDrv.type = LV_INDEV_TYPE_POINTER; - indevDrv.read_cb = lvglTouchRead; - lv_indev_drv_register(&indevDrv); - - const esp_timer_create_args_t lvglTickTimerArgs = { - .callback = &lvglTick, - .name = "lvgl_tick"}; - esp_timer_handle_t lvglTickTimer = nullptr; - esp_timer_create(&lvglTickTimerArgs, &lvglTickTimer); - esp_timer_start_periodic(lvglTickTimer, EXAMPLE_LVGL_TICK_PERIOD_MS * 1000); - - createUi(); - Serial.println("LVGL interaction test ready"); -} - -void loop() { - lv_timer_handler(); - delay(5); -} diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/lvgl_official_based_test/lvgl_official_based_test.ino b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/lvgl_official_based_test/lvgl_official_based_test.ino deleted file mode 100644 index 3d7a3d1b..00000000 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/lvgl_official_based_test/lvgl_official_based_test.ino +++ /dev/null @@ -1,252 +0,0 @@ -#include -#include "Arduino_GFX_Library.h" -#include "pin_config.h" -#include "TouchDrvCSTXXX.hpp" -#include "lv_conf.h" -#include "HWCDC.h" -#include - -HWCDC USBSerial; - -#define EXAMPLE_LVGL_TICK_PERIOD_MS 2 - -static lv_disp_draw_buf_t draw_buf; -static lv_color_t *buf1 = nullptr; -static lv_color_t *buf2 = nullptr; -static lv_obj_t *status_label = nullptr; -static uint32_t click_count = 0; - -Arduino_DataBus *bus = new Arduino_ESP32QSPI( - LCD_CS, LCD_SCLK, LCD_SDIO0, LCD_SDIO1, LCD_SDIO2, LCD_SDIO3); - -Arduino_CO5300 *gfx = new Arduino_CO5300( - bus, LCD_RESET, 0, LCD_WIDTH, LCD_HEIGHT, 0, 0, 0, 0); - -TouchDrvCST92xx touch; -int16_t touch_x[5], touch_y[5]; -bool isPressed = false; -uint32_t screenWidth = 0; -uint32_t screenHeight = 0; - -#if LV_USE_LOG != 0 -void my_print(const char *buf) { - USBSerial.printf(buf); - USBSerial.flush(); -} -#endif - -static void example_lvgl_rounder_cb(struct _lv_disp_drv_t *disp_drv, lv_area_t *area) { - LV_UNUSED(disp_drv); - if (area->x1 % 2 != 0) area->x1--; - if (area->y1 % 2 != 0) area->y1--; - if (area->x2 % 2 == 0) area->x2++; - if (area->y2 % 2 == 0) area->y2++; -} - -static void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p) { - uint32_t w = (area->x2 - area->x1 + 1); - uint32_t h = (area->y2 - area->y1 + 1); - -#if (LV_COLOR_16_SWAP != 0) - gfx->draw16bitBeRGBBitmap(area->x1, area->y1, (uint16_t *)&color_p->full, w, h); -#else - gfx->draw16bitRGBBitmap(area->x1, area->y1, (uint16_t *)&color_p->full, w, h); -#endif - - lv_disp_flush_ready(disp); -} - -static void example_increase_lvgl_tick(void *arg) { - LV_UNUSED(arg); - lv_tick_inc(EXAMPLE_LVGL_TICK_PERIOD_MS); -} - -static void my_touchpad_read(lv_indev_drv_t *indev_driver, lv_indev_data_t *data) { - LV_UNUSED(indev_driver); - if (isPressed) { - uint8_t touched = touch.getPoint(touch_x, touch_y, touch.getSupportTouchPoint()); - if (touched) { - isPressed = false; - data->state = LV_INDEV_STATE_PR; - data->point.x = touch_x[0]; - data->point.y = touch_y[0]; - USBSerial.print("Touch x="); - USBSerial.print(touch_x[0]); - USBSerial.print(" y="); - USBSerial.println(touch_y[0]); - } else { - data->state = LV_INDEV_STATE_REL; - } - } else { - data->state = LV_INDEV_STATE_REL; - } -} - -static void button_event_cb(lv_event_t *event) { - if (lv_event_get_code(event) != LV_EVENT_CLICKED) { - return; - } - - const char *name = (const char *)lv_event_get_user_data(event); - click_count++; - String text = "Pressed: "; - text += name; - text += " (#"; - text += String(click_count); - text += ")"; - lv_label_set_text(status_label, text.c_str()); - USBSerial.println(text); -} - -static lv_obj_t *make_button(lv_obj_t *parent, const char *label_text, lv_coord_t x, lv_coord_t y, lv_coord_t w, lv_coord_t h, lv_color_t bg) { - lv_obj_t *btn = lv_btn_create(parent); - lv_obj_set_size(btn, w, h); - lv_obj_set_pos(btn, x, y); - lv_obj_set_style_radius(btn, 16, 0); - lv_obj_set_style_bg_color(btn, bg, 0); - lv_obj_set_style_border_width(btn, 2, 0); - lv_obj_set_style_border_color(btn, lv_color_hex(0x8AA4BF), 0); - lv_obj_set_style_shadow_width(btn, 0, 0); - lv_obj_add_event_cb(btn, button_event_cb, LV_EVENT_CLICKED, (void *)label_text); - - lv_obj_t *label = lv_label_create(btn); - lv_label_set_text(label, label_text); - lv_obj_set_style_text_font(label, &lv_font_montserrat_18, 0); - lv_obj_set_style_text_color(label, lv_color_hex(0xFFFFFF), 0); - lv_obj_center(label); - return btn; -} - -static void create_ui() { - lv_obj_t *screen = lv_scr_act(); - lv_obj_set_style_bg_color(screen, lv_color_hex(0x0B1320), 0); - lv_obj_set_style_bg_opa(screen, LV_OPA_COVER, 0); - - lv_obj_t *title = lv_label_create(screen); - lv_label_set_text(title, "LVGL OFFICIAL BASED TEST"); - lv_obj_set_style_text_font(title, &lv_font_montserrat_20, 0); - lv_obj_set_style_text_color(title, lv_color_hex(0xFFFFFF), 0); - lv_obj_align(title, LV_ALIGN_TOP_MID, 0, 14); - - lv_obj_t *hint = lv_label_create(screen); - lv_label_set_text(hint, "Based on official LVGL_Widgets init. Tap buttons and watch the status."); - lv_obj_set_width(hint, 430); - lv_label_set_long_mode(hint, LV_LABEL_LONG_WRAP); - lv_obj_set_style_text_font(hint, &lv_font_montserrat_14, 0); - lv_obj_set_style_text_color(hint, lv_color_hex(0xD4DDE7), 0); - lv_obj_align(hint, LV_ALIGN_TOP_MID, 0, 44); - - make_button(screen, "Status", 22, 120, 136, 60, lv_color_hex(0x355C7D)); - make_button(screen, "Connect", 174, 120, 136, 60, lv_color_hex(0x2A9D8F)); - make_button(screen, "Wallet", 326, 120, 132, 60, lv_color_hex(0x457B9D)); - - make_button(screen, "Requests", 22, 196, 136, 60, lv_color_hex(0xE76F51)); - make_button(screen, "Settings",174, 196, 136, 60, lv_color_hex(0x8D5A97)); - make_button(screen, "Register",326, 196, 132, 60, lv_color_hex(0x6A994E)); - - make_button(screen, "Approve", 22, 272, 136, 60, lv_color_hex(0xBC6C25)); - make_button(screen, "Reject", 174, 272, 136, 60, lv_color_hex(0xB56576)); - make_button(screen, "Back", 326, 272, 132, 60, lv_color_hex(0x6C757D)); - - lv_obj_t *bottom_btn = make_button(screen, "Bottom Action", 22, 350, 436, 64, lv_color_hex(0x1D6F42)); - lv_obj_set_style_text_font(lv_obj_get_child(bottom_btn, 0), &lv_font_montserrat_20, 0); - - lv_obj_t *status_panel = lv_obj_create(screen); - lv_obj_set_size(status_panel, 436, 42); - lv_obj_set_pos(status_panel, 22, 426); - lv_obj_set_style_radius(status_panel, 12, 0); - lv_obj_set_style_bg_color(status_panel, lv_color_hex(0x17263A), 0); - lv_obj_set_style_border_width(status_panel, 2, 0); - lv_obj_set_style_border_color(status_panel, lv_color_hex(0x496582), 0); - lv_obj_set_style_pad_all(status_panel, 6, 0); - - status_label = lv_label_create(status_panel); - lv_label_set_text(status_label, "Pressed: none"); - lv_obj_set_style_text_font(status_label, &lv_font_montserrat_16, 0); - lv_obj_set_style_text_color(status_label, lv_color_hex(0xFFFFFF), 0); - lv_obj_center(status_label); -} - -void setup() { - USBSerial.begin(115200); - - Wire.begin(IIC_SDA, IIC_SCL); - - digitalWrite(TP_RST, LOW); - delay(30); - digitalWrite(TP_RST, HIGH); - delay(50); - delay(1000); - - Wire.begin(IIC_SDA, IIC_SCL); - - touch.setPins(TP_RST, TP_INT); - bool result = touch.begin(Wire, 0x5A, IIC_SDA, IIC_SCL); - if (result == false) { - USBSerial.println("touch is not online..."); - while (1) delay(1000); - } - USBSerial.print("Touch model: "); - USBSerial.println(touch.getModelName()); - touch.sleep(); - touch.reset(); - touch.setMaxCoordinates(480, 480); - touch.setSwapXY(true); - touch.setMirrorXY(true, false); - attachInterrupt( - TP_INT, []() { - isPressed = true; - }, - FALLING); - - gfx->begin(); - gfx->setBrightness(200); - bus->writeC8D8(0x36, 0xA0); - - screenWidth = gfx->width(); - screenHeight = gfx->height(); - - lv_init(); - - buf1 = (lv_color_t *)heap_caps_malloc(screenWidth * screenHeight / 4 * sizeof(lv_color_t), MALLOC_CAP_DMA); - buf2 = (lv_color_t *)heap_caps_malloc(screenWidth * screenHeight / 4 * sizeof(lv_color_t), MALLOC_CAP_DMA); - -#if LV_USE_LOG != 0 - lv_log_register_print_cb(my_print); -#endif - - lv_disp_draw_buf_init(&draw_buf, buf1, buf2, screenWidth * screenHeight / 4); - - static lv_disp_drv_t disp_drv; - lv_disp_drv_init(&disp_drv); - disp_drv.hor_res = screenWidth; - disp_drv.ver_res = screenHeight; - disp_drv.flush_cb = my_disp_flush; - disp_drv.rounder_cb = example_lvgl_rounder_cb; - disp_drv.draw_buf = &draw_buf; - disp_drv.sw_rotate = 1; - lv_disp_drv_register(&disp_drv); - - static lv_indev_drv_t indev_drv; - lv_indev_drv_init(&indev_drv); - indev_drv.type = LV_INDEV_TYPE_POINTER; - indev_drv.read_cb = my_touchpad_read; - lv_indev_drv_register(&indev_drv); - - const esp_timer_create_args_t lvgl_tick_timer_args = { - .callback = &example_increase_lvgl_tick, - .name = "lvgl_tick" - }; - - esp_timer_handle_t lvgl_tick_timer = NULL; - esp_timer_create(&lvgl_tick_timer_args, &lvgl_tick_timer); - esp_timer_start_periodic(lvgl_tick_timer, EXAMPLE_LVGL_TICK_PERIOD_MS * 1000); - - create_ui(); - USBSerial.println("LVGL official based test ready"); -} - -void loop() { - lv_timer_handler(); - delay(5); -} diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/lvgl_russian_font_test/lv_font_ru.h b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/lvgl_russian_font_test/lv_font_ru.h deleted file mode 100644 index eecaca80..00000000 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/lvgl_russian_font_test/lv_font_ru.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once -#include -LV_FONT_DECLARE(lv_font_ru_18); -LV_FONT_DECLARE(lv_font_ru_24); diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/lvgl_russian_font_test/lv_font_ru_18.c b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/lvgl_russian_font_test/lv_font_ru_18.c deleted file mode 100644 index 4557e60b..00000000 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/lvgl_russian_font_test/lv_font_ru_18.c +++ /dev/null @@ -1,1553 +0,0 @@ -/******************************************************************************* - * Size: 18 px - * Bpp: 4 - * Opts: --size 18 --bpp 4 --format lvgl --font /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf -r 0x20-0x7E -r 0x0401 -r 0x0410-0x044F -r 0x0451 --lv-include lvgl.h --lv-font-name lv_font_ru_18 -o lv_font_ru_18.c - ******************************************************************************/ - -#ifdef LV_LVGL_H_INCLUDE_SIMPLE -#include "lvgl.h" -#else -#include "lvgl.h" -#endif - -#ifndef LV_FONT_RU_18 -#define LV_FONT_RU_18 1 -#endif - -#if LV_FONT_RU_18 - -/*----------------- - * BITMAPS - *----------------*/ - -/*Store the image of the glyphs*/ -static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { - /* U+0020 " " */ - - /* U+0021 "!" */ - 0x4f, 0x80, 0xf, 0xfe, 0x17, 0xb8, 0x0, 0x40, - 0x4c, 0x88, 0x3a, 0x80, 0x62, 0x99, 0x20, 0x10, - - /* U+0022 "\"" */ - 0x4f, 0x30, 0xf8, 0x0, 0xff, 0xe3, 0x39, 0x8, - 0x1f, 0x80, - - /* U+0023 "#" */ - 0x0, 0xea, 0xc0, 0x5, 0x58, 0x7, 0xc8, 0x80, - 0x2, 0x18, 0x7, 0x84, 0x58, 0x4, 0x38, 0x1, - 0x84, 0x4e, 0xc, 0x28, 0xc, 0x20, 0x9, 0xee, - 0x48, 0x6f, 0x48, 0x6f, 0x58, 0x5d, 0xc2, 0xb7, - 0x61, 0x5b, 0xb4, 0x81, 0x22, 0x8f, 0x23, 0xf, - 0x22, 0x8, 0x4, 0x4e, 0xa, 0x28, 0xa, 0x20, - 0x9, 0xee, 0x48, 0x77, 0x24, 0x3b, 0x96, 0x17, - 0x70, 0x35, 0xd8, 0x1a, 0xed, 0x20, 0x48, 0xc1, - 0xa8, 0xc1, 0x48, 0x82, 0x0, 0x90, 0x10, 0x10, - 0xc, 0x3, 0xd8, 0x60, 0xc, 0x30, 0xe, - - /* U+0024 "$" */ - 0x0, 0xd8, 0x20, 0x1f, 0xfc, 0xa3, 0xbe, 0x3e, - 0xe5, 0x88, 0xb1, 0xac, 0xae, 0x0, 0xdc, 0x39, - 0x45, 0x5a, 0xc8, 0x0, 0xe0, 0x1e, 0x71, 0xb9, - 0x25, 0x0, 0x87, 0xd9, 0x6, 0xfa, 0x0, 0x3, - 0x3a, 0x74, 0x8f, 0x0, 0x1c, 0x94, 0x6a, 0x20, - 0x1e, 0x10, 0x9c, 0x74, 0x17, 0xb2, 0xaa, 0x25, - 0x50, 0xa5, 0xe5, 0xca, 0x37, 0x8b, 0xb1, 0x80, - 0x38, 0x40, 0x3f, 0x50, 0x80, 0x40, - - /* U+0025 "%" */ - 0x9, 0xee, 0x50, 0x80, 0x65, 0xf1, 0x0, 0xa5, - 0xf7, 0x49, 0x60, 0x10, 0xdc, 0x88, 0x4, 0xf2, - 0x66, 0x85, 0x0, 0xac, 0x98, 0x3, 0xff, 0x80, - 0x8b, 0xc0, 0x1c, 0x94, 0x22, 0xa4, 0x0, 0x4b, - 0x90, 0x7, 0x5b, 0x77, 0x2, 0x42, 0x2, 0x0, - 0x3c, 0x37, 0xfd, 0x84, 0x47, 0x90, 0x7d, 0xd4, - 0x0, 0x70, 0x80, 0x39, 0x51, 0xa2, 0x12, 0xd0, - 0x1, 0xe6, 0x2b, 0xa, 0x65, 0x49, 0x70, 0xe, - 0x19, 0xb1, 0x2, 0xe0, 0x1, 0x0, 0x80, 0x6b, - 0x45, 0x0, 0x1f, 0x0, 0x8, 0x4, 0x2, 0x45, - 0x90, 0xa, 0x99, 0xe, 0x58, 0x3, 0x54, 0x10, - 0x4, 0xee, 0xad, 0x79, 0x0, - - /* U+0026 "&" */ - 0x0, 0x15, 0x77, 0xec, 0x80, 0x7d, 0xea, 0xd2, - 0x8e, 0x40, 0x1c, 0x85, 0x10, 0x69, 0xe2, 0x0, - 0xff, 0xe3, 0x21, 0x49, 0x0, 0x7f, 0x10, 0xe, - 0x10, 0x7, 0xc3, 0x8d, 0xc7, 0x84, 0x1, 0x6e, - 0x4, 0x8d, 0xe, 0x1e, 0x18, 0x0, 0x90, 0x10, - 0x84, 0x7, 0xf, 0x4d, 0xc2, 0x80, 0x4, 0x1, - 0xe, 0x1e, 0x4b, 0x10, 0x20, 0x48, 0x4, 0x32, - 0x3, 0xa0, 0x8, 0x36, 0xc7, 0x75, 0x59, 0xd, - 0x10, 0x3, 0x20, 0x62, 0xd, 0x3b, 0xa1, 0xc2, - - /* U+0027 "'" */ - 0x4f, 0x30, 0xf, 0xe7, 0x21, - - /* U+0028 "(" */ - 0x0, 0x17, 0xa8, 0x2, 0xd, 0x40, 0x96, 0x40, - 0x16, 0xa, 0x0, 0x74, 0x0, 0x10, 0x98, 0x1, - 0xc3, 0x40, 0x6, 0x2, 0x1, 0xf1, 0x80, 0x80, - 0x1c, 0x34, 0x0, 0x42, 0x60, 0x13, 0xa0, 0x5, - 0x60, 0xa0, 0x2, 0x59, 0x0, 0xa0, 0xd4, - - /* U+0029 ")" */ - 0x4f, 0x20, 0x2, 0x1c, 0x80, 0x52, 0x84, 0x0, - 0x50, 0xb0, 0x9, 0x1c, 0x2, 0xc1, 0x20, 0x1, - 0x3, 0x80, 0x4, 0xc, 0x3, 0xe1, 0x3, 0x0, - 0x10, 0x38, 0x3, 0x4, 0x80, 0x8, 0xe0, 0x5, - 0xb, 0x0, 0x4a, 0x10, 0x21, 0xc8, 0x0, - - /* U+002A "*" */ - 0x0, 0xde, 0x1, 0xc6, 0x1, 0xc6, 0x7, 0xd2, - 0x20, 0x33, 0xc6, 0x6d, 0xec, 0xc, 0xed, 0x30, - 0x1, 0x88, 0x9, 0x80, 0xb, 0x23, 0x83, 0xa3, - 0x8, 0xe7, 0x8, 0xb, 0x24, 0xc5, 0x40, 0x39, - 0x44, 0x3, 0x68, 0x6, - - /* U+002B "+" */ - 0x0, 0xf1, 0x80, 0x7f, 0xc7, 0x88, 0x1, 0xff, - 0xe1, 0x22, 0xcc, 0x4, 0x5c, 0x3, 0xbb, 0xa8, - 0x27, 0x77, 0x10, 0xd5, 0x68, 0x7, 0xaa, 0xc4, - 0xa, 0xb9, 0x3, 0x15, 0x70, 0x7, 0xff, 0x70, - - /* U+002C "," */ - 0x4, 0x40, 0x55, 0x80, 0x99, 0x82, 0x10, 0xd0, - - /* U+002D "-" */ - 0x2, 0x2c, 0x25, 0xbb, 0xa0, 0xaa, 0xb8, - - /* U+002E "." */ - 0x3, 0x21, 0xce, 0x0, 0x80, - - /* U+002F "/" */ - 0x0, 0xd3, 0xc0, 0x1c, 0xee, 0x0, 0xc6, 0x3a, - 0x1, 0xac, 0x10, 0x3, 0x2a, 0x80, 0x31, 0x13, - 0xc0, 0x32, 0x82, 0x80, 0x6b, 0x40, 0xc, 0x27, - 0xa0, 0x19, 0xc1, 0xc0, 0x36, 0x98, 0x80, 0x42, - 0x96, 0x1, 0x90, 0x14, 0x3, 0x79, 0x10, 0x3, - 0x6c, 0x80, 0x70, - - /* U+0030 "0" */ - 0x0, 0x36, 0xff, 0x48, 0x80, 0x4f, 0x23, 0x2c, - 0xcc, 0x0, 0xc, 0x1e, 0x34, 0x51, 0x40, 0x30, - 0x48, 0x4, 0xa2, 0xc1, 0xa0, 0x80, 0x19, 0x4, - 0x4c, 0x2, 0x1, 0x88, 0x8, 0x3, 0xff, 0x90, - 0xc0, 0x20, 0x18, 0x80, 0xb4, 0x10, 0x3, 0x20, - 0x89, 0x82, 0x40, 0x25, 0x16, 0x1, 0x83, 0xc6, - 0x8a, 0x29, 0x0, 0x3c, 0x8c, 0xb3, 0x30, 0x40, - - /* U+0031 "1" */ - 0x7, 0xae, 0xfe, 0x0, 0xd0, 0x8a, 0x1, 0xed, - 0xeb, 0x20, 0xe, 0x20, 0xf, 0xff, 0xda, 0xbb, - 0x8c, 0x5d, 0xcc, 0x13, 0x10, 0x10, 0x88, 0x50, - - /* U+0032 "2" */ - 0x27, 0xce, 0xfc, 0x70, 0x5, 0xc0, 0x33, 0x84, - 0x60, 0x6f, 0x64, 0x43, 0x14, 0xd9, 0x4, 0x3, - 0x70, 0x70, 0x7, 0x84, 0x3c, 0x3, 0xd0, 0xc, - 0x1, 0xd4, 0x52, 0x20, 0x1a, 0x56, 0x18, 0x3, - 0x4b, 0x43, 0x80, 0x6a, 0x68, 0x70, 0xd, 0x4b, - 0xe, 0x1, 0xa1, 0x48, 0x1d, 0xf2, 0x98, 0x14, - 0x47, 0x78, - - /* U+0033 "3" */ - 0x19, 0xde, 0xfd, 0x92, 0x0, 0x12, 0x3b, 0x3b, - 0x9b, 0x48, 0xf, 0x6a, 0x21, 0x54, 0xb, 0x0, - 0xf9, 0xc0, 0xc0, 0x31, 0x11, 0x38, 0x3c, 0x2, - 0x5d, 0xd5, 0x94, 0x28, 0x4, 0x95, 0x47, 0x30, - 0xe, 0x15, 0x54, 0x74, 0x40, 0x3, 0xe3, 0x26, - 0x0, 0xfe, 0x10, 0x20, 0xe, 0x52, 0x30, 0x8e, - 0xa8, 0x86, 0x50, 0x78, 0x72, 0x3b, 0xc2, 0xda, - 0x60, - - /* U+0034 "4" */ - 0x0, 0xe1, 0xef, 0x90, 0xf, 0xa0, 0x40, 0x3f, - 0x1b, 0x40, 0x7, 0xee, 0x54, 0x0, 0xfa, 0xe, - 0xc0, 0x3e, 0x27, 0x81, 0x0, 0xfb, 0x8d, 0x80, - 0x3e, 0x63, 0xe0, 0xf, 0xd2, 0xa0, 0x44, 0x60, - 0x1, 0x1, 0x2, 0xee, 0xd4, 0xd, 0xae, 0x55, - 0x5d, 0x0, 0x94, 0xa0, 0xab, 0xc8, 0x4, 0xa4, - 0x1, 0xff, 0x0, - - /* U+0035 "5" */ - 0x1f, 0xff, 0x70, 0x4, 0x71, 0x1a, 0x40, 0x25, - 0x77, 0xe0, 0xc, 0x22, 0x0, 0xf3, 0x77, 0x3e, - 0x84, 0x4, 0xde, 0xa1, 0x17, 0x4, 0x32, 0x15, - 0xed, 0x8a, 0x40, 0x3d, 0x20, 0x80, 0x1f, 0x8, - 0x80, 0x3c, 0x23, 0x10, 0x7, 0x58, 0x5d, 0xba, - 0xa2, 0x75, 0x4d, 0xf5, 0x51, 0xd8, 0x63, 0x0, - - /* U+0036 "6" */ - 0x0, 0xc, 0x6f, 0xf5, 0xa0, 0x0, 0x71, 0xd9, - 0xd8, 0x8, 0x1, 0xa7, 0x97, 0x10, 0xb6, 0x3, - 0x34, 0x98, 0x7, 0xac, 0xe, 0xff, 0xda, 0xc0, - 0x2, 0xa, 0x7a, 0x90, 0x97, 0x1, 0x3, 0xc5, - 0x6d, 0x18, 0x0, 0xa8, 0x3, 0x38, 0x19, 0x0, - 0x80, 0x61, 0x7, 0xc0, 0x10, 0xc, 0x20, 0xe8, - 0x12, 0x1, 0xb, 0x9, 0x8c, 0x8e, 0xbc, 0x78, - 0x58, 0x1, 0xac, 0x61, 0xd6, 0xd4, 0x0, - - /* U+0037 "7" */ - 0x8f, 0xff, 0xba, 0xe2, 0x39, 0x41, 0xd, 0xdf, - 0x8c, 0x24, 0x3, 0xcc, 0x46, 0x1, 0xcc, 0x14, - 0x1, 0xea, 0x6, 0x0, 0xe2, 0x35, 0x10, 0xe, - 0xb0, 0xe0, 0xf, 0x38, 0xa0, 0x7, 0x28, 0xb0, - 0x7, 0xb8, 0x28, 0x3, 0x89, 0x10, 0x40, 0x1d, - 0x41, 0xc0, 0x18, - - /* U+0038 "8" */ - 0x1, 0x8d, 0xfe, 0xb5, 0x0, 0xb1, 0xd2, 0x64, - 0xd4, 0xe0, 0xa5, 0x12, 0xcf, 0x81, 0x40, 0x60, - 0x20, 0x10, 0x88, 0x0, 0x81, 0xa, 0x47, 0x43, - 0x0, 0x54, 0x15, 0xb8, 0x98, 0xa0, 0x1, 0x57, - 0xa9, 0x3c, 0x40, 0x3b, 0xd8, 0x56, 0xd1, 0xa0, - 0x90, 0x70, 0xc, 0xe2, 0x4c, 0x1, 0xe3, 0x0, - 0x28, 0x30, 0x4, 0x28, 0x5, 0x61, 0x14, 0xd1, - 0xe3, 0x20, 0x5c, 0xcf, 0x2e, 0x54, 0xc0, - - /* U+0039 "9" */ - 0x1, 0x9e, 0xfe, 0x80, 0x8, 0x7d, 0x9e, 0x5d, - 0xd8, 0x0, 0x91, 0x99, 0x34, 0xc8, 0xd8, 0x10, - 0x18, 0x2, 0x60, 0xa0, 0x10, 0xf, 0x8c, 0x1c, - 0xc, 0x2, 0x30, 0x1, 0x48, 0x72, 0x92, 0x70, - 0x4, 0x74, 0x75, 0xb6, 0xea, 0x6, 0xb, 0xd9, - 0x7d, 0x4e, 0x2, 0x1, 0x1a, 0x9, 0x11, 0x40, - 0x3e, 0xe0, 0x90, 0x7, 0x54, 0x4f, 0x1c, 0x98, - 0x1, 0xdf, 0x2d, 0xb0, 0x0, - - /* U+003A ":" */ - 0x33, 0x6e, 0x0, 0x3b, 0xc0, 0x3c, 0x66, 0xdc, - 0x0, 0x0, - - /* U+003B ";" */ - 0x3, 0x30, 0x6e, 0x0, 0x6e, 0xf0, 0xf, 0xf2, - 0x20, 0x2a, 0xc0, 0x4c, 0xc1, 0x8, 0x68, - - /* U+003C "<" */ - 0x0, 0xff, 0x88, 0x3, 0xf8, 0x5b, 0x34, 0x80, - 0x3c, 0xb7, 0xd2, 0x10, 0x40, 0x12, 0x4f, 0xd3, - 0x3e, 0xe3, 0x80, 0x23, 0xad, 0xdb, 0x36, 0x8, - 0x2, 0x17, 0x14, 0xf9, 0x30, 0xf, 0xd, 0x22, - 0x3b, 0x18, 0x40, 0x3c, 0xb7, 0xd2, 0x13, 0xd6, - 0xa0, 0x1e, 0x16, 0xcd, 0x76, 0xaf, 0xa1, 0x0, - 0xf1, 0x46, 0xe3, 0x21, 0x80, 0x7f, 0x1c, 0xf1, - 0x0, - - /* U+003D "=" */ - 0x2, 0x2f, 0xf8, 0x7, 0x77, 0xfe, 0x21, 0xaa, - 0xff, 0x88, 0x15, 0x7f, 0xe0, 0x1, 0x17, 0xfc, - 0x3, 0xbb, 0xff, 0x10, 0xd5, 0x7f, 0xc4, - - /* U+003E ">" */ - 0x2, 0x0, 0xff, 0x87, 0x71, 0xc4, 0x3, 0xf0, - 0xc8, 0x47, 0x5a, 0x80, 0x7c, 0xd9, 0xb0, 0xd5, - 0xf4, 0x80, 0x1e, 0x27, 0xdd, 0x3a, 0x5f, 0x48, - 0x7, 0xc5, 0x1e, 0xa2, 0xc4, 0x1, 0xe6, 0xbe, - 0x54, 0xa2, 0x0, 0x96, 0xbe, 0x5a, 0x3a, 0xd4, - 0x1, 0x3f, 0x48, 0xfb, 0xa7, 0x10, 0x8, 0x59, - 0x97, 0xd0, 0x40, 0x1e, 0x1f, 0x94, 0x0, 0xfe, - - /* U+003F "?" */ - 0x29, 0xdf, 0xe9, 0x10, 0x97, 0x58, 0x46, 0xd0, - 0xfe, 0x87, 0xa5, 0x33, 0x20, 0x6, 0x30, 0xf, - 0x1b, 0x19, 0x80, 0x23, 0xc2, 0xd0, 0x8, 0x70, - 0xb0, 0x40, 0x27, 0x9, 0x10, 0xd, 0xc0, 0xc0, - 0x1d, 0x8e, 0x60, 0x1c, 0xb6, 0x20, 0x1d, 0x18, - 0x60, 0x1f, 0xf0, - - /* U+0040 "@" */ - 0x0, 0xff, 0xe4, 0x14, 0x6f, 0xfb, 0xad, 0x40, - 0x3e, 0x9d, 0x3a, 0xbc, 0xb2, 0xbd, 0x20, 0xd, - 0x6f, 0x76, 0x74, 0x35, 0x9f, 0x7c, 0x30, 0x4, - 0xaf, 0xa0, 0x7, 0x86, 0x9f, 0x80, 0x9a, 0x84, - 0x13, 0x7f, 0xa2, 0x18, 0x12, 0x6a, 0xa2, 0x40, - 0x1b, 0x1b, 0xa3, 0x70, 0x9, 0x3f, 0x14, 0x1, - 0x23, 0x88, 0x8b, 0x10, 0x8, 0x85, 0xfc, 0x0, - 0x4a, 0x1, 0x90, 0x2, 0x21, 0x7f, 0x0, 0x13, - 0x0, 0x67, 0x0, 0xa, 0xf9, 0x98, 0x1, 0x65, - 0x22, 0x28, 0x20, 0x4c, 0x45, 0xb4, 0x20, 0x39, - 0x6e, 0xe1, 0xb1, 0xd2, 0xd8, 0x1a, 0x70, 0x1, - 0xbf, 0x7a, 0xe3, 0x7a, 0x0, 0x2a, 0x2b, 0x10, - 0x1, 0x8, 0x9, 0xa0, 0x6, 0x1c, 0x7f, 0x83, - 0x11, 0x1c, 0x7c, 0x80, 0x71, 0x64, 0x26, 0x77, - 0x31, 0x63, 0x40, 0x3e, 0x6c, 0xfd, 0xd7, 0x6b, - 0x0, 0x60, - - /* U+0041 "A" */ - 0x0, 0xc3, 0xfe, 0x50, 0xf, 0xe7, 0x2, 0xe0, - 0xf, 0xea, 0x4b, 0x42, 0x0, 0xf8, 0xcd, 0xce, - 0x14, 0x1, 0xf5, 0x2, 0x8a, 0x30, 0x7, 0xce, - 0xa0, 0xe, 0x14, 0x0, 0xe5, 0x1e, 0x0, 0x28, - 0xf0, 0x7, 0x70, 0xb1, 0x14, 0x8a, 0x20, 0x11, - 0x20, 0xee, 0xe5, 0x7, 0x0, 0xa8, 0x26, 0xab, - 0x8a, 0xc0, 0x26, 0x26, 0x55, 0xea, 0x23, 0x4, - 0x1a, 0x0, 0xf2, 0x85, 0x7, 0x2, 0x80, 0x78, - 0x88, 0xc0, - - /* U+0042 "B" */ - 0x3f, 0xfe, 0xda, 0x20, 0xc, 0x91, 0x13, 0xae, - 0x90, 0x4, 0x6e, 0xf5, 0x40, 0x28, 0x7, 0xe2, - 0x0, 0xe1, 0x18, 0x92, 0x5, 0x80, 0x26, 0xee, - 0x6d, 0x86, 0x8, 0x4, 0xb7, 0x6a, 0x83, 0xc2, - 0x0, 0x89, 0x10, 0xaf, 0x83, 0x20, 0x1f, 0x88, - 0x88, 0x1, 0xfc, 0x60, 0x1f, 0xc6, 0x24, 0x1, - 0x23, 0xbd, 0x38, 0x12, 0x1, 0x1c, 0x44, 0xe9, - 0x88, 0x0, - - /* U+0043 "C" */ - 0x0, 0x9b, 0x3b, 0xfa, 0xd4, 0x0, 0x5b, 0x20, - 0xd0, 0xcf, 0x50, 0x1e, 0x53, 0x90, 0xf1, 0x98, - 0xf6, 0x26, 0x60, 0x7, 0x1b, 0xe8, 0x58, 0x7, - 0xe5, 0x2, 0x0, 0xfc, 0x22, 0x0, 0xfe, 0x11, - 0x0, 0x7f, 0x28, 0x10, 0x7, 0xed, 0xb, 0x0, - 0xfc, 0xc4, 0xcc, 0x0, 0xe4, 0x70, 0xf2, 0x9c, - 0x87, 0x8c, 0xbf, 0x2, 0xd9, 0x6, 0x86, 0x7a, - 0x80, - - /* U+0044 "D" */ - 0x3f, 0xfd, 0xdb, 0x48, 0x1, 0xc9, 0x10, 0x97, - 0x4b, 0xc1, 0x0, 0x8d, 0xde, 0xae, 0x63, 0xd0, - 0xf, 0xe9, 0x43, 0x40, 0xf, 0xee, 0xd, 0x0, - 0xfe, 0x70, 0x20, 0xf, 0xe3, 0x7, 0x0, 0xfe, - 0x30, 0x70, 0xf, 0xe7, 0x2, 0x0, 0xfe, 0x90, - 0xd0, 0xf, 0xd2, 0x66, 0x40, 0x2, 0x3b, 0xd5, - 0xcc, 0x7a, 0x1, 0x1c, 0x44, 0xe9, 0x78, 0x20, - - /* U+0045 "E" */ - 0x3f, 0xff, 0xc2, 0x0, 0x38, 0x8f, 0x8, 0x1, - 0x1d, 0xfc, 0x1, 0xff, 0xc1, 0x12, 0x2e, 0x10, - 0x9, 0xb7, 0x7c, 0x1, 0x25, 0x57, 0x40, 0x4, - 0x6a, 0xbc, 0x80, 0x1f, 0xfd, 0x54, 0x77, 0xf0, - 0x80, 0xe, 0x23, 0xc4, - - /* U+0046 "F" */ - 0x3f, 0xff, 0x94, 0x0, 0x71, 0x1c, 0xe0, 0x4, - 0x77, 0xe2, 0x0, 0xff, 0x84, 0x8b, 0x8, 0x4, - 0xdb, 0xbc, 0x1, 0x25, 0x56, 0xf0, 0x8, 0xd5, - 0x71, 0x80, 0x7f, 0xf8, 0x80, - - /* U+0047 "G" */ - 0x0, 0x9a, 0xfb, 0xfb, 0x20, 0x40, 0x5, 0xb2, - 0xcc, 0x86, 0x63, 0xf0, 0x87, 0x94, 0xec, 0x3c, - 0x57, 0xb8, 0x31, 0x33, 0x0, 0x3d, 0x3, 0xa1, - 0x60, 0x1f, 0xca, 0x4, 0x1, 0x88, 0xb0, 0x8, - 0x80, 0x31, 0xee, 0xe7, 0x11, 0x0, 0x63, 0xaa, - 0x38, 0x1, 0x40, 0x80, 0x32, 0xab, 0x0, 0x1a, - 0x14, 0x1, 0xfc, 0xc4, 0xec, 0x1, 0xfd, 0xe5, - 0x3b, 0xf, 0x15, 0x60, 0x40, 0x5b, 0x2c, 0xc8, - 0x76, 0x7d, 0x50, - - /* U+0048 "H" */ - 0x3f, 0x80, 0xf, 0x7e, 0x0, 0x7f, 0xf5, 0xc4, - 0x8b, 0xc0, 0x19, 0xb7, 0x7c, 0x1, 0x92, 0xab, - 0xc0, 0x18, 0xd5, 0x7c, 0x1, 0xff, 0xed, - - /* U+0049 "I" */ - 0x3f, 0x80, 0xf, 0xfe, 0xc0, - - /* U+004A "J" */ - 0x0, 0x1f, 0xc0, 0x7, 0xff, 0xc9, 0xc3, 0xc0, - 0x1a, 0x6, 0xf4, 0xc4, 0x92, 0x8b, 0xe0, - - /* U+004B "K" */ - 0x3f, 0x80, 0xc, 0x7d, 0xe6, 0x1, 0xf1, 0xe0, - 0x61, 0x80, 0x79, 0x30, 0x70, 0xc0, 0x3c, 0xb6, - 0x5e, 0x40, 0x1e, 0x6a, 0x3c, 0x10, 0xf, 0x2c, - 0x9e, 0x8, 0x7, 0xc4, 0xc, 0x1, 0xfc, 0xca, - 0xaa, 0x0, 0xfc, 0x34, 0xaa, 0xa0, 0xf, 0xea, - 0x55, 0x50, 0x7, 0xf5, 0x2a, 0xa8, 0x3, 0xfa, - 0x95, 0x54, 0x1, 0xfd, 0x4a, 0xaa, 0x0, - - /* U+004C "L" */ - 0x3f, 0x80, 0xf, 0xff, 0xf8, 0x7, 0xff, 0x2d, - 0x1d, 0xfc, 0x0, 0x38, 0x8f, 0x0, - - /* U+004D "M" */ - 0x3f, 0xf4, 0x80, 0x70, 0xff, 0xb0, 0x2, 0x60, - 0xe, 0x60, 0xe, 0x50, 0x50, 0xd, 0x48, 0x1, - 0xb4, 0xf8, 0x2, 0x32, 0xe0, 0xe, 0xa4, 0x10, - 0x5, 0xa, 0x80, 0x73, 0x3, 0x0, 0x1d, 0x80, - 0x3e, 0x5a, 0x5, 0x1a, 0x0, 0xfb, 0x89, 0x38, - 0xc8, 0x3, 0xe4, 0x1f, 0x4a, 0x0, 0xfe, 0x64, - 0x7, 0x0, 0xfe, 0x97, 0x91, 0x0, 0xfe, 0x18, - 0x60, 0xf, 0xfe, 0x30, - - /* U+004E "N" */ - 0x3f, 0xf3, 0x0, 0x77, 0xd8, 0x5, 0x0, 0x1f, - 0xc6, 0x2e, 0x1, 0xfa, 0xce, 0x4, 0x3, 0xf7, - 0x84, 0x80, 0x7e, 0x34, 0x71, 0x0, 0xfd, 0x21, - 0x60, 0x1f, 0x89, 0x54, 0x40, 0x1f, 0xa0, 0x24, - 0x3, 0xf1, 0x32, 0x20, 0x3, 0xf4, 0x4, 0x0, - 0x7e, 0x18, 0x30, 0xf, 0xe7, 0x10, 0x0, - - /* U+004F "O" */ - 0x0, 0x9f, 0x3f, 0xdb, 0x2, 0x1, 0x8b, 0x61, - 0xe2, 0xe, 0xef, 0x30, 0xb, 0xca, 0xad, 0xdd, - 0x58, 0x3a, 0x20, 0xc4, 0xca, 0x1, 0x8e, 0x46, - 0x3, 0x42, 0xc0, 0x3c, 0xc0, 0xe0, 0xa0, 0x40, - 0x1f, 0x18, 0x8e, 0x0, 0xfc, 0xe0, 0x62, 0x20, - 0xf, 0xce, 0x6, 0xa0, 0x40, 0x1f, 0x18, 0x8b, - 0x42, 0xc0, 0x3c, 0xc0, 0xe0, 0xc4, 0xca, 0x1, - 0x8e, 0x46, 0x0, 0x1e, 0x55, 0x6e, 0xea, 0xc1, - 0xd1, 0x0, 0x16, 0xc3, 0xc4, 0x1d, 0xde, 0x60, - 0x0, - - /* U+0050 "P" */ - 0x3f, 0xfe, 0xc6, 0x0, 0xc9, 0x10, 0x72, 0x99, - 0x0, 0x46, 0xee, 0x8f, 0x16, 0x10, 0xf, 0xa, - 0x1, 0x0, 0x7c, 0xe0, 0x20, 0x1, 0x22, 0x1d, - 0x11, 0x90, 0x1, 0xb7, 0x58, 0xa7, 0xa0, 0x12, - 0x55, 0xdb, 0xb0, 0x40, 0x23, 0x54, 0x40, 0x80, - 0x7f, 0xf7, 0xc0, - - /* U+0051 "Q" */ - 0x0, 0x9f, 0x3f, 0xdb, 0x2, 0x1, 0x8b, 0x61, - 0xe2, 0xe, 0xef, 0x30, 0xb, 0xca, 0xad, 0xdd, - 0x58, 0x3a, 0x20, 0xc4, 0xca, 0x1, 0x8e, 0x46, - 0x3, 0x42, 0xc0, 0x3c, 0xc0, 0xe0, 0xa0, 0x40, - 0x1f, 0x18, 0x8e, 0x0, 0xfc, 0xe0, 0x62, 0x20, - 0xf, 0xce, 0x4, 0xa0, 0x40, 0x1f, 0x18, 0x86, - 0x85, 0x0, 0x79, 0x81, 0x81, 0x89, 0xd4, 0x3, - 0x1c, 0xc, 0x80, 0x3c, 0xaa, 0xdd, 0xd5, 0x81, - 0xa2, 0x0, 0x2d, 0x87, 0x88, 0x29, 0x79, 0x80, - 0x73, 0xe7, 0xf9, 0x49, 0x80, 0x3f, 0xd4, 0x90, - 0xe0, 0x0, - - /* U+0052 "R" */ - 0x3f, 0xfe, 0xc7, 0x0, 0xe4, 0x88, 0x38, 0xc4, - 0x80, 0x63, 0x77, 0x46, 0x8b, 0x8, 0x7, 0xe4, - 0x2, 0x0, 0xfc, 0xc0, 0x20, 0x10, 0x91, 0xe, - 0x4c, 0xc4, 0x1, 0x36, 0xeb, 0x19, 0x74, 0x3, - 0x25, 0x52, 0x5, 0x84, 0x3, 0x1a, 0xa9, 0xf4, - 0xe8, 0x3, 0xf1, 0xaa, 0x8c, 0x3, 0xf4, 0x4, - 0x0, 0x7e, 0x25, 0x43, 0x0, 0xfd, 0x1, 0x0, - - /* U+0053 "S" */ - 0x1, 0x9d, 0xfe, 0xd9, 0x40, 0x2e, 0x67, 0x89, - 0x77, 0x70, 0x40, 0x55, 0x1d, 0xd5, 0xd0, 0xc, - 0xa, 0x1, 0xc4, 0xc, 0xa, 0x1, 0xf4, 0x5, - 0x6c, 0xb1, 0x0, 0x45, 0xac, 0xd, 0x3b, 0x84, - 0x0, 0x29, 0xde, 0xb5, 0x3f, 0x0, 0xe1, 0x4a, - 0x52, 0x40, 0xf, 0xb4, 0x9, 0x0, 0x3d, 0x60, - 0xb1, 0xf4, 0xee, 0x8d, 0x35, 0x3f, 0x76, 0x98, - 0x61, 0x9a, 0x0, - - /* U+0054 "T" */ - 0xf, 0xff, 0xf8, 0x1, 0x11, 0x94, 0x16, 0x23, - 0x0, 0x1d, 0xf6, 0x6, 0x3b, 0xe0, 0xf, 0xff, - 0xf8, 0x7, 0xff, 0xb0, - - /* U+0055 "U" */ - 0x7f, 0x50, 0xe, 0x2f, 0x90, 0xf, 0xff, 0xf8, - 0x0, 0x40, 0xc0, 0x38, 0x40, 0x4, 0x1c, 0x1, - 0xca, 0x1c, 0x82, 0xc2, 0x1, 0xa8, 0x14, 0x2c, - 0x7a, 0x5e, 0x38, 0xdc, 0x81, 0x71, 0x5e, 0x19, - 0x6a, 0x0, - - /* U+0056 "V" */ - 0xaf, 0x30, 0xf, 0xb7, 0xc3, 0x82, 0x80, 0x3c, - 0x84, 0xc0, 0x82, 0xe0, 0x1e, 0xe0, 0xa0, 0x3, - 0xa, 0x80, 0x72, 0x91, 0x80, 0x28, 0x38, 0x3, - 0x30, 0x58, 0x4, 0x48, 0x81, 0x0, 0xa8, 0x1c, - 0x3, 0x70, 0x30, 0x0, 0x8d, 0x44, 0x3, 0x28, - 0xd0, 0x2, 0x83, 0x80, 0x3c, 0xe4, 0x60, 0xc2, - 0x80, 0x1e, 0xa0, 0xa4, 0x16, 0x0, 0xf8, 0xcc, - 0xde, 0x14, 0x1, 0xfa, 0x81, 0x10, 0x40, 0x1f, - 0x9c, 0x1, 0xc0, 0x1c, - - /* U+0057 "W" */ - 0x4f, 0x80, 0xc, 0x7f, 0xe0, 0xe, 0xbf, 0x14, - 0x4, 0x0, 0xc8, 0x0, 0x40, 0xc, 0x84, 0x20, - 0x66, 0x0, 0xd8, 0x83, 0x80, 0x11, 0x82, 0x0, - 0x10, 0x10, 0x2, 0x4c, 0x44, 0x0, 0x48, 0x18, - 0x0, 0xc0, 0xc0, 0x1, 0x82, 0x61, 0x80, 0x58, - 0x8, 0x0, 0x40, 0x40, 0x2, 0x1, 0xa0, 0x20, - 0x1, 0xc, 0x40, 0x23, 0x30, 0x3, 0x10, 0x8, - 0x70, 0xc, 0x10, 0x3, 0x20, 0x20, 0x26, 0x0, - 0x11, 0x0, 0x81, 0x80, 0x1b, 0x3, 0xc, 0x10, - 0x1, 0x86, 0x18, 0x8, 0x1, 0x90, 0x11, 0x0, - 0x60, 0x4, 0x4, 0x41, 0x80, 0x79, 0xe, 0xd0, - 0x2, 0x21, 0x80, 0x40, 0xf, 0x60, 0x1e, 0x0, - 0x64, 0x30, 0xc0, 0xf, 0x20, 0x1, 0x0, 0x36, - 0x80, 0x10, 0x2, - - /* U+0058 "X" */ - 0x8, 0xf6, 0x0, 0xec, 0xf2, 0x8, 0x29, 0x10, - 0x9, 0xce, 0x8, 0x1, 0xc1, 0x40, 0x2, 0x83, - 0x70, 0x8, 0xdd, 0x18, 0x38, 0x38, 0x3, 0xa0, - 0xe6, 0x47, 0x4, 0x1, 0xee, 0x6, 0x37, 0x0, - 0xff, 0x58, 0x7, 0xe9, 0x2, 0x82, 0x0, 0xf3, - 0x24, 0x78, 0x70, 0x7, 0x14, 0x9b, 0x94, 0x1b, - 0x0, 0x6e, 0xe, 0x0, 0x39, 0xc9, 0x0, 0x1c, - 0xe0, 0x80, 0x2e, 0xe, 0x2, 0x83, 0x70, 0xc, - 0x50, 0x6c, - - /* U+0059 "Y" */ - 0xb, 0xf3, 0x0, 0xe3, 0xfb, 0x0, 0x50, 0xf0, - 0x7, 0x70, 0xd0, 0x0, 0x6c, 0xa4, 0x2, 0x92, - 0xb1, 0x0, 0x95, 0x4c, 0x80, 0x6c, 0xaa, 0x0, - 0xeb, 0x1a, 0x1e, 0x1b, 0x0, 0xf0, 0xd0, 0xf9, - 0x50, 0x80, 0x7c, 0x8c, 0x2c, 0x80, 0x1f, 0xde, - 0x1e, 0x1, 0xff, 0xfa, - - /* U+005A "Z" */ - 0xf, 0xff, 0xf2, 0x84, 0x47, 0xce, 0x0, 0x70, - 0x77, 0xf8, 0xc2, 0x48, 0x3, 0xe8, 0x46, 0x60, - 0x7, 0xca, 0xe9, 0x20, 0x1f, 0x1d, 0x15, 0x0, - 0x7c, 0x3a, 0x1e, 0x20, 0x1f, 0x68, 0xd9, 0x0, - 0x7d, 0x27, 0x8, 0x1, 0xf3, 0x31, 0x5c, 0x3, - 0xe4, 0x92, 0xa0, 0xf, 0x86, 0x81, 0x1d, 0xfe, - 0x32, 0x10, 0x68, 0x8f, 0xac, - - /* U+005B "[" */ - 0x7f, 0xf9, 0x0, 0x15, 0x8a, 0x0, 0x73, 0x10, - 0xf, 0xff, 0x68, 0x80, 0x6c, 0xf4, 0x6c, 0xc9, - 0x0, - - /* U+005C "\\" */ - 0xda, 0x0, 0xe5, 0x50, 0x7, 0x58, 0x20, 0x6, - 0x31, 0xd0, 0xe, 0x77, 0x0, 0x76, 0x89, 0x80, - 0x64, 0x1b, 0x0, 0xe4, 0x50, 0xe, 0xf2, 0x20, - 0x6, 0x50, 0x50, 0xe, 0x5b, 0x0, 0xef, 0x31, - 0x0, 0xc8, 0xe, 0x1, 0x85, 0x34, 0x3, 0xbf, - 0x0, - - /* U+005D "]" */ - 0x4f, 0xf9, 0xd3, 0x28, 0x2, 0x37, 0x0, 0xff, - 0xf9, 0x27, 0xe8, 0x1, 0x33, 0x26, - - /* U+005E "^" */ - 0x0, 0xec, 0xfd, 0x10, 0xf, 0xd6, 0x6a, 0x5a, - 0x1, 0xf5, 0x24, 0xd5, 0xf, 0x0, 0x3a, 0x96, - 0x98, 0x16, 0xce, 0xc0, 0x29, 0x5b, 0x50, 0x9, - 0x31, 0x68, 0x0, - - /* U+005F "_" */ - 0x0, 0xff, 0x8b, 0xff, 0xf8, 0x89, 0x99, 0xfc, - 0x40, - - /* U+0060 "`" */ - 0x28, 0x30, 0x1, 0x13, 0x80, 0x2a, 0xa, 0x0, - 0xbd, 0x14, - - /* U+0061 "a" */ - 0x18, 0xce, 0xfd, 0x70, 0x1, 0x32, 0xc4, 0xb4, - 0x48, 0x1f, 0x4b, 0x32, 0xd9, 0x82, 0x1, 0xed, - 0x4, 0x6, 0xcf, 0xfa, 0xc0, 0xde, 0x5a, 0xb3, - 0x12, 0x0, 0xa2, 0xa5, 0x33, 0x0, 0x7f, 0x58, - 0x1, 0x4a, 0xd9, 0xf4, 0x40, 0x10, 0xeb, 0x35, - 0x4f, 0x0, 0x0, - - /* U+0062 "b" */ - 0x5f, 0x40, 0xf, 0xfe, 0xe4, 0x77, 0xea, 0x80, - 0x69, 0x59, 0x80, 0xa5, 0x0, 0x8f, 0x1d, 0xda, - 0x56, 0x1, 0x48, 0x80, 0x54, 0x28, 0x0, 0x20, - 0xc, 0x60, 0x40, 0x1f, 0xfc, 0x2, 0x0, 0xc6, - 0x4, 0x0, 0x90, 0xd, 0x42, 0x80, 0x3, 0xd7, - 0x76, 0x95, 0x80, 0x52, 0xb3, 0x1, 0x4a, 0x0, - - /* U+0063 "c" */ - 0x0, 0x3e, 0xff, 0xb1, 0x83, 0x21, 0xa2, 0x57, - 0x5c, 0xde, 0xdd, 0xa6, 0xe8, 0x60, 0x3, 0x88, - 0x80, 0x1f, 0xfc, 0x22, 0x20, 0x7, 0xa8, 0x60, - 0x3, 0x9c, 0xde, 0xdd, 0xa6, 0xc3, 0x21, 0xa2, - 0xb, 0xa0, - - /* U+0064 "d" */ - 0x0, 0xfb, 0x70, 0x3, 0xff, 0xa0, 0x35, 0xfe, - 0xb2, 0x0, 0xe, 0x2b, 0x48, 0xe1, 0x84, 0x95, - 0x4b, 0x53, 0x8, 0x29, 0x28, 0x5, 0x0, 0x2, - 0x60, 0xe, 0x10, 0xf, 0xf1, 0x30, 0x7, 0x8, - 0x29, 0x28, 0x5, 0x0, 0x9, 0x1a, 0x86, 0xa6, - 0x10, 0x1f, 0x57, 0x91, 0xc3, 0x0, - - /* U+0065 "e" */ - 0x0, 0x3e, 0xff, 0xac, 0xc0, 0x2b, 0x87, 0x98, - 0x6c, 0x30, 0x74, 0xaa, 0x33, 0xe0, 0xc0, 0x59, - 0x28, 0x4, 0x2e, 0x80, 0x65, 0xff, 0xcc, 0x2, - 0x5, 0x99, 0xf0, 0x91, 0xc, 0xfe, 0xa, 0x8, - 0x0, 0xe1, 0x7, 0x47, 0xc7, 0x68, 0xca, 0x0, - 0x5c, 0x84, 0x4a, 0xb7, 0x80, - - /* U+0066 "f" */ - 0x0, 0xd, 0x77, 0xd8, 0x2, 0xd6, 0x6a, 0x0, - 0xa, 0xa7, 0x53, 0x0, 0x8c, 0x2, 0x9f, 0x6, - 0xff, 0x25, 0xd8, 0x12, 0xec, 0xa4, 0x80, 0x48, - 0x81, 0x0, 0xff, 0xf2, 0x80, - - /* U+0067 "g" */ - 0x2, 0xaf, 0xf5, 0x96, 0xe0, 0xe2, 0xbc, 0x8e, - 0x18, 0x48, 0xd4, 0x35, 0x30, 0x82, 0x92, 0x80, - 0x50, 0x0, 0x26, 0x0, 0xe1, 0x0, 0xff, 0x13, - 0x0, 0x70, 0x82, 0x92, 0x80, 0x4e, 0x0, 0x91, - 0xa8, 0x69, 0x90, 0x80, 0xe2, 0xbc, 0x96, 0x0, - 0x45, 0x5f, 0xeb, 0x21, 0x60, 0xf, 0x38, 0x78, - 0x64, 0xb3, 0x2a, 0xd, 0x42, 0xd2, 0x64, 0xee, - 0xc0, - - /* U+0068 "h" */ - 0x5f, 0x40, 0xf, 0xfe, 0xc3, 0xef, 0xea, 0x80, - 0x51, 0x54, 0x80, 0xa3, 0x0, 0xe, 0xbb, 0xb0, - 0x24, 0x1, 0x60, 0x10, 0x9b, 0x0, 0x8, 0x3, - 0x38, 0x80, 0x7e, 0x30, 0xf, 0xfe, 0xc0, - - /* U+0069 "i" */ - 0x4f, 0x50, 0x9, 0x3d, 0x40, 0x24, 0xf5, 0x0, - 0xff, 0xe7, 0x80, - - /* U+006A "j" */ - 0x0, 0x27, 0xa8, 0x7, 0xc9, 0xea, 0x1, 0xf2, - 0x7a, 0x80, 0x7f, 0xf8, 0xc4, 0x4, 0x0, 0x60, - 0xe2, 0xd6, 0x26, 0x92, 0x3a, 0x0, - - /* U+006B "k" */ - 0x5f, 0x40, 0xf, 0xfe, 0xfb, 0xfc, 0x80, 0x7a, - 0x62, 0x12, 0x1, 0xd4, 0xd2, 0xe0, 0x18, 0x71, - 0x6d, 0x80, 0x3a, 0x8f, 0x10, 0x3, 0xcc, 0x10, - 0x1, 0xf6, 0xd2, 0x60, 0x7, 0xcb, 0x47, 0x80, - 0x1f, 0x2d, 0x9e, 0x0, 0x7c, 0x96, 0x78, 0x20, - - /* U+006C "l" */ - 0x4f, 0x50, 0xf, 0xfe, 0xd8, - - /* U+006D "m" */ - 0x5f, 0x47, 0xdf, 0xc3, 0x3, 0xcf, 0xe7, 0x0, - 0xa2, 0xa8, 0xe5, 0x8b, 0xa9, 0x5, 0xa, 0x0, - 0x1d, 0x78, 0xb0, 0xad, 0x87, 0xc1, 0x90, 0x5, - 0x80, 0x48, 0x6, 0x60, 0x9, 0x48, 0x0, 0x40, - 0x10, 0x83, 0x0, 0x61, 0x10, 0x7, 0xff, 0xfc, - - /* U+006E "n" */ - 0x5f, 0x48, 0xef, 0xd5, 0x0, 0xa4, 0xab, 0x1a, - 0x8c, 0x0, 0xd4, 0x87, 0x61, 0x20, 0xd, 0x0, - 0xc6, 0xc0, 0x2, 0x0, 0xce, 0x20, 0x1f, 0x8c, - 0x3, 0xff, 0xb0, - - /* U+006F "o" */ - 0x1, 0x9e, 0xfe, 0x91, 0x0, 0xb1, 0x9e, 0x5d, - 0xb0, 0x42, 0xa, 0x64, 0xd3, 0x22, 0x90, 0x51, - 0x60, 0x9, 0x85, 0x40, 0x88, 0x1, 0xc4, 0x40, - 0xf, 0xf8, 0x88, 0x1, 0xc4, 0x40, 0x51, 0x60, - 0x9, 0x85, 0x42, 0xa, 0x64, 0xd3, 0x22, 0x90, - 0x6, 0x33, 0xcb, 0xb6, 0x8, 0x0, - - /* U+0070 "p" */ - 0x5f, 0x58, 0xef, 0xd5, 0x0, 0xd6, 0x59, 0xaf, - 0x4a, 0x1, 0x1d, 0x11, 0x28, 0xec, 0x2, 0xa0, - 0xd, 0x42, 0x80, 0x3, 0x0, 0xc4, 0x4, 0x0, - 0x10, 0xf, 0xed, 0x0, 0xc6, 0x4, 0x0, 0x61, - 0x0, 0xa4, 0x50, 0x0, 0x58, 0xee, 0xd1, 0xb0, - 0xa, 0x16, 0x60, 0x29, 0x40, 0x34, 0x77, 0xea, - 0x80, 0x7f, 0xf5, 0x0, - - /* U+0071 "q" */ - 0x1, 0xaf, 0xf5, 0x96, 0xe0, 0xe2, 0xb4, 0x8e, - 0x18, 0x49, 0x54, 0xb5, 0x30, 0x82, 0x92, 0x80, - 0x50, 0x0, 0x26, 0x0, 0xe1, 0x0, 0xff, 0x13, - 0x0, 0x70, 0x82, 0x92, 0x80, 0x50, 0x0, 0x91, - 0xa8, 0x6a, 0x61, 0x1, 0xf5, 0x79, 0x1c, 0x30, - 0x0, 0xd7, 0xfa, 0xc8, 0x3, 0xff, 0xa2, - - /* U+0072 "r" */ - 0x0, 0xf9, 0x7d, 0x23, 0xbd, 0x80, 0x14, 0x75, - 0x88, 0x0, 0x2b, 0x43, 0x20, 0x5, 0x0, 0x78, - 0x80, 0x3f, 0xfb, 0x60, - - /* U+0073 "s" */ - 0x0, 0x3e, 0xff, 0xb6, 0x40, 0x13, 0x9, 0x32, - 0x54, 0x0, 0x3a, 0x4b, 0x32, 0x34, 0x0, 0x6a, - 0x40, 0x1e, 0x90, 0xdd, 0x4a, 0x80, 0x49, 0xf4, - 0x88, 0xac, 0x0, 0x85, 0x67, 0x60, 0xd8, 0x4, - 0x3, 0x18, 0x8, 0x75, 0x3a, 0xbd, 0x2, 0x83, - 0xb4, 0xd4, 0xa6, 0x90, - - /* U+0074 "t" */ - 0x2, 0x82, 0x0, 0xce, 0xe6, 0x0, 0xff, 0x45, - 0x5, 0xff, 0xaa, 0x90, 0x11, 0x76, 0x82, 0x20, - 0x1a, 0x20, 0x80, 0x3f, 0xfa, 0x22, 0x2, 0x1, - 0x94, 0x21, 0x94, 0xc0, 0x68, 0x26, 0xa4, - - /* U+0075 "u" */ - 0x7f, 0x20, 0xd, 0xb8, 0x1, 0xff, 0xe1, 0x10, - 0x10, 0xc, 0x40, 0xa0, 0x80, 0x13, 0x80, 0xc, - 0xa2, 0x5e, 0xa8, 0x20, 0xf, 0x46, 0x80, 0xc3, - 0x0, - - /* U+0076 "v" */ - 0x4f, 0x60, 0xe, 0xce, 0x4, 0x1a, 0x0, 0xc4, - 0x6c, 0x0, 0x63, 0x20, 0xa, 0x82, 0x80, 0x14, - 0x14, 0x1, 0x29, 0x10, 0x0, 0x46, 0xc0, 0x3, - 0x2a, 0x0, 0xd4, 0x28, 0x14, 0xc, 0x1, 0x9c, - 0x38, 0x19, 0x4, 0x3, 0xa, 0x2b, 0x7, 0x0, - 0x7b, 0x82, 0x41, 0x40, 0x3c, 0xa2, 0xc, 0x1, - 0x80, - - /* U+0077 "w" */ - 0x1f, 0x80, 0xa, 0xfd, 0xc0, 0x2c, 0xd1, 0x24, - 0x0, 0x90, 0x30, 0x2, 0x34, 0x4, 0x30, 0x1, - 0x82, 0xa0, 0x1, 0x3, 0x3, 0x1, 0x2, 0xc6, - 0x40, 0xc3, 0x1, 0x1, 0x3, 0x1, 0x10, 0x62, - 0x80, 0xa6, 0x20, 0x24, 0x80, 0x78, 0x9, 0x82, - 0x48, 0x1, 0x21, 0xa8, 0x20, 0x62, 0x20, 0x30, - 0x2, 0xc0, 0x81, 0x20, 0x40, 0x80, 0x40, 0x9, - 0x0, 0x9c, 0x0, 0x42, 0x46, 0x1, 0x84, 0xc3, - 0x0, 0x24, 0x4, 0x0, 0x0, - - /* U+0078 "x" */ - 0xc, 0xf2, 0x0, 0x9b, 0xe0, 0x1, 0xa3, 0xe0, - 0x2, 0x93, 0x80, 0x0, 0xd9, 0x48, 0x78, 0xe8, - 0x6, 0x56, 0x66, 0x15, 0x8, 0x7, 0x49, 0x1b, - 0x20, 0x7, 0x8c, 0x81, 0x40, 0x3e, 0xe1, 0x83, - 0x80, 0xe, 0xa2, 0xa7, 0x57, 0x30, 0x9, 0x95, - 0xd0, 0x2c, 0x74, 0x40, 0xa4, 0xe0, 0x0, 0x3a, - 0x34, 0x0, - - /* U+0079 "y" */ - 0x4f, 0x70, 0xe, 0xce, 0x4, 0x2a, 0x0, 0xc4, - 0x6c, 0x0, 0xa2, 0x30, 0xa, 0x82, 0x80, 0xc, - 0x14, 0x1, 0x32, 0x10, 0x0, 0x55, 0x80, 0xa, - 0x3c, 0x1, 0xb8, 0x14, 0x38, 0x54, 0x3, 0x20, - 0xc8, 0xa3, 0x80, 0x7a, 0x4e, 0xc2, 0x80, 0x3c, - 0xc0, 0xa6, 0x60, 0xf, 0xa, 0x5, 0x0, 0x7e, - 0x10, 0x60, 0xf, 0x85, 0x58, 0x3, 0xc6, 0xba, - 0x16, 0x1, 0xea, 0xa0, 0xd1, 0x0, 0x70, - - /* U+007A "z" */ - 0xf, 0xff, 0xa8, 0x2e, 0xf9, 0x80, 0x81, 0x13, - 0x3b, 0x1c, 0x0, 0x61, 0xd1, 0xd0, 0xe, 0xd1, - 0xc1, 0x0, 0xd4, 0x76, 0x40, 0x1a, 0x16, 0x10, - 0x3, 0x2b, 0xb3, 0x80, 0x62, 0xa1, 0xd4, 0x4c, - 0x62, 0x3, 0x77, 0xd2, - - /* U+007B "{" */ - 0x0, 0x8a, 0xfb, 0xcc, 0x2, 0xe4, 0x8b, 0x30, - 0x8, 0xd1, 0x90, 0x3, 0x88, 0x3, 0xff, 0x92, - 0x40, 0x20, 0x18, 0x60, 0x30, 0x2, 0xce, 0x58, - 0x40, 0xb, 0xac, 0xe0, 0xc0, 0x22, 0x4e, 0xb, - 0x0, 0xe2, 0x1, 0x0, 0xff, 0xe1, 0x98, 0x7, - 0x85, 0x8, 0x3, 0xac, 0x77, 0xcc, 0x2, 0x5f, - 0xdc, 0x30, - - /* U+007C "|" */ - 0xbc, 0x0, 0xff, 0xeb, 0x0, - - /* U+007D "}" */ - 0xbf, 0xd6, 0x0, 0xd3, 0x6d, 0x24, 0x1, 0x12, - 0x40, 0x20, 0x7, 0x8, 0x8, 0x7, 0xff, 0x24, - 0xc3, 0x80, 0x38, 0x49, 0xd0, 0x3, 0xbc, 0xef, - 0xcc, 0x2, 0xe2, 0x9c, 0x30, 0x0, 0x9b, 0x30, - 0xc0, 0x23, 0xe, 0x0, 0xff, 0xe0, 0x88, 0x8, - 0x6, 0x1b, 0x2, 0x0, 0xb3, 0x9d, 0x10, 0x1, - 0x76, 0x75, 0x80, 0x60, - - /* U+007E "~" */ - 0x0, 0xc2, 0x1, 0xfc, 0x99, 0xfd, 0xf4, 0xc4, - 0x46, 0xd2, 0x1b, 0x6a, 0xa3, 0x3c, 0xee, 0xa5, - 0x48, 0x76, 0x95, 0x53, 0xbd, 0x79, 0xf0, 0x0, - - /* U+0401 "Ё" */ - 0x0, 0x5f, 0x82, 0x7b, 0x80, 0x62, 0x30, 0x73, - 0x10, 0xd, 0x38, 0x7, 0x8c, 0x0, 0x3f, 0xff, - 0xc2, 0x0, 0x38, 0x8f, 0x8, 0x1, 0x1d, 0xfc, - 0x1, 0xff, 0xc1, 0x12, 0x2e, 0x10, 0x9, 0xb7, - 0x7c, 0x1, 0x25, 0x57, 0x40, 0x4, 0x6a, 0xbc, - 0x80, 0x1f, 0xfd, 0x54, 0x77, 0xf0, 0x80, 0xe, - 0x23, 0xc4, - - /* U+0410 "А" */ - 0x0, 0xc3, 0xfe, 0x50, 0xf, 0xe7, 0x2, 0xe0, - 0xf, 0xea, 0x4b, 0x42, 0x0, 0xf8, 0xcd, 0xce, - 0x14, 0x1, 0xf5, 0x2, 0x8a, 0x30, 0x7, 0xce, - 0xa0, 0xe, 0x14, 0x0, 0xe5, 0x1e, 0x0, 0x28, - 0xf0, 0x7, 0x70, 0xb1, 0x14, 0x8a, 0x20, 0x11, - 0x20, 0xee, 0xe5, 0x7, 0x0, 0xa8, 0x26, 0xab, - 0x8a, 0xc0, 0x26, 0x26, 0x55, 0xea, 0x23, 0x4, - 0x1a, 0x0, 0xf2, 0x85, 0x7, 0x2, 0x80, 0x78, - 0x88, 0xc0, - - /* U+0411 "Б" */ - 0x3f, 0xff, 0xc4, 0x1, 0x24, 0x47, 0x8c, 0x2, - 0x37, 0x7f, 0x8, 0x7, 0xff, 0x8, 0x48, 0x82, - 0x1, 0xf3, 0x6e, 0xbb, 0xf5, 0x40, 0x32, 0x55, - 0x50, 0x74, 0xc0, 0x11, 0xaa, 0xcf, 0x81, 0x60, - 0x1f, 0x88, 0xa0, 0xf, 0xe3, 0x0, 0xfe, 0x31, - 0x20, 0x9, 0x1d, 0xe9, 0xc0, 0x80, 0x8, 0xe2, - 0x27, 0x4b, 0x50, - - /* U+0412 "В" */ - 0x3f, 0xfe, 0xda, 0x20, 0xc, 0x91, 0x13, 0xae, - 0x90, 0x4, 0x6e, 0xf5, 0x40, 0x28, 0x7, 0xe2, - 0x0, 0xe1, 0x18, 0x92, 0x5, 0x80, 0x26, 0xee, - 0x6d, 0x86, 0x8, 0x4, 0xb7, 0x6a, 0x83, 0xc2, - 0x0, 0x89, 0x10, 0xaf, 0x83, 0x20, 0x1f, 0x88, - 0x88, 0x1, 0xfc, 0x60, 0x1f, 0xc6, 0x24, 0x1, - 0x23, 0xbd, 0x38, 0x12, 0x1, 0x1c, 0x44, 0xe9, - 0x88, 0x0, - - /* U+0413 "Г" */ - 0x3f, 0xff, 0xc0, 0x3, 0x88, 0xf0, 0x1, 0x1d, - 0xfc, 0x1, 0xff, 0xff, 0x0, 0xff, 0xe1, 0x80, - - /* U+0414 "Д" */ - 0x0, 0x8b, 0xff, 0xeb, 0x0, 0xf8, 0xa2, 0x27, - 0x0, 0xfe, 0x77, 0xd2, 0x1, 0xff, 0xcb, 0x30, - 0xf, 0xf8, 0x40, 0x3f, 0xf8, 0x2c, 0x1c, 0x1, - 0xff, 0x10, 0x10, 0x7, 0xfd, 0xa0, 0xe0, 0x1f, - 0xf3, 0x89, 0x0, 0x7f, 0x94, 0x90, 0x3, 0xfd, - 0x34, 0x6, 0xef, 0xa4, 0x19, 0xc4, 0x4c, 0x0, - 0x68, 0x8c, 0xe0, 0x50, 0x60, 0x9, 0xff, 0xfd, - 0x40, 0x1f, 0xfc, 0x53, 0x20, 0xf, 0xcc, 0x60, - - /* U+0415 "Е" */ - 0x3f, 0xff, 0xc2, 0x0, 0x38, 0x8f, 0x8, 0x1, - 0x1d, 0xfc, 0x1, 0xff, 0xc1, 0x12, 0x2e, 0x10, - 0x9, 0xb7, 0x7c, 0x1, 0x25, 0x57, 0x40, 0x4, - 0x6a, 0xbc, 0x80, 0x1f, 0xfd, 0x54, 0x77, 0xf0, - 0x80, 0xe, 0x23, 0xc4, - - /* U+0416 "Ж" */ - 0x1d, 0xf4, 0x0, 0xc7, 0xf2, 0x1, 0x87, 0x7d, - 0x0, 0x70, 0xac, 0xc0, 0x3f, 0xda, 0x54, 0x80, - 0x1, 0xc1, 0xc3, 0x0, 0xfd, 0x67, 0x2a, 0x1, - 0x87, 0x7, 0x48, 0x3, 0xd4, 0x90, 0xc0, 0x1e, - 0x2d, 0x1c, 0x10, 0xd, 0x2a, 0xee, 0x0, 0xfc, - 0x66, 0x1c, 0x70, 0x4, 0x30, 0x58, 0x7, 0xf3, - 0x9a, 0x95, 0x3, 0xb9, 0x47, 0xc0, 0x3f, 0x14, - 0x1d, 0x50, 0x40, 0x52, 0xa0, 0xdc, 0x3, 0xe9, - 0xe, 0x5, 0x80, 0x3b, 0x6, 0x48, 0x20, 0xe, - 0x64, 0x82, 0x0, 0x20, 0x28, 0x5, 0x21, 0xc0, - 0x18, 0x60, 0xdc, 0x3, 0xf8, 0xa4, 0xd8, 0x2, - 0xb1, 0xf0, 0xf, 0xf9, 0x8e, 0x44, 0x15, 0x4e, - 0x60, 0x1f, 0xfc, 0xe, 0xa, 0x0, - - /* U+0417 "З" */ - 0x4a, 0xdf, 0xf6, 0xd1, 0x80, 0x3d, 0xd1, 0xdc, - 0x88, 0xc7, 0xa, 0xd9, 0x88, 0x4f, 0x8c, 0x0, - 0x80, 0x70, 0x90, 0x6, 0x12, 0x21, 0xc9, 0xc0, - 0x5, 0x3b, 0xac, 0x6a, 0x70, 0xa, 0xaa, 0x82, - 0xa6, 0x0, 0x89, 0x54, 0xfa, 0x52, 0x20, 0x1f, - 0x50, 0x28, 0x7, 0xde, 0x0, 0x50, 0xe, 0x16, - 0x4, 0x8f, 0xa8, 0x85, 0x70, 0xd0, 0x4b, 0x3b, - 0xe6, 0xd5, 0x0, - - /* U+0418 "И" */ - 0x3f, 0x70, 0xe, 0xef, 0xb0, 0xf, 0x9c, 0x40, - 0x3f, 0xc, 0x18, 0x7, 0xe8, 0x8, 0x0, 0xf8, - 0x99, 0x10, 0x1, 0xf4, 0x4, 0x80, 0x7c, 0x4a, - 0xa2, 0x0, 0xfa, 0x42, 0xc0, 0x3e, 0x34, 0x71, - 0x0, 0xfb, 0xc2, 0x40, 0x3e, 0xb3, 0x81, 0x0, - 0xf8, 0xc5, 0xc0, 0x3f, 0xa0, 0x3, 0xe0, - - /* U+0419 "Й" */ - 0x0, 0x9c, 0x80, 0xc, 0x40, 0x1d, 0xfb, 0xfe, - 0xd2, 0x0, 0xe8, 0xfd, 0xeb, 0x0, 0xfc, 0x42, - 0x1, 0x8f, 0xdc, 0x3, 0xbb, 0xec, 0x3, 0xe7, - 0x10, 0xf, 0xc3, 0x6, 0x1, 0xfa, 0x2, 0x0, - 0x3e, 0x26, 0x44, 0x0, 0x7d, 0x1, 0x20, 0x1f, - 0x12, 0xa8, 0x80, 0x3e, 0x90, 0xb0, 0xf, 0x8d, - 0x1c, 0x40, 0x3e, 0xf0, 0x90, 0xf, 0xac, 0xe0, - 0x40, 0x3e, 0x31, 0x70, 0xf, 0xe8, 0x0, 0xf8, - - /* U+041A "К" */ - 0x3f, 0x80, 0xe, 0x9f, 0xa0, 0xf, 0xd2, 0xcb, - 0x40, 0x1f, 0x4b, 0x2d, 0x0, 0x7d, 0x2c, 0x94, - 0x1, 0xf4, 0x32, 0x58, 0x7, 0xd0, 0xe1, 0xc0, - 0x1f, 0x33, 0xa1, 0x58, 0x80, 0x78, 0x52, 0xe4, - 0x68, 0x3, 0xc7, 0x60, 0x8c, 0x8a, 0x1, 0xc8, - 0x1, 0x49, 0x58, 0x80, 0x7f, 0x70, 0xd0, 0x7, - 0xf1, 0xba, 0x30, 0x7, 0xf4, 0x14, 0x90, - - /* U+041B "Л" */ - 0x0, 0xdf, 0xff, 0x60, 0x7, 0x14, 0x46, 0x0, - 0xf9, 0x9d, 0xf0, 0x7, 0x8, 0x7, 0xff, 0x4, - 0x40, 0x3f, 0x8c, 0x3, 0xfe, 0x10, 0x30, 0xf, - 0xe6, 0xe, 0x0, 0xfe, 0xd0, 0x30, 0xf, 0xe4, - 0x5, 0x0, 0xfc, 0xc6, 0x82, 0x1, 0xe2, 0xb9, - 0x19, 0x0, 0xf9, 0x98, 0xfe, 0x40, 0x1f, 0x0, - - /* U+041C "М" */ - 0x3f, 0xf4, 0x80, 0x70, 0xff, 0xb0, 0x2, 0x60, - 0xe, 0x60, 0xe, 0x50, 0x50, 0xd, 0x48, 0x1, - 0xb4, 0xf8, 0x2, 0x32, 0xe0, 0xe, 0xa4, 0x10, - 0x5, 0xa, 0x80, 0x73, 0x3, 0x0, 0x1d, 0x80, - 0x3e, 0x5a, 0x5, 0x1a, 0x0, 0xfb, 0x89, 0x38, - 0xc8, 0x3, 0xe4, 0x1f, 0x4a, 0x0, 0xfe, 0x64, - 0x7, 0x0, 0xfe, 0x97, 0x91, 0x0, 0xfe, 0x18, - 0x60, 0xf, 0xfe, 0x30, - - /* U+041D "Н" */ - 0x3f, 0x80, 0xf, 0x7e, 0x0, 0x7f, 0xf5, 0xc4, - 0x8b, 0xc0, 0x19, 0xb7, 0x7c, 0x1, 0x92, 0xab, - 0xc0, 0x18, 0xd5, 0x7c, 0x1, 0xff, 0xed, - - /* U+041E "О" */ - 0x0, 0x9f, 0x3f, 0xdb, 0x2, 0x1, 0x8b, 0x61, - 0xe2, 0xe, 0xef, 0x30, 0xb, 0xca, 0xad, 0xdd, - 0x58, 0x3a, 0x20, 0xc4, 0xca, 0x1, 0x8e, 0x46, - 0x3, 0x42, 0xc0, 0x3c, 0xc0, 0xe0, 0xa0, 0x40, - 0x1f, 0x18, 0x8e, 0x0, 0xfc, 0xe0, 0x62, 0x20, - 0xf, 0xce, 0x6, 0xa0, 0x40, 0x1f, 0x18, 0x8b, - 0x42, 0xc0, 0x3c, 0xc0, 0xe0, 0xc4, 0xca, 0x1, - 0x8e, 0x46, 0x0, 0x1e, 0x55, 0x6e, 0xea, 0xc1, - 0xd1, 0x0, 0x16, 0xc3, 0xc4, 0x1d, 0xde, 0x60, - 0x0, - - /* U+041F "П" */ - 0x3f, 0xff, 0xec, 0x0, 0x1c, 0x47, 0x80, 0x32, - 0x3b, 0xf8, 0x3, 0xff, 0xfe, 0x1, 0xff, 0xd9, - - /* U+0420 "Р" */ - 0x3f, 0xfe, 0xc6, 0x0, 0xc9, 0x10, 0x72, 0x99, - 0x0, 0x46, 0xee, 0x8f, 0x16, 0x10, 0xf, 0xa, - 0x1, 0x0, 0x7c, 0xe0, 0x20, 0x1, 0x22, 0x1d, - 0x11, 0x90, 0x1, 0xb7, 0x58, 0xa7, 0xa0, 0x12, - 0x55, 0xdb, 0xb0, 0x40, 0x23, 0x54, 0x40, 0x80, - 0x7f, 0xf7, 0xc0, - - /* U+0421 "С" */ - 0x0, 0x9b, 0x3b, 0xfa, 0xd4, 0x0, 0x5b, 0x20, - 0xd0, 0xcf, 0x50, 0x1e, 0x53, 0x90, 0xf1, 0x98, - 0xf6, 0x26, 0x60, 0x7, 0x1b, 0xe8, 0x58, 0x7, - 0xe5, 0x2, 0x0, 0xfc, 0x22, 0x0, 0xfe, 0x11, - 0x0, 0x7f, 0x28, 0x10, 0x7, 0xed, 0xb, 0x0, - 0xfc, 0xc4, 0xcc, 0x0, 0xe4, 0x70, 0xf2, 0x9c, - 0x87, 0x8c, 0xbf, 0x2, 0xd9, 0x6, 0x86, 0x7a, - 0x80, - - /* U+0422 "Т" */ - 0xf, 0xff, 0xf8, 0x1, 0x11, 0x94, 0x16, 0x23, - 0x0, 0x1d, 0xf6, 0x6, 0x3b, 0xe0, 0xf, 0xff, - 0xf8, 0x7, 0xff, 0xb0, - - /* U+0423 "У" */ - 0x7f, 0x60, 0xe, 0x7f, 0x76, 0xb, 0x0, 0xe9, - 0x7, 0x16, 0x24, 0x0, 0x94, 0x58, 0x1, 0x41, - 0xe0, 0x14, 0x85, 0x80, 0xc, 0xc8, 0x40, 0x46, - 0x84, 0x1, 0x48, 0x50, 0x58, 0x78, 0x6, 0x51, - 0x72, 0x62, 0x40, 0xe, 0x90, 0xf0, 0xb0, 0xf, - 0x30, 0x10, 0x30, 0x7, 0x85, 0x41, 0x80, 0x3f, - 0x30, 0x58, 0x7, 0x14, 0x59, 0xa1, 0x0, 0x73, - 0x3a, 0xaa, 0x80, 0x38, - - /* U+0424 "Ф" */ - 0x0, 0xe2, 0xfa, 0x0, 0xfe, 0x59, 0xe0, 0x4a, - 0x72, 0x0, 0xc7, 0xb4, 0xc0, 0x13, 0xc6, 0xc8, - 0x0, 0xb0, 0xa7, 0xf8, 0x13, 0x74, 0x8d, 0x21, - 0x61, 0x2c, 0x1, 0xc5, 0x64, 0xc2, 0x80, 0xe0, - 0x1f, 0x90, 0x10, 0xc0, 0x40, 0x3f, 0x70, 0x19, - 0x1, 0x0, 0x7e, 0xd0, 0x2b, 0x8, 0x0, 0xf8, - 0x94, 0x51, 0xcd, 0x6d, 0x4, 0x0, 0x4f, 0x81, - 0x60, 0xc, 0x74, 0xbc, 0x5, 0xd8, 0x2b, 0x50, - 0xa, 0x3e, 0xe0, 0xe, 0xb7, 0x10, 0x3, 0xc8, - 0xa0, 0xca, 0x40, 0x18, - - /* U+0425 "Х" */ - 0x8, 0xf6, 0x0, 0xec, 0xf2, 0x8, 0x29, 0x10, - 0x9, 0xce, 0x8, 0x1, 0xc1, 0x40, 0x2, 0x83, - 0x70, 0x8, 0xdd, 0x18, 0x38, 0x38, 0x3, 0xa0, - 0xe6, 0x47, 0x4, 0x1, 0xee, 0x6, 0x37, 0x0, - 0xff, 0x58, 0x7, 0xe9, 0x2, 0x82, 0x0, 0xf3, - 0x24, 0x78, 0x70, 0x7, 0x14, 0x9b, 0x94, 0x1b, - 0x0, 0x6e, 0xe, 0x0, 0x39, 0xc9, 0x0, 0x1c, - 0xe0, 0x80, 0x2e, 0xe, 0x2, 0x83, 0x70, 0xc, - 0x50, 0x6c, - - /* U+0426 "Ц" */ - 0x3f, 0x80, 0xf, 0x7e, 0x0, 0x7f, 0xff, 0xc0, - 0x3f, 0xfd, 0xe8, 0xef, 0xe0, 0x27, 0x20, 0x1, - 0xc4, 0x78, 0x6, 0x18, 0xff, 0xff, 0xb0, 0x3, - 0xff, 0x9a, 0x26, 0xe0, - - /* U+0427 "Ч" */ - 0x7f, 0x50, 0xc, 0x7f, 0x20, 0x1f, 0xfd, 0x22, - 0xd, 0x0, 0xf9, 0x5, 0xd8, 0x8a, 0x60, 0x0, - 0xd0, 0xce, 0xed, 0x40, 0x12, 0x76, 0x55, 0x50, - 0x1, 0xc6, 0xab, 0x20, 0x7, 0xff, 0x78, - - /* U+0428 "Ш" */ - 0x3f, 0x80, 0xc, 0x9f, 0x0, 0x19, 0x3d, 0xc0, - 0x3f, 0xff, 0xe0, 0x1f, 0xff, 0xf0, 0xf, 0xfe, - 0x52, 0x3b, 0xed, 0x4, 0x77, 0xdc, 0x1, 0x8e, - 0x23, 0x30, 0x1c, 0x46, 0x50, 0x0, - - /* U+0429 "Щ" */ - 0x3f, 0x80, 0xc, 0x9f, 0x0, 0x19, 0x3d, 0xc0, - 0x3f, 0xff, 0xe0, 0x1f, 0xff, 0xf0, 0xf, 0xfe, - 0xaa, 0x3b, 0xed, 0x4, 0x77, 0xdc, 0x18, 0xe0, - 0x3, 0x88, 0xcc, 0x7, 0x11, 0x94, 0x12, 0xf, - 0xff, 0xff, 0x86, 0xe0, 0x1f, 0xfd, 0x7e, 0x30, - - /* U+042A "Ъ" */ - 0x7f, 0xfe, 0x20, 0xf, 0x92, 0x22, 0x30, 0xf, - 0xe3, 0x77, 0x94, 0x3, 0xff, 0xa2, 0xc4, 0x41, - 0x0, 0xff, 0x5e, 0xeb, 0xbe, 0xc8, 0x3, 0xe9, - 0xaa, 0x99, 0x30, 0x40, 0x3c, 0x8a, 0xb4, 0xb8, - 0xc8, 0x7, 0xfd, 0x60, 0x40, 0x1f, 0xfc, 0xda, - 0xd, 0x0, 0xf5, 0x3b, 0xa3, 0x18, 0x98, 0x3, - 0xcf, 0x10, 0x71, 0x6c, 0x10, - - /* U+042B "Ы" */ - 0x3f, 0x80, 0xf, 0xd5, 0xe2, 0x1, 0xff, 0xe0, - 0x12, 0x20, 0x80, 0x7f, 0x9b, 0x75, 0xdf, 0xaa, - 0x1, 0xf2, 0x55, 0x50, 0x74, 0xc0, 0x1e, 0x35, - 0x59, 0xf0, 0x2c, 0x3, 0xfe, 0x22, 0x80, 0x3f, - 0xf8, 0x6, 0x1, 0xff, 0xc0, 0x31, 0x20, 0xf, - 0x23, 0xbd, 0x58, 0x12, 0x1, 0xe3, 0x88, 0x91, - 0x18, 0x80, 0x18, - - /* U+042C "Ь" */ - 0x3f, 0x80, 0xf, 0xfe, 0xf8, 0x91, 0x4, 0x3, - 0xe6, 0xdd, 0x77, 0xea, 0x80, 0x64, 0xaa, 0xa0, - 0xe9, 0x80, 0x23, 0x55, 0x9f, 0x2, 0xc0, 0x3f, - 0x11, 0x40, 0x1f, 0xc6, 0x1, 0xfc, 0x62, 0x40, - 0x12, 0x3b, 0xd5, 0x81, 0x20, 0x11, 0xc4, 0x48, - 0x8c, 0x40, - - /* U+042D "Э" */ - 0x1, 0x8c, 0xff, 0x75, 0x18, 0x6, 0xe7, 0x68, - 0x83, 0xa6, 0x40, 0x4, 0xbd, 0x4e, 0xe9, 0xe4, - 0x76, 0x0, 0x50, 0x80, 0x75, 0x4, 0x0, 0x7f, - 0xb, 0xa, 0x0, 0x44, 0x5e, 0xe0, 0x30, 0x2, - 0xee, 0xfa, 0x3, 0xc0, 0x9, 0x55, 0xe6, 0xf, - 0x0, 0xa, 0xaf, 0x80, 0x6, 0x1, 0xf8, 0x5c, - 0x50, 0x24, 0x40, 0x3a, 0xc6, 0x0, 0xd, 0xd4, - 0xee, 0x9e, 0x57, 0x60, 0x7, 0x3b, 0x44, 0x1d, - 0x32, 0x0, 0x0, - - /* U+042E "Ю" */ - 0x2f, 0xa0, 0xe, 0x5b, 0xef, 0xea, 0x30, 0xf, - 0xf5, 0xd3, 0x32, 0x1d, 0x31, 0xc0, 0x3f, 0x4a, - 0x36, 0xc3, 0xcf, 0x94, 0x20, 0x7, 0x89, 0x8a, - 0x40, 0x30, 0xf8, 0x48, 0x7, 0x94, 0x2c, 0x3, - 0xc4, 0x84, 0x40, 0x8, 0x89, 0x80, 0xa0, 0x1f, - 0x18, 0x38, 0x1, 0x77, 0x48, 0x2, 0x1, 0xf7, - 0x81, 0x80, 0x12, 0xa8, 0x60, 0x20, 0x1f, 0x78, - 0x18, 0x0, 0x55, 0x48, 0xa, 0x1, 0xf1, 0x83, - 0x80, 0x75, 0x5, 0x80, 0x78, 0x90, 0x88, 0x1, - 0xc4, 0xa5, 0x20, 0x18, 0x7c, 0x24, 0x3, 0xea, - 0x46, 0xd8, 0x79, 0xf2, 0x84, 0x0, 0xfd, 0x72, - 0x2d, 0xe, 0x98, 0xe0, 0x0, - - /* U+042F "Я" */ - 0x0, 0x3e, 0x7f, 0xf5, 0x85, 0x40, 0xbc, 0x44, - 0x0, 0x25, 0x1d, 0x87, 0x78, 0x0, 0xe0, 0x80, - 0x1f, 0x30, 0x30, 0x7, 0xc6, 0x47, 0x26, 0x45, - 0x0, 0x58, 0xcc, 0xcd, 0xd8, 0x2, 0x19, 0x80, - 0x6a, 0xa0, 0x6, 0x18, 0x29, 0x55, 0x0, 0x6b, - 0x9, 0x0, 0xf2, 0x2a, 0x90, 0x3, 0xd2, 0x16, - 0x1, 0xe7, 0x29, 0x10, 0xf, 0x0, - - /* U+0430 "а" */ - 0x18, 0xce, 0xfd, 0x70, 0x1, 0x32, 0xc4, 0xb4, - 0x48, 0x1f, 0x4b, 0x32, 0xd9, 0x82, 0x1, 0xed, - 0x4, 0x6, 0xcf, 0xfa, 0xc0, 0xde, 0x5a, 0xb3, - 0x12, 0x0, 0xa2, 0xa5, 0x33, 0x0, 0x7f, 0x58, - 0x1, 0x4a, 0xd9, 0xf4, 0x40, 0x10, 0xeb, 0x35, - 0x4f, 0x0, 0x0, - - /* U+0431 "б" */ - 0x0, 0xf8, 0x48, 0x3, 0x8e, 0xbb, 0xfb, 0x4c, - 0x2, 0x6c, 0x78, 0xbb, 0x61, 0x80, 0xe, 0x53, - 0x59, 0x10, 0x60, 0x14, 0x8d, 0x80, 0x7e, 0x45, - 0x8d, 0xfe, 0x91, 0x0, 0x85, 0x1d, 0xd2, 0xed, - 0xe2, 0x1, 0xa2, 0x9a, 0x68, 0x60, 0x3, 0x38, - 0x4, 0xa4, 0xe0, 0x1, 0x20, 0xe, 0x71, 0x10, - 0x18, 0x7, 0xf9, 0x88, 0x3, 0x9c, 0x44, 0x1a, - 0xe, 0x1, 0x29, 0x38, 0x1, 0x8e, 0x29, 0xa6, - 0x86, 0x0, 0x2c, 0x77, 0x4b, 0xaf, 0x88, 0x0, - - /* U+0432 "в" */ - 0x5f, 0xfd, 0xd4, 0x20, 0x14, 0x5d, 0xa5, 0x70, - 0x2, 0x34, 0x43, 0xb1, 0x0, 0x70, 0xa3, 0x98, - 0x5, 0x7f, 0xd6, 0x5a, 0x1, 0x4e, 0x62, 0x47, - 0x4, 0x0, 0x46, 0x66, 0x92, 0x70, 0xf, 0xc2, - 0x0, 0x34, 0x43, 0x50, 0x28, 0x2, 0x2e, 0xd0, - 0xb8, 0x40, - - /* U+0433 "г" */ - 0x5f, 0xff, 0x48, 0x2, 0x2e, 0xf8, 0x0, 0x68, - 0x98, 0x80, 0x3f, 0xfd, 0x80, - - /* U+0434 "д" */ - 0x0, 0x9f, 0xff, 0xc6, 0x1, 0xe9, 0xbb, 0x30, - 0x7, 0xe4, 0x4b, 0xc0, 0x3f, 0xf8, 0xdc, 0x6, - 0x1, 0xfc, 0x40, 0x20, 0x1f, 0xca, 0x60, 0x1f, - 0xc8, 0x36, 0x1, 0xf9, 0x68, 0x9, 0x12, 0xf0, - 0x42, 0x1a, 0x10, 0xab, 0xb9, 0x82, 0x28, 0x1, - 0x9f, 0xff, 0x18, 0x7, 0xff, 0x4, 0x60, 0x80, - 0x3e, 0x9b, - - /* U+0435 "е" */ - 0x0, 0x3e, 0xff, 0xac, 0xc0, 0x2b, 0x87, 0x98, - 0x6c, 0x30, 0x74, 0xaa, 0x33, 0xe0, 0xc0, 0x59, - 0x28, 0x4, 0x2e, 0x80, 0x65, 0xff, 0xcc, 0x2, - 0x5, 0x99, 0xf0, 0x91, 0xc, 0xfe, 0xa, 0x8, - 0x0, 0xe1, 0x7, 0x47, 0xc7, 0x68, 0xca, 0x0, - 0x5c, 0x84, 0x4a, 0xb7, 0x80, - - /* U+0436 "ж" */ - 0x6, 0xf7, 0x0, 0xaf, 0x80, 0x24, 0xfa, 0x0, - 0x34, 0x41, 0x40, 0x3c, 0x76, 0x94, 0x1, 0x3b, - 0x52, 0x0, 0x62, 0xd3, 0xb0, 0xe, 0x95, 0xb3, - 0x0, 0xe, 0x1e, 0x0, 0x7c, 0xc1, 0xac, 0x38, - 0x26, 0x20, 0x1e, 0x63, 0xa2, 0x20, 0x1d, 0x8d, - 0x80, 0x71, 0x4a, 0xab, 0x48, 0x31, 0x25, 0x50, - 0x3, 0x48, 0xd8, 0xb, 0x9, 0x3, 0x1d, 0x0, - 0x4c, 0x96, 0x20, 0x1f, 0x70, 0xc8, 0xc, 0xaa, - 0x80, 0x3f, 0x14, 0x32, 0x0, - - /* U+0437 "з" */ - 0x5c, 0xef, 0xea, 0x20, 0x36, 0x99, 0x3a, 0xe0, - 0x35, 0x3b, 0x4c, 0x9, 0x80, 0x42, 0x76, 0x26, - 0x0, 0xee, 0x60, 0x78, 0x5, 0xb7, 0x25, 0xa0, - 0x11, 0xa3, 0x69, 0xb0, 0x7, 0x38, 0xd, 0x43, - 0x2c, 0x58, 0x31, 0x2c, 0xd2, 0xb6, 0x88, - - /* U+0438 "и" */ - 0x5f, 0x40, 0x9, 0x7f, 0xc2, 0x1, 0xe8, 0x0, - 0xfc, 0xe4, 0x80, 0x1e, 0x18, 0x73, 0x0, 0xf5, - 0x8c, 0x0, 0x79, 0x16, 0xc0, 0x3e, 0x93, 0x50, - 0xf, 0x79, 0x78, 0x7, 0xc8, 0xc6, 0x1, 0xf0, - 0xc0, 0x7, 0x80, - - /* U+0439 "й" */ - 0x0, 0x30, 0x80, 0x11, 0x0, 0x1b, 0x20, 0xa, - 0x44, 0x3, 0x42, 0x7e, 0xb2, 0x80, 0x62, 0xdd, - 0x75, 0x80, 0x4b, 0xe8, 0x4, 0x2b, 0xfe, 0x10, - 0xf, 0x40, 0x7, 0xe7, 0x24, 0x0, 0xf0, 0xc3, - 0x98, 0x7, 0xac, 0x60, 0x3, 0xc8, 0xb6, 0x1, - 0xf4, 0x9a, 0x80, 0x7b, 0xcb, 0xc0, 0x3e, 0x46, - 0x30, 0xf, 0x86, 0x0, 0x3c, - - /* U+043A "к" */ - 0x5f, 0x40, 0xa, 0xbd, 0x40, 0x3d, 0x4b, 0x4a, - 0x1, 0xd2, 0xb4, 0xa0, 0x1d, 0x2d, 0x2a, 0x1, - 0xd0, 0xc0, 0x20, 0x1e, 0x38, 0x58, 0x30, 0xe, - 0x77, 0x58, 0xf0, 0x7, 0x60, 0xd, 0x14, 0x0, - 0x7c, 0x8c, 0xe6, 0x1, 0xf4, 0x96, 0x80, - - /* U+043B "л" */ - 0x0, 0xab, 0xff, 0xc0, 0x1e, 0xbb, 0x90, 0x3, - 0xe4, 0x48, 0x80, 0x38, 0x44, 0x1, 0xfc, 0xe0, - 0x1f, 0xe1, 0x20, 0xf, 0xe2, 0x50, 0xf, 0xcc, - 0x18, 0x1, 0xe2, 0x99, 0x1a, 0x80, 0x79, 0xd1, - 0xf0, 0x3, 0xe0, - - /* U+043C "м" */ - 0x5f, 0xf1, 0x80, 0x69, 0xff, 0x0, 0x52, 0x1, - 0xb, 0x0, 0x66, 0x51, 0x0, 0x30, 0xa0, 0x5, - 0xa2, 0xc0, 0xa, 0x60, 0xe, 0x6a, 0x4, 0x29, - 0x0, 0xe9, 0x24, 0xf5, 0x10, 0xe, 0x15, 0x84, - 0xe0, 0xf, 0xb8, 0xc9, 0x0, 0x3e, 0x4e, 0xd0, - 0xf, 0xe1, 0x0, 0xe0, - - /* U+043D "н" */ - 0x5f, 0x40, 0xc, 0xfe, 0x40, 0x1f, 0xfc, 0xff, - 0x0, 0xd7, 0xff, 0x9c, 0x3, 0x46, 0x66, 0x60, - 0xc, 0x67, 0xdc, 0x1, 0xff, 0xd4, - - /* U+043E "о" */ - 0x1, 0x9e, 0xfe, 0x91, 0x0, 0xb1, 0x9e, 0x5d, - 0xb0, 0x42, 0xa, 0x64, 0xd3, 0x22, 0x90, 0x51, - 0x60, 0x9, 0x85, 0x40, 0x88, 0x1, 0xc4, 0x40, - 0xf, 0xf8, 0x88, 0x1, 0xc4, 0x40, 0x51, 0x60, - 0x9, 0x85, 0x42, 0xa, 0x64, 0xd3, 0x22, 0x90, - 0x6, 0x33, 0xcb, 0xb6, 0x8, 0x0, - - /* U+043F "п" */ - 0x5f, 0xff, 0xc4, 0x0, 0x8b, 0xbc, 0xa0, 0x18, - 0xd1, 0x36, 0x80, 0x7f, 0xff, 0x0, - - /* U+0440 "р" */ - 0x5f, 0x58, 0xef, 0xd5, 0x0, 0xd6, 0x59, 0xaf, - 0x4a, 0x1, 0x1d, 0x11, 0x28, 0xec, 0x2, 0xa0, - 0xd, 0x42, 0x80, 0x3, 0x0, 0xc4, 0x4, 0x0, - 0x10, 0xf, 0xed, 0x0, 0xc6, 0x4, 0x0, 0x61, - 0x0, 0xa4, 0x50, 0x0, 0x58, 0xee, 0xd1, 0xb0, - 0xa, 0x16, 0x60, 0x29, 0x40, 0x34, 0x77, 0xea, - 0x80, 0x7f, 0xf5, 0x0, - - /* U+0441 "с" */ - 0x0, 0x3e, 0xff, 0xb1, 0x83, 0x21, 0xa2, 0x57, - 0x5c, 0xde, 0xdd, 0xa6, 0xe8, 0x60, 0x3, 0x88, - 0x80, 0x1f, 0xfc, 0x22, 0x20, 0x7, 0xa8, 0x60, - 0x3, 0x9c, 0xde, 0xdd, 0xa6, 0xc3, 0x21, 0xa2, - 0xb, 0xa0, - - /* U+0442 "т" */ - 0x7f, 0xff, 0xe5, 0xbb, 0x94, 0x2e, 0xf1, 0x22, - 0x44, 0x8, 0x98, 0x3, 0xff, 0xf4, - - /* U+0443 "у" */ - 0x4f, 0x70, 0xe, 0xce, 0x4, 0x2a, 0x0, 0xc4, - 0x6c, 0x0, 0xa2, 0x30, 0xa, 0x82, 0x80, 0xc, - 0x14, 0x1, 0x32, 0x10, 0x0, 0x55, 0x80, 0xa, - 0x3c, 0x1, 0xb8, 0x14, 0x38, 0x54, 0x3, 0x20, - 0xc8, 0xa3, 0x80, 0x7a, 0x4e, 0xc2, 0x80, 0x3c, - 0xc0, 0xa6, 0x60, 0xf, 0xa, 0x5, 0x0, 0x7e, - 0x10, 0x60, 0xf, 0x85, 0x58, 0x3, 0xc6, 0xba, - 0x16, 0x1, 0xea, 0xa0, 0xd1, 0x0, 0x70, - - /* U+0444 "ф" */ - 0x0, 0xf1, 0x7c, 0x0, 0x7f, 0xf6, 0x8f, 0x3f, - 0x18, 0x1, 0x3f, 0xce, 0x1, 0xe, 0x14, 0x25, - 0x3, 0x14, 0xac, 0x38, 0x2, 0x3, 0x1e, 0x2c, - 0x16, 0xda, 0xd2, 0x0, 0x8, 0x64, 0x0, 0x70, - 0x30, 0xb, 0x41, 0x0, 0x98, 0x3, 0xf8, 0x80, - 0x40, 0x3f, 0xf8, 0x46, 0x2, 0xc0, 0x1f, 0xc4, - 0x4, 0xe, 0x64, 0x0, 0x70, 0x30, 0xb, 0x41, - 0x2, 0xc3, 0x1d, 0xd6, 0xb, 0x6d, 0x69, 0x0, - 0x2, 0xc2, 0x8b, 0xa0, 0x62, 0x95, 0x87, 0x0, - 0x8f, 0x3f, 0x18, 0x1, 0x3f, 0xce, 0x1, 0xff, - 0xe3, - - /* U+0445 "х" */ - 0xc, 0xf2, 0x0, 0x9b, 0xe0, 0x1, 0xa3, 0xe0, - 0x2, 0x93, 0x80, 0x0, 0xd9, 0x48, 0x78, 0xe8, - 0x6, 0x56, 0x66, 0x15, 0x8, 0x7, 0x49, 0x1b, - 0x20, 0x7, 0x8c, 0x81, 0x40, 0x3e, 0xe1, 0x83, - 0x80, 0xe, 0xa2, 0xa7, 0x57, 0x30, 0x9, 0x95, - 0xd0, 0x2c, 0x74, 0x40, 0xa4, 0xe0, 0x0, 0x3a, - 0x34, 0x0, - - /* U+0446 "ц" */ - 0x5f, 0x40, 0xc, 0xfe, 0x40, 0x1f, 0xff, 0xf0, - 0xe, 0x34, 0x4d, 0xa0, 0x82, 0x0, 0x8b, 0xbc, - 0xa1, 0x2e, 0xbf, 0xff, 0x88, 0x3, 0xff, 0x93, - 0x6a, - - /* U+0447 "ч" */ - 0xbf, 0x0, 0xd3, 0xe0, 0x1f, 0x84, 0x3, 0xe3, - 0x0, 0xfb, 0x2, 0x44, 0x0, 0x60, 0xac, 0xce, - 0xff, 0x28, 0x2, 0x7b, 0x32, 0x40, 0x8, 0x4c, - 0xe2, 0x0, 0xff, 0xe2, 0x80, - - /* U+0448 "ш" */ - 0x5f, 0x40, 0xa, 0x7c, 0x3, 0x66, 0x80, 0x7f, - 0xff, 0xc0, 0x3f, 0xf9, 0xa6, 0x89, 0x10, 0x2a, - 0x24, 0x20, 0x14, 0x5d, 0xc8, 0x15, 0x77, 0x10, - 0x0, - - /* U+0449 "щ" */ - 0x5f, 0x40, 0xa, 0x7c, 0x3, 0x66, 0x80, 0x7f, - 0xff, 0xc0, 0x3f, 0xfb, 0xa6, 0x89, 0x10, 0x2a, - 0x24, 0x26, 0x80, 0x14, 0x5d, 0xc8, 0x15, 0x77, - 0x10, 0xd9, 0x2f, 0xff, 0xff, 0x3, 0x40, 0x3f, - 0xfa, 0x67, 0x4, - - /* U+044A "ъ" */ - 0x7f, 0xfc, 0xa0, 0x1e, 0x5b, 0xb4, 0x0, 0x7e, - 0x24, 0x41, 0x80, 0x7f, 0xf0, 0x4c, 0x3, 0xfe, - 0x9f, 0xfb, 0x14, 0x3, 0xcf, 0x98, 0xa0, 0xa4, - 0x0, 0xed, 0x33, 0x2f, 0x6, 0x80, 0x7f, 0xf1, - 0x75, 0x10, 0xde, 0x1a, 0x1, 0xcf, 0x76, 0x86, - 0xb4, - - /* U+044B "ы" */ - 0x5f, 0x40, 0xf, 0xbe, 0x40, 0x3f, 0xfb, 0x57, - 0xff, 0x62, 0x0, 0x7a, 0x33, 0x12, 0x36, 0x60, - 0x1c, 0x67, 0x34, 0x82, 0x0, 0x7f, 0xf1, 0x4d, - 0x10, 0xd4, 0xa, 0x1, 0xd1, 0x76, 0x85, 0xc2, - 0x0, 0x80, - - /* U+044C "ь" */ - 0x5f, 0x40, 0xf, 0xfe, 0xbd, 0xff, 0xd8, 0x80, - 0x14, 0x66, 0x24, 0x6c, 0xc0, 0x6, 0x73, 0x48, - 0x20, 0x7, 0xfc, 0x68, 0x86, 0xa0, 0x50, 0x4, - 0x5d, 0xa1, 0x70, 0x80, - - /* U+044D "э" */ - 0x8d, 0xff, 0x62, 0x80, 0x15, 0x53, 0x27, 0xa8, - 0xd, 0x86, 0x65, 0xab, 0x98, 0x7, 0x40, 0x50, - 0x77, 0xfd, 0xa0, 0x41, 0xb9, 0x98, 0x2, 0x33, - 0xc2, 0x4, 0x1, 0xd0, 0x15, 0xd0, 0xcf, 0xaa, - 0xc6, 0xcb, 0x30, 0x33, 0x20, - - /* U+044E "ю" */ - 0x4f, 0x50, 0xa, 0x37, 0xfa, 0x88, 0x3, 0xeb, - 0x77, 0x4b, 0x2e, 0x10, 0x7, 0x32, 0x3d, 0x34, - 0x58, 0xc0, 0x6, 0x1d, 0x9, 0x0, 0x90, 0xd4, - 0x2, 0xae, 0x41, 0x10, 0x6, 0x50, 0x20, 0x4, - 0x59, 0x0, 0x7f, 0xc4, 0x8c, 0x22, 0x0, 0xca, - 0x4, 0x1, 0xb8, 0x24, 0x2, 0x43, 0x50, 0xe, - 0x54, 0x7a, 0x68, 0xb1, 0x80, 0xf, 0x5b, 0xba, - 0x59, 0x70, 0x80, - - /* U+044F "я" */ - 0x2, 0xae, 0xff, 0xc8, 0x1e, 0xb3, 0x76, 0x70, - 0x1, 0x94, 0x3a, 0x23, 0x40, 0xe, 0x2, 0x1, - 0xe5, 0xb, 0x31, 0x0, 0xc3, 0x61, 0x9d, 0xf4, - 0x1, 0x24, 0x83, 0xe4, 0x0, 0x45, 0x4b, 0x6, - 0x40, 0x17, 0x1d, 0x0, 0x74, 0x9f, 0x80, 0x78, - - /* U+0451 "ё" */ - 0x0, 0x4e, 0x2, 0x62, 0x80, 0x65, 0x30, 0x13, - 0x30, 0x6, 0xcf, 0x5, 0xf6, 0x0, 0xff, 0xe1, - 0x3e, 0xff, 0xac, 0xc0, 0x2b, 0x87, 0x98, 0x6c, - 0x30, 0x74, 0xaa, 0x33, 0xe0, 0xc0, 0x59, 0x28, - 0x4, 0x2e, 0x80, 0x65, 0xff, 0xcc, 0x2, 0x5, - 0x99, 0xf0, 0x91, 0xc, 0xfe, 0xa, 0x8, 0x0, - 0xe1, 0x7, 0x47, 0xc7, 0x68, 0xca, 0x0, 0x5c, - 0x84, 0x4a, 0xb7, 0x80 -}; - - -/*--------------------- - * GLYPH DESCRIPTION - *--------------------*/ - -static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { - {.bitmap_index = 0, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */, - {.bitmap_index = 0, .adv_w = 92, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 0, .adv_w = 115, .box_w = 3, .box_h = 13, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 16, .adv_w = 132, .box_w = 6, .box_h = 5, .ofs_x = 1, .ofs_y = 8}, - {.bitmap_index = 26, .adv_w = 241, .box_w = 13, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 105, .adv_w = 183, .box_w = 9, .box_h = 17, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 167, .adv_w = 274, .box_w = 16, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 260, .adv_w = 225, .box_w = 13, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 332, .adv_w = 79, .box_w = 3, .box_h = 5, .ofs_x = 1, .ofs_y = 8}, - {.bitmap_index = 337, .adv_w = 112, .box_w = 5, .box_h = 16, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 376, .adv_w = 112, .box_w = 5, .box_h = 16, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 415, .adv_w = 144, .box_w = 9, .box_h = 9, .ofs_x = 0, .ofs_y = 4}, - {.bitmap_index = 451, .adv_w = 241, .box_w = 13, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 483, .adv_w = 92, .box_w = 3, .box_h = 5, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 491, .adv_w = 104, .box_w = 6, .box_h = 3, .ofs_x = 0, .ofs_y = 3}, - {.bitmap_index = 498, .adv_w = 92, .box_w = 3, .box_h = 3, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 503, .adv_w = 97, .box_w = 7, .box_h = 15, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 546, .adv_w = 183, .box_w = 10, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 602, .adv_w = 183, .box_w = 9, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 626, .adv_w = 183, .box_w = 9, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 676, .adv_w = 183, .box_w = 10, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 733, .adv_w = 183, .box_w = 11, .box_h = 13, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 784, .adv_w = 183, .box_w = 9, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 832, .adv_w = 183, .box_w = 10, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 895, .adv_w = 183, .box_w = 9, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 938, .adv_w = 183, .box_w = 10, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1001, .adv_w = 183, .box_w = 10, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1062, .adv_w = 97, .box_w = 2, .box_h = 10, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 1072, .adv_w = 97, .box_w = 3, .box_h = 12, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 1087, .adv_w = 241, .box_w = 13, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1144, .adv_w = 241, .box_w = 13, .box_h = 7, .ofs_x = 1, .ofs_y = 2}, - {.bitmap_index = 1167, .adv_w = 241, .box_w = 13, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1223, .adv_w = 153, .box_w = 8, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1266, .adv_w = 288, .box_w = 16, .box_h = 17, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 1388, .adv_w = 197, .box_w = 13, .box_h = 13, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 1454, .adv_w = 198, .box_w = 11, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1512, .adv_w = 201, .box_w = 11, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1569, .adv_w = 222, .box_w = 12, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1625, .adv_w = 182, .box_w = 10, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1661, .adv_w = 166, .box_w = 9, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1690, .adv_w = 223, .box_w = 12, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1757, .adv_w = 217, .box_w = 11, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1780, .adv_w = 85, .box_w = 3, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1785, .adv_w = 85, .box_w = 5, .box_h = 17, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 1800, .adv_w = 189, .box_w = 12, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1855, .adv_w = 160, .box_w = 9, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1869, .adv_w = 248, .box_w = 13, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1929, .adv_w = 215, .box_w = 11, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1976, .adv_w = 227, .box_w = 13, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 2049, .adv_w = 174, .box_w = 10, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 2092, .adv_w = 227, .box_w = 13, .box_h = 15, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 2174, .adv_w = 200, .box_w = 11, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 2230, .adv_w = 183, .box_w = 10, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 2289, .adv_w = 176, .box_w = 13, .box_h = 13, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 2309, .adv_w = 211, .box_w = 11, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 2343, .adv_w = 197, .box_w = 13, .box_h = 13, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 2411, .adv_w = 285, .box_w = 18, .box_h = 13, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 2518, .adv_w = 197, .box_w = 12, .box_h = 13, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 2584, .adv_w = 176, .box_w = 13, .box_h = 13, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 2628, .adv_w = 197, .box_w = 12, .box_h = 13, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 2681, .adv_w = 112, .box_w = 5, .box_h = 17, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 2698, .adv_w = 97, .box_w = 7, .box_h = 15, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 2739, .adv_w = 112, .box_w = 5, .box_h = 17, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 2753, .adv_w = 241, .box_w = 13, .box_h = 5, .ofs_x = 1, .ofs_y = 8}, - {.bitmap_index = 2780, .adv_w = 144, .box_w = 11, .box_h = 3, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 2789, .adv_w = 144, .box_w = 5, .box_h = 4, .ofs_x = 1, .ofs_y = 11}, - {.bitmap_index = 2799, .adv_w = 176, .box_w = 9, .box_h = 10, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 2842, .adv_w = 183, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 2890, .adv_w = 158, .box_w = 8, .box_h = 10, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 2924, .adv_w = 183, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 2970, .adv_w = 177, .box_w = 10, .box_h = 10, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 3015, .adv_w = 101, .box_w = 7, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 3044, .adv_w = 183, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 3101, .adv_w = 183, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 3132, .adv_w = 80, .box_w = 3, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 3143, .adv_w = 80, .box_w = 5, .box_h = 18, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 3165, .adv_w = 167, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 3205, .adv_w = 80, .box_w = 3, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 3210, .adv_w = 281, .box_w = 15, .box_h = 10, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 3250, .adv_w = 183, .box_w = 9, .box_h = 10, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 3277, .adv_w = 176, .box_w = 10, .box_h = 10, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 3323, .adv_w = 183, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 3375, .adv_w = 183, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 3422, .adv_w = 118, .box_w = 7, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 3442, .adv_w = 150, .box_w = 9, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 3486, .adv_w = 113, .box_w = 7, .box_h = 13, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 3517, .adv_w = 183, .box_w = 9, .box_h = 10, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 3542, .adv_w = 170, .box_w = 11, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 3591, .adv_w = 236, .box_w = 14, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 3660, .adv_w = 170, .box_w = 11, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 3710, .adv_w = 170, .box_w = 11, .box_h = 14, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 3773, .adv_w = 151, .box_w = 9, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 3809, .adv_w = 183, .box_w = 8, .box_h = 17, .ofs_x = 2, .ofs_y = -3}, - {.bitmap_index = 3859, .adv_w = 97, .box_w = 2, .box_h = 18, .ofs_x = 2, .ofs_y = -4}, - {.bitmap_index = 3864, .adv_w = 183, .box_w = 8, .box_h = 17, .ofs_x = 2, .ofs_y = -3}, - {.bitmap_index = 3916, .adv_w = 241, .box_w = 13, .box_h = 4, .ofs_x = 1, .ofs_y = 4}, - {.bitmap_index = 3940, .adv_w = 182, .box_w = 10, .box_h = 16, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 3990, .adv_w = 197, .box_w = 13, .box_h = 13, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 4056, .adv_w = 198, .box_w = 11, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 4107, .adv_w = 198, .box_w = 11, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 4165, .adv_w = 176, .box_w = 9, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 4181, .adv_w = 225, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 4245, .adv_w = 182, .box_w = 10, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 4281, .adv_w = 310, .box_w = 20, .box_h = 13, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 4383, .adv_w = 185, .box_w = 10, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 4442, .adv_w = 215, .box_w = 11, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 4489, .adv_w = 215, .box_w = 11, .box_h = 17, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 4553, .adv_w = 204, .box_w = 12, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 4608, .adv_w = 217, .box_w = 12, .box_h = 13, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 4656, .adv_w = 248, .box_w = 13, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 4716, .adv_w = 217, .box_w = 11, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 4739, .adv_w = 227, .box_w = 13, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 4812, .adv_w = 217, .box_w = 11, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 4828, .adv_w = 174, .box_w = 10, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 4871, .adv_w = 201, .box_w = 11, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 4928, .adv_w = 176, .box_w = 13, .box_h = 13, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 4948, .adv_w = 176, .box_w = 11, .box_h = 13, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 5008, .adv_w = 248, .box_w = 14, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 5084, .adv_w = 197, .box_w = 12, .box_h = 13, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 5150, .adv_w = 224, .box_w = 13, .box_h = 16, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 5178, .adv_w = 197, .box_w = 10, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 5209, .adv_w = 308, .box_w = 17, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 5239, .adv_w = 315, .box_w = 18, .box_h = 16, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 5279, .adv_w = 240, .box_w = 14, .box_h = 13, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 5332, .adv_w = 254, .box_w = 14, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 5383, .adv_w = 198, .box_w = 11, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 5425, .adv_w = 201, .box_w = 12, .box_h = 13, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 5492, .adv_w = 311, .box_w = 18, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 5585, .adv_w = 200, .box_w = 10, .box_h = 13, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 5639, .adv_w = 176, .box_w = 9, .box_h = 10, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 5682, .adv_w = 178, .box_w = 11, .box_h = 15, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 5754, .adv_w = 170, .box_w = 9, .box_h = 10, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 5796, .adv_w = 151, .box_w = 8, .box_h = 10, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 5809, .adv_w = 199, .box_w = 12, .box_h = 13, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 5859, .adv_w = 177, .box_w = 10, .box_h = 10, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 5904, .adv_w = 259, .box_w = 16, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 5973, .adv_w = 153, .box_w = 8, .box_h = 10, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 6012, .adv_w = 187, .box_w = 10, .box_h = 10, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 6047, .adv_w = 187, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 6100, .adv_w = 174, .box_w = 10, .box_h = 10, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 6139, .adv_w = 184, .box_w = 11, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 6174, .adv_w = 217, .box_w = 11, .box_h = 10, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 6218, .adv_w = 188, .box_w = 10, .box_h = 10, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 6240, .adv_w = 176, .box_w = 10, .box_h = 10, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 6286, .adv_w = 188, .box_w = 10, .box_h = 10, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 6300, .adv_w = 183, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 6352, .adv_w = 158, .box_w = 8, .box_h = 10, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 6386, .adv_w = 168, .box_w = 10, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 6400, .adv_w = 170, .box_w = 11, .box_h = 14, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 6463, .adv_w = 246, .box_w = 15, .box_h = 17, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 6544, .adv_w = 170, .box_w = 11, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 6594, .adv_w = 196, .box_w = 11, .box_h = 13, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 6619, .adv_w = 170, .box_w = 8, .box_h = 10, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 6648, .adv_w = 264, .box_w = 14, .box_h = 10, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 6673, .adv_w = 271, .box_w = 16, .box_h = 13, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 6708, .adv_w = 203, .box_w = 12, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 6749, .adv_w = 227, .box_w = 12, .box_h = 10, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 6783, .adv_w = 170, .box_w = 9, .box_h = 10, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 6811, .adv_w = 158, .box_w = 8, .box_h = 10, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 6848, .adv_w = 242, .box_w = 14, .box_h = 10, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 6907, .adv_w = 173, .box_w = 9, .box_h = 10, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 6947, .adv_w = 177, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0} -}; - -/*--------------------- - * CHARACTER MAPPING - *--------------------*/ - - - -/*Collect the unicode lists and glyph_id offsets*/ -static const lv_font_fmt_txt_cmap_t cmaps[] = -{ - { - .range_start = 32, .range_length = 95, .glyph_id_start = 1, - .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY - }, - { - .range_start = 1025, .range_length = 1, .glyph_id_start = 96, - .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY - }, - { - .range_start = 1040, .range_length = 64, .glyph_id_start = 97, - .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY - }, - { - .range_start = 1105, .range_length = 1, .glyph_id_start = 161, - .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY - } -}; - - - -/*-------------------- - * ALL CUSTOM DATA - *--------------------*/ - -#if LVGL_VERSION_MAJOR == 8 -/*Store all the custom data of the font*/ -static lv_font_fmt_txt_glyph_cache_t cache; -#endif - -#if LVGL_VERSION_MAJOR >= 8 -static const lv_font_fmt_txt_dsc_t font_dsc = { -#else -static lv_font_fmt_txt_dsc_t font_dsc = { -#endif - .glyph_bitmap = glyph_bitmap, - .glyph_dsc = glyph_dsc, - .cmaps = cmaps, - .kern_dsc = NULL, - .kern_scale = 0, - .cmap_num = 4, - .bpp = 4, - .kern_classes = 0, - .bitmap_format = 1, -#if LVGL_VERSION_MAJOR == 8 - .cache = &cache -#endif -}; - - - -/*----------------- - * PUBLIC FONT - *----------------*/ - -/*Initialize a public general font descriptor*/ -#if LVGL_VERSION_MAJOR >= 8 -const lv_font_t lv_font_ru_18 = { -#else -lv_font_t lv_font_ru_18 = { -#endif - .get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt, /*Function pointer to get glyph's data*/ - .get_glyph_bitmap = lv_font_get_bitmap_fmt_txt, /*Function pointer to get glyph's bitmap*/ - .line_height = 22, /*The maximum line height required by the font*/ - .base_line = 5, /*Baseline measured from the bottom of the line*/ -#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) - .subpx = LV_FONT_SUBPX_NONE, -#endif -#if LV_VERSION_CHECK(7, 4, 0) || LVGL_VERSION_MAJOR >= 8 - .underline_position = 0, - .underline_thickness = 1, -#endif - .dsc = &font_dsc, /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */ -#if LV_VERSION_CHECK(8, 2, 0) || LVGL_VERSION_MAJOR >= 9 - .fallback = NULL, -#endif - .user_data = NULL, -}; - - - -#endif /*#if LV_FONT_RU_18*/ - diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/lvgl_russian_font_test/lv_font_ru_24.c b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/lvgl_russian_font_test/lv_font_ru_24.c deleted file mode 100644 index 609a499a..00000000 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/lvgl_russian_font_test/lv_font_ru_24.c +++ /dev/null @@ -1,2048 +0,0 @@ -/******************************************************************************* - * Size: 24 px - * Bpp: 4 - * Opts: --size 24 --bpp 4 --format lvgl --font /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf -r 0x20-0x7E -r 0x0401 -r 0x0410-0x044F -r 0x0451 --lv-include lvgl.h --lv-font-name lv_font_ru_24 -o lv_font_ru_24.c - ******************************************************************************/ - -#ifdef LV_LVGL_H_INCLUDE_SIMPLE -#include "lvgl.h" -#else -#include "lvgl.h" -#endif - -#ifndef LV_FONT_RU_24 -#define LV_FONT_RU_24 1 -#endif - -#if LV_FONT_RU_24 - -/*----------------- - * BITMAPS - *----------------*/ - -/*Store the image of the glyphs*/ -static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { - /* U+0020 " " */ - - /* U+0021 "!" */ - 0x6f, 0xf0, 0x7, 0xff, 0x24, 0xc0, 0x2, 0x2, - 0xe0, 0x62, 0x2, 0x55, 0x0, 0xa8, 0x2, 0x26, - 0xee, 0x0, 0x78, - - /* U+0022 "\"" */ - 0xbf, 0x40, 0x4f, 0xb0, 0xf, 0xfe, 0xb9, 0x99, - 0xc1, 0xcc, 0x80, - - /* U+0023 "#" */ - 0x0, 0xfa, 0x3d, 0x80, 0x5, 0xf6, 0x1, 0xfe, - 0x30, 0x40, 0x2, 0x6, 0x0, 0x7f, 0x90, 0x48, - 0x1, 0x80, 0x80, 0x1f, 0xc6, 0x8, 0x1, 0x20, - 0x18, 0x7, 0xf2, 0x86, 0x80, 0x8, 0x4c, 0x3, - 0xd7, 0xdd, 0x48, 0x4f, 0x73, 0x0, 0xfb, 0xa3, - 0x0, 0x30, 0x8c, 0x0, 0x11, 0xc0, 0x1, 0x19, - 0xc0, 0x1b, 0xfe, 0xd0, 0x4f, 0xf8, 0x83, 0xff, - 0x20, 0x7, 0x20, 0x18, 0x0, 0x48, 0xc0, 0x3f, - 0xd8, 0x18, 0x0, 0x50, 0x50, 0xf, 0xf3, 0x82, - 0x0, 0x30, 0x30, 0x3, 0x87, 0x77, 0x10, 0x6e, - 0xce, 0x17, 0xba, 0xc0, 0x1, 0x91, 0x60, 0x1, - 0x14, 0x0, 0x12, 0x28, 0x0, 0x5f, 0xf3, 0x5, - 0xff, 0xac, 0x1b, 0xfe, 0xe0, 0xf, 0x20, 0x28, - 0x3, 0x3, 0x0, 0x3f, 0x84, 0x88, 0x20, 0x4, - 0x4, 0x0, 0xfe, 0x50, 0x40, 0x8, 0xc4, 0x40, - 0x1f, 0xd8, 0x18, 0x0, 0x30, 0x40, 0xf, 0x80, - - /* U+0024 "$" */ - 0x0, 0xc3, 0xe2, 0x1, 0xff, 0xd2, 0x19, 0xde, - 0xe, 0xe6, 0x40, 0x80, 0xfb, 0x11, 0x82, 0x19, - 0x9c, 0x82, 0xc4, 0xfb, 0x42, 0xb7, 0xa0, 0x41, - 0x2, 0x4, 0x3, 0xb, 0x90, 0x8, 0x38, 0x7, - 0xf1, 0x5, 0x0, 0x7f, 0x58, 0x36, 0xc8, 0x18, - 0x7, 0x34, 0x1, 0x38, 0x6e, 0x9c, 0x3, 0x3f, - 0x4a, 0x80, 0xa, 0x38, 0x80, 0x21, 0x6b, 0xc, - 0x91, 0x17, 0x80, 0x7c, 0x4d, 0xa0, 0x44, 0x0, - 0xfc, 0x60, 0x6, 0x10, 0xf, 0x84, 0x0, 0xde, - 0xe2, 0x1, 0x8b, 0x40, 0x88, 0x31, 0xdb, 0xa0, - 0xfd, 0x30, 0xe0, 0xe8, 0x43, 0x30, 0x9, 0x36, - 0x98, 0xb, 0xdf, 0x70, 0x3b, 0x64, 0x80, 0x3f, - 0xfa, 0x42, 0xe2, 0x1, 0xc0, - - /* U+0025 "%" */ - 0x0, 0x4f, 0x7e, 0xb0, 0x7, 0xcb, 0xf0, 0x1, - 0xd8, 0xc4, 0xc7, 0x2e, 0x1, 0xc3, 0x65, 0x0, - 0x19, 0x4d, 0x32, 0x7c, 0x20, 0x40, 0x34, 0xc, - 0x80, 0x76, 0x7, 0x0, 0x5, 0x81, 0x40, 0x23, - 0x65, 0x40, 0xe, 0x30, 0x60, 0xb, 0x80, 0x80, - 0x2f, 0xb, 0x0, 0xf1, 0x83, 0x0, 0x5c, 0x6, - 0x0, 0x63, 0x81, 0x0, 0xf6, 0x7, 0x0, 0x5, - 0xc1, 0x0, 0x60, 0x9c, 0x3, 0xe5, 0x34, 0xc9, - 0xf1, 0x71, 0x8, 0x19, 0x0, 0xfe, 0xc6, 0x26, - 0x39, 0x80, 0x36, 0x54, 0x7, 0xdf, 0xd6, 0x0, - 0xd3, 0xdf, 0xac, 0x0, 0xe0, 0xb0, 0x98, 0x5, - 0x39, 0x70, 0xf, 0xe7, 0x29, 0x12, 0x62, 0xda, - 0xf1, 0x81, 0x0, 0xf8, 0x60, 0xd8, 0x14, 0x28, - 0x0, 0x2e, 0x8, 0x1, 0xf5, 0x87, 0x80, 0x38, - 0x8, 0x2, 0xe0, 0x20, 0xf, 0x22, 0xb1, 0x80, - 0x7f, 0xf1, 0x64, 0x60, 0x2, 0xe0, 0x20, 0xb, - 0x80, 0x80, 0x39, 0xca, 0x4, 0x2, 0x50, 0xa0, - 0x0, 0xb8, 0x20, 0x6, 0x28, 0x36, 0x0, 0xc4, - 0xc5, 0xb3, 0xe3, 0x2, 0x1, 0xa4, 0x3c, 0x3, - 0xd3, 0x6, 0xc7, 0x2e, 0x0, - - /* U+0026 "&" */ - 0x0, 0xcb, 0x7f, 0xed, 0xa5, 0x0, 0xfe, 0x8a, - 0x40, 0x1, 0x2d, 0x10, 0x7, 0xc4, 0xe0, 0xbd, - 0xfe, 0xa4, 0x0, 0xfc, 0xa0, 0x34, 0x20, 0x5, - 0xb2, 0x0, 0xfe, 0x20, 0xf, 0xfe, 0x12, 0x1, - 0x98, 0x3, 0xff, 0x82, 0x6a, 0x1a, 0x20, 0x1f, - 0xfc, 0x1, 0x70, 0x1c, 0x10, 0xf, 0xf0, 0xf9, - 0x5b, 0x16, 0x8, 0x7, 0x66, 0x4, 0x28, 0x5d, - 0x25, 0x4b, 0x4, 0x2, 0x23, 0x21, 0x24, 0x9, - 0x0, 0x52, 0x16, 0x8, 0x1, 0x1, 0x1, 0x0, - 0x84, 0x2, 0xb3, 0x2c, 0x10, 0xa0, 0xe0, 0x10, - 0xf, 0xb0, 0xcb, 0x18, 0xcc, 0x80, 0x40, 0x42, - 0x1, 0xda, 0x44, 0x90, 0xf0, 0x2, 0x0, 0x28, - 0x3, 0x87, 0x80, 0x2, 0x40, 0x1, 0x80, 0x4c, - 0x40, 0x1, 0x3e, 0x0, 0x7, 0x40, 0x27, 0x70, - 0x1d, 0xff, 0xb6, 0x2, 0x30, 0xe, 0x80, 0x28, - 0xc6, 0x20, 0x1, 0x3e, 0xb9, 0xd0, 0x2c, 0x0, - - /* U+0027 "'" */ - 0xbf, 0x40, 0xf, 0xfe, 0x19, 0x99, 0xc0, - - /* U+0028 "(" */ - 0x0, 0xaf, 0xcc, 0x0, 0x68, 0x83, 0x0, 0x78, - 0x40, 0x0, 0xcc, 0x46, 0x0, 0xa0, 0xa0, 0x9, - 0x81, 0x40, 0x8, 0x2, 0x40, 0x3, 0x5, 0x0, - 0xb0, 0xc, 0x2, 0x70, 0xf0, 0x8, 0x80, 0x40, - 0x38, 0xc0, 0x23, 0x3, 0x0, 0x84, 0x4, 0x2, - 0x50, 0xe0, 0xb, 0x1, 0x0, 0x27, 0x2, 0x0, - 0x88, 0xc1, 0x40, 0x2a, 0xf, 0x0, 0x98, 0x14, - 0x3, 0x38, 0x38, 0x5, 0x3, 0x20, 0x1a, 0x98, - 0x80, - - /* U+0029 ")" */ - 0xd, 0xf1, 0x0, 0xd0, 0x10, 0x1, 0x94, 0x98, - 0x80, 0x35, 0x5, 0x80, 0x65, 0x7, 0x0, 0xc4, - 0x62, 0xa0, 0x19, 0x43, 0x0, 0x36, 0x2, 0x0, - 0x67, 0x2, 0x10, 0x8, 0xc0, 0x6, 0x1, 0x8, - 0x0, 0x40, 0x3c, 0xe0, 0x10, 0x80, 0x1c, 0x2, - 0x30, 0x1, 0x0, 0x4c, 0x0, 0x10, 0x8, 0xc1, - 0x0, 0x36, 0x86, 0x0, 0x65, 0x5, 0x0, 0x94, - 0xc, 0x80, 0x2f, 0x9, 0x0, 0x89, 0x49, 0x40, - 0x2b, 0x8, 0x0, 0xdd, 0xa, 0x1, 0x0, - - /* U+002A "*" */ - 0x0, 0xea, 0xa0, 0x7, 0xff, 0x1a, 0x4c, 0x3, - 0xc7, 0x20, 0x2b, 0x90, 0x1, 0xa3, 0x14, 0x45, - 0x94, 0xba, 0xee, 0xd5, 0xac, 0x10, 0x2, 0xea, - 0x11, 0x13, 0x54, 0x3, 0x9d, 0x80, 0xc, 0xe0, - 0x19, 0x7a, 0x69, 0x55, 0x53, 0xca, 0x3, 0x4f, - 0xca, 0x0, 0x5e, 0x7a, 0x11, 0x74, 0x80, 0x7a, - 0x78, 0x40, 0x40, 0x3f, 0x8, 0x7, 0xbb, 0x80, - 0x1c, - - /* U+002B "+" */ - 0x0, 0xfa, 0x68, 0x3, 0xff, 0x84, 0xea, 0x1, - 0xff, 0xff, 0x0, 0xff, 0xe0, 0x3f, 0xff, 0x84, - 0x3f, 0xfd, 0x20, 0x1f, 0xfc, 0x47, 0xee, 0xf0, - 0x87, 0x77, 0xa4, 0x4, 0x7c, 0x0, 0x11, 0xf0, - 0x7, 0xff, 0xfc, 0x3, 0xc0, - - /* U+002C "," */ - 0x3, 0xff, 0x20, 0x7, 0x9c, 0x0, 0xa1, 0x80, - 0xc2, 0x8, 0x10, 0x0, 0x36, 0x10, - - /* U+002D "-" */ - 0xdf, 0xfe, 0x70, 0xf, 0x80, - - /* U+002E "." */ - 0x1, 0x10, 0x3f, 0x70, 0x3, 0xf8, - - /* U+002F "/" */ - 0x0, 0xe1, 0xfe, 0x0, 0xf2, 0x2, 0x0, 0x7b, - 0xc3, 0xc0, 0x3c, 0x80, 0x80, 0x1c, 0x62, 0x62, - 0x1, 0xd6, 0x16, 0x1, 0xe5, 0x5, 0x0, 0xe2, - 0x2c, 0x1, 0xc8, 0x8, 0x1, 0xed, 0xd, 0x0, - 0xf2, 0x2, 0x0, 0x72, 0x82, 0x80, 0x7b, 0xc3, - 0x0, 0x3c, 0x80, 0xe0, 0x1c, 0x62, 0x62, 0x1, - 0xd6, 0x16, 0x1, 0xe5, 0x4, 0x0, 0xe1, 0x21, - 0x30, 0xe, 0x70, 0x70, 0xf, 0x68, 0x68, 0x7, - 0xb1, 0xd0, 0x3, 0xc0, - - /* U+0030 "0" */ - 0x0, 0x86, 0x77, 0xfa, 0x8c, 0x3, 0x8f, 0xd8, - 0x80, 0x57, 0x18, 0x3, 0x68, 0x9e, 0x7f, 0x28, - 0x49, 0x80, 0x1c, 0x45, 0xa6, 0x3, 0x46, 0x10, - 0x0, 0xa0, 0x71, 0x0, 0xd0, 0x8, 0x22, 0x20, - 0xd0, 0xe, 0x40, 0x2, 0x28, 0x1, 0x40, 0x3c, - 0x41, 0xa2, 0x0, 0x10, 0xf, 0x30, 0x9, 0x80, - 0x7f, 0xc6, 0x1, 0xff, 0xc1, 0x30, 0xf, 0xf8, - 0xc4, 0x0, 0x20, 0x1e, 0x60, 0x15, 0x0, 0x28, - 0x7, 0x88, 0x34, 0x48, 0x30, 0x3, 0x90, 0x0, - 0x81, 0x40, 0xc2, 0x1, 0xa0, 0x10, 0x41, 0xc4, - 0x5a, 0x60, 0x34, 0x61, 0x0, 0x16, 0x81, 0xe7, - 0xf2, 0x84, 0x98, 0x4, 0x7c, 0xc2, 0x2, 0xb8, - 0xc0, 0x0, - - /* U+0031 "1" */ - 0x15, 0x8b, 0xef, 0xf1, 0x80, 0x64, 0xa7, 0x41, - 0x0, 0xfc, 0x29, 0x12, 0x1, 0xf2, 0xf5, 0xba, - 0x0, 0x7f, 0xff, 0xc0, 0x3f, 0xfe, 0xa2, 0x38, - 0x0, 0xe2, 0x30, 0x3, 0xba, 0xc0, 0x5, 0xf7, - 0x42, 0x1, 0xff, 0xc0, - - /* U+0032 "2" */ - 0x1, 0x6a, 0xef, 0xf6, 0xc0, 0x80, 0x7, 0xa5, - 0x44, 0x0, 0x4f, 0xc8, 0x6, 0x5, 0x19, 0xdb, - 0x2, 0x16, 0x47, 0x5a, 0xe6, 0x24, 0xfa, 0x0, - 0xa1, 0x50, 0xf, 0x19, 0x80, 0xc0, 0x3f, 0x98, - 0x3, 0xfe, 0x70, 0x30, 0xf, 0xcc, 0x41, 0x40, - 0x1f, 0x14, 0x83, 0x90, 0x7, 0x87, 0xc0, 0xe0, - 0x3, 0xc3, 0x84, 0x78, 0x1, 0xe1, 0xc2, 0x26, - 0x80, 0x78, 0x74, 0x89, 0x82, 0x1, 0xc3, 0xa6, - 0x58, 0x20, 0x1e, 0xd3, 0x1c, 0x10, 0xf, 0x61, - 0x8e, 0x80, 0x8f, 0x8c, 0xc0, 0x39, 0xdd, 0xef, - 0x0, 0xff, 0xe0, 0x0, - - /* U+0033 "3" */ - 0x2, 0x7b, 0xdf, 0xf7, 0x52, 0x0, 0x68, 0x82, - 0x10, 0x0, 0x56, 0xe4, 0x2, 0x26, 0xac, 0xed, - 0xb4, 0x6, 0x60, 0x2, 0x25, 0x4c, 0x49, 0x2d, - 0x2, 0x80, 0x3f, 0xd8, 0x4, 0x1, 0xfe, 0xd0, - 0x20, 0xf, 0x84, 0xe5, 0x42, 0x40, 0x31, 0x7f, - 0xbb, 0x18, 0x21, 0x40, 0x3f, 0xd0, 0xe0, 0x1c, - 0x5f, 0xee, 0xc4, 0x8d, 0x20, 0xf, 0x84, 0xed, - 0x8b, 0x80, 0x3f, 0xd6, 0x6, 0x40, 0x1f, 0xc4, - 0x0, 0x60, 0xf, 0xe2, 0x0, 0xff, 0xe0, 0x40, - 0x1, 0xb, 0xa1, 0x8, 0x49, 0x71, 0x41, 0xc0, - 0x2, 0xf7, 0xbd, 0xb4, 0x60, 0xd0, 0x5, 0x6c, - 0x62, 0x0, 0x26, 0xc9, 0x0, 0x0, - - /* U+0034 "4" */ - 0x0, 0xfb, 0x7f, 0xcc, 0x1, 0xf9, 0xc8, 0x3, - 0xfc, 0x50, 0x40, 0x1f, 0xe9, 0x9, 0x10, 0xf, - 0xca, 0x8a, 0x80, 0x1f, 0x86, 0xc2, 0xc0, 0x3f, - 0xa0, 0x64, 0x40, 0x3f, 0x1b, 0x1b, 0x0, 0x7f, - 0x70, 0x78, 0x7, 0xf4, 0x13, 0x18, 0x7, 0xe2, - 0x71, 0x80, 0xf, 0xe9, 0x8, 0x10, 0xf, 0x8, - 0x1, 0x82, 0x7f, 0xf8, 0x42, 0x3f, 0x80, 0x3f, - 0xf8, 0x3b, 0xff, 0xf0, 0x84, 0xff, 0x0, 0x7f, - 0xf6, 0xc0, - - /* U+0035 "5" */ - 0x6, 0xff, 0xfd, 0xc0, 0x1f, 0xfc, 0x63, 0xee, - 0xf7, 0x80, 0x78, 0x47, 0xe0, 0xf, 0xfe, 0x99, - 0xf7, 0xfb, 0xa4, 0x80, 0x3e, 0x10, 0x0, 0xb6, - 0xa8, 0x4, 0x6f, 0x7d, 0xfd, 0x22, 0x14, 0x60, - 0x5, 0x84, 0x10, 0x16, 0xf1, 0x8, 0x0, 0xfe, - 0x19, 0x4, 0x0, 0xff, 0x20, 0x0, 0x80, 0x3f, - 0xf8, 0x6, 0x1, 0xfc, 0x80, 0x1, 0x0, 0xfc, - 0x52, 0x8, 0x5, 0xd0, 0x84, 0x24, 0xf8, 0x21, - 0x0, 0x1, 0x7b, 0xde, 0xd8, 0x10, 0xb3, 0x2, - 0x95, 0x21, 0x1, 0x37, 0xe4, 0x0, 0x0, - - /* U+0036 "6" */ - 0x0, 0xc5, 0x3b, 0xfe, 0xd9, 0x30, 0xc, 0xda, - 0xc4, 0x0, 0x26, 0x90, 0x9, 0x64, 0x12, 0xf7, - 0x58, 0xfa, 0x0, 0x1a, 0x6, 0xb4, 0x22, 0x1c, - 0x38, 0x2, 0x40, 0xa4, 0x3, 0xf9, 0x42, 0x80, - 0x3f, 0x84, 0x81, 0xe, 0xfb, 0xf6, 0x4, 0x0, - 0x40, 0x4, 0xc4, 0x10, 0x27, 0xf2, 0x7, 0x0, - 0x41, 0x5f, 0xfa, 0x84, 0x5e, 0x1, 0xde, 0x80, - 0x5, 0xa0, 0x25, 0x0, 0x90, 0x80, 0x32, 0x10, - 0x63, 0x0, 0xc, 0x3, 0xcc, 0x4, 0x40, 0xf, - 0xfe, 0xa, 0x1, 0x80, 0x79, 0x80, 0x83, 0x81, - 0x8, 0x3, 0x21, 0x6, 0x2, 0x98, 0x7a, 0x0, - 0x16, 0x80, 0xd4, 0x1, 0xa4, 0x4b, 0xff, 0x50, - 0x96, 0x80, 0x43, 0xae, 0x40, 0x3, 0x8d, 0x10, - - /* U+0037 "7" */ - 0xf, 0xff, 0xf8, 0xc0, 0x3f, 0xf8, 0x4, 0x1d, - 0xdf, 0x88, 0x14, 0x40, 0x47, 0xe3, 0x20, 0xe0, - 0xf, 0xea, 0x1, 0x40, 0xf, 0xe6, 0x6, 0x0, - 0xfe, 0x41, 0xa, 0x0, 0xfe, 0xe0, 0x32, 0x0, - 0xfc, 0x2a, 0x14, 0x1, 0xfc, 0xe0, 0x7, 0x0, - 0xfe, 0xa0, 0x51, 0x0, 0xfc, 0x46, 0x1c, 0x1, - 0xfd, 0x40, 0x28, 0x1, 0xfc, 0xc0, 0xc0, 0x1f, - 0xc8, 0x21, 0x40, 0x1f, 0xdc, 0x6, 0x40, 0x1f, - 0x85, 0x42, 0x80, 0x3f, 0x9c, 0x0, 0xe0, 0x1e, - - /* U+0038 "8" */ - 0x0, 0x96, 0xfb, 0xfd, 0x90, 0x20, 0x1a, 0xe9, - 0x4, 0x0, 0x6f, 0xe4, 0x0, 0x74, 0x7, 0xef, - 0xe9, 0x1, 0xf0, 0x5, 0x2, 0xc0, 0x80, 0xb4, - 0x81, 0x10, 0xc, 0x34, 0x3, 0x90, 0x3, 0x10, - 0x68, 0x7, 0x20, 0x0, 0x82, 0x81, 0x5c, 0x40, - 0xb, 0x1, 0x20, 0x6, 0x70, 0x8e, 0xff, 0x51, - 0x5b, 0x0, 0x51, 0x20, 0x1c, 0x24, 0x1, 0xe, - 0x4b, 0x6f, 0xec, 0x14, 0xc0, 0x2, 0x8d, 0xa4, - 0x80, 0x9e, 0x81, 0xc8, 0x88, 0x16, 0x1, 0xca, - 0x20, 0xae, 0x0, 0x20, 0xf, 0x10, 0x70, 0x4, - 0x40, 0x1e, 0x20, 0x17, 0x0, 0x58, 0x7, 0x28, - 0x86, 0x92, 0x3, 0x49, 0x0, 0xb5, 0x1, 0x28, - 0x51, 0x3, 0x6f, 0xf4, 0x80, 0xf0, 0x0, 0x76, - 0x4c, 0x40, 0x6, 0xfe, 0x60, - - /* U+0039 "9" */ - 0x0, 0x96, 0xfb, 0xfa, 0x48, 0x3, 0xaa, 0x88, - 0x20, 0x2d, 0xa8, 0x1, 0x42, 0x84, 0x77, 0xea, - 0x5, 0x88, 0xb, 0x83, 0xb8, 0x40, 0xac, 0x82, - 0x1, 0x0, 0x12, 0x1, 0xd6, 0xc, 0x4, 0x0, - 0x10, 0xe, 0x20, 0x1, 0x80, 0x7f, 0xf0, 0x14, - 0x80, 0x2, 0x1, 0xc4, 0x0, 0xe4, 0x0, 0x40, - 0x7, 0x58, 0x4, 0x2c, 0xd, 0x2, 0x7, 0x64, - 0x1, 0xa5, 0x1, 0xfb, 0xf1, 0x18, 0x83, 0xc0, - 0x17, 0x48, 0x22, 0x4a, 0x92, 0x2, 0x0, 0x96, - 0xfb, 0x96, 0xa6, 0x0, 0x40, 0xf, 0xe9, 0x3, - 0x10, 0xf, 0xca, 0xa0, 0x80, 0x2, 0x4a, 0x10, - 0x9c, 0xd0, 0x32, 0x0, 0x5, 0xaf, 0x7b, 0x18, - 0x1a, 0x40, 0x24, 0x73, 0x10, 0x15, 0xb9, 0x0, - 0x80, - - /* U+003A ":" */ - 0x3f, 0xf2, 0x0, 0x7e, 0x3e, 0xe2, 0x0, 0x88, - 0x3, 0xff, 0x8c, 0x22, 0x3, 0xee, 0x20, 0x7, - 0xe0, - - /* U+003B ";" */ - 0x3, 0xff, 0x20, 0x7, 0xfc, 0x7d, 0xc4, 0x0, - 0x8, 0x80, 0x3f, 0xf9, 0xe7, 0xfe, 0x40, 0xf, - 0x38, 0x1, 0x43, 0x1, 0x84, 0x10, 0x20, 0x0, - 0x6c, 0x20, - - /* U+003C "<" */ - 0x0, 0xff, 0xe1, 0x11, 0x80, 0x7f, 0xf0, 0x17, - 0x36, 0x80, 0x3f, 0x8e, 0x7e, 0x8c, 0x38, 0x3, - 0xc2, 0xfb, 0x8c, 0x5, 0x1c, 0xe0, 0x19, 0x6f, - 0xa0, 0x85, 0xb3, 0x5c, 0x40, 0x7, 0x3f, 0x48, - 0xb, 0x7d, 0x26, 0x1, 0x9b, 0x18, 0xe, 0x7a, - 0x90, 0x3, 0xe1, 0x0, 0xd, 0xb8, 0x80, 0x7f, - 0x33, 0x88, 0xa3, 0xad, 0x40, 0x3f, 0xc, 0x75, - 0xa8, 0x25, 0x7c, 0x98, 0x7, 0xe4, 0xae, 0x93, - 0x6, 0xcd, 0x82, 0x0, 0xf8, 0x5b, 0x35, 0x84, - 0x9f, 0x71, 0x0, 0x3f, 0x14, 0xf5, 0x20, 0x1e, - 0x80, 0x7f, 0xcb, 0x7d, 0x1e, - - /* U+003D "=" */ - 0x1, 0x1f, 0xfe, 0x10, 0x3f, 0x77, 0xff, 0xa, - 0x40, 0x3f, 0xf8, 0x8f, 0xff, 0xff, 0xc2, 0x90, - 0xf, 0xfe, 0x28, 0x8f, 0xff, 0x8, 0x1f, 0xbb, - 0xff, 0x85, 0x20, 0x1f, 0xfc, 0x40, - - /* U+003E ">" */ - 0x32, 0x0, 0xff, 0xe1, 0x26, 0xe3, 0x8, 0x7, - 0xfc, 0x40, 0x73, 0xd4, 0x80, 0x1f, 0xcb, 0xd2, - 0x60, 0xb7, 0xd0, 0x40, 0x1f, 0xb, 0x66, 0xb8, - 0x89, 0xf7, 0x18, 0x3, 0xf1, 0x47, 0x5a, 0x81, - 0xcf, 0xd2, 0x0, 0x7e, 0x4a, 0xf9, 0x30, 0x5b, - 0x80, 0xf, 0xf3, 0xd1, 0x0, 0x4, 0x3, 0xf2, - 0x57, 0x49, 0xb, 0x58, 0x7, 0x1c, 0xf5, 0xa8, - 0x25, 0x74, 0x90, 0x0, 0x5f, 0x71, 0x84, 0xa3, - 0xad, 0x40, 0x23, 0xbe, 0x82, 0x6, 0xcd, 0x71, - 0x0, 0xe4, 0x40, 0x25, 0x7c, 0x98, 0x7, 0xe2, - 0x7d, 0xb5, 0x0, 0xff, 0x80, - - /* U+003F "?" */ - 0x1, 0x7c, 0xff, 0x6c, 0x88, 0x0, 0xfa, 0xc, - 0x0, 0x4d, 0xe4, 0xe, 0xd, 0x9f, 0xd2, 0x3, - 0x20, 0xdb, 0x26, 0x2, 0xce, 0x8, 0x4, 0x40, - 0xe, 0xd0, 0xf, 0xf7, 0x81, 0x80, 0x7c, 0xea, - 0x1e, 0x1, 0xe7, 0x80, 0xa3, 0x0, 0xe6, 0x80, - 0xa5, 0x0, 0xf4, 0x84, 0xa8, 0x7, 0x90, 0x0, - 0xc0, 0x1f, 0x8, 0x8, 0x7, 0xff, 0x1d, 0x33, - 0x0, 0x1f, 0x84, 0x8c, 0x3, 0xf3, 0x77, 0x0, - 0x3f, 0xf9, 0xe0, - - /* U+0040 "@" */ - 0x0, 0xf9, 0x27, 0x7b, 0xfb, 0x1c, 0x80, 0x3f, - 0xe4, 0xdb, 0x62, 0x33, 0x1, 0xc6, 0xc0, 0x7, - 0xf4, 0x59, 0x36, 0x7e, 0xe7, 0x72, 0x49, 0xf4, - 0x40, 0x3d, 0x2e, 0x5b, 0x26, 0x1, 0x85, 0xb6, - 0xb, 0x4, 0x3, 0x2b, 0x1e, 0x10, 0x7, 0xf3, - 0xc9, 0x50, 0x6, 0xb1, 0xd1, 0x0, 0x1c, 0xdd, - 0x28, 0x6, 0x66, 0x22, 0x80, 0x1c, 0x6c, 0x40, - 0xb, 0x8c, 0x8b, 0x57, 0x6f, 0x0, 0x40, 0x70, - 0x2, 0x85, 0x40, 0x3, 0x41, 0x1d, 0xf2, 0x88, - 0x0, 0x85, 0x10, 0x4, 0x47, 0x0, 0xa4, 0x1d, - 0xc2, 0xd, 0x0, 0x1d, 0x80, 0x6c, 0x18, 0x1, - 0x20, 0x50, 0x6, 0x60, 0xe, 0x10, 0x72, 0x1, - 0x0, 0x88, 0x8, 0x3, 0x8, 0x80, 0x30, 0x80, - 0x7f, 0xf2, 0x78, 0x18, 0x80, 0x40, 0x22, 0x2, - 0x0, 0xc2, 0x20, 0xc, 0xe2, 0x4c, 0x18, 0x1, - 0x20, 0x50, 0x6, 0x60, 0xc, 0xe3, 0x20, 0x44, - 0x40, 0xa, 0x81, 0xdc, 0x20, 0xd0, 0x0, 0x29, - 0x84, 0x70, 0x2, 0x92, 0x80, 0xa, 0x82, 0x3b, - 0xe5, 0x10, 0x1a, 0xcc, 0xb0, 0xa, 0x42, 0x4, - 0x0, 0xb8, 0xc8, 0xb5, 0x78, 0xb1, 0xb2, 0x1, - 0x86, 0x4a, 0x80, 0x23, 0x9b, 0xa5, 0x7, 0xa7, - 0x20, 0xf, 0x32, 0xa6, 0x8, 0x7, 0xf3, 0x88, - 0x7, 0xd4, 0xc7, 0xd0, 0x40, 0x18, 0x5b, 0x62, - 0x0, 0x1f, 0xa6, 0x89, 0xf7, 0xb3, 0x1b, 0xd2, - 0x4f, 0x20, 0x1f, 0xcb, 0xb4, 0xa6, 0x79, 0x27, - 0xa0, 0x3, 0x80, - - /* U+0041 "A" */ - 0x0, 0xf2, 0xff, 0xac, 0x3, 0xff, 0x83, 0xe0, - 0x4, 0x10, 0xf, 0xf8, 0x54, 0x14, 0x18, 0x3, - 0xfe, 0x70, 0x59, 0xa, 0x0, 0xff, 0xa8, 0x38, - 0xc4, 0x8c, 0x3, 0xf8, 0x8c, 0x50, 0x18, 0x28, - 0x3, 0xfa, 0x81, 0xc0, 0x14, 0xe, 0x1, 0xfc, - 0xc1, 0x40, 0x2, 0x20, 0xa8, 0x7, 0xc8, 0x22, - 0x30, 0xa, 0x83, 0x80, 0x3e, 0xe0, 0x60, 0xc, - 0xc0, 0x82, 0x1, 0xe5, 0xa, 0x0, 0xc2, 0x60, - 0xe0, 0x1c, 0xc0, 0xd, 0xff, 0xe3, 0xa, 0x0, - 0xea, 0x0, 0xff, 0x19, 0x0, 0x44, 0x61, 0xbd, - 0xdf, 0x20, 0x50, 0x5, 0x40, 0x44, 0x11, 0xfb, - 0x81, 0x80, 0x26, 0xa, 0x0, 0xfc, 0x80, 0x28, - 0x8, 0x20, 0xa0, 0x1f, 0x85, 0x3, 0x83, 0x80, - 0x88, 0x1, 0xfd, 0xa0, 0xa2, - - /* U+0042 "B" */ - 0xaf, 0xff, 0x76, 0x38, 0x7, 0xf8, 0x4e, 0x34, - 0x40, 0x24, 0xff, 0xbb, 0x5c, 0xa, 0xc0, 0x3e, - 0x12, 0x86, 0x5, 0x0, 0xff, 0x78, 0x7, 0xff, - 0x3, 0xc0, 0x80, 0x3f, 0x13, 0xb0, 0x58, 0x4, - 0x9f, 0xfb, 0x60, 0xe9, 0x80, 0x3f, 0xc5, 0xa0, - 0x19, 0x3f, 0xf7, 0x50, 0x3d, 0x0, 0x7e, 0x15, - 0xa0, 0x54, 0x0, 0xfe, 0x41, 0xd, 0x0, 0xff, - 0x10, 0x10, 0x7, 0xf8, 0x80, 0x3f, 0xe4, 0x10, - 0x30, 0xf, 0x85, 0xa8, 0x1, 0x20, 0x4, 0xff, - 0xdd, 0x22, 0x16, 0x20, 0x1f, 0x89, 0xf5, 0x0, - - /* U+0043 "C" */ - 0x0, 0xe6, 0xbe, 0xff, 0x6d, 0x20, 0x7, 0x2f, - 0x4a, 0x8, 0x0, 0x96, 0xf4, 0x80, 0xd, 0x42, - 0x28, 0xce, 0xe6, 0x41, 0x11, 0x40, 0xe4, 0xf, - 0x9c, 0xc4, 0x46, 0xfb, 0x0, 0x8, 0x1, 0xd0, - 0xf, 0xce, 0xe2, 0x40, 0x91, 0x0, 0xff, 0x20, - 0x1, 0x40, 0x3f, 0xee, 0x0, 0x10, 0x7, 0xfc, - 0x20, 0x40, 0x1f, 0xfc, 0xf1, 0x2, 0x0, 0xff, - 0xe0, 0x70, 0x0, 0x80, 0x3f, 0xe4, 0x0, 0x28, - 0x7, 0xfc, 0x48, 0x12, 0x20, 0x1f, 0xf4, 0x0, - 0xe8, 0x7, 0xe7, 0x70, 0x1c, 0x81, 0xf3, 0x90, - 0x88, 0xdf, 0x60, 0x2, 0x6a, 0x11, 0x46, 0xf7, - 0x32, 0x8, 0xd4, 0x2, 0x5e, 0x94, 0x10, 0x1, - 0x2d, 0xe1, 0x0, - - /* U+0044 "D" */ - 0xaf, 0xfe, 0xed, 0xa7, 0x10, 0xf, 0xf8, 0x49, - 0x63, 0xa8, 0x40, 0x39, 0x3f, 0xee, 0xc9, 0x30, - 0x5c, 0x10, 0xf, 0xc2, 0x6d, 0x92, 0x5, 0x40, - 0x1f, 0xfc, 0x6, 0x70, 0x43, 0x0, 0xff, 0xe0, - 0x48, 0x2, 0x80, 0x3f, 0xf8, 0x2, 0x80, 0x80, - 0x1f, 0xfc, 0x13, 0x2, 0x0, 0xff, 0xe0, 0xf8, - 0x7, 0xff, 0x4f, 0xc0, 0x3f, 0xf8, 0x66, 0x4, - 0x1, 0xff, 0xc0, 0x14, 0x4, 0x0, 0xff, 0xe0, - 0x48, 0x2, 0x80, 0x3f, 0xe6, 0x70, 0x43, 0x0, - 0xf8, 0x4d, 0xb2, 0x40, 0xa8, 0x3, 0x27, 0xfd, - 0xd9, 0x26, 0xb, 0x82, 0x1, 0xf8, 0x49, 0x63, - 0xa8, 0x40, 0x20, - - /* U+0045 "E" */ - 0xaf, 0xff, 0xf3, 0x0, 0x7f, 0xf0, 0x93, 0xbb, - 0xf3, 0x0, 0x42, 0x3f, 0x80, 0x3f, 0xfb, 0x69, - 0xff, 0xf8, 0x40, 0x3f, 0xf8, 0x49, 0xdd, 0xf8, - 0x40, 0x21, 0x1f, 0xc0, 0x1f, 0xfe, 0x81, 0x1f, - 0xc0, 0x12, 0x77, 0x7e, 0xa0, 0xf, 0xfe, 0x0, - - /* U+0046 "F" */ - 0xaf, 0xff, 0xe6, 0x0, 0xff, 0xe0, 0xa7, 0x77, - 0xcc, 0x1, 0x8, 0xfc, 0x1, 0xff, 0xd8, 0x4f, - 0xff, 0x50, 0x7, 0xff, 0x9, 0x3b, 0xbd, 0x40, - 0x18, 0x47, 0xc0, 0x1f, 0xff, 0xf0, 0xc, - - /* U+0047 "G" */ - 0x0, 0xe6, 0xae, 0xff, 0x75, 0xb9, 0x0, 0x72, - 0xf4, 0xa8, 0x80, 0x5, 0x23, 0x68, 0x2, 0x6a, - 0x11, 0x46, 0x77, 0xed, 0x30, 0x29, 0x1, 0xc8, - 0x27, 0x39, 0x88, 0x12, 0xcf, 0x30, 0x2, 0x0, - 0x6c, 0x3, 0xf0, 0xc9, 0x11, 0x2, 0x0, 0x3f, - 0xf8, 0x8, 0x0, 0x40, 0xf, 0xfe, 0x7, 0x0, - 0x8, 0x3, 0xff, 0x80, 0x20, 0x40, 0x1e, 0x9f, - 0xfe, 0xa0, 0xf, 0xfe, 0x20, 0x81, 0x0, 0x7a, - 0x7f, 0xe4, 0x0, 0x70, 0x0, 0x80, 0x3f, 0xf8, - 0x8, 0x0, 0x40, 0xf, 0xfe, 0x1, 0x20, 0x40, - 0x7, 0xff, 0x6, 0x0, 0x6c, 0x3, 0xff, 0x80, - 0x72, 0x9, 0xce, 0x62, 0x2, 0x94, 0x80, 0x60, - 0x6, 0xa1, 0x14, 0x67, 0x7f, 0x5a, 0x82, 0xc0, - 0x4, 0xbd, 0x28, 0x20, 0x1, 0x48, 0xda, 0x10, - - /* U+0048 "H" */ - 0xaf, 0xb0, 0xf, 0xd5, 0xf6, 0x1, 0xff, 0xff, - 0x0, 0xff, 0x93, 0xff, 0xf2, 0x80, 0x7f, 0xf1, - 0x93, 0xbb, 0xf2, 0x0, 0x70, 0x8f, 0xf0, 0x7, - 0xff, 0xfc, 0x3, 0xff, 0x9a, - - /* U+0049 "I" */ - 0xaf, 0xb0, 0xf, 0xff, 0x38, - - /* U+004A "J" */ - 0x0, 0xd5, 0xf6, 0x1, 0xff, 0xff, 0x0, 0xff, - 0xef, 0x88, 0x6, 0x60, 0x30, 0x8, 0x4c, 0x3c, - 0x4, 0xf4, 0x0, 0xe9, 0xd8, 0x61, 0x2, 0x1, - 0x1d, 0x38, 0x0, - - /* U+004B "K" */ - 0xaf, 0xb0, 0xf, 0xe, 0xff, 0x18, 0x7, 0xf0, - 0xe1, 0xe, 0x18, 0x7, 0xe2, 0xc2, 0x1c, 0x20, - 0xf, 0xc5, 0x84, 0x4c, 0x20, 0xf, 0xc5, 0x82, - 0x58, 0x40, 0x1f, 0x8b, 0x4, 0xb0, 0x40, 0x3f, - 0x1e, 0x9, 0x60, 0x80, 0x7e, 0x6c, 0x13, 0xc1, - 0x0, 0xfe, 0x20, 0x7, 0x88, 0x7, 0xf8, 0x84, - 0x34, 0x80, 0x3f, 0xcd, 0xa0, 0x3e, 0x20, 0x1f, - 0xe3, 0xc0, 0x2c, 0x10, 0xf, 0xf1, 0xe0, 0x16, - 0x8, 0x7, 0xf8, 0xec, 0xb, 0x4, 0x3, 0xfc, - 0x96, 0x5, 0xa0, 0x1f, 0xf2, 0x50, 0x1e, 0x0, - 0x7f, 0xcb, 0x40, 0x78, 0x1, 0xff, 0x2d, 0x1, - 0xd8, 0x0, - - /* U+004C "L" */ - 0xaf, 0xb0, 0xf, 0xff, 0xf8, 0x7, 0xff, 0xfc, - 0x3, 0xff, 0xa4, 0x23, 0xf8, 0x2, 0x4e, 0xef, - 0xc8, 0x1, 0xff, 0xc0, - - /* U+004D "M" */ - 0xaf, 0xf8, 0x40, 0x3e, 0x5f, 0xf9, 0x40, 0x33, - 0x80, 0x7d, 0xc0, 0x1e, 0x10, 0xa0, 0xf, 0xa, - 0x8, 0x7, 0x21, 0x19, 0x0, 0x73, 0x3, 0x80, - 0x79, 0x42, 0x80, 0x3a, 0x82, 0x80, 0x3d, 0x40, - 0xc0, 0x18, 0x8a, 0x30, 0xf, 0x11, 0x8a, 0x0, - 0x54, 0x14, 0x1, 0xfa, 0x83, 0x40, 0x26, 0x5, - 0x0, 0xfc, 0xe0, 0xc0, 0x4, 0x13, 0x20, 0xf, - 0xc2, 0xa0, 0xa1, 0xc1, 0x40, 0x1f, 0xee, 0xe, - 0x5, 0x6, 0x0, 0xff, 0x20, 0xa3, 0x82, 0x80, - 0x7f, 0xf0, 0x1c, 0x20, 0x38, 0x3, 0xff, 0x81, - 0x40, 0x1, 0x40, 0xf, 0xfe, 0x1, 0xbb, 0xac, - 0x3, 0xff, 0x85, 0x10, 0x50, 0xf, 0xfe, 0xe8, - - /* U+004E "N" */ - 0xaf, 0xf6, 0x0, 0x7d, 0x7f, 0x20, 0x11, 0xa8, - 0x7, 0xff, 0x6, 0x0, 0x3f, 0xe3, 0x2, 0x50, - 0xf, 0xf3, 0x38, 0x40, 0x7, 0xfd, 0x20, 0x4c, - 0x1, 0xfe, 0x17, 0xb, 0x0, 0xff, 0xa4, 0x49, - 0x80, 0x3f, 0xc3, 0x21, 0x0, 0x1f, 0xf3, 0x88, - 0x98, 0x3, 0xfe, 0x90, 0x80, 0xf, 0xf9, 0xc4, - 0x4e, 0x1, 0xff, 0x40, 0x48, 0x7, 0xfc, 0xc2, - 0x27, 0x0, 0xff, 0xa0, 0x21, 0xc0, 0x3f, 0xcc, - 0x40, 0x60, 0x1f, 0xf4, 0x0, 0x7f, 0xf0, 0x54, - 0x80, 0x20, - - /* U+004F "O" */ - 0x0, 0xc2, 0xf9, 0xdf, 0xd8, 0xe0, 0x1f, 0x9b, - 0xa0, 0xc4, 0x4, 0xe3, 0x90, 0x3, 0x9e, 0x40, - 0xab, 0xbf, 0xa4, 0x45, 0x6a, 0x1, 0x1c, 0x2, - 0x6a, 0x88, 0xb, 0x79, 0x85, 0x10, 0x2, 0x0, - 0x68, 0x3, 0xc3, 0xa0, 0x8, 0x2, 0x40, 0x91, - 0x0, 0xf8, 0x58, 0x14, 0x10, 0x0, 0xa0, 0x1f, - 0xda, 0x0, 0x4e, 0x0, 0x10, 0x7, 0xf2, 0x80, - 0x8, 0x40, 0x80, 0x3f, 0xc2, 0x0, 0xe3, 0x0, - 0xff, 0xe2, 0x10, 0x10, 0x7, 0xf8, 0x40, 0x1f, - 0xc0, 0x2, 0x0, 0xfe, 0x50, 0x1, 0xa0, 0x1, - 0x40, 0x3f, 0xb4, 0x0, 0x84, 0x81, 0x20, 0x1f, - 0x85, 0x81, 0x40, 0x10, 0x3, 0x60, 0x1f, 0x68, - 0x2, 0x0, 0x7, 0x0, 0x9a, 0xa2, 0x2, 0xdc, - 0x61, 0x44, 0x1, 0x3c, 0x81, 0x57, 0x7f, 0x48, - 0x8a, 0x94, 0x3, 0x9b, 0xa0, 0xc4, 0x4, 0xe3, - 0xd4, 0x2, - - /* U+0050 "P" */ - 0xaf, 0xff, 0x6c, 0x8, 0x7, 0xf1, 0x3f, 0x98, - 0x4, 0x9f, 0xf6, 0xc0, 0xe, 0x80, 0x7c, 0x4f, - 0x20, 0x2a, 0x1, 0xf9, 0x80, 0x18, 0x1, 0xfc, - 0x20, 0x60, 0x1f, 0xc2, 0x6, 0x1, 0xf9, 0x80, - 0x18, 0x1, 0xe2, 0x79, 0x1, 0x50, 0x2, 0x7f, - 0xdb, 0x0, 0xa, 0x0, 0xfc, 0x4f, 0xc8, 0x1, - 0x27, 0xfe, 0xd8, 0x10, 0xf, 0xff, 0xf0, - - /* U+0051 "Q" */ - 0x0, 0xc2, 0xf9, 0xdf, 0xd8, 0xe0, 0x1f, 0x9b, - 0xa0, 0xc4, 0x4, 0xe3, 0x90, 0x3, 0x9e, 0x40, - 0xab, 0xbf, 0xa4, 0x45, 0x6a, 0x1, 0x1c, 0x2, - 0x6a, 0x88, 0xb, 0x79, 0x85, 0x8, 0x2, 0x0, - 0x68, 0x3, 0xc3, 0xc0, 0x8, 0x2, 0x40, 0x91, - 0x0, 0xf8, 0x98, 0x18, 0x10, 0x0, 0xa0, 0x1f, - 0xda, 0x0, 0x4e, 0x0, 0x10, 0x7, 0xf2, 0x80, - 0x8, 0x40, 0x80, 0x3f, 0xc2, 0x0, 0xe3, 0x0, - 0xff, 0xe2, 0x10, 0x10, 0x7, 0xf8, 0x40, 0x1f, - 0xc0, 0x2, 0x0, 0xfe, 0x20, 0x1, 0x20, 0x1, - 0x40, 0x3f, 0xa8, 0x0, 0x84, 0x81, 0x20, 0x1f, - 0x85, 0x81, 0x4, 0x20, 0x6, 0xc0, 0x3e, 0xd0, - 0x4, 0x0, 0xe, 0x1, 0x35, 0x44, 0x5, 0x74, - 0xc1, 0xcc, 0x2, 0x79, 0x2, 0xae, 0xfe, 0xa2, - 0x7, 0x80, 0xe, 0x6e, 0x83, 0x10, 0xd, 0x90, - 0x1, 0xf0, 0xbe, 0x77, 0xe8, 0x2, 0x80, 0x3f, - 0xf8, 0x25, 0x60, 0xd0, 0x1, 0xff, 0xc1, 0x49, - 0x7, 0x60, 0x0, - - /* U+0052 "R" */ - 0xaf, 0xff, 0x6c, 0x90, 0x7, 0xfc, 0x4d, 0xaa, - 0x1, 0xc9, 0xff, 0x6c, 0x88, 0x50, 0x80, 0x7e, - 0x26, 0xd0, 0x3, 0x80, 0x7f, 0x8c, 0x43, 0xc0, - 0x3f, 0xf9, 0x86, 0x21, 0xc0, 0x1f, 0x85, 0x74, - 0x0, 0xa0, 0x19, 0x3f, 0xee, 0xa1, 0x9, 0x20, - 0xf, 0xfb, 0x18, 0x3, 0x93, 0xfd, 0xd8, 0x81, - 0xc2, 0x1, 0xf8, 0x4e, 0xd0, 0xa8, 0x3, 0xfe, - 0x90, 0x44, 0x0, 0x7f, 0x89, 0x42, 0x0, 0x3f, - 0xe8, 0x3, 0x40, 0xf, 0xf1, 0x20, 0x40, 0x7, - 0xfd, 0xe0, 0x66, 0x0, 0xff, 0x21, 0x84, 0x0, - - /* U+0053 "S" */ - 0x0, 0x9a, 0xfb, 0xfb, 0x6d, 0x88, 0x0, 0x3b, - 0x28, 0x20, 0x24, 0x93, 0xe0, 0xd, 0x20, 0x7d, - 0xff, 0x6c, 0xa0, 0x0, 0xcc, 0x15, 0x4, 0x0, - 0x26, 0xbc, 0x5, 0x0, 0x28, 0x7, 0xc2, 0x1, - 0x84, 0x3, 0xf9, 0x0, 0x16, 0x1, 0xfc, 0x4a, - 0xb, 0xd4, 0xe6, 0x1, 0xea, 0x70, 0x15, 0x8c, - 0xfb, 0x40, 0xd, 0x1f, 0x4c, 0x60, 0x4, 0xb8, - 0x0, 0xe5, 0x9c, 0xfa, 0x20, 0x75, 0x0, 0xfc, - 0xb8, 0x21, 0xc0, 0x1f, 0xc2, 0x80, 0xc0, 0x1f, - 0xfc, 0x12, 0x20, 0x7, 0xc2, 0x80, 0xee, 0xdb, - 0x62, 0x0, 0x13, 0x78, 0x84, 0x88, 0x24, 0xef, - 0xfb, 0x64, 0x42, 0x4d, 0x36, 0x10, 0x80, 0x2, - 0x6f, 0xac, 0x0, - - /* U+0054 "T" */ - 0x1f, 0xff, 0xfe, 0x15, 0x80, 0x7f, 0xf1, 0x7, - 0xbb, 0xc4, 0xf, 0xdd, 0xd6, 0x2, 0x3e, 0x0, - 0x84, 0x78, 0x3, 0xff, 0xfe, 0x1, 0xff, 0xff, - 0x0, 0xff, 0xff, 0x80, - - /* U+0055 "U" */ - 0xef, 0x70, 0xf, 0xdd, 0xee, 0x1, 0xff, 0xff, - 0x0, 0xff, 0xfb, 0xf8, 0x7, 0xfc, 0x40, 0x20, - 0x1f, 0x84, 0x9, 0x41, 0x0, 0x3e, 0x40, 0x3, - 0xe8, 0x12, 0x80, 0x7a, 0x0, 0x88, 0x86, 0x14, - 0xe4, 0x0, 0x4b, 0x30, 0x80, 0x6, 0x98, 0x46, - 0xff, 0xad, 0x2, 0x14, 0x0, 0x39, 0x28, 0x20, - 0x2, 0x6d, 0x70, 0x0, - - /* U+0056 "V" */ - 0xaf, 0xd0, 0xf, 0xf3, 0x7f, 0x87, 0x80, 0x8c, - 0x3, 0xfa, 0x81, 0x45, 0x4, 0x28, 0x3, 0xf1, - 0x18, 0x70, 0x1, 0x81, 0xc0, 0x3f, 0x50, 0xa, - 0x0, 0x28, 0x5, 0x0, 0x3e, 0x60, 0x60, 0x8, - 0x8c, 0x38, 0x3, 0xc8, 0x21, 0x40, 0x1a, 0x81, - 0x44, 0x3, 0xb4, 0xc, 0x80, 0x33, 0x0, 0x1c, - 0x3, 0x98, 0x28, 0x3, 0xca, 0x14, 0x1, 0x94, - 0x0, 0xe0, 0x1e, 0xe0, 0x32, 0x0, 0xb8, 0x10, - 0x40, 0x3c, 0x82, 0xa, 0x0, 0x14, 0xe, 0x0, - 0xfc, 0xc1, 0x40, 0x6, 0x1, 0x50, 0xf, 0xd4, - 0x4, 0x61, 0x40, 0xe0, 0x1f, 0xc4, 0x61, 0x46, - 0x41, 0x40, 0x1f, 0xea, 0x7, 0xa0, 0x23, 0x0, - 0xff, 0x38, 0xb, 0x5, 0x0, 0x7f, 0xc2, 0xa0, - 0x13, 0x0, 0x7f, 0xf0, 0x3c, 0x0, 0x82, 0x1, - 0xe0, - - /* U+0057 "W" */ - 0x1f, 0xf2, 0x0, 0x7a, 0x7f, 0xca, 0x1, 0xe9, - 0xfd, 0x12, 0xc, 0x0, 0xf2, 0x0, 0x30, 0x3, - 0xc8, 0x8, 0x8, 0x8, 0x1, 0xc2, 0x42, 0xa, - 0x1, 0xc2, 0x41, 0x81, 0x80, 0x60, 0x1c, 0x80, - 0xe4, 0x60, 0x1c, 0xa0, 0x4, 0x4, 0x0, 0x20, - 0x6, 0xd0, 0xf4, 0x4, 0x0, 0xd8, 0x4, 0x20, - 0x24, 0x18, 0x1, 0x90, 0x13, 0x3, 0x0, 0x32, - 0x2, 0x0, 0x48, 0x8, 0x1, 0x8c, 0x49, 0xc1, - 0x0, 0x31, 0x86, 0x0, 0x5e, 0x6, 0x1, 0x20, - 0x20, 0x10, 0x98, 0x4, 0x80, 0x4, 0x0, 0x90, - 0x0, 0x60, 0xc, 0xc, 0x0, 0x20, 0x20, 0x3, - 0x0, 0x84, 0x2, 0x21, 0x4, 0x0, 0x20, 0x20, - 0x3, 0x0, 0xc0, 0x6, 0xe, 0x1, 0xc8, 0x18, - 0x0, 0x30, 0x20, 0x2, 0x86, 0x0, 0x10, 0x30, - 0x3, 0xb0, 0x10, 0xc, 0x10, 0x2, 0x30, 0x40, - 0x30, 0x2, 0x0, 0x72, 0x0, 0xd, 0x3, 0x0, - 0x32, 0x1, 0xa0, 0x9, 0x0, 0x71, 0x8, 0x26, - 0x2, 0x0, 0x6c, 0x4, 0xc0, 0x40, 0xf, 0x90, - 0x31, 0x0, 0xc0, 0x31, 0x86, 0x20, 0x60, 0x7, - 0xd8, 0x8, 0x6, 0x1, 0xc8, 0x8, 0x0, 0x40, - 0xf, 0x90, 0x2, 0x40, 0xf, 0x18, 0x0, 0x48, - 0x3, 0xe2, 0x10, 0x6, 0x0, 0x79, 0x0, 0x8, - 0x1, 0x80, - - /* U+0058 "X" */ - 0x2, 0xff, 0x30, 0x7, 0xd1, 0xfc, 0x20, 0x4e, - 0x10, 0x20, 0x1c, 0x6e, 0x16, 0x20, 0x8, 0x21, - 0xb0, 0xe, 0xe0, 0x55, 0x0, 0x6e, 0x5, 0x50, - 0x5, 0x4, 0x36, 0x1, 0xc6, 0xc1, 0x62, 0x4, - 0xe1, 0x2, 0x1, 0xe9, 0x21, 0xb0, 0xe0, 0x46, - 0x0, 0xfd, 0x20, 0xb6, 0x61, 0x20, 0x1f, 0xc8, - 0xc0, 0x81, 0x24, 0x1, 0xfe, 0xa0, 0x1, 0x30, - 0x7, 0xfd, 0x0, 0x2, 0x30, 0xf, 0xf3, 0x20, - 0x18, 0x70, 0x7, 0xf0, 0xc8, 0x46, 0x89, 0x40, - 0x7, 0xea, 0x2, 0x71, 0x80, 0x72, 0x0, 0xf2, - 0xa0, 0x70, 0x1, 0x90, 0x38, 0x3, 0x86, 0xc1, - 0xcc, 0x2, 0x90, 0x37, 0x0, 0xd6, 0x25, 0x0, - 0x18, 0xa0, 0x20, 0x80, 0x8, 0xa1, 0xc0, 0x1e, - 0x73, 0x9, 0x0, 0x50, 0x31, 0x80, 0x7d, 0xc0, - 0x8a, - - /* U+0059 "Y" */ - 0xb, 0xfc, 0x0, 0xfc, 0x5f, 0xe5, 0xa, 0x3, - 0x70, 0xf, 0xb8, 0x11, 0x40, 0x64, 0x20, 0x80, - 0x39, 0xcc, 0x28, 0x2, 0x64, 0xe, 0x0, 0xc5, - 0x1, 0x22, 0x1, 0xa4, 0xd, 0xc0, 0x2e, 0x4, - 0x60, 0xe, 0x28, 0x8, 0x20, 0x63, 0x9, 0x0, - 0xf9, 0xcc, 0x24, 0x64, 0x24, 0x80, 0x3f, 0x70, - 0x27, 0x81, 0xb0, 0x7, 0xf1, 0x40, 0x8, 0x70, - 0x7, 0xfc, 0xe2, 0xc, 0x40, 0x1f, 0xfc, 0x3, - 0x1, 0x0, 0xff, 0xff, 0x80, 0x7f, 0xf7, 0xc0, - - /* U+005A "Z" */ - 0xaf, 0xff, 0xfe, 0x8, 0x80, 0x7f, 0xf0, 0xeb, - 0xbb, 0xfa, 0xc0, 0xc, 0x20, 0x23, 0xf8, 0x28, - 0xe, 0x40, 0x3f, 0xda, 0x22, 0xd0, 0xf, 0xf4, - 0x18, 0x50, 0x80, 0x7f, 0x2b, 0x84, 0x20, 0x7, - 0xf1, 0x50, 0x2b, 0x80, 0x7f, 0xbc, 0xa, 0x80, - 0x3f, 0xd6, 0x41, 0xe0, 0x1f, 0xe7, 0x40, 0xb2, - 0x0, 0xfe, 0x48, 0x7, 0x40, 0xf, 0xe2, 0xa0, - 0x48, 0x0, 0xff, 0x78, 0x95, 0x0, 0x7f, 0xa8, - 0x83, 0x84, 0x3, 0xf9, 0x94, 0x20, 0x84, 0x7f, - 0x82, 0x0, 0x11, 0xdd, 0xfe, 0x50, 0xf, 0xfe, - 0x18, - - /* U+005B "[" */ - 0xff, 0xe0, 0x8, 0xce, 0x0, 0xbf, 0x30, 0x1, - 0xff, 0xff, 0x0, 0xff, 0xe9, 0x7e, 0x60, 0x2, - 0x33, 0x80, - - /* U+005C "\\" */ - 0xdf, 0x20, 0xf, 0x28, 0x28, 0x7, 0xb0, 0x30, - 0x3, 0xc8, 0x8, 0x1, 0xf2, 0x82, 0x80, 0x7b, - 0xc3, 0xc0, 0x3c, 0x80, 0x80, 0x1e, 0x13, 0x13, - 0x0, 0xf5, 0x85, 0x80, 0x79, 0x41, 0x40, 0x3c, - 0x42, 0x42, 0x1, 0xe7, 0x7, 0x0, 0xf6, 0x86, - 0x80, 0x79, 0x1, 0x0, 0x3e, 0x40, 0x40, 0xf, - 0x68, 0x68, 0x7, 0x9c, 0x1c, 0x3, 0xc2, 0x62, - 0x60, 0x1e, 0x40, 0x40, 0xf, 0x58, 0x58, 0x7, - 0x8e, 0x2c, 0x0, - - /* U+005D "]" */ - 0xaf, 0xfc, 0x84, 0x66, 0x0, 0xa3, 0x30, 0x40, - 0x1f, 0xff, 0xf0, 0xf, 0xfe, 0x8c, 0x66, 0x8, - 0x0, 0x46, 0x60, 0x8, - - /* U+005E "^" */ - 0x0, 0xf4, 0x7f, 0xa8, 0x3, 0xfe, 0x77, 0x0, - 0x16, 0x40, 0x3f, 0x96, 0x1, 0xa0, 0x19, 0xc0, - 0x3e, 0x4a, 0x7, 0x97, 0x90, 0x86, 0x0, 0xe3, - 0xb0, 0x78, 0x0, 0x34, 0x84, 0xa0, 0x4, 0x5a, - 0x11, 0x0, 0xc, 0xd4, 0x16, 0x60, 0x38, 0x32, - 0xe0, 0x1e, 0x5a, 0xd, 0x20, - - /* U+005F "_" */ - 0x2b, 0xbf, 0xfe, 0x1, 0xa, 0x27, 0xff, 0x0, - 0x40, - - /* U+0060 "`" */ - 0x68, 0x30, 0x9, 0x5f, 0x44, 0x0, 0x74, 0x3a, - 0x1, 0x2c, 0x1c, 0x0, 0x4e, 0xce, 0x80, - - /* U+0061 "a" */ - 0x1, 0x6b, 0xdf, 0xf6, 0xc0, 0x80, 0x51, 0x28, - 0x40, 0x2, 0x7f, 0x20, 0x7, 0x3e, 0xff, 0xd8, - 0x63, 0x20, 0x7, 0x82, 0x0, 0x8f, 0x45, 0x8, - 0x3, 0xf0, 0xa8, 0x20, 0x0, 0xe7, 0x7f, 0xf2, - 0x0, 0x83, 0x63, 0x11, 0xc, 0xe1, 0xf, 0x19, - 0x7, 0xfd, 0xcc, 0x90, 0x0, 0xe0, 0x70, 0x1, - 0xc2, 0x0, 0xe0, 0x60, 0xf, 0x20, 0x3, 0xc1, - 0x80, 0x3a, 0x0, 0x24, 0x3, 0x80, 0x0, 0xc3, - 0x88, 0x0, 0xd4, 0x1f, 0xfb, 0x8e, 0xc8, 0x1, - 0x54, 0x10, 0x0, 0xe6, 0x40, 0x10, - - /* U+0062 "b" */ - 0xdf, 0x50, 0xf, 0xff, 0x80, 0xcf, 0x7f, 0x48, - 0x80, 0x62, 0xf6, 0x1, 0x13, 0x78, 0x80, 0x50, - 0x17, 0xdc, 0xc1, 0x16, 0x80, 0x6d, 0x40, 0x1, - 0xe0, 0x1a, 0x0, 0x10, 0xc0, 0x31, 0x20, 0x68, - 0x3, 0x0, 0x3d, 0x80, 0xa0, 0x2, 0x0, 0xf1, - 0x1, 0x0, 0x7f, 0xf0, 0x88, 0x3, 0xc4, 0x4, - 0x0, 0xc0, 0xf, 0x60, 0x28, 0x1, 0xc, 0x3, - 0x12, 0x6, 0x80, 0x5a, 0x80, 0x3, 0xc0, 0x34, - 0x0, 0x48, 0x5f, 0xfb, 0x4, 0x5a, 0x1, 0x1f, - 0xb0, 0x80, 0xb7, 0x88, 0x0, - - /* U+0063 "c" */ - 0x0, 0x8a, 0x77, 0xfb, 0x60, 0x80, 0xf, 0xac, - 0x40, 0x24, 0xf2, 0xd, 0x0, 0xbb, 0xfe, 0xe9, - 0x30, 0x80, 0x6a, 0x20, 0x0, 0xb4, 0x28, 0x84, - 0x0, 0x7d, 0xa0, 0x82, 0x1, 0xf1, 0x1, 0x0, - 0x7f, 0xf1, 0xc8, 0x8, 0x3, 0xf6, 0x82, 0x8, - 0x7, 0xca, 0x21, 0x0, 0x1f, 0xa0, 0x1a, 0x88, - 0x0, 0x2d, 0x0, 0xd0, 0xb, 0xbf, 0xee, 0x93, - 0x0, 0x3e, 0x28, 0x80, 0x93, 0xc8, - - /* U+0064 "d" */ - 0x0, 0xfe, 0x1f, 0xf0, 0x80, 0x7f, 0xfa, 0xdf, - 0x7f, 0xa8, 0x80, 0x3d, 0x70, 0x40, 0x5, 0xd4, - 0x0, 0xd0, 0x81, 0x5f, 0xda, 0x74, 0x1, 0xb, - 0x84, 0xa8, 0x0, 0xb0, 0x40, 0x24, 0x1, 0x60, - 0xe, 0x90, 0xb, 0x1, 0x0, 0x3c, 0x80, 0x11, - 0x81, 0x80, 0x78, 0x80, 0x3f, 0xf8, 0x6, 0x1, - 0x18, 0x18, 0x7, 0x84, 0x2, 0xc0, 0x40, 0xf, - 0x20, 0x4, 0x80, 0x2c, 0x1, 0xd2, 0x1, 0xb, - 0x84, 0xb0, 0x0, 0xb0, 0x40, 0x34, 0x20, 0x4f, - 0xf6, 0x9d, 0x0, 0x75, 0xc1, 0x0, 0x17, 0x50, - 0x2, - - /* U+0065 "e" */ - 0x0, 0x8e, 0xbb, 0xfd, 0x8c, 0x1, 0xcf, 0x8a, - 0x20, 0x3, 0x9b, 0x0, 0x96, 0x2, 0x3b, 0xfd, - 0x42, 0x92, 0x0, 0xb0, 0xa7, 0x10, 0x2, 0xe8, - 0x30, 0xa0, 0x92, 0x80, 0x71, 0x90, 0x26, 0x1, - 0xe6, 0x7c, 0x60, 0x44, 0x1, 0x33, 0xf8, 0x40, - 0x32, 0xff, 0xff, 0x39, 0x3, 0x0, 0x7f, 0xb4, - 0xc, 0x80, 0x3f, 0x94, 0x42, 0x40, 0x3e, 0x10, - 0x5, 0x82, 0x59, 0x80, 0x47, 0x1e, 0x0, 0x59, - 0x4, 0xcf, 0xef, 0xc7, 0x10, 0x9, 0xb5, 0x88, - 0x4, 0x49, 0x1c, 0x0, - - /* U+0066 "f" */ - 0x0, 0xd1, 0xbf, 0xee, 0x0, 0xad, 0xc8, 0x44, - 0x40, 0x2, 0x40, 0xce, 0xe6, 0x0, 0x1c, 0x8, - 0xc0, 0x38, 0xc0, 0x40, 0x33, 0xfc, 0x81, 0xff, - 0xca, 0x46, 0x40, 0x3, 0x39, 0x97, 0x2c, 0xf, - 0x32, 0x30, 0xf, 0xff, 0xf8, 0x7, 0xff, 0x30, - - /* U+0067 "g" */ - 0x0, 0x9f, 0x7f, 0xa8, 0xc7, 0xfc, 0x20, 0xc, - 0x82, 0x0, 0x2e, 0x20, 0x6, 0x93, 0xa, 0xfe, - 0xd4, 0xa0, 0x8, 0x58, 0x29, 0x40, 0x5, 0x64, - 0x1, 0x38, 0xa, 0x80, 0x75, 0x0, 0x5e, 0x8, - 0x1, 0xe4, 0x0, 0x8c, 0xc, 0x3, 0xc4, 0x1, - 0xff, 0xc4, 0x30, 0x30, 0xf, 0x10, 0x5, 0xe0, - 0x80, 0x1e, 0x40, 0x9, 0xc0, 0x54, 0x3, 0xa8, - 0x2, 0x16, 0xa, 0x50, 0x1, 0x59, 0x0, 0x69, - 0x30, 0xaf, 0xed, 0x4a, 0x0, 0x8, 0x3, 0x20, - 0x80, 0xb, 0xae, 0x1, 0xe7, 0xdf, 0xea, 0x27, - 0x3, 0x0, 0xff, 0x48, 0x20, 0x0, 0x64, 0xc0, - 0x22, 0xb3, 0xa, 0x0, 0x9b, 0x3f, 0xb9, 0xa8, - 0x14, 0x40, 0x1, 0x84, 0x11, 0x89, 0xb5, 0x40, - 0x0, - - /* U+0068 "h" */ - 0xdf, 0x50, 0xf, 0xff, 0x8c, 0x6f, 0xf5, 0x8, - 0x6, 0x3d, 0x72, 0x1, 0x5f, 0x10, 0xa, 0x2, - 0xff, 0xd4, 0x3, 0x0, 0x10, 0xfa, 0x0, 0x16, - 0x1, 0xc0, 0x25, 0x20, 0xc, 0xa0, 0x22, 0x0, - 0x68, 0x7, 0x10, 0x0, 0xc0, 0x4, 0x1, 0xff, - 0xff, 0x0, 0xff, 0xe3, 0x0, - - /* U+0069 "i" */ - 0xbf, 0x60, 0x8, 0x88, 0x73, 0xaa, 0x1, 0x5f, - 0xb0, 0x7, 0xff, 0x6c, - - /* U+006A "j" */ - 0x0, 0xaf, 0xd8, 0x3, 0xf8, 0x88, 0x60, 0x14, - 0xea, 0x80, 0x7f, 0x5f, 0xb0, 0x7, 0xff, 0xfc, - 0x3, 0xce, 0x1, 0xc2, 0x4, 0x0, 0x42, 0x5, - 0x6f, 0xb0, 0x51, 0x10, 0xb, 0xd0, 0x0, - - /* U+006B "k" */ - 0xdf, 0x50, 0xf, 0xff, 0xad, 0xfe, 0x90, 0x7, - 0xd8, 0x85, 0x84, 0x1, 0xc3, 0x86, 0x6c, 0x10, - 0xe, 0x1c, 0x33, 0x60, 0x80, 0x71, 0x79, 0x26, - 0x0, 0x7b, 0x70, 0x56, 0xc0, 0x3e, 0x71, 0x2a, - 0x0, 0xfc, 0xa0, 0x50, 0x1, 0xfb, 0xe8, 0x1d, - 0xc0, 0x1f, 0x96, 0x42, 0x1c, 0x3, 0xf3, 0x48, - 0x43, 0x0, 0x7e, 0x69, 0x9, 0x60, 0xf, 0xcd, - 0x1, 0x2a, 0x1, 0xf9, 0xe0, 0x29, 0x40, - - /* U+006C "l" */ - 0xbf, 0x60, 0xf, 0xff, 0x50, - - /* U+006D "m" */ - 0xdf, 0x50, 0x8d, 0xfd, 0x70, 0x9, 0x2f, 0xbe, - 0xcc, 0x3, 0x1e, 0xb9, 0x1, 0x45, 0x3, 0xda, - 0x8, 0x26, 0x18, 0x5, 0x1, 0x7f, 0xd0, 0xa, - 0xf0, 0xfd, 0xf8, 0x41, 0xe0, 0x10, 0xfa, 0x0, - 0xba, 0x4, 0x34, 0x8, 0x1c, 0x81, 0x88, 0x1, - 0x48, 0x3, 0x68, 0x2, 0xc0, 0x32, 0x0, 0x14, - 0x1, 0xa0, 0x1c, 0x60, 0x2, 0x0, 0xe2, 0x1, - 0x0, 0x10, 0x7, 0xc4, 0x1, 0xff, 0xff, 0x0, - 0xff, 0xff, 0x0, - - /* U+006E "n" */ - 0xdf, 0x50, 0x8d, 0xfe, 0xa1, 0x0, 0xc7, 0xae, - 0x40, 0x2b, 0xe2, 0x1, 0x40, 0x5f, 0xfa, 0x80, - 0x60, 0x2, 0x1f, 0x40, 0x2, 0xc0, 0x38, 0x4, - 0xa4, 0x1, 0x94, 0x4, 0x40, 0xd, 0x0, 0xe2, - 0x0, 0x18, 0x0, 0x80, 0x3f, 0xff, 0xe0, 0x1f, - 0xfc, 0x60, - - /* U+006F "o" */ - 0x0, 0x96, 0xfb, 0xfa, 0x88, 0x3, 0xaa, 0x88, - 0x23, 0x2e, 0xb0, 0x5, 0xa, 0x11, 0xfd, 0xc4, - 0x9, 0x30, 0x17, 0x8, 0x70, 0x0, 0xd9, 0x84, - 0x2, 0x0, 0x1c, 0x3, 0xa0, 0x10, 0x74, 0x10, - 0x3, 0xc8, 0x0, 0x52, 0x2, 0x0, 0xfe, 0x10, - 0x1, 0x80, 0x7f, 0x88, 0x18, 0x3, 0xf8, 0x74, - 0xc, 0x40, 0x39, 0x0, 0xa, 0x80, 0x9, 0x0, - 0xe8, 0x4, 0x11, 0x38, 0x3b, 0x80, 0x3, 0x66, - 0x10, 0x0, 0x85, 0x8, 0xfe, 0xe2, 0x4, 0x98, - 0x5, 0x54, 0x41, 0x19, 0x75, 0x80, 0x0, - - /* U+0070 "p" */ - 0xdf, 0x51, 0x9e, 0xfe, 0x91, 0x0, 0xc5, 0xec, - 0x2, 0x26, 0xf1, 0x0, 0xa0, 0x2f, 0xb9, 0x82, - 0x2d, 0x0, 0xda, 0x80, 0x3, 0xc0, 0x34, 0x0, - 0x21, 0x80, 0x62, 0x40, 0xd0, 0x6, 0x0, 0x7b, - 0x1, 0x40, 0x4, 0x1, 0xe2, 0x2, 0x0, 0xff, - 0xe1, 0x10, 0x7, 0x88, 0x8, 0x1, 0x80, 0x1e, - 0xc0, 0x50, 0x2, 0x18, 0x6, 0x24, 0xd, 0x0, - 0xb5, 0x0, 0x7, 0x80, 0x68, 0x0, 0x90, 0xbf, - 0xf6, 0x8, 0xb4, 0x2, 0x3f, 0x61, 0x1, 0x6f, - 0x10, 0xc, 0x33, 0xdf, 0xd2, 0x20, 0x1f, 0xfe, - 0x60, - - /* U+0071 "q" */ - 0x0, 0x9f, 0x7f, 0xa8, 0x87, 0xfc, 0x20, 0xb, - 0x82, 0x0, 0x2e, 0xa0, 0x6, 0x84, 0xa, 0xfe, - 0xd3, 0xa0, 0x8, 0x5c, 0x25, 0x40, 0x5, 0x82, - 0x1, 0x20, 0xb, 0x0, 0x74, 0x80, 0x58, 0x8, - 0x1, 0xe4, 0x0, 0x8c, 0xc, 0x3, 0xc4, 0x1, - 0xff, 0xc0, 0x30, 0x8, 0xc0, 0xc0, 0x3c, 0x20, - 0x16, 0x2, 0x0, 0x79, 0x0, 0x24, 0x1, 0x60, - 0xe, 0x90, 0x8, 0x5c, 0x25, 0x80, 0x5, 0x82, - 0x1, 0xa1, 0x2, 0x7f, 0xb4, 0xe8, 0x3, 0xae, - 0x8, 0x0, 0xba, 0x80, 0x1e, 0x7d, 0xfe, 0xa2, - 0x0, 0xff, 0xf6, 0x0, - - /* U+0072 "r" */ - 0xdf, 0x50, 0x8d, 0xfd, 0x0, 0x1e, 0xb9, 0x0, - 0x68, 0x3a, 0xef, 0xe0, 0x0, 0xea, 0x88, 0x18, - 0x1, 0xc, 0x3, 0xd8, 0x1, 0xf1, 0x0, 0x7f, - 0xfc, 0x40, - - /* U+0073 "s" */ - 0x0, 0x36, 0x7f, 0xbb, 0x64, 0xc0, 0x17, 0x26, - 0x2, 0x22, 0x69, 0x5, 0x40, 0xaf, 0xef, 0xe9, - 0xc0, 0xc0, 0x65, 0x0, 0x85, 0x98, 0x2, 0x6, - 0x1, 0xfa, 0xc1, 0x6d, 0x44, 0x3, 0x8e, 0x1, - 0x2b, 0xb6, 0x8, 0x2, 0x7e, 0x84, 0x2, 0x7d, - 0x50, 0x8, 0x5e, 0xff, 0x10, 0x28, 0x3, 0xe3, - 0xb0, 0x1, 0x80, 0x7f, 0x9e, 0xa5, 0x0, 0x21, - 0xa0, 0x2, 0xb, 0x5f, 0xf7, 0xf2, 0x85, 0x4, - 0xc2, 0x10, 0x81, 0x36, 0xa8, 0x0, - - /* U+0074 "t" */ - 0x0, 0x34, 0x18, 0x7, 0xa9, 0xd4, 0x3, 0xff, - 0x94, 0xbe, 0x61, 0x3f, 0xf6, 0x89, 0x80, 0x8, - 0xce, 0x74, 0xc3, 0xb, 0xcc, 0xa8, 0x3, 0xff, - 0xea, 0xe0, 0x20, 0x1e, 0x30, 0xb1, 0x0, 0xea, - 0x3, 0xee, 0xac, 0x0, 0x56, 0x82, 0x33, 0x0, - - /* U+0075 "u" */ - 0xff, 0x18, 0x7, 0x17, 0xf8, 0x3, 0xff, 0xfe, - 0x1, 0xff, 0xc6, 0x10, 0x8, 0x41, 0x80, 0x39, - 0x40, 0x25, 0xf, 0x0, 0xeb, 0x0, 0xb8, 0x15, - 0xc4, 0xf, 0xc, 0x2, 0x54, 0x8, 0xef, 0xc2, - 0xa0, 0xd, 0x6e, 0x40, 0x2d, 0xec, 0x1, 0x0, - - /* U+0076 "v" */ - 0x1f, 0xf1, 0x0, 0x7d, 0xfe, 0x41, 0x30, 0xa0, - 0xf, 0x28, 0xa, 0x5, 0x2, 0x80, 0x7b, 0xc1, - 0xc0, 0xe, 0x4, 0x60, 0x1c, 0xa1, 0xa0, 0x1, - 0x40, 0xa0, 0xc, 0xa0, 0x28, 0x1, 0x70, 0x38, - 0x6, 0xe0, 0x60, 0xc, 0xa0, 0x28, 0x0, 0x14, - 0xb, 0x0, 0xe5, 0xd, 0x0, 0x38, 0x11, 0x80, - 0x77, 0x3, 0x0, 0x28, 0x28, 0x3, 0xc8, 0x20, - 0xa2, 0x60, 0xa0, 0x1f, 0x38, 0x7b, 0x1, 0x90, - 0x7, 0xd4, 0xb, 0x41, 0x60, 0x1f, 0x8c, 0x40, - 0x81, 0x80, 0x3f, 0x98, 0x0, 0x82, 0x1, 0x80, - - /* U+0077 "w" */ - 0xdf, 0x40, 0xd, 0x3f, 0xe3, 0x0, 0xd5, 0xf0, - 0x81, 0x80, 0x19, 0x0, 0x8, 0x1, 0x90, 0x33, - 0xc1, 0x0, 0x21, 0x20, 0x6, 0x0, 0x44, 0x20, - 0x88, 0x3, 0x0, 0x90, 0x18, 0x50, 0x2, 0x40, - 0x30, 0x21, 0x4, 0x0, 0x68, 0x62, 0x81, 0x80, - 0x30, 0x10, 0x0, 0x81, 0x80, 0x4, 0x4, 0xc0, - 0x40, 0x2, 0x6, 0x0, 0x30, 0x10, 0x0, 0x64, - 0x28, 0x18, 0x4, 0x20, 0x80, 0x4, 0x3, 0x4, - 0x4, 0x3, 0x5, 0x4, 0x3, 0x0, 0x88, 0x41, - 0x30, 0x30, 0x0, 0x82, 0x5e, 0x8, 0x1, 0x90, - 0x31, 0x1, 0x0, 0x18, 0x8, 0x80, 0xc0, 0xd, - 0x80, 0x86, 0x42, 0x0, 0x40, 0xa2, 0x4, 0x0, - 0xc8, 0x6, 0x8, 0x1, 0x18, 0x18, 0x18, 0x7, - 0x10, 0x80, 0x30, 0x3, 0x20, 0x1, 0x0, 0x3c, - 0x80, 0x4, 0x0, 0xd8, 0x0, 0xc0, 0x8, - - /* U+0078 "x" */ - 0x8, 0xfe, 0x10, 0xe, 0xbf, 0xc0, 0x4, 0x18, - 0xd0, 0x6, 0x64, 0xe, 0x0, 0xb8, 0x11, 0x80, - 0x5, 0x21, 0x24, 0x1, 0x14, 0x84, 0x90, 0x70, - 0x23, 0x0, 0x73, 0x20, 0x74, 0x18, 0xd0, 0x7, - 0xd4, 0x26, 0xe1, 0x62, 0x1, 0xf0, 0xc0, 0x1, - 0x54, 0x1, 0xfd, 0x40, 0x7, 0x0, 0xfe, 0x73, - 0x1, 0x29, 0x0, 0xf8, 0xe0, 0x2a, 0x80, 0xc8, - 0x1, 0xee, 0x5, 0x52, 0x38, 0x50, 0x80, 0x69, - 0x21, 0xb0, 0x4, 0x10, 0xd8, 0x4, 0x8c, 0x14, - 0x20, 0x17, 0x2, 0xb0, 0xd, 0x3, 0x20, 0x6, - 0x38, 0x9, 0x20, - - /* U+0079 "y" */ - 0x1f, 0xf1, 0x80, 0x7d, 0xfe, 0x41, 0x40, 0xa0, - 0xf, 0x28, 0xa, 0x7, 0x83, 0x80, 0x7b, 0x81, - 0x80, 0x8, 0x22, 0x50, 0xc, 0x48, 0x14, 0x1, - 0x30, 0x70, 0x6, 0xa0, 0x32, 0x0, 0xa8, 0x10, - 0x40, 0x26, 0x9, 0x0, 0xc4, 0x80, 0xc0, 0x4, - 0x10, 0x50, 0xe, 0xe0, 0xa0, 0x7, 0x3, 0x0, - 0x79, 0x44, 0x8c, 0x14, 0x28, 0x3, 0xe7, 0xa, - 0x60, 0x23, 0x0, 0xfa, 0xc1, 0xac, 0x28, 0x3, - 0xf1, 0x18, 0x10, 0x30, 0x7, 0xf5, 0x0, 0x10, - 0x40, 0x3f, 0x9c, 0x1, 0xe0, 0x1f, 0xe4, 0x1, - 0x40, 0xf, 0xf7, 0x3, 0x0, 0x7f, 0x95, 0x2, - 0x40, 0x3e, 0x1e, 0xe5, 0x3, 0x88, 0x7, 0xe1, - 0x11, 0x44, 0x0, 0x3e, - - /* U+007A "z" */ - 0xaf, 0xff, 0xe9, 0x23, 0x3f, 0x80, 0x28, 0xcc, - 0xf5, 0x0, 0x28, 0x3, 0xc7, 0x21, 0x26, 0x1, - 0xc3, 0xa0, 0xcc, 0x0, 0xf6, 0x89, 0xc8, 0x7, - 0xa4, 0xc7, 0x40, 0x3c, 0xcc, 0xd, 0x10, 0xe, - 0x39, 0x9, 0x30, 0xe, 0x1d, 0x6, 0x60, 0x7, - 0xb4, 0x4e, 0x40, 0x3d, 0x26, 0x3a, 0x1, 0xf3, - 0x0, 0x37, 0x33, 0xce, 0x0, 0x13, 0x3f, 0xb8, - - /* U+007B "{" */ - 0x0, 0xc3, 0x1b, 0xfe, 0x40, 0xd, 0xae, 0x44, - 0x37, 0x0, 0x88, 0xc2, 0xf7, 0xc, 0x2, 0x60, - 0x14, 0x0, 0xf0, 0x81, 0x80, 0x7f, 0xf4, 0x44, - 0x3, 0xe3, 0x0, 0xfe, 0xf0, 0x60, 0xe, 0x15, - 0x60, 0xf0, 0xd, 0xfd, 0x43, 0x4a, 0x1, 0x90, - 0xc0, 0x7c, 0x3, 0xaf, 0x38, 0x55, 0xc0, 0x3c, - 0x2c, 0x18, 0x1, 0xf7, 0x3, 0x80, 0x7c, 0x60, - 0x20, 0x1f, 0xfd, 0x13, 0x0, 0xf9, 0xc0, 0x4c, - 0x3, 0xc4, 0x40, 0xcd, 0xc3, 0x0, 0xd8, 0xc4, - 0x43, 0x70, - - /* U+007C "|" */ - 0xff, 0x0, 0x7f, 0xff, 0x40, - - /* U+007D "}" */ - 0xff, 0x6d, 0x10, 0x7, 0x19, 0x89, 0x70, 0x40, - 0x36, 0x63, 0x84, 0x4e, 0x1, 0xe1, 0x40, 0xe0, - 0xf, 0x88, 0x4, 0x3, 0xff, 0xb6, 0x60, 0x1f, - 0x70, 0x38, 0x7, 0xce, 0x5, 0x2, 0x1, 0xc3, - 0x86, 0xfd, 0xe8, 0x1, 0x90, 0xc0, 0x91, 0xc0, - 0x23, 0x80, 0xbd, 0xb3, 0x0, 0x90, 0xd, 0x0, - 0x3d, 0xe0, 0xc0, 0x1f, 0xc6, 0x1, 0xff, 0xcf, - 0x10, 0xf, 0xc2, 0xe1, 0xe0, 0x1b, 0x31, 0xc2, - 0xe, 0x1, 0x8c, 0xc2, 0xb8, 0x20, 0x18, - - /* U+007E "~" */ - 0x0, 0xff, 0xe3, 0x2d, 0xff, 0x5a, 0x80, 0x79, - 0x60, 0x6e, 0x90, 0x5, 0x2b, 0x9c, 0x80, 0xea, - 0x82, 0xc8, 0x8b, 0xed, 0x82, 0x18, 0xdf, 0xc5, - 0x3b, 0x9, 0xb4, 0x12, 0x7d, 0xb5, 0x10, 0x39, - 0xc2, 0x76, 0x0, 0xf2, 0x57, 0x7e, 0x30, 0x0, - - /* U+0401 "Ё" */ - 0x0, 0x57, 0xd8, 0xf, 0xf9, 0x40, 0x3f, 0xf8, - 0x9d, 0x1c, 0x3, 0x10, 0x70, 0xc, 0x8e, 0xa0, - 0x7, 0x71, 0x0, 0x7f, 0xf0, 0xab, 0xff, 0xfc, - 0xc0, 0x1f, 0xfc, 0x24, 0xee, 0xfc, 0xc0, 0x10, - 0x8f, 0xe0, 0xf, 0xfe, 0xda, 0x7f, 0xfe, 0x10, - 0xf, 0xfe, 0x12, 0x77, 0x7e, 0x10, 0x8, 0x47, - 0xf0, 0x7, 0xff, 0xa0, 0x47, 0xf0, 0x4, 0x9d, - 0xdf, 0xa8, 0x3, 0xff, 0x80, - - /* U+0410 "А" */ - 0x0, 0xf2, 0xff, 0xac, 0x3, 0xff, 0x83, 0xe0, - 0x4, 0x10, 0xf, 0xf8, 0x54, 0x14, 0x18, 0x3, - 0xfe, 0x70, 0x59, 0xa, 0x0, 0xff, 0xa8, 0x38, - 0xc4, 0x8c, 0x3, 0xf8, 0x8c, 0x50, 0x18, 0x28, - 0x3, 0xfa, 0x81, 0xc0, 0x14, 0xe, 0x1, 0xfc, - 0xc1, 0x40, 0x2, 0x20, 0xa8, 0x7, 0xc8, 0x22, - 0x30, 0xa, 0x83, 0x80, 0x3e, 0xe0, 0x60, 0xc, - 0xc0, 0x82, 0x1, 0xe5, 0xa, 0x0, 0xc2, 0x60, - 0xe0, 0x1c, 0xc0, 0xd, 0xff, 0xe3, 0xa, 0x0, - 0xea, 0x0, 0xff, 0x19, 0x0, 0x44, 0x61, 0xbd, - 0xdf, 0x20, 0x50, 0x5, 0x40, 0x44, 0x11, 0xfb, - 0x81, 0x80, 0x26, 0xa, 0x0, 0xfc, 0x80, 0x28, - 0x8, 0x20, 0xa0, 0x1f, 0x85, 0x3, 0x83, 0x80, - 0x88, 0x1, 0xfd, 0xa0, 0xa2, - - /* U+0411 "Б" */ - 0xaf, 0xff, 0xf4, 0x0, 0x7f, 0xf1, 0x13, 0xff, - 0xf4, 0x0, 0x7f, 0xfa, 0xd3, 0xff, 0xb6, 0x8, - 0x3, 0xfc, 0x4f, 0xa8, 0x1, 0x27, 0xfe, 0xe9, - 0x10, 0xb1, 0x0, 0xf8, 0x5a, 0x80, 0xc, 0x1, - 0xfc, 0x82, 0x1a, 0x1, 0xfe, 0x20, 0x10, 0xf, - 0xf1, 0x0, 0x80, 0x7f, 0x20, 0x86, 0x80, 0x7c, - 0x2d, 0x40, 0x6, 0x0, 0x27, 0xfe, 0xe9, 0x10, - 0xa1, 0x0, 0xfc, 0x4d, 0xaa, 0x0, - - /* U+0412 "В" */ - 0xaf, 0xff, 0x76, 0x38, 0x7, 0xf8, 0x4e, 0x34, - 0x40, 0x24, 0xff, 0xbb, 0x5c, 0xa, 0xc0, 0x3e, - 0x12, 0x86, 0x5, 0x0, 0xff, 0x78, 0x7, 0xff, - 0x3, 0xc0, 0x80, 0x3f, 0x13, 0xb0, 0x58, 0x4, - 0x9f, 0xfb, 0x60, 0xe9, 0x80, 0x3f, 0xc5, 0xa0, - 0x19, 0x3f, 0xf7, 0x50, 0x3d, 0x0, 0x7e, 0x15, - 0xa0, 0x54, 0x0, 0xfe, 0x41, 0xd, 0x0, 0xff, - 0x10, 0x10, 0x7, 0xf8, 0x80, 0x3f, 0xe4, 0x10, - 0x30, 0xf, 0x85, 0xa8, 0x1, 0x20, 0x4, 0xff, - 0xdd, 0x22, 0x16, 0x20, 0x1f, 0x89, 0xf5, 0x0, - - /* U+0413 "Г" */ - 0xaf, 0xff, 0xf2, 0x0, 0x7f, 0xf0, 0x93, 0xbb, - 0xf2, 0x0, 0x42, 0x3f, 0x80, 0x3f, 0xff, 0xe0, - 0x1f, 0xff, 0xf0, 0xf, 0xfe, 0x38, - - /* U+0414 "Д" */ - 0x0, 0xdb, 0xff, 0xfd, 0x20, 0x1f, 0xfc, 0xd6, - 0xee, 0xe2, 0x0, 0xff, 0x8, 0xfc, 0x1, 0xff, - 0xcd, 0x30, 0xf, 0xfe, 0x37, 0x80, 0x7f, 0xf0, - 0x84, 0x3, 0xff, 0x8c, 0x40, 0x1f, 0xfc, 0x12, - 0x0, 0x8, 0x7, 0xff, 0x5, 0x80, 0xc, 0x1, - 0xff, 0xc1, 0x30, 0x1, 0x0, 0x7f, 0xf0, 0x74, - 0xc, 0x3, 0xff, 0x84, 0x80, 0x80, 0x1f, 0xfc, - 0x15, 0x10, 0xb0, 0xf, 0xf8, 0x56, 0x80, 0xc8, - 0x47, 0xe0, 0x0, 0x86, 0x50, 0x0, 0xfb, 0xbe, - 0x20, 0x6e, 0x90, 0xf, 0xfe, 0x3e, 0xff, 0xff, - 0xd2, 0x1, 0xff, 0xd8, 0x61, 0x0, 0xff, 0xe0, - 0x88, 0x80, - - /* U+0415 "Е" */ - 0xaf, 0xff, 0xf3, 0x0, 0x7f, 0xf0, 0x93, 0xbb, - 0xf3, 0x0, 0x42, 0x3f, 0x80, 0x3f, 0xfb, 0x69, - 0xff, 0xf8, 0x40, 0x3f, 0xf8, 0x49, 0xdd, 0xf8, - 0x40, 0x21, 0x1f, 0xc0, 0x1f, 0xfe, 0x81, 0x1f, - 0xc0, 0x12, 0x77, 0x7e, 0xa0, 0xf, 0xfe, 0x0, - - /* U+0416 "Ж" */ - 0xa, 0xff, 0x18, 0x7, 0x93, 0xfc, 0x20, 0x1e, - 0x5f, 0xf4, 0x0, 0x29, 0x3, 0x48, 0x3, 0xff, - 0x84, 0x94, 0xd, 0x0, 0x15, 0x90, 0xe0, 0x80, - 0x7f, 0xf0, 0xe, 0xc1, 0x24, 0x3, 0xb0, 0x87, - 0x4, 0x3, 0xfc, 0x5a, 0x7, 0x60, 0x1e, 0x1f, - 0x12, 0xd0, 0xf, 0xe1, 0xf1, 0x2d, 0x0, 0xfc, - 0x5a, 0x7, 0x40, 0x1f, 0xb4, 0x87, 0xc4, 0x3, - 0xf8, 0xec, 0x16, 0x40, 0x3d, 0x66, 0x18, 0x40, - 0x1f, 0xf2, 0x88, 0x33, 0x80, 0x6a, 0x40, 0x22, - 0x0, 0x7f, 0xf0, 0x20, 0x40, 0x11, 0xc0, 0xb, - 0x50, 0x1, 0x38, 0x7, 0xfc, 0x6c, 0x18, 0xc0, - 0xa0, 0x5, 0x8, 0x90, 0x82, 0x0, 0xff, 0x70, - 0x31, 0xca, 0x80, 0x67, 0x73, 0x18, 0x48, 0x7, - 0xf3, 0x90, 0xc0, 0x2, 0x8c, 0x0, 0xb0, 0x0, - 0xe0, 0x45, 0x0, 0xf8, 0xa0, 0x2c, 0x40, 0x28, - 0x0, 0x58, 0x4, 0x4e, 0x16, 0x1, 0xf4, 0x82, - 0x28, 0x7, 0xff, 0x2, 0x8, 0x64, 0x3, 0x95, - 0x2, 0x40, 0x3f, 0xf8, 0x52, 0xc, 0x60, 0x10, - 0xd8, 0x41, 0x0, 0x7f, 0xf0, 0x91, 0x43, 0x80, - 0x28, 0x12, 0x70, 0xf, 0xfe, 0x25, 0x89, 0x38, - 0x1b, 0x4, 0x80, 0x7f, 0xf1, 0x46, 0x2, 0x4, - - /* U+0417 "З" */ - 0x5, 0x9c, 0xef, 0xf6, 0xd2, 0x80, 0x47, 0x4c, - 0x62, 0x0, 0x25, 0xad, 0x20, 0x0, 0xb5, 0xf7, - 0x59, 0x0, 0x5e, 0x7, 0xd2, 0x82, 0x31, 0xbd, - 0x81, 0x20, 0x7, 0xf2, 0x0, 0x4, 0x3, 0xf8, - 0xc0, 0xe, 0x1, 0xf0, 0xae, 0x83, 0x90, 0x4, - 0xdf, 0xf7, 0x51, 0xd4, 0x0, 0x7f, 0x8b, 0x0, - 0x39, 0xbf, 0xed, 0x91, 0x6c, 0x0, 0xfc, 0x4d, - 0x80, 0x6c, 0x1, 0xfc, 0x4a, 0x18, 0x1, 0xfe, - 0x30, 0x60, 0xf, 0xf1, 0x3, 0x99, 0x0, 0x7c, - 0x68, 0x1a, 0xbb, 0x4a, 0x42, 0x49, 0x38, 0x6, - 0xc0, 0x5, 0xad, 0xed, 0xb6, 0x4, 0xd0, 0x6c, - 0x74, 0x10, 0x1, 0x36, 0x58, 0x80, - - /* U+0418 "И" */ - 0xaf, 0xa0, 0xf, 0xb7, 0xfd, 0x20, 0x1f, 0xca, - 0x40, 0x1f, 0xfc, 0x8, 0x0, 0xff, 0xe0, 0x31, - 0x1, 0x80, 0x7f, 0xa0, 0x21, 0xc0, 0x3f, 0x98, - 0x44, 0xe0, 0x1f, 0xe8, 0x9, 0x0, 0xff, 0x38, - 0x89, 0xc0, 0x3f, 0xd2, 0x10, 0x1, 0xfe, 0x71, - 0x13, 0x0, 0x7f, 0xa4, 0x20, 0x3, 0xfd, 0x2, - 0x4c, 0x1, 0xfc, 0x2e, 0x16, 0x1, 0xfe, 0x90, - 0x26, 0x0, 0xfe, 0x67, 0x8, 0x0, 0xff, 0x18, - 0x12, 0x80, 0x7f, 0xf0, 0x20, 0x3, 0xff, 0x80, - 0x6a, 0x1, 0xfc, - - /* U+0419 "Й" */ - 0x0, 0xab, 0x4c, 0x0, 0xbe, 0xc0, 0x1e, 0x92, - 0xcf, 0xf5, 0x13, 0x0, 0x78, 0xfa, 0x59, 0xeb, - 0x40, 0x3f, 0xb, 0x4c, 0x28, 0x7, 0xff, 0x1e, - 0xbe, 0x80, 0x3e, 0xdf, 0xf4, 0x80, 0x7f, 0x29, - 0x0, 0x7f, 0xf0, 0x20, 0x3, 0xff, 0x80, 0xc4, - 0x6, 0x1, 0xfe, 0x80, 0x87, 0x0, 0xfe, 0x61, - 0x13, 0x80, 0x7f, 0xa0, 0x24, 0x3, 0xfc, 0xe2, - 0x27, 0x0, 0xff, 0x48, 0x40, 0x7, 0xf9, 0xc4, - 0x4c, 0x1, 0xfe, 0x90, 0x80, 0xf, 0xf4, 0x9, - 0x30, 0x7, 0xf0, 0xb8, 0x58, 0x7, 0xfa, 0x40, - 0x98, 0x3, 0xf9, 0x9c, 0x20, 0x3, 0xfc, 0x60, - 0x4a, 0x1, 0xff, 0xc0, 0x80, 0xf, 0xfe, 0x1, - 0xa8, 0x7, 0xf0, - - /* U+041A "К" */ - 0xaf, 0xb0, 0xf, 0x93, 0xfd, 0x60, 0x1f, 0xe4, - 0xb0, 0x3b, 0x0, 0xfe, 0x3b, 0x3, 0xc0, 0xf, - 0xe3, 0xc0, 0x2d, 0x0, 0xfe, 0x2d, 0x2, 0xc1, - 0x0, 0xfc, 0x58, 0x25, 0x82, 0x1, 0xf8, 0x70, - 0x45, 0xe2, 0x1, 0xf8, 0x70, 0x41, 0x48, 0x3, - 0xf3, 0xe1, 0x0, 0x11, 0x40, 0x3f, 0x19, 0x6, - 0x30, 0x58, 0x80, 0x7f, 0x59, 0xc9, 0xd, 0x80, - 0x7e, 0xb4, 0x0, 0x48, 0x2a, 0x80, 0x3c, 0x88, - 0x0, 0x91, 0x82, 0xc4, 0x3, 0xfe, 0x91, 0x15, - 0x80, 0x7f, 0xf0, 0x28, 0x15, 0x0, 0x3f, 0xe4, - 0x50, 0xa0, 0xf, 0xfe, 0x5, 0x88, 0xa4, 0x3, - 0xfe, 0x1b, 0x6, 0x40, - - /* U+041B "Л" */ - 0x0, 0xeb, 0xff, 0xfe, 0xb0, 0xf, 0xfe, 0x5a, - 0xf7, 0x72, 0x0, 0x7f, 0x84, 0x78, 0x3, 0xfc, - 0x60, 0x1f, 0xfc, 0x17, 0x0, 0xff, 0xe9, 0x88, - 0x8, 0x7, 0xff, 0x4, 0xc3, 0xc0, 0x3f, 0xf8, - 0x22, 0x2, 0x1, 0xff, 0xc0, 0x20, 0x1, 0x0, - 0x7f, 0xf0, 0x18, 0x0, 0xa0, 0x1f, 0xfc, 0xc, - 0x1, 0x10, 0x7, 0xff, 0x1, 0x41, 0x0, 0x3f, - 0xf8, 0xc, 0x41, 0xc0, 0x1f, 0xe3, 0xa9, 0x4, - 0x40, 0x7, 0xfb, 0x14, 0x16, 0xc0, 0x3f, 0xe1, - 0x6c, 0xa0, 0xf, 0xf8, - - /* U+041C "М" */ - 0xaf, 0xf8, 0x40, 0x3e, 0x5f, 0xf9, 0x40, 0x33, - 0x80, 0x7d, 0xc0, 0x1e, 0x10, 0xa0, 0xf, 0xa, - 0x8, 0x7, 0x21, 0x19, 0x0, 0x73, 0x3, 0x80, - 0x79, 0x42, 0x80, 0x3a, 0x82, 0x80, 0x3d, 0x40, - 0xc0, 0x18, 0x8a, 0x30, 0xf, 0x11, 0x8a, 0x0, - 0x54, 0x14, 0x1, 0xfa, 0x83, 0x40, 0x26, 0x5, - 0x0, 0xfc, 0xe0, 0xc0, 0x4, 0x13, 0x20, 0xf, - 0xc2, 0xa0, 0xa1, 0xc1, 0x40, 0x1f, 0xee, 0xe, - 0x5, 0x6, 0x0, 0xff, 0x20, 0xa3, 0x82, 0x80, - 0x7f, 0xf0, 0x1c, 0x20, 0x38, 0x3, 0xff, 0x81, - 0x40, 0x1, 0x40, 0xf, 0xfe, 0x1, 0xbb, 0xac, - 0x3, 0xff, 0x85, 0x10, 0x50, 0xf, 0xfe, 0xe8, - - /* U+041D "Н" */ - 0xaf, 0xb0, 0xf, 0xd5, 0xf6, 0x1, 0xff, 0xff, - 0x0, 0xff, 0x93, 0xff, 0xf2, 0x80, 0x7f, 0xf1, - 0x93, 0xbb, 0xf2, 0x0, 0x70, 0x8f, 0xf0, 0x7, - 0xff, 0xfc, 0x3, 0xff, 0x9a, - - /* U+041E "О" */ - 0x0, 0xc2, 0xf9, 0xdf, 0xd8, 0xe0, 0x1f, 0x9b, - 0xa0, 0xc4, 0x4, 0xe3, 0x90, 0x3, 0x9e, 0x40, - 0xab, 0xbf, 0xa4, 0x45, 0x6a, 0x1, 0x1c, 0x2, - 0x6a, 0x88, 0xb, 0x79, 0x85, 0x10, 0x2, 0x0, - 0x68, 0x3, 0xc3, 0xa0, 0x8, 0x2, 0x40, 0x91, - 0x0, 0xf8, 0x58, 0x14, 0x10, 0x0, 0xa0, 0x1f, - 0xda, 0x0, 0x4e, 0x0, 0x10, 0x7, 0xf2, 0x80, - 0x8, 0x40, 0x80, 0x3f, 0xc2, 0x0, 0xe3, 0x0, - 0xff, 0xe2, 0x10, 0x10, 0x7, 0xf8, 0x40, 0x1f, - 0xc0, 0x2, 0x0, 0xfe, 0x50, 0x1, 0xa0, 0x1, - 0x40, 0x3f, 0xb4, 0x0, 0x84, 0x81, 0x20, 0x1f, - 0x85, 0x81, 0x40, 0x10, 0x3, 0x60, 0x1f, 0x68, - 0x2, 0x0, 0x7, 0x0, 0x9a, 0xa2, 0x2, 0xdc, - 0x61, 0x44, 0x1, 0x3c, 0x81, 0x57, 0x7f, 0x48, - 0x8a, 0x94, 0x3, 0x9b, 0xa0, 0xc4, 0x4, 0xe3, - 0xd4, 0x2, - - /* U+041F "П" */ - 0xaf, 0xff, 0xfe, 0x5, 0x80, 0x7f, 0xf1, 0x13, - 0xbb, 0xf2, 0x0, 0x70, 0x8f, 0xf0, 0x7, 0xff, - 0xfc, 0x3, 0xff, 0xfe, 0x1, 0xff, 0xe4, - - /* U+0420 "Р" */ - 0xaf, 0xff, 0x6c, 0x8, 0x7, 0xf1, 0x3f, 0x98, - 0x4, 0x9f, 0xf6, 0xc0, 0xe, 0x80, 0x7c, 0x4f, - 0x20, 0x2a, 0x1, 0xf9, 0x80, 0x18, 0x1, 0xfc, - 0x20, 0x60, 0x1f, 0xc2, 0x6, 0x1, 0xf9, 0x80, - 0x18, 0x1, 0xe2, 0x79, 0x1, 0x50, 0x2, 0x7f, - 0xdb, 0x0, 0xa, 0x0, 0xfc, 0x4f, 0xc8, 0x1, - 0x27, 0xfe, 0xd8, 0x10, 0xf, 0xff, 0xf0, - - /* U+0421 "С" */ - 0x0, 0xe6, 0xbe, 0xff, 0x6d, 0x20, 0x7, 0x2f, - 0x4a, 0x8, 0x0, 0x96, 0xf4, 0x80, 0xd, 0x42, - 0x28, 0xce, 0xe6, 0x41, 0x11, 0x40, 0xe4, 0xf, - 0x9c, 0xc4, 0x46, 0xfb, 0x0, 0x8, 0x1, 0xd0, - 0xf, 0xce, 0xe2, 0x40, 0x91, 0x0, 0xff, 0x20, - 0x1, 0x40, 0x3f, 0xee, 0x0, 0x10, 0x7, 0xfc, - 0x20, 0x40, 0x1f, 0xfc, 0xf1, 0x2, 0x0, 0xff, - 0xe0, 0x70, 0x0, 0x80, 0x3f, 0xe4, 0x0, 0x28, - 0x7, 0xfc, 0x48, 0x12, 0x20, 0x1f, 0xf4, 0x0, - 0xe8, 0x7, 0xe7, 0x70, 0x1c, 0x81, 0xf3, 0x90, - 0x88, 0xdf, 0x60, 0x2, 0x6a, 0x11, 0x46, 0xf7, - 0x32, 0x8, 0xd4, 0x2, 0x5e, 0x94, 0x10, 0x1, - 0x2d, 0xe1, 0x0, - - /* U+0422 "Т" */ - 0x1f, 0xff, 0xfe, 0x15, 0x80, 0x7f, 0xf1, 0x7, - 0xbb, 0xc4, 0xf, 0xdd, 0xd6, 0x2, 0x3e, 0x0, - 0x84, 0x78, 0x3, 0xff, 0xfe, 0x1, 0xff, 0xff, - 0x0, 0xff, 0xff, 0x80, - - /* U+0423 "У" */ - 0x6f, 0xf1, 0x0, 0x7d, 0x1f, 0xe0, 0x61, 0xb, - 0x0, 0xf9, 0x81, 0x80, 0xe, 0xc, 0x1, 0xe5, - 0x10, 0xb0, 0x5, 0x80, 0x18, 0x3, 0xa4, 0xc, - 0x80, 0x4, 0x81, 0x40, 0x18, 0xcc, 0x12, 0x1, - 0xb8, 0xc, 0xc0, 0x15, 0x0, 0xa8, 0x6, 0x51, - 0x9, 0x0, 0xb, 0x3, 0x0, 0x7a, 0x41, 0x44, - 0x18, 0x1, 0x40, 0x1e, 0x60, 0x3, 0x5, 0x2, - 0x10, 0x7, 0x85, 0x42, 0x90, 0x83, 0xc0, 0x3f, - 0x70, 0x15, 0x1, 0x20, 0x7, 0xe4, 0x20, 0x10, - 0xa0, 0xf, 0xf5, 0x80, 0x4c, 0x1, 0xfe, 0x70, - 0x2, 0x88, 0x7, 0xf9, 0x0, 0x12, 0x1, 0xfc, - 0x29, 0x0, 0x66, 0x0, 0xfd, 0x7d, 0x64, 0x10, - 0x1, 0xff, 0xa, 0x5a, 0x0, 0x7c, - - /* U+0424 "Ф" */ - 0x0, 0xfd, 0xbf, 0x0, 0x1f, 0xfc, 0x21, 0x33, - 0x1, 0x18, 0x7, 0xf8, 0x5f, 0x7b, 0x4, 0x17, - 0x3e, 0xd4, 0x3, 0xc9, 0xf0, 0x40, 0x60, 0x1, - 0x20, 0x4a, 0xc1, 0x0, 0x8e, 0xc4, 0x53, 0xf8, - 0x40, 0xdb, 0xa6, 0x3, 0xc0, 0xb, 0x80, 0x7d, - 0x80, 0x3c, 0x53, 0x40, 0x50, 0x6, 0x41, 0x62, - 0x1, 0xfc, 0xa8, 0xc, 0x8, 0x0, 0x50, 0xf, - 0xfb, 0x40, 0x4b, 0xc0, 0x3f, 0xf8, 0x44, 0x0, - 0x10, 0xf, 0xfe, 0x3f, 0x0, 0x8, 0x3, 0xfe, - 0x30, 0x1, 0x38, 0x2, 0xc0, 0x3f, 0xe9, 0x3, - 0x11, 0x30, 0x33, 0x80, 0x7e, 0x1b, 0x10, 0x80, - 0x4, 0x98, 0x46, 0xba, 0x0, 0x5, 0x23, 0xd0, - 0x21, 0x0, 0x2c, 0x70, 0x28, 0xb2, 0x6, 0xb7, - 0x12, 0xa7, 0x0, 0xe8, 0xe9, 0x53, 0x0, 0xa, - 0x3d, 0xea, 0x80, 0x7c, 0x2d, 0x58, 0x40, 0xd7, - 0x8, 0x1, 0xff, 0xcc, - - /* U+0425 "Х" */ - 0x2, 0xff, 0x30, 0x7, 0xd1, 0xfc, 0x20, 0x4e, - 0x10, 0x20, 0x1c, 0x6e, 0x16, 0x20, 0x8, 0x21, - 0xb0, 0xe, 0xe0, 0x55, 0x0, 0x6e, 0x5, 0x50, - 0x5, 0x4, 0x36, 0x1, 0xc6, 0xc1, 0x62, 0x4, - 0xe1, 0x2, 0x1, 0xe9, 0x21, 0xb0, 0xe0, 0x46, - 0x0, 0xfd, 0x20, 0xb6, 0x61, 0x20, 0x1f, 0xc8, - 0xc0, 0x81, 0x24, 0x1, 0xfe, 0xa0, 0x1, 0x30, - 0x7, 0xfd, 0x0, 0x2, 0x30, 0xf, 0xf3, 0x20, - 0x18, 0x70, 0x7, 0xf0, 0xc8, 0x46, 0x89, 0x40, - 0x7, 0xea, 0x2, 0x71, 0x80, 0x72, 0x0, 0xf2, - 0xa0, 0x70, 0x1, 0x90, 0x38, 0x3, 0x86, 0xc1, - 0xcc, 0x2, 0x90, 0x37, 0x0, 0xd6, 0x25, 0x0, - 0x18, 0xa0, 0x20, 0x80, 0x8, 0xa1, 0xc0, 0x1e, - 0x73, 0x9, 0x0, 0x50, 0x31, 0x80, 0x7d, 0xc0, - 0x8a, - - /* U+0426 "Ц" */ - 0xaf, 0xb0, 0xf, 0xd5, 0xf6, 0x1, 0xff, 0xff, - 0x0, 0xff, 0xff, 0x80, 0x7f, 0xff, 0xc0, 0x30, - 0x8f, 0xf0, 0x0, 0x40, 0x24, 0xee, 0xfc, 0x80, - 0x9d, 0x60, 0x1f, 0xfc, 0x4a, 0xff, 0xff, 0xe0, - 0x50, 0x7, 0xff, 0x8c, 0x46, - - /* U+0427 "Ч" */ - 0xff, 0x30, 0x7, 0x93, 0xfc, 0x20, 0x1f, 0xfe, - 0x81, 0xe, 0x0, 0xff, 0x10, 0x28, 0x7, 0xfa, - 0xc0, 0xa4, 0x80, 0x3f, 0x39, 0x83, 0x6f, 0xfe, - 0xb0, 0xd, 0x8e, 0x20, 0x1f, 0xf4, 0x77, 0xf7, - 0x6a, 0x0, 0xfc, 0x23, 0xc0, 0x1f, 0xff, 0xf0, - 0xf, 0x0, - - /* U+0428 "Ш" */ - 0xaf, 0xb0, 0xf, 0x2f, 0xf8, 0x3, 0xc3, 0xfe, - 0x50, 0xf, 0xff, 0xf8, 0x7, 0xff, 0xfc, 0x3, - 0xff, 0xfe, 0x1, 0xff, 0xff, 0x0, 0xff, 0x84, - 0x7c, 0x60, 0x1, 0x1f, 0x18, 0x7, 0x27, 0x77, - 0xa4, 0x1, 0xdd, 0xed, 0x0, 0xff, 0xe6, 0x80, - - /* U+0429 "Щ" */ - 0xaf, 0xb0, 0xf, 0x2f, 0xf8, 0x3, 0xc3, 0xfe, - 0x50, 0xf, 0xff, 0xf8, 0x7, 0xff, 0xfc, 0x3, - 0xff, 0xfe, 0x1, 0xff, 0xff, 0x0, 0xff, 0xee, - 0x88, 0xf8, 0xc0, 0x2, 0x3e, 0x30, 0x8, 0x40, - 0x24, 0xee, 0xf4, 0x80, 0x3b, 0xbd, 0xa0, 0xa, - 0xe4, 0x0, 0xff, 0xe6, 0x57, 0xff, 0xff, 0x21, - 0x0, 0x3f, 0xff, 0x62, 0x20, - - /* U+042A "Ъ" */ - 0x4f, 0xff, 0x8c, 0x3, 0xff, 0xa2, 0x9d, 0xdb, - 0x0, 0x3f, 0xf8, 0x42, 0x3c, 0x1, 0xff, 0xff, - 0x0, 0xb3, 0xff, 0x75, 0xa8, 0x7, 0xff, 0x10, - 0x52, 0xac, 0x3, 0xfd, 0x7f, 0xfb, 0x14, 0x12, - 0x40, 0x3f, 0x9c, 0x3, 0x1d, 0x20, 0x30, 0x7, - 0xff, 0x13, 0x80, 0x6, 0x1, 0xff, 0xc3, 0x10, - 0x3, 0x80, 0x7f, 0xf0, 0xc4, 0x0, 0xe0, 0x1f, - 0xfc, 0x3e, 0x0, 0x18, 0x7, 0xe7, 0x0, 0x84, - 0xed, 0x1, 0x80, 0x3f, 0xaf, 0xfe, 0xec, 0x40, - 0x49, 0x0, 0xff, 0xe1, 0xa, 0x55, 0x80, 0x0, - - /* U+042B "Ы" */ - 0xaf, 0xb0, 0xf, 0xfa, 0x3f, 0x40, 0x3f, 0xff, - 0xe0, 0x1f, 0xfd, 0x14, 0xff, 0xed, 0x82, 0x0, - 0xff, 0xe1, 0x13, 0xea, 0x0, 0x7c, 0x9f, 0xfb, - 0xa4, 0x42, 0xc4, 0x3, 0xfe, 0x16, 0xa0, 0x3, - 0x0, 0x7f, 0xf0, 0x50, 0x43, 0x40, 0x3f, 0xf8, - 0x44, 0x2, 0x1, 0xff, 0xc2, 0x20, 0x10, 0xf, - 0xfe, 0xa, 0x8, 0x68, 0x7, 0xfc, 0x2d, 0x40, - 0x6, 0x0, 0xf2, 0x7f, 0xee, 0x91, 0xb, 0x10, - 0xf, 0xfe, 0x1, 0x3e, 0xa0, 0x7, 0x0, - - /* U+042C "Ь" */ - 0xaf, 0xb0, 0xf, 0xff, 0xf8, 0x7, 0xff, 0xd, - 0x3f, 0xfb, 0x60, 0x80, 0x3f, 0xc4, 0xfa, 0x80, - 0x12, 0x7f, 0xee, 0x91, 0xb, 0x10, 0xf, 0x85, - 0xa8, 0x0, 0xc0, 0x1f, 0xc8, 0x21, 0xa0, 0x1f, - 0xe2, 0x1, 0x0, 0xff, 0x10, 0x8, 0x7, 0xf2, - 0x8, 0x68, 0x7, 0xc2, 0xd4, 0x0, 0x60, 0x2, - 0x7f, 0xee, 0x91, 0xb, 0x10, 0xf, 0xc4, 0xfa, - 0x80, - - /* U+042D "Э" */ - 0x0, 0x35, 0xf7, 0xfb, 0x69, 0x40, 0x39, 0x7a, - 0x50, 0x40, 0x4, 0xb5, 0xa4, 0x1, 0x70, 0x9c, - 0xef, 0xf6, 0x40, 0x96, 0x98, 0x0, 0xaf, 0x18, - 0x80, 0x4d, 0xfc, 0x83, 0x80, 0x12, 0x80, 0x1f, - 0xf, 0x81, 0x38, 0x7, 0xfc, 0x4a, 0x12, 0x1, - 0xff, 0xc0, 0xf0, 0x12, 0x0, 0x84, 0x7f, 0x30, - 0x1, 0x80, 0xf, 0xdd, 0xfb, 0x0, 0x2, 0x1, - 0xff, 0xc5, 0x7f, 0xff, 0xda, 0x0, 0x10, 0xf, - 0xf9, 0xc0, 0xc, 0x1, 0xff, 0x78, 0x9, 0x0, - 0x7f, 0x89, 0x42, 0x42, 0x94, 0x3, 0xe1, 0xf0, - 0x17, 0x1, 0xac, 0x62, 0x1, 0x37, 0xf2, 0xd, - 0x0, 0x70, 0x9c, 0xef, 0xf6, 0x40, 0x96, 0x98, - 0x1, 0x7a, 0x50, 0x40, 0x4, 0xb5, 0xa4, 0x1, - 0x0, - - /* U+042E "Ю" */ - 0x8f, 0xd0, 0xf, 0x85, 0xf3, 0xbf, 0xb1, 0xc4, - 0x3, 0xff, 0x82, 0xdd, 0x6, 0x20, 0x27, 0x1e, - 0xa0, 0x1f, 0xf3, 0x48, 0x15, 0x77, 0xf4, 0x88, - 0xa9, 0x40, 0x3f, 0x8e, 0x41, 0x35, 0x44, 0x5, - 0xb8, 0xc2, 0x88, 0x3, 0xf4, 0x0, 0xd0, 0x7, - 0xda, 0x0, 0x80, 0xf, 0x85, 0x2, 0x44, 0x3, - 0xe1, 0x70, 0x51, 0x0, 0xf3, 0x80, 0x14, 0x3, - 0xfa, 0xc0, 0xa, 0x1, 0x8, 0xde, 0x0, 0x20, - 0xf, 0xe3, 0x0, 0x18, 0x0, 0xbb, 0xa6, 0x1, - 0x0, 0xff, 0xe0, 0xf8, 0x7, 0xff, 0x34, 0xbf, - 0xe7, 0x1, 0x0, 0xff, 0xe0, 0xf8, 0x7, 0xb8, - 0x0, 0x40, 0x1f, 0xc6, 0x0, 0x30, 0xf, 0x38, - 0x1, 0x40, 0x3f, 0xac, 0x0, 0xa0, 0x1e, 0x14, - 0x9, 0x10, 0xf, 0x85, 0xc1, 0x44, 0x3, 0xe9, - 0x1, 0xa0, 0xf, 0xb4, 0x1, 0x0, 0x1f, 0x8a, - 0x41, 0x35, 0x44, 0x5, 0xb4, 0xc2, 0x88, 0x3, - 0xf9, 0xa8, 0xa, 0xbb, 0xfa, 0x48, 0x69, 0x40, - 0x3f, 0xe5, 0xe8, 0x31, 0x1, 0x38, 0xf5, 0x0, - 0x80, - - /* U+042F "Я" */ - 0x0, 0x8e, 0x77, 0xff, 0xe5, 0x0, 0x3e, 0x31, - 0x0, 0x7f, 0x1c, 0x0, 0xd6, 0xff, 0xdc, 0x1, - 0xa8, 0x1, 0xaa, 0x40, 0x10, 0x80, 0x65, 0x1, - 0x30, 0xf, 0xfe, 0x62, 0x80, 0x98, 0x7, 0xfa, - 0x80, 0x1c, 0xa2, 0x1, 0xf8, 0xec, 0x4a, 0xbb, - 0xff, 0x0, 0x72, 0x74, 0x88, 0x7, 0xff, 0x1, - 0xc4, 0x1f, 0xfd, 0xc0, 0x1f, 0x58, 0xc, 0x0, - 0x4, 0x3, 0xc6, 0xa1, 0x60, 0x1f, 0xef, 0x3, - 0x50, 0xf, 0xe6, 0x30, 0xf0, 0xf, 0xf4, 0x3, - 0x18, 0x7, 0xf4, 0x8, 0x40, 0x7, 0xf1, 0x38, - 0x40, 0x80, 0x7f, 0x0, - - /* U+0430 "а" */ - 0x1, 0x6b, 0xdf, 0xf6, 0xc0, 0x80, 0x51, 0x28, - 0x40, 0x2, 0x7f, 0x20, 0x7, 0x3e, 0xff, 0xd8, - 0x63, 0x20, 0x7, 0x82, 0x0, 0x8f, 0x45, 0x8, - 0x3, 0xf0, 0xa8, 0x20, 0x0, 0xe7, 0x7f, 0xf2, - 0x0, 0x83, 0x63, 0x11, 0xc, 0xe1, 0xf, 0x19, - 0x7, 0xfd, 0xcc, 0x90, 0x0, 0xe0, 0x70, 0x1, - 0xc2, 0x0, 0xe0, 0x60, 0xf, 0x20, 0x3, 0xc1, - 0x80, 0x3a, 0x0, 0x24, 0x3, 0x80, 0x0, 0xc3, - 0x88, 0x0, 0xd4, 0x1f, 0xfb, 0x8e, 0xc8, 0x1, - 0x54, 0x10, 0x0, 0xe6, 0x40, 0x10, - - /* U+0431 "б" */ - 0x0, 0xff, 0xe2, 0x94, 0x5e, 0xf7, 0x3c, 0x40, - 0x35, 0x6b, 0xa1, 0x8, 0x81, 0x0, 0x2c, 0x50, - 0x6d, 0xff, 0xca, 0x0, 0x83, 0xb, 0x92, 0x0, - 0xf9, 0xc2, 0x50, 0x3, 0xf2, 0x81, 0x30, 0x7, - 0xf6, 0x2, 0x22, 0xfb, 0xfa, 0x8c, 0x2, 0x30, - 0x7b, 0x41, 0x19, 0x71, 0xc0, 0x30, 0x83, 0xf7, - 0x4c, 0x10, 0xa0, 0x19, 0xa0, 0x40, 0x65, 0x2, - 0x0, 0xc0, 0x10, 0x1, 0xd0, 0x4, 0x40, 0x1, - 0x8, 0x7, 0x18, 0x83, 0x80, 0x18, 0x3, 0xe3, - 0x2, 0xe0, 0x70, 0xf, 0xf0, 0x81, 0x0, 0x7c, - 0x60, 0x48, 0x2, 0x40, 0x1c, 0x62, 0xe, 0x44, - 0x8, 0x0, 0xe8, 0x2, 0x20, 0x40, 0x2c, 0x8, - 0xc, 0xa0, 0x40, 0x1, 0x5c, 0x1f, 0xba, 0x60, - 0x85, 0x0, 0xa2, 0xd0, 0x46, 0x5c, 0x70, 0x0, - - /* U+0432 "в" */ - 0xdf, 0xfe, 0xeb, 0x40, 0xc, 0x46, 0x62, 0x14, - 0xb6, 0x0, 0xa3, 0x31, 0xbc, 0xa1, 0x0, 0x1f, - 0xc, 0x0, 0x88, 0x3, 0xe1, 0x0, 0x8, 0x7, - 0x93, 0x81, 0x80, 0x2a, 0xff, 0xac, 0xa6, 0x40, - 0x11, 0x19, 0x88, 0x42, 0x58, 0x2, 0x8c, 0xc6, - 0xf5, 0x4, 0x98, 0x7, 0xca, 0xa0, 0xa0, 0xf, - 0xf1, 0x0, 0x7c, 0xaa, 0xc, 0x0, 0x46, 0x63, - 0x7a, 0x80, 0x9c, 0x0, 0x46, 0x62, 0x13, 0x8d, - 0x0, - - /* U+0433 "г" */ - 0xdf, 0xff, 0xce, 0x0, 0x23, 0x3f, 0x10, 0x2, - 0x33, 0x3c, 0xa0, 0x1f, 0xff, 0xf0, 0xf, 0xfe, - 0xb8, - - /* U+0434 "д" */ - 0x0, 0x93, 0xff, 0xf5, 0x0, 0x7e, 0x33, 0xc2, - 0x1, 0xfc, 0x39, 0x99, 0x80, 0x3f, 0xfb, 0x22, - 0x6, 0x1, 0xff, 0xc0, 0x20, 0x10, 0xf, 0xfe, - 0x7, 0x3, 0x0, 0x7f, 0xf0, 0x14, 0x34, 0x3, - 0xff, 0x80, 0x60, 0x60, 0x1f, 0xf3, 0x0, 0xa0, - 0x7, 0xf8, 0xa0, 0x18, 0x3, 0xfd, 0x3a, 0x20, - 0xb9, 0x9c, 0xc0, 0x98, 0x8a, 0x1, 0x11, 0x9f, - 0x8, 0x9, 0x88, 0x3, 0xff, 0xfd, 0x20, 0x1f, - 0xfd, 0x49, 0x80, 0xf, 0xf2, 0x43, 0x80, - - /* U+0435 "е" */ - 0x0, 0x8e, 0xbb, 0xfd, 0x8c, 0x1, 0xcf, 0x8a, - 0x20, 0x3, 0x9b, 0x0, 0x96, 0x2, 0x3b, 0xfd, - 0x42, 0x92, 0x0, 0xb0, 0xa7, 0x10, 0x2, 0xe8, - 0x30, 0xa0, 0x92, 0x80, 0x71, 0x90, 0x26, 0x1, - 0xe6, 0x7c, 0x60, 0x44, 0x1, 0x33, 0xf8, 0x40, - 0x32, 0xff, 0xff, 0x39, 0x3, 0x0, 0x7f, 0xb4, - 0xc, 0x80, 0x3f, 0x94, 0x42, 0x40, 0x3e, 0x10, - 0x5, 0x82, 0x59, 0x80, 0x47, 0x1e, 0x0, 0x59, - 0x4, 0xcf, 0xef, 0xc7, 0x10, 0x9, 0xb5, 0x88, - 0x4, 0x49, 0x1c, 0x0, - - /* U+0436 "ж" */ - 0x2, 0xef, 0x70, 0xc, 0x9f, 0xc0, 0x1d, 0x9f, - 0x40, 0x2, 0xd0, 0x85, 0x0, 0xff, 0x51, 0x9a, - 0x80, 0x23, 0xa0, 0xa3, 0x0, 0xfd, 0x2a, 0x5a, - 0x1, 0xcb, 0x1, 0xa4, 0x1, 0xe6, 0x60, 0xf8, - 0x80, 0x79, 0xd8, 0x7c, 0x40, 0x32, 0xc8, 0x69, - 0x0, 0x7e, 0x91, 0x2d, 0x0, 0x8e, 0x81, 0x8c, - 0x3, 0xf9, 0xc4, 0xe, 0x40, 0x74, 0x0, 0xc4, - 0x1, 0xf8, 0xa0, 0x2c, 0x88, 0x0, 0x16, 0x60, - 0x48, 0x7, 0xe9, 0x7, 0x4f, 0x10, 0x2, 0x4c, - 0x85, 0x14, 0x3, 0xca, 0x83, 0x0, 0x56, 0x3, - 0x60, 0xb, 0xb, 0x10, 0xc, 0x36, 0x14, 0x1, - 0x8, 0x7, 0x2a, 0xc, 0x0, 0x68, 0x15, 0x40, - 0xf, 0xf5, 0x3, 0x18, 0x0, 0xd8, 0x2c, 0x3, - 0xfe, 0x18, 0xe, 0x0, 0x70, 0x48, 0x80, 0x7f, - 0xf0, 0x1c, 0xc9, 0xc0, - - /* U+0437 "з" */ - 0x8, 0xbd, 0xff, 0x6c, 0x90, 0x4, 0xe8, 0x40, - 0x2, 0x6d, 0x40, 0x4, 0xe7, 0xfd, 0x86, 0x12, - 0x0, 0x63, 0x0, 0x8f, 0xc0, 0x80, 0x3e, 0x19, - 0x3, 0x0, 0xd9, 0xbd, 0xc5, 0x1f, 0x0, 0xc4, - 0x41, 0x2, 0xc3, 0x0, 0xdd, 0xfd, 0x61, 0xaa, - 0x1, 0xe1, 0x4c, 0xa, 0x10, 0xf, 0x84, 0x81, - 0x40, 0x3e, 0x12, 0x0, 0x2b, 0x88, 0x4, 0x98, - 0x2, 0x85, 0x1d, 0xfd, 0xf6, 0x41, 0x40, 0xae, - 0x62, 0x20, 0x26, 0xd4, 0x0, - - /* U+0438 "и" */ - 0xdf, 0x50, 0xe, 0xaf, 0xf3, 0x0, 0x7c, 0x6a, - 0x1, 0xfe, 0xf0, 0xf, 0xf2, 0x99, 0x20, 0x7, - 0xe8, 0x9, 0x0, 0xfc, 0xe4, 0x88, 0x0, 0xf8, - 0x60, 0x24, 0x3, 0xf4, 0x3, 0x10, 0x7, 0xc4, - 0xc1, 0x0, 0x1f, 0xa4, 0x20, 0x40, 0x3e, 0xc4, - 0x17, 0x0, 0xfc, 0xc1, 0x60, 0x1f, 0xe3, 0x50, - 0xf, 0xf7, 0x80, 0x7e, - - /* U+0439 "й" */ - 0x0, 0x65, 0x0, 0x43, 0xea, 0x1, 0x91, 0x54, - 0x3, 0x60, 0xe0, 0x1a, 0x46, 0xbf, 0x95, 0xc8, - 0x3, 0xf, 0x43, 0x32, 0xe0, 0x3, 0xe7, 0x99, - 0x20, 0x6, 0xdf, 0x50, 0xe, 0xaf, 0xf3, 0x0, - 0x7c, 0x6a, 0x1, 0xfe, 0xf0, 0xf, 0xf2, 0x99, - 0x20, 0x7, 0xe8, 0x9, 0x0, 0xfc, 0xe4, 0x88, - 0x0, 0xf8, 0x60, 0x24, 0x3, 0xf4, 0x3, 0x10, - 0x7, 0xc4, 0xc1, 0x0, 0x1f, 0xa4, 0x20, 0x40, - 0x3e, 0xc4, 0x17, 0x0, 0xfc, 0xc1, 0x60, 0x1f, - 0xe3, 0x50, 0xf, 0xf7, 0x80, 0x7e, - - /* U+043A "к" */ - 0xdf, 0x50, 0xc, 0x5d, 0xf2, 0x1, 0xf0, 0xf8, - 0xac, 0x80, 0x78, 0x70, 0x92, 0x80, 0x3e, 0xd2, - 0x3b, 0x0, 0xfa, 0xcc, 0xb4, 0x3, 0xea, 0x40, - 0xe1, 0x0, 0xf4, 0x28, 0x3, 0xc0, 0x3e, 0x21, - 0xb1, 0x36, 0x0, 0xfb, 0x52, 0xc2, 0x48, 0x3, - 0xa4, 0xc1, 0x54, 0x12, 0x1, 0xc6, 0x1, 0x58, - 0xa3, 0x0, 0x7e, 0x1b, 0x9, 0x10, 0xf, 0xca, - 0x81, 0x40, 0x1f, 0xd4, 0x8, 0xa0, - - /* U+043B "л" */ - 0x0, 0xd1, 0xff, 0xf9, 0x40, 0x3c, 0x26, 0x78, - 0x3, 0xf9, 0x33, 0x31, 0x0, 0x7f, 0xf2, 0x8c, - 0x3, 0xfe, 0x10, 0xf, 0xfe, 0x9, 0x80, 0x80, - 0x7f, 0xcc, 0x1c, 0x1, 0xff, 0x10, 0x10, 0x7, - 0xf8, 0x84, 0x14, 0x3, 0xfd, 0x40, 0x62, 0x1, - 0xf8, 0x61, 0xc2, 0x40, 0x3f, 0xf, 0x38, 0x3a, - 0x80, 0x7f, 0xa, 0xe4, 0x0, 0x7f, 0x0, - - /* U+043C "м" */ - 0xdf, 0xf4, 0x0, 0x79, 0xbf, 0xdc, 0x1, 0x30, - 0x7, 0xa8, 0x3, 0x88, 0x54, 0x3, 0x19, 0x88, - 0x3, 0x50, 0x70, 0x6, 0xa0, 0xa0, 0xc, 0x48, - 0x82, 0x0, 0x98, 0x90, 0x3, 0xb8, 0x28, 0x0, - 0xc1, 0x40, 0x1e, 0x51, 0x60, 0x5, 0x3, 0x0, - 0x7c, 0xc2, 0xa6, 0x65, 0x10, 0xf, 0xa8, 0x3a, - 0x83, 0x80, 0x3f, 0x12, 0x21, 0x89, 0x0, 0x3f, - 0xb8, 0x1, 0x40, 0x1f, 0xe5, 0xaa, 0x30, 0x7, - 0xfc, 0xaa, 0x10, 0xf, 0xfe, 0x38, - - /* U+043D "н" */ - 0xdf, 0x50, 0xf, 0x57, 0xc0, 0x7, 0xff, 0xca, - 0xbf, 0xfc, 0xa0, 0x18, 0x8c, 0xfc, 0x20, 0x1a, - 0x33, 0x3c, 0x80, 0x1f, 0xff, 0x20, - - /* U+043E "о" */ - 0x0, 0x96, 0xfb, 0xfa, 0x88, 0x3, 0xaa, 0x88, - 0x23, 0x2e, 0xb0, 0x5, 0xa, 0x11, 0xfd, 0xc4, - 0x9, 0x30, 0x17, 0x8, 0x70, 0x0, 0xd9, 0x84, - 0x2, 0x0, 0x1c, 0x3, 0xa0, 0x10, 0x74, 0x10, - 0x3, 0xc8, 0x0, 0x52, 0x2, 0x0, 0xfe, 0x10, - 0x1, 0x80, 0x7f, 0x88, 0x18, 0x3, 0xf8, 0x74, - 0xc, 0x40, 0x39, 0x0, 0xa, 0x80, 0x9, 0x0, - 0xe8, 0x4, 0x11, 0x38, 0x3b, 0x80, 0x3, 0x66, - 0x10, 0x0, 0x85, 0x8, 0xfe, 0xe2, 0x4, 0x98, - 0x5, 0x54, 0x41, 0x19, 0x75, 0x80, 0x0, - - /* U+043F "п" */ - 0xdf, 0xff, 0xf4, 0x0, 0x8, 0xcf, 0xc2, 0x1, - 0xa3, 0x33, 0xc8, 0x1, 0xff, 0xff, 0x0, 0xff, - 0xf7, 0x80, - - /* U+0440 "р" */ - 0xdf, 0x51, 0x9e, 0xfe, 0x91, 0x0, 0xc5, 0xec, - 0x2, 0x26, 0xf1, 0x0, 0xa0, 0x2f, 0xb9, 0x82, - 0x2d, 0x0, 0xda, 0x80, 0x3, 0xc0, 0x34, 0x0, - 0x21, 0x80, 0x62, 0x40, 0xd0, 0x6, 0x0, 0x7b, - 0x1, 0x40, 0x4, 0x1, 0xe2, 0x2, 0x0, 0xff, - 0xe1, 0x10, 0x7, 0x88, 0x8, 0x1, 0x80, 0x1e, - 0xc0, 0x50, 0x2, 0x18, 0x6, 0x24, 0xd, 0x0, - 0xb5, 0x0, 0x7, 0x80, 0x68, 0x0, 0x90, 0xbf, - 0xf6, 0x8, 0xb4, 0x2, 0x3f, 0x61, 0x1, 0x6f, - 0x10, 0xc, 0x33, 0xdf, 0xd2, 0x20, 0x1f, 0xfe, - 0x60, - - /* U+0441 "с" */ - 0x0, 0x8a, 0x77, 0xfb, 0x60, 0x80, 0xf, 0xac, - 0x40, 0x24, 0xf2, 0xd, 0x0, 0xbb, 0xfe, 0xe9, - 0x30, 0x80, 0x6a, 0x20, 0x0, 0xb4, 0x28, 0x84, - 0x0, 0x7d, 0xa0, 0x82, 0x1, 0xf1, 0x1, 0x0, - 0x7f, 0xf1, 0xc8, 0x8, 0x3, 0xf6, 0x82, 0x8, - 0x7, 0xca, 0x21, 0x0, 0x1f, 0xa0, 0x1a, 0x88, - 0x0, 0x2d, 0x0, 0xd0, 0xb, 0xbf, 0xee, 0x93, - 0x0, 0x3e, 0x28, 0x80, 0x93, 0xc8, - - /* U+0442 "т" */ - 0x4f, 0xff, 0xfe, 0x2, 0x39, 0x9f, 0x0, 0xc, - 0xf9, 0xcf, 0x33, 0x68, 0x3, 0x33, 0x8c, 0x3, - 0xff, 0xfe, 0x1, 0xff, 0xff, 0x0, 0xc0, - - /* U+0443 "у" */ - 0x1f, 0xf1, 0x80, 0x7d, 0xfe, 0x41, 0x40, 0xa0, - 0xf, 0x28, 0xa, 0x7, 0x83, 0x80, 0x7b, 0x81, - 0x80, 0x8, 0x22, 0x50, 0xc, 0x48, 0x14, 0x1, - 0x30, 0x70, 0x6, 0xa0, 0x32, 0x0, 0xa8, 0x10, - 0x40, 0x26, 0x9, 0x0, 0xc4, 0x80, 0xc0, 0x4, - 0x10, 0x50, 0xe, 0xe0, 0xa0, 0x7, 0x3, 0x0, - 0x79, 0x44, 0x8c, 0x14, 0x28, 0x3, 0xe7, 0xa, - 0x60, 0x23, 0x0, 0xfa, 0xc1, 0xac, 0x28, 0x3, - 0xf1, 0x18, 0x10, 0x30, 0x7, 0xf5, 0x0, 0x10, - 0x40, 0x3f, 0x9c, 0x1, 0xe0, 0x1f, 0xe4, 0x1, - 0x40, 0xf, 0xf7, 0x3, 0x0, 0x7f, 0x95, 0x2, - 0x40, 0x3e, 0x1e, 0xe5, 0x3, 0x88, 0x7, 0xe1, - 0x11, 0x44, 0x0, 0x3e, - - /* U+0444 "ф" */ - 0x0, 0xfd, 0xbe, 0xa0, 0x1f, 0xff, 0x71, 0xae, - 0xe4, 0x80, 0x64, 0xdf, 0xd6, 0x0, 0xc3, 0xea, - 0x20, 0xd8, 0x0, 0xcb, 0x20, 0x29, 0x80, 0xa, - 0xc4, 0xb7, 0xb4, 0x48, 0x19, 0xff, 0xd0, 0xe, - 0x60, 0x4a, 0x1e, 0x40, 0x5e, 0x0, 0x68, 0x0, - 0x3a, 0x84, 0x82, 0x1, 0x90, 0x4, 0x44, 0xc, - 0x0, 0xdc, 0x8, 0x1e, 0xc, 0x1, 0xff, 0xc0, - 0x50, 0x11, 0x18, 0x18, 0x7, 0xff, 0x0, 0x40, - 0x6, 0x1, 0xff, 0xc7, 0x30, 0x30, 0xf, 0xfe, - 0x0, 0x80, 0xf, 0xc1, 0x80, 0x3f, 0xf8, 0xa, - 0x0, 0x14, 0x3, 0x20, 0x8, 0x88, 0x1e, 0x1, - 0xb8, 0x14, 0x9, 0x3, 0xc8, 0xb, 0xc0, 0xb, - 0x0, 0x7, 0x50, 0x90, 0x5, 0x9, 0x6f, 0x6b, - 0x10, 0x33, 0xff, 0xa0, 0x1c, 0xc0, 0x3, 0xea, - 0x0, 0x6b, 0x0, 0x65, 0x90, 0x14, 0xc0, 0x6, - 0x1a, 0xfe, 0x90, 0xc, 0x9b, 0xfa, 0xc0, 0x1f, - 0xff, 0xf0, 0xc, - - /* U+0445 "х" */ - 0x8, 0xfe, 0x10, 0xe, 0xbf, 0xc0, 0x4, 0x18, - 0xd0, 0x6, 0x64, 0xe, 0x0, 0xb8, 0x11, 0x80, - 0x5, 0x21, 0x24, 0x1, 0x14, 0x84, 0x90, 0x70, - 0x23, 0x0, 0x73, 0x20, 0x74, 0x18, 0xd0, 0x7, - 0xd4, 0x26, 0xe1, 0x62, 0x1, 0xf0, 0xc0, 0x1, - 0x54, 0x1, 0xfd, 0x40, 0x7, 0x0, 0xfe, 0x73, - 0x1, 0x29, 0x0, 0xf8, 0xe0, 0x2a, 0x80, 0xc8, - 0x1, 0xee, 0x5, 0x52, 0x38, 0x50, 0x80, 0x69, - 0x21, 0xb0, 0x4, 0x10, 0xd8, 0x4, 0x8c, 0x14, - 0x20, 0x17, 0x2, 0xb0, 0xd, 0x3, 0x20, 0x6, - 0x38, 0x9, 0x20, - - /* U+0446 "ц" */ - 0xdf, 0x50, 0xf, 0x57, 0xc0, 0x7, 0xff, 0xfc, - 0x3, 0xff, 0xfe, 0x1, 0xfa, 0x33, 0x3c, 0x80, - 0xd8, 0x40, 0x2, 0x33, 0xf0, 0x80, 0x98, 0xef, - 0xff, 0xfa, 0x0, 0x3f, 0xfb, 0xa9, 0x4, - - /* U+0447 "ч" */ - 0x3f, 0xe0, 0xe, 0x2f, 0xf0, 0x7, 0xff, 0x30, - 0x40, 0x3f, 0x8, 0x0, 0x40, 0x3e, 0x21, 0xb, - 0x0, 0xfd, 0x0, 0xbf, 0x99, 0x78, 0x4, 0xd4, - 0x60, 0x67, 0x10, 0x6, 0x5c, 0xff, 0xda, 0x1, - 0xff, 0xed, - - /* U+0448 "ш" */ - 0xdf, 0x50, 0xc, 0x3f, 0xe1, 0x0, 0xcd, 0xf8, - 0x1, 0xff, 0xff, 0x0, 0xff, 0xff, 0x80, 0x7f, - 0xf9, 0xa3, 0x33, 0x80, 0x1b, 0x99, 0xa0, 0x3, - 0x11, 0x9e, 0x20, 0x1, 0x9f, 0x8, 0x0, - - /* U+0449 "щ" */ - 0xdf, 0x50, 0xc, 0x3f, 0xe1, 0x0, 0xcd, 0xf8, - 0x1, 0xff, 0xff, 0x0, 0xff, 0xff, 0x80, 0x7f, - 0xff, 0xa3, 0x33, 0x80, 0x1b, 0x99, 0xa0, 0xf, - 0x18, 0x0, 0x46, 0x78, 0x80, 0x6, 0x7c, 0x20, - 0x3, 0xed, 0xff, 0xff, 0xe2, 0x60, 0x7, 0xff, - 0xbc, 0xa2, 0xc0, - - /* U+044A "ъ" */ - 0x4f, 0xff, 0x10, 0x7, 0xe7, 0x33, 0xc0, 0x1f, - 0xf1, 0xe6, 0x60, 0xf, 0xff, 0xb6, 0xff, 0xdd, - 0x6c, 0x1, 0xfc, 0x46, 0x62, 0x14, 0x9a, 0x0, - 0xfd, 0xf9, 0x8d, 0xf8, 0x5, 0x40, 0xf, 0xfe, - 0x3, 0x90, 0x60, 0x7, 0xff, 0xf, 0xc0, 0x3f, - 0xf8, 0xe, 0x40, 0x60, 0x1f, 0x7e, 0x63, 0x7e, - 0x1, 0x50, 0x3, 0xe2, 0x33, 0x10, 0xa4, 0xd0, - 0x0, - - /* U+044B "ы" */ - 0xdf, 0x50, 0xf, 0xe5, 0xfd, 0x0, 0xff, 0xff, - 0x80, 0x2b, 0xff, 0x63, 0x80, 0x7e, 0x23, 0x31, - 0x9, 0xc6, 0x80, 0x7d, 0x19, 0x8d, 0xea, 0x2, - 0x70, 0xf, 0xf9, 0x54, 0x18, 0x1, 0xff, 0xc2, - 0x10, 0xf, 0xf9, 0x54, 0x1a, 0x1, 0xe8, 0xcc, - 0x6f, 0x50, 0x13, 0x80, 0x78, 0x8c, 0xc4, 0x27, - 0x1a, 0x1, 0xc0, - - /* U+044C "ь" */ - 0xdf, 0x50, 0xf, 0xff, 0xad, 0x7f, 0xec, 0x70, - 0xc, 0x46, 0x62, 0x13, 0x8d, 0x0, 0xa3, 0x31, - 0xbd, 0x40, 0x4e, 0x1, 0xf2, 0xa8, 0x30, 0x3, - 0xfc, 0x20, 0x1f, 0x2a, 0x83, 0x40, 0x11, 0x98, - 0xde, 0xa0, 0x27, 0x0, 0x11, 0x98, 0x84, 0xe3, - 0x40, - - /* U+044D "э" */ - 0x28, 0xde, 0xfd, 0x93, 0x0, 0xa1, 0xc8, 0x40, - 0x9b, 0x1c, 0x1, 0x95, 0xdf, 0xee, 0x80, 0x86, - 0x6, 0x51, 0x0, 0xb, 0xc8, 0x40, 0x7, 0xe6, - 0x21, 0x50, 0x2c, 0xcf, 0x18, 0x60, 0x9, 0x9f, - 0x84, 0xc, 0xf, 0xff, 0xca, 0x1, 0xfe, 0x60, - 0x30, 0xf, 0x84, 0xc3, 0x0, 0x3e, 0xb0, 0x2, - 0xcb, 0x88, 0x0, 0xa9, 0x42, 0x40, 0xe3, 0xbf, - 0xda, 0xa0, 0xec, 0x10, 0xe4, 0x20, 0x2b, 0x90, - 0x0, - - /* U+044E "ю" */ - 0xbf, 0x60, 0xc, 0x53, 0xbf, 0xec, 0x70, 0xf, - 0xe5, 0xd6, 0x20, 0x1, 0xc6, 0x8, 0x7, 0x8a, - 0x80, 0xf3, 0xfd, 0x40, 0x74, 0x1, 0xe8, 0x1, - 0xd3, 0x0, 0x2d, 0x82, 0x18, 0x7, 0x28, 0x30, - 0x80, 0x64, 0x30, 0xa0, 0x4, 0x6e, 0x80, 0x18, - 0x1, 0xe4, 0x5, 0x0, 0x9, 0x10, 0x0, 0xc0, - 0x1e, 0xe0, 0x10, 0x4, 0xff, 0x0, 0x7f, 0xf1, - 0x4, 0x0, 0xc0, 0x1e, 0xe0, 0x10, 0xe, 0x30, - 0xc0, 0xf, 0x20, 0x28, 0x7, 0x50, 0x38, 0x80, - 0x64, 0x30, 0xa0, 0xe, 0x62, 0xd, 0x30, 0x2, - 0xd8, 0x21, 0x80, 0x7b, 0xc4, 0xf3, 0xfd, 0x40, - 0x74, 0x1, 0xf1, 0x7b, 0x90, 0x0, 0xe3, 0x4, - 0x0, - - /* U+044F "я" */ - 0x0, 0xc, 0x6f, 0xff, 0x98, 0x7, 0xdc, 0x84, - 0xce, 0x0, 0xd2, 0x22, 0xce, 0xcc, 0x8c, 0x2, - 0x40, 0x63, 0x0, 0xfc, 0xe0, 0x1f, 0xf1, 0x83, - 0x98, 0x7, 0xe9, 0x20, 0xce, 0xcc, 0x8c, 0x2, - 0x1d, 0x81, 0x11, 0x9c, 0x1, 0xe5, 0x10, 0xcf, - 0xf1, 0x80, 0x74, 0x83, 0x18, 0x7, 0xcc, 0x83, - 0x20, 0x1f, 0xc, 0x5, 0x0, 0x7e, 0xb1, 0x54, - 0x0, 0xf9, 0x54, 0x36, 0x1, 0xf8, - - /* U+0451 "ё" */ - 0x0, 0x95, 0xd0, 0x5, 0xdc, 0x20, 0x1d, 0xd1, - 0xc0, 0x71, 0x2, 0x0, 0xff, 0xe3, 0x5f, 0xd0, - 0x17, 0xf8, 0xc0, 0x3f, 0xfa, 0x67, 0x5d, 0xfe, - 0xc6, 0x0, 0xe7, 0xc5, 0x10, 0x1, 0xcd, 0x80, - 0x4b, 0x1, 0x1d, 0xfe, 0xa1, 0x49, 0x0, 0x58, - 0x53, 0x88, 0x1, 0x74, 0x18, 0x50, 0x49, 0x40, - 0x38, 0xc8, 0x13, 0x0, 0xf3, 0x3e, 0x30, 0x22, - 0x0, 0x99, 0xfc, 0x20, 0x19, 0x7f, 0xff, 0x9c, - 0x81, 0x80, 0x3f, 0xda, 0x6, 0x40, 0x1f, 0xca, - 0x21, 0x20, 0x1f, 0x8, 0x2, 0xc1, 0x2c, 0xc0, - 0x23, 0x8f, 0x0, 0x2c, 0x82, 0x67, 0xf7, 0xe3, - 0x88, 0x4, 0xda, 0xc4, 0x2, 0x24, 0x8e, 0x0 -}; - - -/*--------------------- - * GLYPH DESCRIPTION - *--------------------*/ - -static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { - {.bitmap_index = 0, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */, - {.bitmap_index = 0, .adv_w = 122, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 0, .adv_w = 154, .box_w = 3, .box_h = 18, .ofs_x = 3, .ofs_y = 0}, - {.bitmap_index = 19, .adv_w = 177, .box_w = 7, .box_h = 7, .ofs_x = 2, .ofs_y = 11}, - {.bitmap_index = 30, .adv_w = 322, .box_w = 18, .box_h = 18, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 158, .adv_w = 244, .box_w = 12, .box_h = 23, .ofs_x = 2, .ofs_y = -4}, - {.bitmap_index = 259, .adv_w = 365, .box_w = 21, .box_h = 18, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 416, .adv_w = 299, .box_w = 17, .box_h = 18, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 544, .adv_w = 106, .box_w = 3, .box_h = 7, .ofs_x = 2, .ofs_y = 11}, - {.bitmap_index = 551, .adv_w = 150, .box_w = 6, .box_h = 23, .ofs_x = 2, .ofs_y = -4}, - {.bitmap_index = 616, .adv_w = 150, .box_w = 7, .box_h = 23, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 687, .adv_w = 192, .box_w = 12, .box_h = 12, .ofs_x = 0, .ofs_y = 6}, - {.bitmap_index = 744, .adv_w = 322, .box_w = 16, .box_h = 16, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 781, .adv_w = 122, .box_w = 5, .box_h = 6, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 795, .adv_w = 139, .box_w = 7, .box_h = 2, .ofs_x = 1, .ofs_y = 6}, - {.bitmap_index = 800, .adv_w = 122, .box_w = 4, .box_h = 4, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 806, .adv_w = 129, .box_w = 9, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 874, .adv_w = 244, .box_w = 13, .box_h = 18, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 972, .adv_w = 244, .box_w = 12, .box_h = 18, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 1008, .adv_w = 244, .box_w = 12, .box_h = 18, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1092, .adv_w = 244, .box_w = 13, .box_h = 18, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1186, .adv_w = 244, .box_w = 13, .box_h = 18, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1252, .adv_w = 244, .box_w = 13, .box_h = 18, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1331, .adv_w = 244, .box_w = 13, .box_h = 18, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1435, .adv_w = 244, .box_w = 13, .box_h = 18, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1507, .adv_w = 244, .box_w = 13, .box_h = 18, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1616, .adv_w = 244, .box_w = 13, .box_h = 18, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1721, .adv_w = 129, .box_w = 4, .box_h = 13, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 1738, .adv_w = 129, .box_w = 5, .box_h = 16, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 1764, .adv_w = 322, .box_w = 16, .box_h = 14, .ofs_x = 2, .ofs_y = 1}, - {.bitmap_index = 1849, .adv_w = 322, .box_w = 16, .box_h = 8, .ofs_x = 2, .ofs_y = 4}, - {.bitmap_index = 1879, .adv_w = 322, .box_w = 16, .box_h = 14, .ofs_x = 2, .ofs_y = 1}, - {.bitmap_index = 1964, .adv_w = 204, .box_w = 11, .box_h = 18, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 2031, .adv_w = 384, .box_w = 22, .box_h = 22, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 2234, .adv_w = 263, .box_w = 17, .box_h = 18, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 2343, .adv_w = 263, .box_w = 13, .box_h = 18, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 2423, .adv_w = 268, .box_w = 15, .box_h = 18, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 2522, .adv_w = 296, .box_w = 16, .box_h = 18, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 2613, .adv_w = 243, .box_w = 12, .box_h = 18, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 2653, .adv_w = 221, .box_w = 11, .box_h = 18, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 2684, .adv_w = 298, .box_w = 16, .box_h = 18, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 2796, .adv_w = 289, .box_w = 14, .box_h = 18, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 2825, .adv_w = 113, .box_w = 3, .box_h = 18, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 2830, .adv_w = 113, .box_w = 7, .box_h = 23, .ofs_x = -2, .ofs_y = -5}, - {.bitmap_index = 2857, .adv_w = 252, .box_w = 15, .box_h = 18, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 2947, .adv_w = 214, .box_w = 12, .box_h = 18, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 2967, .adv_w = 331, .box_w = 17, .box_h = 18, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 3063, .adv_w = 287, .box_w = 14, .box_h = 18, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 3137, .adv_w = 302, .box_w = 17, .box_h = 18, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 3259, .adv_w = 232, .box_w = 12, .box_h = 18, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 3314, .adv_w = 302, .box_w = 17, .box_h = 21, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 3453, .adv_w = 267, .box_w = 14, .box_h = 18, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 3533, .adv_w = 244, .box_w = 13, .box_h = 18, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 3632, .adv_w = 235, .box_w = 16, .box_h = 18, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 3660, .adv_w = 281, .box_w = 14, .box_h = 18, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 3712, .adv_w = 263, .box_w = 17, .box_h = 18, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 3825, .adv_w = 380, .box_w = 23, .box_h = 18, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 4003, .adv_w = 263, .box_w = 16, .box_h = 18, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 4116, .adv_w = 235, .box_w = 16, .box_h = 18, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 4188, .adv_w = 263, .box_w = 15, .box_h = 18, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 4269, .adv_w = 150, .box_w = 6, .box_h = 22, .ofs_x = 2, .ofs_y = -3}, - {.bitmap_index = 4287, .adv_w = 129, .box_w = 9, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 4354, .adv_w = 150, .box_w = 6, .box_h = 22, .ofs_x = 2, .ofs_y = -3}, - {.bitmap_index = 4374, .adv_w = 322, .box_w = 16, .box_h = 7, .ofs_x = 2, .ofs_y = 11}, - {.bitmap_index = 4419, .adv_w = 192, .box_w = 14, .box_h = 2, .ofs_x = -1, .ofs_y = -6}, - {.bitmap_index = 4428, .adv_w = 192, .box_w = 6, .box_h = 5, .ofs_x = 2, .ofs_y = 15}, - {.bitmap_index = 4443, .adv_w = 235, .box_w = 12, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 4521, .adv_w = 244, .box_w = 12, .box_h = 19, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 4598, .adv_w = 211, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 4660, .adv_w = 244, .box_w = 13, .box_h = 19, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 4741, .adv_w = 236, .box_w = 13, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 4817, .adv_w = 135, .box_w = 9, .box_h = 19, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 4857, .adv_w = 244, .box_w = 13, .box_h = 19, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 4962, .adv_w = 243, .box_w = 12, .box_h = 19, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 5007, .adv_w = 107, .box_w = 3, .box_h = 19, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 5019, .adv_w = 107, .box_w = 6, .box_h = 24, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 5050, .adv_w = 222, .box_w = 12, .box_h = 19, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 5113, .adv_w = 107, .box_w = 3, .box_h = 19, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 5118, .adv_w = 374, .box_w = 20, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 5185, .adv_w = 243, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 5227, .adv_w = 235, .box_w = 13, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 5306, .adv_w = 244, .box_w = 12, .box_h = 19, .ofs_x = 2, .ofs_y = -5}, - {.bitmap_index = 5387, .adv_w = 244, .box_w = 13, .box_h = 19, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 5471, .adv_w = 158, .box_w = 8, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 5497, .adv_w = 200, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 5567, .adv_w = 151, .box_w = 9, .box_h = 18, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 5607, .adv_w = 243, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 5647, .adv_w = 227, .box_w = 14, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 5727, .adv_w = 314, .box_w = 18, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 5846, .adv_w = 227, .box_w = 14, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 5929, .adv_w = 227, .box_w = 14, .box_h = 19, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 6029, .adv_w = 202, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 6085, .adv_w = 244, .box_w = 10, .box_h = 23, .ofs_x = 3, .ofs_y = -4}, - {.bitmap_index = 6159, .adv_w = 129, .box_w = 3, .box_h = 25, .ofs_x = 3, .ofs_y = -6}, - {.bitmap_index = 6164, .adv_w = 244, .box_w = 10, .box_h = 23, .ofs_x = 3, .ofs_y = -4}, - {.bitmap_index = 6235, .adv_w = 322, .box_w = 16, .box_h = 6, .ofs_x = 2, .ofs_y = 5}, - {.bitmap_index = 6275, .adv_w = 243, .box_w = 12, .box_h = 23, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 6336, .adv_w = 263, .box_w = 17, .box_h = 18, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 6445, .adv_w = 263, .box_w = 13, .box_h = 18, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 6507, .adv_w = 263, .box_w = 13, .box_h = 18, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 6587, .adv_w = 234, .box_w = 12, .box_h = 18, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 6609, .adv_w = 300, .box_w = 17, .box_h = 22, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 6699, .adv_w = 243, .box_w = 12, .box_h = 18, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 6739, .adv_w = 414, .box_w = 26, .box_h = 18, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 6907, .adv_w = 246, .box_w = 13, .box_h = 18, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 7001, .adv_w = 287, .box_w = 14, .box_h = 18, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 7076, .adv_w = 287, .box_w = 14, .box_h = 23, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 7175, .adv_w = 273, .box_w = 15, .box_h = 18, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 7267, .adv_w = 289, .box_w = 16, .box_h = 18, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 7343, .adv_w = 331, .box_w = 17, .box_h = 18, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 7439, .adv_w = 289, .box_w = 14, .box_h = 18, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 7468, .adv_w = 302, .box_w = 17, .box_h = 18, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 7590, .adv_w = 289, .box_w = 14, .box_h = 18, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 7613, .adv_w = 232, .box_w = 12, .box_h = 18, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 7668, .adv_w = 268, .box_w = 15, .box_h = 18, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 7767, .adv_w = 235, .box_w = 16, .box_h = 18, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 7795, .adv_w = 234, .box_w = 15, .box_h = 18, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 7897, .adv_w = 331, .box_w = 19, .box_h = 18, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 8021, .adv_w = 263, .box_w = 16, .box_h = 18, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 8134, .adv_w = 298, .box_w = 16, .box_h = 22, .ofs_x = 2, .ofs_y = -4}, - {.bitmap_index = 8171, .adv_w = 263, .box_w = 13, .box_h = 18, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 8213, .adv_w = 411, .box_w = 22, .box_h = 18, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 8253, .adv_w = 420, .box_w = 24, .box_h = 22, .ofs_x = 2, .ofs_y = -4}, - {.bitmap_index = 8306, .adv_w = 320, .box_w = 19, .box_h = 18, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 8386, .adv_w = 339, .box_w = 17, .box_h = 18, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 8457, .adv_w = 263, .box_w = 13, .box_h = 18, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 8514, .adv_w = 268, .box_w = 15, .box_h = 18, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 8619, .adv_w = 415, .box_w = 23, .box_h = 18, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 8764, .adv_w = 267, .box_w = 14, .box_h = 18, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 8848, .adv_w = 235, .box_w = 12, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 8926, .adv_w = 237, .box_w = 13, .box_h = 21, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 9038, .adv_w = 226, .box_w = 11, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 9103, .adv_w = 202, .box_w = 10, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 9120, .adv_w = 266, .box_w = 15, .box_h = 18, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 9191, .adv_w = 236, .box_w = 13, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 9267, .adv_w = 346, .box_w = 21, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 9383, .adv_w = 204, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 9452, .adv_w = 250, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 9504, .adv_w = 250, .box_w = 12, .box_h = 19, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 9582, .adv_w = 232, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 9644, .adv_w = 245, .box_w = 14, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 9699, .adv_w = 290, .box_w = 14, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 9769, .adv_w = 251, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 9791, .adv_w = 235, .box_w = 13, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 9870, .adv_w = 251, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 9888, .adv_w = 244, .box_w = 12, .box_h = 19, .ofs_x = 2, .ofs_y = -5}, - {.bitmap_index = 9969, .adv_w = 211, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 10031, .adv_w = 224, .box_w = 14, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 10054, .adv_w = 227, .box_w = 14, .box_h = 19, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 10154, .adv_w = 328, .box_w = 19, .box_h = 23, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 10285, .adv_w = 227, .box_w = 14, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 10368, .adv_w = 261, .box_w = 14, .box_h = 18, .ofs_x = 2, .ofs_y = -4}, - {.bitmap_index = 10399, .adv_w = 227, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 10433, .adv_w = 351, .box_w = 18, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 10464, .adv_w = 362, .box_w = 20, .box_h = 18, .ofs_x = 2, .ofs_y = -4}, - {.bitmap_index = 10507, .adv_w = 271, .box_w = 16, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 10564, .adv_w = 303, .box_w = 15, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 10615, .adv_w = 226, .box_w = 11, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 10656, .adv_w = 211, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 10721, .adv_w = 323, .box_w = 17, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 10818, .adv_w = 231, .box_w = 12, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 10880, .adv_w = 236, .box_w = 13, .box_h = 20, .ofs_x = 1, .ofs_y = 0} -}; - -/*--------------------- - * CHARACTER MAPPING - *--------------------*/ - - - -/*Collect the unicode lists and glyph_id offsets*/ -static const lv_font_fmt_txt_cmap_t cmaps[] = -{ - { - .range_start = 32, .range_length = 95, .glyph_id_start = 1, - .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY - }, - { - .range_start = 1025, .range_length = 1, .glyph_id_start = 96, - .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY - }, - { - .range_start = 1040, .range_length = 64, .glyph_id_start = 97, - .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY - }, - { - .range_start = 1105, .range_length = 1, .glyph_id_start = 161, - .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY - } -}; - - - -/*-------------------- - * ALL CUSTOM DATA - *--------------------*/ - -#if LVGL_VERSION_MAJOR == 8 -/*Store all the custom data of the font*/ -static lv_font_fmt_txt_glyph_cache_t cache; -#endif - -#if LVGL_VERSION_MAJOR >= 8 -static const lv_font_fmt_txt_dsc_t font_dsc = { -#else -static lv_font_fmt_txt_dsc_t font_dsc = { -#endif - .glyph_bitmap = glyph_bitmap, - .glyph_dsc = glyph_dsc, - .cmaps = cmaps, - .kern_dsc = NULL, - .kern_scale = 0, - .cmap_num = 4, - .bpp = 4, - .kern_classes = 0, - .bitmap_format = 1, -#if LVGL_VERSION_MAJOR == 8 - .cache = &cache -#endif -}; - - - -/*----------------- - * PUBLIC FONT - *----------------*/ - -/*Initialize a public general font descriptor*/ -#if LVGL_VERSION_MAJOR >= 8 -const lv_font_t lv_font_ru_24 = { -#else -lv_font_t lv_font_ru_24 = { -#endif - .get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt, /*Function pointer to get glyph's data*/ - .get_glyph_bitmap = lv_font_get_bitmap_fmt_txt, /*Function pointer to get glyph's bitmap*/ - .line_height = 29, /*The maximum line height required by the font*/ - .base_line = 6, /*Baseline measured from the bottom of the line*/ -#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) - .subpx = LV_FONT_SUBPX_NONE, -#endif -#if LV_VERSION_CHECK(7, 4, 0) || LVGL_VERSION_MAJOR >= 8 - .underline_position = 0, - .underline_thickness = 1, -#endif - .dsc = &font_dsc, /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */ -#if LV_VERSION_CHECK(8, 2, 0) || LVGL_VERSION_MAJOR >= 9 - .fallback = NULL, -#endif - .user_data = NULL, -}; - - - -#endif /*#if LV_FONT_RU_24*/ - diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/lvgl_russian_font_test/lvgl_russian_font_test.ino b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/lvgl_russian_font_test/lvgl_russian_font_test.ino deleted file mode 100644 index 2c59f6e9..00000000 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/lvgl_russian_font_test/lvgl_russian_font_test.ino +++ /dev/null @@ -1,264 +0,0 @@ -#include -#include -#include -#include -#include -#include "lv_font_ru.h" - -#define PIN_LCD_CS 12 -#define PIN_LCD_SCLK 38 -#define PIN_LCD_D0 4 -#define PIN_LCD_D1 5 -#define PIN_LCD_D2 6 -#define PIN_LCD_D3 7 -#define PIN_LCD_RST 2 -#define PIN_I2C_SDA 15 -#define PIN_I2C_SCL 14 -#define PIN_TP_INT 11 - -#define DISP_W 480 -#define DISP_H 480 -#define LVGL_TICK_MS 2 -#define TEST_VERSION "v1-ru-font" - -static lv_disp_draw_buf_t gDrawBuf; -static lv_color_t *gBuf1 = nullptr; -static lv_color_t *gBuf2 = nullptr; -static lv_obj_t *gStatusLabel = nullptr; -static lv_obj_t *gTouchLabel = nullptr; -static uint32_t gClickCount = 0; -static bool gTouchActive = false; -static int16_t gLastX = -1; -static int16_t gLastY = -1; - -Arduino_DataBus *gBus = new Arduino_ESP32QSPI( - PIN_LCD_CS, PIN_LCD_SCLK, PIN_LCD_D0, PIN_LCD_D1, PIN_LCD_D2, PIN_LCD_D3); -Arduino_CO5300 *gfx = new Arduino_CO5300( - gBus, PIN_LCD_RST, 0, DISP_W, DISP_H, 0, 0, 0, 0); -TouchDrvCST92xx gTouch; - -static void lvglFlushCb(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *colorP) { - uint32_t w = area->x2 - area->x1 + 1; - uint32_t h = area->y2 - area->y1 + 1; -#if (LV_COLOR_16_SWAP != 0) - gfx->draw16bitBeRGBBitmap(area->x1, area->y1, (uint16_t *)&colorP->full, w, h); -#else - gfx->draw16bitRGBBitmap(area->x1, area->y1, (uint16_t *)&colorP->full, w, h); -#endif - lv_disp_flush_ready(disp); -} - -static void lvglTick(void *arg) { - LV_UNUSED(arg); - lv_tick_inc(LVGL_TICK_MS); -} - -static void updateTouchLabel() { - if (!gTouchLabel) { - return; - } - - char text[96]; - if (gTouchActive) { - snprintf(text, sizeof(text), "Касание: x=%d y=%d", gLastX, gLastY); - } else { - snprintf(text, sizeof(text), "Касание: нет x=%d y=%d", gLastX, gLastY); - } - lv_label_set_text(gTouchLabel, text); -} - -static void lvglTouchRead(lv_indev_drv_t *indevDrv, lv_indev_data_t *data) { - LV_UNUSED(indevDrv); - int16_t x = 0; - int16_t y = 0; - bool touching = gTouch.getPoint(&x, &y, 1) > 0; - - if (touching) { - gTouchActive = true; - gLastX = x; - gLastY = y; - data->state = LV_INDEV_STATE_PR; - data->point.x = x; - data->point.y = y; - } else { - gTouchActive = false; - data->state = LV_INDEV_STATE_REL; - data->point.x = gLastX >= 0 ? gLastX : 0; - data->point.y = gLastY >= 0 ? gLastY : 0; - } - - updateTouchLabel(); -} - -static void buttonEventCb(lv_event_t *event) { - if (lv_event_get_code(event) != LV_EVENT_CLICKED) { - return; - } - - const char *name = (const char *)lv_event_get_user_data(event); - gClickCount++; - - char text[128]; - snprintf(text, sizeof(text), "Нажато: %s (%lu)", name, (unsigned long)gClickCount); - lv_label_set_text(gStatusLabel, text); - Serial.println(text); -} - -static lv_obj_t *makeButton(lv_obj_t *parent, - const char *labelText, - lv_coord_t x, - lv_coord_t y, - lv_coord_t w, - lv_coord_t h, - uint32_t bgColor) { - lv_obj_t *btn = lv_btn_create(parent); - lv_obj_set_size(btn, w, h); - lv_obj_set_pos(btn, x, y); - lv_obj_set_style_radius(btn, 16, 0); - lv_obj_set_style_bg_color(btn, lv_color_hex(bgColor), 0); - lv_obj_set_style_bg_opa(btn, LV_OPA_COVER, 0); - lv_obj_set_style_border_width(btn, 2, 0); - lv_obj_set_style_border_color(btn, lv_color_hex(0x6F8BA4), 0); - lv_obj_set_style_shadow_width(btn, 0, 0); - lv_obj_set_style_pad_all(btn, 4, 0); - lv_obj_add_event_cb(btn, buttonEventCb, LV_EVENT_CLICKED, (void *)labelText); - - lv_obj_t *label = lv_label_create(btn); - lv_label_set_text(label, labelText); - lv_obj_set_width(label, w - 12); - lv_label_set_long_mode(label, LV_LABEL_LONG_WRAP); - lv_obj_set_style_text_align(label, LV_TEXT_ALIGN_CENTER, 0); - lv_obj_set_style_text_color(label, lv_color_hex(0xFFFFFF), 0); - lv_obj_set_style_text_font(label, &lv_font_ru_18, 0); - lv_obj_center(label); - return btn; -} - -static void createUi() { - lv_obj_t *screen = lv_scr_act(); - lv_obj_set_style_bg_color(screen, lv_color_hex(0x08131E), 0); - lv_obj_set_style_bg_opa(screen, LV_OPA_COVER, 0); - lv_obj_set_style_pad_all(screen, 0, 0); - lv_obj_set_scrollbar_mode(screen, LV_SCROLLBAR_MODE_OFF); - - lv_obj_t *title = lv_label_create(screen); - lv_label_set_text(title, "Русский тест LVGL"); - lv_obj_set_style_text_font(title, &lv_font_ru_24, 0); - lv_obj_set_style_text_color(title, lv_color_hex(0xFFFFFF), 0); - lv_obj_align(title, LV_ALIGN_TOP_MID, 0, 10); - - lv_obj_t *version = lv_label_create(screen); - lv_label_set_text(version, "Версия: " TEST_VERSION); - lv_obj_set_style_text_font(version, &lv_font_ru_18, 0); - lv_obj_set_style_text_color(version, lv_color_hex(0xD8E0EA), 0); - lv_obj_align(version, LV_ALIGN_TOP_MID, 0, 42); - - lv_obj_t *hint = lv_label_create(screen); - lv_label_set_text(hint, "Проверка кириллицы, длинных слов, кнопок и нажатий."); - lv_obj_set_width(hint, 436); - lv_label_set_long_mode(hint, LV_LABEL_LONG_WRAP); - lv_obj_set_style_text_font(hint, &lv_font_ru_18, 0); - lv_obj_set_style_text_color(hint, lv_color_hex(0xD8E0EA), 0); - lv_obj_align(hint, LV_ALIGN_TOP_MID, 0, 72); - - makeButton(screen, "Статус", 22, 126, 136, 62, 0x355C7D); - makeButton(screen, "Подключение", 172, 126, 136, 62, 0x2A9D8F); - makeButton(screen, "Кошелёк", 322, 126, 136, 62, 0x457B9D); - - makeButton(screen, "Запросы", 22, 204, 136, 62, 0xE76F51); - makeButton(screen, "Настройки", 172, 204, 136, 62, 0x8D5A97); - makeButton(screen, "Регистрация", 322, 204, 136, 62, 0x6A994E); - - makeButton(screen, "Разрешить", 22, 282, 136, 62, 0xBC6C25); - makeButton(screen, "Отклонить", 172, 282, 136, 62, 0xB56576); - makeButton(screen, "Назад", 322, 282, 136, 62, 0x6C757D); - - makeButton(screen, "Проверка переноса русского текста", 22, 360, 436, 64, 0x1D6F42); - - lv_obj_t *statusPanel = lv_obj_create(screen); - lv_obj_set_size(statusPanel, 436, 24); - lv_obj_set_pos(statusPanel, 22, 428); - lv_obj_set_style_radius(statusPanel, 10, 0); - lv_obj_set_style_bg_color(statusPanel, lv_color_hex(0x162435), 0); - lv_obj_set_style_bg_opa(statusPanel, LV_OPA_COVER, 0); - lv_obj_set_style_border_width(statusPanel, 1, 0); - lv_obj_set_style_border_color(statusPanel, lv_color_hex(0x4D6986), 0); - lv_obj_set_style_pad_all(statusPanel, 2, 0); - - gStatusLabel = lv_label_create(statusPanel); - lv_label_set_text(gStatusLabel, "Нажато: ничего"); - lv_obj_set_style_text_font(gStatusLabel, &lv_font_ru_18, 0); - lv_obj_set_style_text_color(gStatusLabel, lv_color_hex(0xFFFFFF), 0); - lv_obj_center(gStatusLabel); - - lv_obj_t *touchPanel = lv_obj_create(screen); - lv_obj_set_size(touchPanel, 436, 24); - lv_obj_set_pos(touchPanel, 22, 454); - lv_obj_set_style_radius(touchPanel, 10, 0); - lv_obj_set_style_bg_color(touchPanel, lv_color_hex(0x162435), 0); - lv_obj_set_style_bg_opa(touchPanel, LV_OPA_COVER, 0); - lv_obj_set_style_border_width(touchPanel, 1, 0); - lv_obj_set_style_border_color(touchPanel, lv_color_hex(0x4D6986), 0); - lv_obj_set_style_pad_all(touchPanel, 2, 0); - - gTouchLabel = lv_label_create(touchPanel); - lv_label_set_text(gTouchLabel, "Касание: нет x=-1 y=-1"); - lv_obj_set_style_text_font(gTouchLabel, &lv_font_ru_18, 0); - lv_obj_set_style_text_color(gTouchLabel, lv_color_hex(0xD8E0EA), 0); - lv_obj_center(gTouchLabel); -} - -void setup() { - Serial.begin(115200); - Wire.begin(PIN_I2C_SDA, PIN_I2C_SCL); - - gfx->begin(); - gBus->writeC8D8(0x36, 0xA0); - gfx->setBrightness(220); - gfx->fillScreen(0x0000); - - gTouch.setPins(PIN_TP_INT, -1); - gTouch.begin(Wire, CST92XX_SLAVE_ADDRESS, PIN_I2C_SDA, PIN_I2C_SCL); - gTouch.setMaxCoordinates(DISP_W, DISP_H); - gTouch.setSwapXY(true); - gTouch.setMirrorXY(true, false); - - lv_init(); - - uint32_t screenWidth = gfx->width(); - uint32_t screenHeight = gfx->height(); - uint32_t bufPixels = screenWidth * 40; - gBuf1 = (lv_color_t *)heap_caps_malloc(bufPixels * sizeof(lv_color_t), MALLOC_CAP_DMA); - gBuf2 = (lv_color_t *)heap_caps_malloc(bufPixels * sizeof(lv_color_t), MALLOC_CAP_DMA); - - lv_disp_draw_buf_init(&gDrawBuf, gBuf1, gBuf2, bufPixels); - - static lv_disp_drv_t dispDrv; - lv_disp_drv_init(&dispDrv); - dispDrv.hor_res = screenWidth; - dispDrv.ver_res = screenHeight; - dispDrv.flush_cb = lvglFlushCb; - dispDrv.draw_buf = &gDrawBuf; - lv_disp_drv_register(&dispDrv); - - static lv_indev_drv_t indevDrv; - lv_indev_drv_init(&indevDrv); - indevDrv.type = LV_INDEV_TYPE_POINTER; - indevDrv.read_cb = lvglTouchRead; - lv_indev_drv_register(&indevDrv); - - const esp_timer_create_args_t tickArgs = { - .callback = &lvglTick, - .name = "lvgl_tick"}; - esp_timer_handle_t tickTimer = nullptr; - esp_timer_create(&tickArgs, &tickTimer); - esp_timer_start_periodic(tickTimer, LVGL_TICK_MS * 1000); - - createUi(); - Serial.println("Русский LVGL font test ready: " TEST_VERSION); -} - -void loop() { - lv_timer_handler(); - delay(5); -} diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/lvgl_subserver_touch_test/lvgl_subserver_touch_test.ino b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/lvgl_subserver_touch_test/lvgl_subserver_touch_test.ino deleted file mode 100644 index 8308cca3..00000000 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/lvgl_subserver_touch_test/lvgl_subserver_touch_test.ino +++ /dev/null @@ -1,256 +0,0 @@ -#include -#include -#include -#include -#include - -// Подтверждено на устройстве: LVGL-рендер работает вместе с touch-путём из shine_homeserver_ui. - -#define PIN_LCD_CS 12 -#define PIN_LCD_SCLK 38 -#define PIN_LCD_D0 4 -#define PIN_LCD_D1 5 -#define PIN_LCD_D2 6 -#define PIN_LCD_D3 7 -#define PIN_LCD_RST 2 -#define PIN_I2C_SDA 15 -#define PIN_I2C_SCL 14 -#define PIN_TP_INT 11 - -#define DISP_W 480 -#define DISP_H 480 -#define LVGL_TICK_MS 2 -#define TEST_VERSION "v1-subtouch" - -static lv_disp_draw_buf_t gDrawBuf; -static lv_color_t *gBuf1 = nullptr; -static lv_color_t *gBuf2 = nullptr; -static lv_obj_t *gStatusLabel = nullptr; -static lv_obj_t *gTouchLabel = nullptr; -static lv_obj_t *gVersionLabel = nullptr; -static uint32_t gClickCount = 0; -static bool gTouchActive = false; -static int16_t gLastX = -1; -static int16_t gLastY = -1; - -Arduino_DataBus *gBus = new Arduino_ESP32QSPI( - PIN_LCD_CS, PIN_LCD_SCLK, PIN_LCD_D0, PIN_LCD_D1, PIN_LCD_D2, PIN_LCD_D3); -Arduino_CO5300 *gfx = new Arduino_CO5300( - gBus, PIN_LCD_RST, 0, DISP_W, DISP_H, 0, 0, 0, 0); -TouchDrvCST92xx gTouch; - -static void lvglFlushCb(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *colorP) { - uint32_t w = area->x2 - area->x1 + 1; - uint32_t h = area->y2 - area->y1 + 1; -#if (LV_COLOR_16_SWAP != 0) - gfx->draw16bitBeRGBBitmap(area->x1, area->y1, (uint16_t *)&colorP->full, w, h); -#else - gfx->draw16bitRGBBitmap(area->x1, area->y1, (uint16_t *)&colorP->full, w, h); -#endif - lv_disp_flush_ready(disp); -} - -static void lvglTick(void *arg) { - LV_UNUSED(arg); - lv_tick_inc(LVGL_TICK_MS); -} - -static void updateTouchLabel() { - if (!gTouchLabel) { - return; - } - - char text[96]; - if (gTouchActive) { - snprintf(text, sizeof(text), "Touch: pressed x=%d y=%d", gLastX, gLastY); - } else { - snprintf(text, sizeof(text), "Touch: released x=%d y=%d", gLastX, gLastY); - } - lv_label_set_text(gTouchLabel, text); -} - -static void lvglTouchRead(lv_indev_drv_t *indevDrv, lv_indev_data_t *data) { - LV_UNUSED(indevDrv); - int16_t x = 0; - int16_t y = 0; - bool touching = gTouch.getPoint(&x, &y, 1) > 0; - - if (touching) { - gTouchActive = true; - gLastX = x; - gLastY = y; - data->state = LV_INDEV_STATE_PR; - data->point.x = x; - data->point.y = y; - } else { - gTouchActive = false; - data->state = LV_INDEV_STATE_REL; - data->point.x = gLastX >= 0 ? gLastX : 0; - data->point.y = gLastY >= 0 ? gLastY : 0; - } - - updateTouchLabel(); -} - -static void buttonEventCb(lv_event_t *event) { - if (lv_event_get_code(event) != LV_EVENT_CLICKED) { - return; - } - - const char *name = (const char *)lv_event_get_user_data(event); - gClickCount++; - - char text[96]; - snprintf(text, sizeof(text), "Pressed: %s (#%lu)", name, (unsigned long)gClickCount); - lv_label_set_text(gStatusLabel, text); - Serial.println(text); -} - -static lv_obj_t *makeButton(lv_obj_t *parent, - const char *labelText, - lv_coord_t x, - lv_coord_t y, - lv_coord_t w, - lv_coord_t h, - uint32_t bgColor) { - lv_obj_t *btn = lv_btn_create(parent); - lv_obj_set_size(btn, w, h); - lv_obj_set_pos(btn, x, y); - lv_obj_set_style_radius(btn, 16, 0); - lv_obj_set_style_bg_color(btn, lv_color_hex(bgColor), 0); - lv_obj_set_style_bg_opa(btn, LV_OPA_COVER, 0); - lv_obj_set_style_border_width(btn, 2, 0); - lv_obj_set_style_border_color(btn, lv_color_hex(0x6F8BA4), 0); - lv_obj_set_style_shadow_width(btn, 0, 0); - lv_obj_add_event_cb(btn, buttonEventCb, LV_EVENT_CLICKED, (void *)labelText); - - lv_obj_t *label = lv_label_create(btn); - lv_label_set_text(label, labelText); - lv_obj_set_style_text_color(label, lv_color_hex(0xFFFFFF), 0); - lv_obj_set_style_text_font(label, &lv_font_montserrat_18, 0); - lv_obj_center(label); - return btn; -} - -static void createUi() { - lv_obj_t *screen = lv_scr_act(); - lv_obj_set_style_bg_color(screen, lv_color_hex(0x07111C), 0); - lv_obj_set_style_bg_opa(screen, LV_OPA_COVER, 0); - lv_obj_set_style_pad_all(screen, 0, 0); - lv_obj_set_scrollbar_mode(screen, LV_SCROLLBAR_MODE_OFF); - - gVersionLabel = lv_label_create(screen); - lv_label_set_text(gVersionLabel, "LVGL + subserver touch " TEST_VERSION); - lv_obj_set_style_text_font(gVersionLabel, &lv_font_montserrat_18, 0); - lv_obj_set_style_text_color(gVersionLabel, lv_color_hex(0xFFFFFF), 0); - lv_obj_align(gVersionLabel, LV_ALIGN_TOP_MID, 0, 12); - - lv_obj_t *subtitle = lv_label_create(screen); - lv_label_set_text(subtitle, "Touch path comes from shine_homeserver_ui. Tap buttons and watch status."); - lv_obj_set_width(subtitle, 436); - lv_label_set_long_mode(subtitle, LV_LABEL_LONG_WRAP); - lv_obj_set_style_text_font(subtitle, &lv_font_montserrat_14, 0); - lv_obj_set_style_text_color(subtitle, lv_color_hex(0xD6DEE7), 0); - lv_obj_align(subtitle, LV_ALIGN_TOP_MID, 0, 42); - - makeButton(screen, "Status", 22, 110, 136, 62, 0x355C7D); - makeButton(screen, "Connect", 172, 110, 136, 62, 0x2A9D8F); - makeButton(screen, "Wallet", 322, 110, 136, 62, 0x457B9D); - - makeButton(screen, "Requests", 22, 188, 136, 62, 0xE76F51); - makeButton(screen, "Settings", 172, 188, 136, 62, 0x8D5A97); - makeButton(screen, "Register", 322, 188, 136, 62, 0x6A994E); - - makeButton(screen, "Approve", 22, 266, 136, 62, 0xBC6C25); - makeButton(screen, "Reject", 172, 266, 136, 62, 0xB56576); - makeButton(screen, "Back", 322, 266, 136, 62, 0x6C757D); - - makeButton(screen, "Bottom Action", 22, 346, 436, 68, 0x1D6F42); - - lv_obj_t *statusPanel = lv_obj_create(screen); - lv_obj_set_size(statusPanel, 436, 26); - lv_obj_set_pos(statusPanel, 22, 420); - lv_obj_set_style_radius(statusPanel, 10, 0); - lv_obj_set_style_bg_color(statusPanel, lv_color_hex(0x162435), 0); - lv_obj_set_style_bg_opa(statusPanel, LV_OPA_COVER, 0); - lv_obj_set_style_border_width(statusPanel, 1, 0); - lv_obj_set_style_border_color(statusPanel, lv_color_hex(0x4D6986), 0); - lv_obj_set_style_pad_all(statusPanel, 2, 0); - - gStatusLabel = lv_label_create(statusPanel); - lv_label_set_text(gStatusLabel, "Pressed: none"); - lv_obj_set_style_text_font(gStatusLabel, &lv_font_montserrat_14, 0); - lv_obj_set_style_text_color(gStatusLabel, lv_color_hex(0xFFFFFF), 0); - lv_obj_center(gStatusLabel); - - lv_obj_t *touchPanel = lv_obj_create(screen); - lv_obj_set_size(touchPanel, 436, 26); - lv_obj_set_pos(touchPanel, 22, 450); - lv_obj_set_style_radius(touchPanel, 10, 0); - lv_obj_set_style_bg_color(touchPanel, lv_color_hex(0x162435), 0); - lv_obj_set_style_bg_opa(touchPanel, LV_OPA_COVER, 0); - lv_obj_set_style_border_width(touchPanel, 1, 0); - lv_obj_set_style_border_color(touchPanel, lv_color_hex(0x4D6986), 0); - lv_obj_set_style_pad_all(touchPanel, 2, 0); - - gTouchLabel = lv_label_create(touchPanel); - lv_label_set_text(gTouchLabel, "Touch: released x=-1 y=-1"); - lv_obj_set_style_text_font(gTouchLabel, &lv_font_montserrat_14, 0); - lv_obj_set_style_text_color(gTouchLabel, lv_color_hex(0xD6DEE7), 0); - lv_obj_center(gTouchLabel); -} - -void setup() { - Serial.begin(115200); - Wire.begin(PIN_I2C_SDA, PIN_I2C_SCL); - - gfx->begin(); - gBus->writeC8D8(0x36, 0xA0); - gfx->setBrightness(220); - gfx->fillScreen(0x0000); - - gTouch.setPins(PIN_TP_INT, -1); - gTouch.begin(Wire, CST92XX_SLAVE_ADDRESS, PIN_I2C_SDA, PIN_I2C_SCL); - gTouch.setMaxCoordinates(DISP_W, DISP_H); - gTouch.setSwapXY(true); - gTouch.setMirrorXY(true, false); - - lv_init(); - - uint32_t screenWidth = gfx->width(); - uint32_t screenHeight = gfx->height(); - uint32_t bufPixels = screenWidth * 40; - gBuf1 = (lv_color_t *)heap_caps_malloc(bufPixels * sizeof(lv_color_t), MALLOC_CAP_DMA); - gBuf2 = (lv_color_t *)heap_caps_malloc(bufPixels * sizeof(lv_color_t), MALLOC_CAP_DMA); - - lv_disp_draw_buf_init(&gDrawBuf, gBuf1, gBuf2, bufPixels); - - static lv_disp_drv_t dispDrv; - lv_disp_drv_init(&dispDrv); - dispDrv.hor_res = screenWidth; - dispDrv.ver_res = screenHeight; - dispDrv.flush_cb = lvglFlushCb; - dispDrv.draw_buf = &gDrawBuf; - lv_disp_drv_register(&dispDrv); - - static lv_indev_drv_t indevDrv; - lv_indev_drv_init(&indevDrv); - indevDrv.type = LV_INDEV_TYPE_POINTER; - indevDrv.read_cb = lvglTouchRead; - lv_indev_drv_register(&indevDrv); - - const esp_timer_create_args_t tickArgs = { - .callback = &lvglTick, - .name = "lvgl_tick"}; - esp_timer_handle_t tickTimer = nullptr; - esp_timer_create(&tickArgs, &tickTimer); - esp_timer_start_periodic(tickTimer, LVGL_TICK_MS * 1000); - - createUi(); - Serial.println("LVGL + subserver touch test ready: " TEST_VERSION); -} - -void loop() { - lv_timer_handler(); - delay(5); -} diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/lvgl_touch_debug_test/lvgl_touch_debug_test.ino b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/lvgl_touch_debug_test/lvgl_touch_debug_test.ino deleted file mode 100644 index 0f0c97c5..00000000 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/lvgl_touch_debug_test/lvgl_touch_debug_test.ino +++ /dev/null @@ -1,218 +0,0 @@ -#include -#include -#include -#include -#include "pin_config.h" -#include "TouchDrvCSTXXX.hpp" - -#define EXAMPLE_LVGL_TICK_PERIOD_MS 2 - -static lv_disp_draw_buf_t gDrawBuf; -static lv_color_t *gBuf1 = nullptr; -static lv_color_t *gBuf2 = nullptr; -static lv_obj_t *gRawLabel = nullptr; -static lv_obj_t *gEventLabel = nullptr; -static lv_obj_t *gMarker = nullptr; - -static TouchDrvCST92xx gTouch; -static int16_t gTouchX[5]; -static int16_t gTouchY[5]; -static bool gTouchPressed = false; -static uint32_t gRawTouchCount = 0; -static uint32_t gLvglButtonCount = 0; - -Arduino_DataBus *gBus = new Arduino_ESP32QSPI( - LCD_CS, LCD_SCLK, LCD_SDIO0, LCD_SDIO1, LCD_SDIO2, LCD_SDIO3); -Arduino_CO5300 *gfx = new Arduino_CO5300( - gBus, LCD_RESET, 0, LCD_WIDTH, LCD_HEIGHT, 0, 0, 0, 0); - -static void lvglFlushCb(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *colorP) { - uint32_t w = area->x2 - area->x1 + 1; - uint32_t h = area->y2 - area->y1 + 1; -#if (LV_COLOR_16_SWAP != 0) - gfx->draw16bitBeRGBBitmap(area->x1, area->y1, (uint16_t *)&colorP->full, w, h); -#else - gfx->draw16bitRGBBitmap(area->x1, area->y1, (uint16_t *)&colorP->full, w, h); -#endif - lv_disp_flush_ready(disp); -} - -static void lvglTick(void *arg) { - LV_UNUSED(arg); - lv_tick_inc(EXAMPLE_LVGL_TICK_PERIOD_MS); -} - -static void lvglTouchRead(lv_indev_drv_t *indevDrv, lv_indev_data_t *data) { - LV_UNUSED(indevDrv); - uint8_t touched = gTouch.getPoint(gTouchX, gTouchY, gTouch.getSupportTouchPoint()); - if (touched > 0) { - data->state = LV_INDEV_STATE_PR; - data->point.x = gTouchX[0]; - data->point.y = gTouchY[0]; - return; - } - data->state = LV_INDEV_STATE_REL; -} - -static void bigButtonEventCb(lv_event_t *event) { - if (lv_event_get_code(event) != LV_EVENT_CLICKED) { - return; - } - gLvglButtonCount++; - String status = "LVGL button clicked: "; - status += String(gLvglButtonCount); - lv_label_set_text(gEventLabel, status.c_str()); - Serial.println(status); -} - -static void updateRawTouchState() { - uint8_t touched = gTouch.getPoint(gTouchX, gTouchY, gTouch.getSupportTouchPoint()); - if (touched > 0) { - gTouchPressed = true; - gRawTouchCount++; - - String line1 = "RAW pressed"; - String line2 = "x=" + String(gTouchX[0]) + " y=" + String(gTouchY[0]) + " n=" + String(gRawTouchCount); - String text = line1 + "\n" + line2; - lv_label_set_text(gRawLabel, text.c_str()); - - int markerX = gTouchX[0] - 8; - int markerY = gTouchY[0] - 8; - if (markerX < 0) markerX = 0; - if (markerY < 0) markerY = 0; - lv_obj_set_pos(gMarker, markerX, markerY); - lv_obj_clear_flag(gMarker, LV_OBJ_FLAG_HIDDEN); - return; - } - - if (gTouchPressed) { - gTouchPressed = false; - lv_label_set_text(gRawLabel, "RAW released\nTouch ended"); - lv_obj_add_flag(gMarker, LV_OBJ_FLAG_HIDDEN); - } -} - -static void createUi() { - lv_obj_t *screen = lv_scr_act(); - lv_obj_set_style_bg_color(screen, lv_color_hex(0x000000), 0); - lv_obj_set_style_bg_opa(screen, LV_OPA_COVER, 0); - - lv_obj_t *title = lv_label_create(screen); - lv_label_set_text(title, "LVGL TOUCH DEBUG"); - lv_obj_set_style_text_font(title, &lv_font_montserrat_22, 0); - lv_obj_set_style_text_color(title, lv_color_hex(0xFFFFFF), 0); - lv_obj_align(title, LV_ALIGN_TOP_MID, 0, 12); - - gRawLabel = lv_label_create(screen); - lv_label_set_text(gRawLabel, "RAW released\nTouch not seen yet"); - lv_obj_set_style_text_font(gRawLabel, &lv_font_montserrat_18, 0); - lv_obj_set_style_text_color(gRawLabel, lv_color_hex(0x9EE493), 0); - lv_obj_align(gRawLabel, LV_ALIGN_TOP_LEFT, 16, 56); - - gEventLabel = lv_label_create(screen); - lv_label_set_text(gEventLabel, "LVGL button clicked: 0"); - lv_obj_set_style_text_font(gEventLabel, &lv_font_montserrat_18, 0); - lv_obj_set_style_text_color(gEventLabel, lv_color_hex(0xFFD166), 0); - lv_obj_align(gEventLabel, LV_ALIGN_TOP_LEFT, 16, 118); - - lv_obj_t *btn = lv_btn_create(screen); - lv_obj_set_size(btn, 360, 110); - lv_obj_align(btn, LV_ALIGN_CENTER, 0, 36); - lv_obj_set_style_radius(btn, 18, 0); - lv_obj_set_style_bg_color(btn, lv_color_hex(0x2A9D8F), 0); - lv_obj_set_style_border_width(btn, 3, 0); - lv_obj_set_style_border_color(btn, lv_color_hex(0xBDE0FE), 0); - lv_obj_add_event_cb(btn, bigButtonEventCb, LV_EVENT_CLICKED, nullptr); - - lv_obj_t *btnLabel = lv_label_create(btn); - lv_label_set_text(btnLabel, "Tap Here"); - lv_obj_set_style_text_font(btnLabel, &lv_font_montserrat_24, 0); - lv_obj_set_style_text_color(btnLabel, lv_color_hex(0xFFFFFF), 0); - lv_obj_center(btnLabel); - - lv_obj_t *hint = lv_label_create(screen); - lv_label_set_text(hint, "Need both: RAW coords change and LVGL button click."); - lv_obj_set_width(hint, 430); - lv_label_set_long_mode(hint, LV_LABEL_LONG_WRAP); - lv_obj_set_style_text_font(hint, &lv_font_montserrat_16, 0); - lv_obj_set_style_text_color(hint, lv_color_hex(0xD9D9D9), 0); - lv_obj_align(hint, LV_ALIGN_BOTTOM_MID, 0, -34); - - gMarker = lv_obj_create(screen); - lv_obj_set_size(gMarker, 16, 16); - lv_obj_set_style_radius(gMarker, LV_RADIUS_CIRCLE, 0); - lv_obj_set_style_bg_color(gMarker, lv_color_hex(0xFF4D6D), 0); - lv_obj_set_style_border_width(gMarker, 2, 0); - lv_obj_set_style_border_color(gMarker, lv_color_hex(0xFFFFFF), 0); - lv_obj_add_flag(gMarker, LV_OBJ_FLAG_HIDDEN); -} - -void setup() { - Serial.begin(115200); - Wire.begin(IIC_SDA, IIC_SCL); - - pinMode(TP_RST, OUTPUT); - pinMode(TP_INT, INPUT); - digitalWrite(TP_RST, LOW); - delay(30); - digitalWrite(TP_RST, HIGH); - delay(50); - delay(1000); - - gTouch.setPins(TP_RST, TP_INT); - bool touchOk = gTouch.begin(Wire, 0x5A, IIC_SDA, IIC_SCL); - if (!touchOk) { - Serial.println("Touch init failed"); - } else { - Serial.print("Touch model: "); - Serial.println(gTouch.getModelName()); - gTouch.sleep(); - gTouch.reset(); - gTouch.setMaxCoordinates(480, 480); - gTouch.setSwapXY(true); - gTouch.setMirrorXY(true, false); - } - - gfx->begin(); - gBus->writeC8D8(0x36, 0xA0); - gfx->setBrightness(220); - gfx->fillScreen(0x0000); - - lv_init(); - - uint32_t screenWidth = gfx->width(); - uint32_t screenHeight = gfx->height(); - gBuf1 = (lv_color_t *)heap_caps_malloc(screenWidth * screenHeight / 4 * sizeof(lv_color_t), MALLOC_CAP_DMA); - gBuf2 = (lv_color_t *)heap_caps_malloc(screenWidth * screenHeight / 4 * sizeof(lv_color_t), MALLOC_CAP_DMA); - lv_disp_draw_buf_init(&gDrawBuf, gBuf1, gBuf2, screenWidth * screenHeight / 4); - - static lv_disp_drv_t dispDrv; - lv_disp_drv_init(&dispDrv); - dispDrv.hor_res = screenWidth; - dispDrv.ver_res = screenHeight; - dispDrv.flush_cb = lvglFlushCb; - dispDrv.draw_buf = &gDrawBuf; - lv_disp_drv_register(&dispDrv); - - static lv_indev_drv_t indevDrv; - lv_indev_drv_init(&indevDrv); - indevDrv.type = LV_INDEV_TYPE_POINTER; - indevDrv.read_cb = lvglTouchRead; - lv_indev_drv_register(&indevDrv); - - const esp_timer_create_args_t lvglTickTimerArgs = { - .callback = &lvglTick, - .name = "lvgl_tick"}; - esp_timer_handle_t lvglTickTimer = nullptr; - esp_timer_create(&lvglTickTimerArgs, &lvglTickTimer); - esp_timer_start_periodic(lvglTickTimer, EXAMPLE_LVGL_TICK_PERIOD_MS * 1000); - - createUi(); - Serial.println("LVGL touch debug test ready"); -} - -void loop() { - updateRawTouchState(); - lv_timer_handler(); - delay(5); -} diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/usb_contact_resistance_test/usb_contact_resistance_test.ino b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/usb_contact_resistance_test/usb_contact_resistance_test.ino deleted file mode 100644 index e6730051..00000000 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/usb_contact_resistance_test/usb_contact_resistance_test.ino +++ /dev/null @@ -1,295 +0,0 @@ -#include -#include -#include -#include -#include "pin_config.h" -#include "TouchDrvCSTXXX.hpp" - -#define EXAMPLE_LVGL_TICK_PERIOD_MS 2 - -// ESP32-S3 native USB data pins. -static constexpr int kUsbDmPin = 19; // USB D- -static constexpr int kUsbDpPin = 20; // USB D+, ADC input in resistance mode. -static constexpr uint32_t kUiRefreshMs = 120; -static constexpr uint32_t kAdcSamples = 32; - -// For a stable ohm reading connect a known resistor from D+ / GPIO20 to GND. -// The measured resistance must be connected between D- / GPIO19 and D+ / GPIO20. -static constexpr float kKnownPulldownOhms = 10000.0f; -static constexpr float kSourceMillivolts = 3300.0f; -static constexpr float kOpenThresholdMillivolts = 25.0f; - -static lv_disp_draw_buf_t gDrawBuf; -static lv_color_t *gBuf1 = nullptr; -static lv_color_t *gBuf2 = nullptr; -static lv_obj_t *gModeLabel = nullptr; -static lv_obj_t *gResistanceLabel = nullptr; -static lv_obj_t *gRawLabel = nullptr; -static lv_obj_t *gHintLabel = nullptr; -static lv_obj_t *gActionButton = nullptr; -static lv_obj_t *gActionButtonLabel = nullptr; - -static TouchDrvCST92xx gTouch; -static int16_t gTouchX[5]; -static int16_t gTouchY[5]; - -static bool gSensorMode = false; -static uint32_t gLastUiRefreshMs = 0; - -Arduino_DataBus *gBus = new Arduino_ESP32QSPI( - LCD_CS, LCD_SCLK, LCD_SDIO0, LCD_SDIO1, LCD_SDIO2, LCD_SDIO3); -Arduino_CO5300 *gfx = new Arduino_CO5300( - gBus, LCD_RESET, 0, LCD_WIDTH, LCD_HEIGHT, 0, 0, 0, 0); - -static void lvglFlushCb(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *colorP) { - uint32_t w = area->x2 - area->x1 + 1; - uint32_t h = area->y2 - area->y1 + 1; -#if (LV_COLOR_16_SWAP != 0) - gfx->draw16bitBeRGBBitmap(area->x1, area->y1, (uint16_t *)&colorP->full, w, h); -#else - gfx->draw16bitRGBBitmap(area->x1, area->y1, (uint16_t *)&colorP->full, w, h); -#endif - lv_disp_flush_ready(disp); -} - -static void lvglTick(void *arg) { - LV_UNUSED(arg); - lv_tick_inc(EXAMPLE_LVGL_TICK_PERIOD_MS); -} - -static void lvglTouchRead(lv_indev_drv_t *indevDrv, lv_indev_data_t *data) { - LV_UNUSED(indevDrv); - uint8_t touched = gTouch.getPoint(gTouchX, gTouchY, gTouch.getSupportTouchPoint()); - if (touched > 0) { - data->state = LV_INDEV_STATE_PR; - data->point.x = gTouchX[0]; - data->point.y = gTouchY[0]; - return; - } - data->state = LV_INDEV_STATE_REL; -} - -static uint32_t readAverageRaw() { - uint32_t sum = 0; - for (uint32_t i = 0; i < kAdcSamples; i++) { - sum += analogRead(kUsbDpPin); - delayMicroseconds(250); - } - return sum / kAdcSamples; -} - -static uint32_t readAverageMillivolts() { - uint32_t sum = 0; - for (uint32_t i = 0; i < kAdcSamples; i++) { - sum += analogReadMilliVolts(kUsbDpPin); - delayMicroseconds(250); - } - return sum / kAdcSamples; -} - -static void setResistanceText(float ohms) { - if (ohms >= 1000000.0f) { - String text = String(ohms / 1000000.0f, 2) + " Mohm"; - lv_label_set_text(gResistanceLabel, text.c_str()); - } else if (ohms >= 1000.0f) { - String text = String(ohms / 1000.0f, 2) + " kohm"; - lv_label_set_text(gResistanceLabel, text.c_str()); - } else { - String text = String(ohms, 0) + " ohm"; - lv_label_set_text(gResistanceLabel, text.c_str()); - } -} - -static void updateResistanceUi() { - if (!gSensorMode) { - return; - } - - uint32_t now = millis(); - if (now - gLastUiRefreshMs < kUiRefreshMs) { - return; - } - gLastUiRefreshMs = now; - - uint32_t raw = readAverageRaw(); - uint32_t millivolts = readAverageMillivolts(); - - if (millivolts <= kOpenThresholdMillivolts) { - lv_label_set_text(gResistanceLabel, "OPEN"); - lv_obj_set_style_text_color(gResistanceLabel, lv_color_hex(0xFFD166), 0); - } else if (millivolts >= (uint32_t)(kSourceMillivolts - 80.0f)) { - lv_label_set_text(gResistanceLabel, "SHORT / LOW"); - lv_obj_set_style_text_color(gResistanceLabel, lv_color_hex(0x7CFF8A), 0); - } else { - float rx = kKnownPulldownOhms * ((kSourceMillivolts / (float)millivolts) - 1.0f); - lv_obj_set_style_text_color(gResistanceLabel, lv_color_hex(0x7CFF8A), 0); - setResistanceText(rx); - } - - String rawText = "ADC raw: " + String(raw); - rawText += "\nD+ voltage: " + String(millivolts) + " mV"; - rawText += "\nKnown pulldown: 10 kohm to GND"; - lv_label_set_text(gRawLabel, rawText.c_str()); -} - -static void enterSensorMode() { - Serial.flush(); - delay(30); - - pinMode(kUsbDmPin, OUTPUT); - digitalWrite(kUsbDmPin, HIGH); - - pinMode(kUsbDpPin, INPUT); - analogReadResolution(12); - analogSetPinAttenuation(kUsbDpPin, ADC_11db); - - gSensorMode = true; - gLastUiRefreshMs = 0; - - lv_label_set_text(gModeLabel, "Resistance mode"); - lv_label_set_text(gHintLabel, "D- is 3.3V source. D+ is ADC input.\nUse 10 kohm from D+ to GND for accurate readings."); - lv_label_set_text(gActionButtonLabel, "Restart to USB"); - updateResistanceUi(); -} - -static void actionButtonEventCb(lv_event_t *event) { - if (lv_event_get_code(event) != LV_EVENT_CLICKED) { - return; - } - - if (!gSensorMode) { - enterSensorMode(); - return; - } - - lv_label_set_text(gModeLabel, "Restarting..."); - lv_label_set_text(gHintLabel, "USB mode will return after reboot."); - lv_timer_handler(); - delay(150); - ESP.restart(); -} - -static void createUi() { - lv_obj_t *screen = lv_scr_act(); - lv_obj_set_style_bg_color(screen, lv_color_hex(0x0B1320), 0); - lv_obj_set_style_bg_opa(screen, LV_OPA_COVER, 0); - - lv_obj_t *title = lv_label_create(screen); - lv_label_set_text(title, "USB RESISTANCE TEST"); - lv_obj_set_style_text_color(title, lv_color_hex(0xFFFFFF), 0); - lv_obj_set_style_text_font(title, &lv_font_montserrat_22, 0); - lv_obj_align(title, LV_ALIGN_TOP_MID, 0, 24); - - gModeLabel = lv_label_create(screen); - lv_label_set_text(gModeLabel, "USB mode"); - lv_obj_set_style_text_color(gModeLabel, lv_color_hex(0xB8C8DC), 0); - lv_obj_set_style_text_font(gModeLabel, &lv_font_montserrat_18, 0); - lv_obj_align(gModeLabel, LV_ALIGN_TOP_MID, 0, 68); - - gResistanceLabel = lv_label_create(screen); - lv_label_set_text(gResistanceLabel, "READY"); - lv_obj_set_style_text_color(gResistanceLabel, lv_color_hex(0x72D6FF), 0); - lv_obj_set_style_text_font(gResistanceLabel, &lv_font_montserrat_40, 0); - lv_obj_align(gResistanceLabel, LV_ALIGN_CENTER, 0, -72); - - gRawLabel = lv_label_create(screen); - lv_label_set_text(gRawLabel, "ADC raw: -\nD+ voltage: -\nKnown pulldown: 10 kohm to GND"); - lv_obj_set_width(gRawLabel, 420); - lv_label_set_long_mode(gRawLabel, LV_LABEL_LONG_WRAP); - lv_obj_set_style_text_align(gRawLabel, LV_TEXT_ALIGN_CENTER, 0); - lv_obj_set_style_text_color(gRawLabel, lv_color_hex(0xD5DCE5), 0); - lv_obj_set_style_text_font(gRawLabel, &lv_font_montserrat_16, 0); - lv_obj_align(gRawLabel, LV_ALIGN_CENTER, 0, -8); - - gHintLabel = lv_label_create(screen); - lv_label_set_text(gHintLabel, "USB is normal now.\nTap Start to measure resistance between D- and D+."); - lv_obj_set_width(gHintLabel, 420); - lv_label_set_long_mode(gHintLabel, LV_LABEL_LONG_WRAP); - lv_obj_set_style_text_align(gHintLabel, LV_TEXT_ALIGN_CENTER, 0); - lv_obj_set_style_text_color(gHintLabel, lv_color_hex(0xAAB7C6), 0); - lv_obj_set_style_text_font(gHintLabel, &lv_font_montserrat_14, 0); - lv_obj_align(gHintLabel, LV_ALIGN_CENTER, 0, 72); - - gActionButton = lv_btn_create(screen); - lv_obj_set_size(gActionButton, 260, 72); - lv_obj_align(gActionButton, LV_ALIGN_BOTTOM_MID, 0, -42); - lv_obj_set_style_radius(gActionButton, 18, 0); - lv_obj_set_style_bg_color(gActionButton, lv_color_hex(0x2A9D8F), 0); - lv_obj_set_style_border_width(gActionButton, 0, 0); - lv_obj_add_event_cb(gActionButton, actionButtonEventCb, LV_EVENT_CLICKED, nullptr); - - gActionButtonLabel = lv_label_create(gActionButton); - lv_label_set_text(gActionButtonLabel, "Start"); - lv_obj_set_style_text_color(gActionButtonLabel, lv_color_hex(0xFFFFFF), 0); - lv_obj_set_style_text_font(gActionButtonLabel, &lv_font_montserrat_22, 0); - lv_obj_center(gActionButtonLabel); -} - -void setup() { - Serial.begin(115200); - - Wire.begin(IIC_SDA, IIC_SCL); - - pinMode(TP_RST, OUTPUT); - pinMode(TP_INT, INPUT); - digitalWrite(TP_RST, LOW); - delay(30); - digitalWrite(TP_RST, HIGH); - delay(50); - delay(1000); - - gTouch.setPins(TP_RST, TP_INT); - bool touchOk = gTouch.begin(Wire, 0x5A, IIC_SDA, IIC_SCL); - if (!touchOk) { - Serial.println("Touch init failed"); - } else { - gTouch.sleep(); - gTouch.reset(); - gTouch.setMaxCoordinates(480, 480); - gTouch.setSwapXY(true); - gTouch.setMirrorXY(true, false); - } - - gfx->begin(); - gBus->writeC8D8(0x36, 0xA0); - gfx->setBrightness(220); - gfx->fillScreen(0x0000); - - lv_init(); - - uint32_t screenWidth = gfx->width(); - uint32_t screenHeight = gfx->height(); - gBuf1 = (lv_color_t *)heap_caps_malloc(screenWidth * screenHeight / 4 * sizeof(lv_color_t), MALLOC_CAP_DMA); - gBuf2 = (lv_color_t *)heap_caps_malloc(screenWidth * screenHeight / 4 * sizeof(lv_color_t), MALLOC_CAP_DMA); - lv_disp_draw_buf_init(&gDrawBuf, gBuf1, gBuf2, screenWidth * screenHeight / 4); - - static lv_disp_drv_t dispDrv; - lv_disp_drv_init(&dispDrv); - dispDrv.hor_res = screenWidth; - dispDrv.ver_res = screenHeight; - dispDrv.flush_cb = lvglFlushCb; - dispDrv.draw_buf = &gDrawBuf; - lv_disp_drv_register(&dispDrv); - - static lv_indev_drv_t indevDrv; - lv_indev_drv_init(&indevDrv); - indevDrv.type = LV_INDEV_TYPE_POINTER; - indevDrv.read_cb = lvglTouchRead; - lv_indev_drv_register(&indevDrv); - - const esp_timer_create_args_t lvglTickTimerArgs = { - .callback = &lvglTick, - .name = "lvgl_tick"}; - esp_timer_handle_t lvglTickTimer = nullptr; - esp_timer_create(&lvglTickTimerArgs, &lvglTickTimer); - esp_timer_start_periodic(lvglTickTimer, EXAMPLE_LVGL_TICK_PERIOD_MS * 1000); - - createUi(); - Serial.println("USB resistance test ready; native USB remains active until Start is tapped."); -} - -void loop() { - updateResistanceUi(); - lv_timer_handler(); - delay(5); -} diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/usb_contact_screen_start_stub/usb_contact_screen_start_stub.ino b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/usb_contact_screen_start_stub/usb_contact_screen_start_stub.ino deleted file mode 100644 index 59d74ac3..00000000 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/usb_contact_screen_start_stub/usb_contact_screen_start_stub.ino +++ /dev/null @@ -1,600 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "ESP_I2S.h" -#include "es8311.h" - -#define PIN_LCD_CS 12 -#define PIN_LCD_SCLK 38 -#define PIN_LCD_D0 4 -#define PIN_LCD_D1 5 -#define PIN_LCD_D2 6 -#define PIN_LCD_D3 7 -#define PIN_LCD_RST 2 -#define PIN_I2C_SDA 15 -#define PIN_I2C_SCL 14 -#define PIN_TP_INT 11 -#define PIN_USER_BTN 0 -#define PIN_PA 46 -#define PIN_I2S_BCLK 9 -#define PIN_I2S_LRCK 45 -#define PIN_I2S_DOUT 8 -#define PIN_I2S_DIN 10 -#define PIN_I2S_MCLK 42 - -#define DISP_W 480 -#define DISP_H 480 - -static constexpr int kUsbDmPin = 19; -static constexpr int kUsbDpPin = 20; -static constexpr uint32_t kContactDebounceMs = 80; -static constexpr uint32_t kButtonDebounceMs = 45; -static constexpr uint32_t kUiPeriodMs = 200; -static constexpr uint32_t kSampleRate = 16000; -static constexpr uint32_t kMinCycleMs = 1500; -static constexpr uint32_t kPauseAfterMs = 60000; - -#define C_BG 0x0841u -#define C_PANEL 0x1082u -#define C_CARD 0x18C3u -#define C_BORDER 0x39C7u -#define C_TEXT 0xFFFFu -#define C_MUTE 0xBDF7u -#define C_ACCENT 0x5D5Fu -#define C_OK 0x3666u -#define C_BAD 0xD145u -#define C_BUTTON 0x2145u - -Arduino_DataBus *gBus = new Arduino_ESP32QSPI( - PIN_LCD_CS, PIN_LCD_SCLK, PIN_LCD_D0, PIN_LCD_D1, PIN_LCD_D2, PIN_LCD_D3); -Arduino_CO5300 *gfx = new Arduino_CO5300( - gBus, PIN_LCD_RST, 0, DISP_W, DISP_H, 0, 0, 0, 0); - -TouchDrvCST92xx gTouch; -I2SClass gI2s; -Preferences gPrefs; - -struct Rect { - int16_t x; - int16_t y; - int16_t w; - int16_t h; -}; - -static const Rect kStartButton = {96, 348, 288, 78}; -static const Rect kLimitSlider = {42, 132, 396, 44}; -static const Rect kTickSlider = {42, 246, 396, 44}; -static const Rect kAlertSlider = {42, 360, 396, 44}; -static const uint16_t kLimitsSec[] = {5, 7, 10, 15, 20}; -static const int16_t kTickAmpByVolume[] = {0, 40, 80, 140, 220, 320, 440, 580, 720, 800, 1600}; -static const int16_t kAlertAmpByVolume[] = {0, 150, 300, 500, 800, 12000, 12000, 12000, 12000, 12000, 12000}; - -static bool gStarted = false; -static bool gSettingsOpen = false; -static bool gAudioReady = false; -static bool gStableClosed = false; -static bool gLastRawClosed = false; -static bool gStaticDrawn = false; -static bool gNeedRedraw = true; -static bool gNeedStaticRedraw = true; -static bool gLastDrawnClosed = false; -static bool gLastDrawnPaused = false; -static bool gTouchDown = false; -static bool gUserButtonDown = false; -static int16_t gTouchStartX = 0; -static int16_t gTouchStartY = 0; -static int16_t gTouchLastX = 0; -static int16_t gTouchLastY = 0; -static uint32_t gLastRawChangeMs = 0; -static uint32_t gStartedMs = 0; -static uint32_t gLastCycleStartMs = 0; -static uint32_t gLastUiMs = 0; -static uint32_t gUserButtonChangeMs = 0; -static uint32_t gCycleMs[5] = {}; -static uint8_t gCycleCount = 0; -static uint8_t gCycleNext = 0; -static uint8_t gLimitIndex = 2; -static uint8_t gTickVolume = 3; -static uint8_t gAlertVolume = 10; -static uint8_t gShortStreak = 0; -static char gLastTopLine[48] = ""; -static char gLastStreakLine[48] = ""; - -static void drawPanel(int x, int y, int w, int h, uint16_t fill, uint16_t border, int radius = 10) { - gfx->fillRoundRect(x, y, w, h, radius, fill); - gfx->drawRoundRect(x, y, w, h, radius, border); -} - -static void drawText(int x, int y, const char *text, uint16_t color, uint8_t size = 2) { - gfx->setFont(); - gfx->setTextSize(size); - gfx->setTextColor(color); - gfx->setCursor(x, y); - gfx->print(text); -} - -static void drawCenteredText(int x, int y, int w, const char *text, uint16_t color, uint8_t size = 2) { - int textW = strlen(text) * 6 * size; - int textX = x + (w - textW) / 2; - if (textX < x + 8) { - textX = x + 8; - } - drawText(textX, y, text, color, size); -} - -static void drawButton(const Rect &rect, const char *label, uint8_t size = 2) { - drawPanel(rect.x, rect.y, rect.w, rect.h, C_BUTTON, C_BORDER, 12); - drawCenteredText(rect.x, rect.y + 18, rect.w, label, C_TEXT, size); -} - -static bool contains(const Rect &rect, int16_t x, int16_t y) { - return x >= rect.x && x < rect.x + rect.w && y >= rect.y && y < rect.y + rect.h; -} - -static void clearArea(int x, int y, int w, int h, uint16_t fill) { - gfx->fillRect(x, y, w, h, fill); -} - -static void formatSec(char *out, size_t outSize, uint32_t ms) { - snprintf(out, outSize, "%lu.%01lus", (unsigned long)(ms / 1000), (unsigned long)((ms % 1000) / 100)); -} - -static void formatClock(char *out, size_t outSize, uint32_t ms) { - uint32_t sec = ms / 1000; - snprintf(out, outSize, "%02lu:%02lu", (unsigned long)(sec / 60), (unsigned long)(sec % 60)); -} - -static uint32_t averageCycleMs() { - if (gCycleCount == 0) { - return 0; - } - uint32_t sum = 0; - for (uint8_t i = 0; i < gCycleCount; i++) { - sum += gCycleMs[i]; - } - return sum / gCycleCount; -} - -static void resetCachedUiText() { - gLastTopLine[0] = '\0'; - gLastStreakLine[0] = '\0'; -} - -static void loadSettings() { - gPrefs.begin("breath-mon", false); - gLimitIndex = gPrefs.getUChar("limit", gLimitIndex); - gTickVolume = gPrefs.getUChar("tick", gTickVolume); - gAlertVolume = gPrefs.getUChar("alert", gAlertVolume); - if (gLimitIndex > 4) { - gLimitIndex = 2; - } - if (gTickVolume > 10) { - gTickVolume = 3; - } - if (gAlertVolume > 10) { - gAlertVolume = 10; - } -} - -static void saveSettings() { - gPrefs.putUChar("limit", gLimitIndex); - gPrefs.putUChar("tick", gTickVolume); - gPrefs.putUChar("alert", gAlertVolume); -} - -static bool isAutoPaused() { - return gStarted && gLastCycleStartMs != 0 && (millis() - gLastCycleStartMs) > kPauseAfterMs; -} - -static esp_err_t codecInit() { - es8311_handle_t esHandle = es8311_create(0, ES8311_ADDRRES_0); - if (!esHandle) { - return ESP_FAIL; - } - const es8311_clock_config_t clk = { - .mclk_inverted = false, - .sclk_inverted = false, - .mclk_from_mclk_pin = true, - .mclk_frequency = (int)kSampleRate * 256, - .sample_frequency = (int)kSampleRate, - }; - if (es8311_init(esHandle, &clk, ES8311_RESOLUTION_16, ES8311_RESOLUTION_16) != ESP_OK) { - return ESP_FAIL; - } - es8311_voice_volume_set(esHandle, 100, nullptr); - es8311_voice_mute(esHandle, false); - return ESP_OK; -} - -static void initAudio() { - pinMode(PIN_PA, OUTPUT); - digitalWrite(PIN_PA, HIGH); - gI2s.setPins(PIN_I2S_BCLK, PIN_I2S_LRCK, PIN_I2S_DOUT, PIN_I2S_DIN, PIN_I2S_MCLK); - if (!gI2s.begin(I2S_MODE_STD, kSampleRate, I2S_DATA_BIT_WIDTH_16BIT, I2S_SLOT_MODE_STEREO, I2S_STD_SLOT_BOTH)) { - Serial.println("I2S init failed"); - return; - } - gAudioReady = (codecInit() == ESP_OK); - Serial.println(gAudioReady ? "Audio init OK" : "Audio codec init failed"); -} - -static void playBeep(uint16_t freq, uint16_t samples, int16_t amp) { - if (!gAudioReady || amp <= 0) { - return; - } - static int16_t toneBuf[1600 * 2]; - if (samples > 1600) { - samples = 1600; - } - for (int i = 0; i < samples; i++) { - float s = sinf(2.0f * 3.1415926f * (float)freq * ((float)i / (float)kSampleRate)); - int16_t v = (int16_t)(s * amp); - toneBuf[i * 2] = v; - toneBuf[i * 2 + 1] = v; - } - gI2s.write((uint8_t *)toneBuf, samples * 2 * sizeof(int16_t)); -} - -static void playCycleTick() { - playBeep(880, 480, kTickAmpByVolume[gTickVolume]); -} - -static void playAlertBeep() { - playBeep(1200, 1600, kAlertAmpByVolume[gAlertVolume]); -} - -static void alertIfNeeded() { - if (gShortStreak == 0) { - return; - } - uint8_t count = min(gShortStreak, 5); - for (uint8_t i = 0; i < count; i++) { - playAlertBeep(); - delay(80); - } -} - -static void addCycle(uint32_t cycleMs) { - gCycleMs[gCycleNext] = cycleMs; - gCycleNext = (gCycleNext + 1) % 5; - if (gCycleCount < 5) { - gCycleCount++; - } - - uint32_t avgMs = averageCycleMs(); - if (avgMs > 0 && avgMs < (uint32_t)kLimitsSec[gLimitIndex] * 1000UL) { - if (gShortStreak < 5) { - gShortStreak++; - } - } else { - gShortStreak = 0; - } -} - -static void drawReadyScreen() { - gfx->fillScreen(C_BG); - drawPanel(12, 12, 456, 456, C_PANEL, C_BORDER, 16); - drawText(28, 42, "BREATH MONITOR", C_TEXT, 3); - drawText(28, 78, "USB contact sensor", C_MUTE, 2); - drawPanel(34, 132, 412, 160, C_CARD, C_BORDER, 14); - drawCenteredText(34, 166, 412, "READY", C_ACCENT, 4); - drawCenteredText(34, 222, 412, "Closed = exhale", C_TEXT, 2); - drawCenteredText(34, 252, 412, "Open = inhale", C_MUTE, 2); - drawButton(kStartButton, "START", 3); -} - -static void drawSlider(const Rect &rect, const char *title, const char *value, uint8_t pos, uint8_t maxPos) { - drawText(rect.x, rect.y - 28, title, C_TEXT, 2); - drawText(rect.x + 278, rect.y - 28, value, C_ACCENT, 2); - drawPanel(rect.x, rect.y, rect.w, rect.h, C_BUTTON, C_BORDER, 12); - int trackX = rect.x + 22; - int trackW = rect.w - 44; - int trackY = rect.y + rect.h / 2 - 3; - gfx->fillRect(trackX, trackY, trackW, 6, C_BORDER); - int knobX = trackX + (trackW * pos) / max(1, maxPos); - gfx->fillRoundRect(knobX - 10, rect.y + 8, 20, rect.h - 16, 8, C_ACCENT); -} - -static void drawSettingsScreen() { - char value[24]; - gfx->fillScreen(C_BG); - drawPanel(12, 12, 456, 456, C_PANEL, C_BORDER, 16); - drawText(28, 36, "SETTINGS", C_TEXT, 3); - drawText(28, 72, "Press top button to close", C_MUTE, 2); - - snprintf(value, sizeof(value), "%us", kLimitsSec[gLimitIndex]); - drawSlider(kLimitSlider, "Limit", value, gLimitIndex, 4); - snprintf(value, sizeof(value), "%u/10", gTickVolume); - drawSlider(kTickSlider, "Cycle tick volume", value, gTickVolume, 10); - snprintf(value, sizeof(value), "%u/10", gAlertVolume); - drawSlider(kAlertSlider, "Alert volume", value, gAlertVolume, 10); - - gStaticDrawn = false; - gNeedStaticRedraw = true; -} - -static void drawMonitorStatic() { - gfx->fillScreen(C_BG); - drawPanel(12, 12, 456, 456, C_PANEL, C_BORDER, 16); - drawText(28, 32, "BREATH MONITOR", C_TEXT, 2); - drawPanel(28, 96, 424, 104, C_CARD, C_BORDER, 14); - drawPanel(28, 216, 200, 72, C_CARD, C_BORDER, 10); - drawText(42, 236, "Current", C_MUTE, 1); - drawPanel(252, 216, 200, 72, C_CARD, C_BORDER, 10); - drawText(266, 236, "Average 5", C_MUTE, 1); - drawPanel(28, 304, 200, 64, C_CARD, C_BORDER, 10); - drawText(42, 322, "From start", C_MUTE, 1); - drawPanel(252, 304, 200, 64, C_CARD, C_BORDER, 10); - drawText(266, 322, "Limit", C_MUTE, 1); - gStaticDrawn = true; - gLastDrawnClosed = !gStableClosed; - gLastDrawnPaused = !isAutoPaused(); - resetCachedUiText(); -} - -static void updateMonitorValues(bool force) { - char line[48]; - char value[16]; - uint32_t now = millis(); - uint32_t runMs = now - gStartedMs; - uint32_t currentMs = (gLastCycleStartMs == 0) ? 0 : now - gLastCycleStartMs; - bool paused = isAutoPaused(); - if (paused) { - currentMs = now - gLastCycleStartMs - kPauseAfterMs; - } - uint32_t avgMs = averageCycleMs(); - - if (force || gLastDrawnClosed != gStableClosed || gLastDrawnPaused != paused) { - clearArea(42, 118, 396, 68, C_CARD); - if (paused) { - drawCenteredText(28, 122, 424, "PAUSE", C_BAD, 4); - drawCenteredText(28, 172, 424, "no cycle for 60s", C_MUTE, 2); - } else { - drawCenteredText(28, 122, 424, gStableClosed ? "EXHALE" : "INHALE", - gStableClosed ? C_OK : C_ACCENT, 4); - drawCenteredText(28, 172, 424, gStableClosed ? "contact closed" : "contact open", C_MUTE, 2); - } - gLastDrawnClosed = gStableClosed; - gLastDrawnPaused = paused; - } - - snprintf(line, sizeof(line), "Limit: %us top button: settings", kLimitsSec[gLimitIndex]); - if (strcmp(line, gLastTopLine) != 0) { - clearArea(28, 58, 424, 28, C_PANEL); - drawText(28, 60, line, C_MUTE, 2); - strncpy(gLastTopLine, line, sizeof(gLastTopLine) - 1); - gLastTopLine[sizeof(gLastTopLine) - 1] = '\0'; - } - - clearArea(42, 254, 160, 28, C_CARD); - formatSec(value, sizeof(value), currentMs); - drawText(42, 256, value, C_TEXT, 3); - - clearArea(266, 254, 160, 28, C_CARD); - if (avgMs > 0) { - formatSec(value, sizeof(value), avgMs); - } else { - snprintf(value, sizeof(value), "--"); - } - drawText(266, 256, value, C_TEXT, 3); - - clearArea(42, 340, 160, 24, C_CARD); - formatClock(value, sizeof(value), runMs); - drawText(42, 342, value, C_TEXT, 2); - - clearArea(266, 340, 160, 24, C_CARD); - snprintf(value, sizeof(value), "%us", kLimitsSec[gLimitIndex]); - drawText(266, 342, value, C_TEXT, 2); - - snprintf(line, sizeof(line), "Short avg streak: %u", gShortStreak); - if (strcmp(line, gLastStreakLine) != 0) { - clearArea(28, 398, 280, 28, C_PANEL); - drawText(32, 402, line, gShortStreak > 0 ? C_BAD : C_MUTE, 2); - strncpy(gLastStreakLine, line, sizeof(gLastStreakLine) - 1); - gLastStreakLine[sizeof(gLastStreakLine) - 1] = '\0'; - } -} - -static void redrawScreen() { - if (gSettingsOpen) { - drawSettingsScreen(); - } else if (gStarted) { - if (gNeedStaticRedraw || !gStaticDrawn) { - drawMonitorStatic(); - gNeedStaticRedraw = false; - } - updateMonitorValues(true); - } else { - drawReadyScreen(); - } - gNeedRedraw = false; - gLastUiMs = millis(); -} - -static void enterSensorMode() { - Serial.flush(); - delay(30); - pinMode(kUsbDmPin, OUTPUT); - digitalWrite(kUsbDmPin, LOW); - pinMode(kUsbDpPin, INPUT_PULLUP); - - uint32_t now = millis(); - gStarted = true; - gStartedMs = now; - gLastCycleStartMs = 0; - gLastRawClosed = (digitalRead(kUsbDpPin) == LOW); - gStableClosed = gLastRawClosed; - gLastRawChangeMs = now; - if (gStableClosed) { - gLastCycleStartMs = now; - playCycleTick(); - } - gNeedStaticRedraw = true; - gNeedRedraw = true; -} - -static void toggleSettings() { - gSettingsOpen = !gSettingsOpen; - gNeedStaticRedraw = true; - gNeedRedraw = true; - resetCachedUiText(); -} - -static void handleStableContact(bool closed) { - uint32_t now = millis(); - gStableClosed = closed; - if (closed) { - if (gLastCycleStartMs != 0) { - uint32_t cycleMs = now - gLastCycleStartMs; - if (cycleMs >= kPauseAfterMs) { - gShortStreak = 0; - gLastCycleStartMs = now; - playCycleTick(); - } else if (cycleMs >= kMinCycleMs) { - addCycle(cycleMs); - gLastCycleStartMs = now; - playCycleTick(); - alertIfNeeded(); - } - } else { - gLastCycleStartMs = now; - playCycleTick(); - } - } - gNeedRedraw = !gSettingsOpen; -} - -static void pollContact() { - if (!gStarted) { - return; - } - bool rawClosed = (digitalRead(kUsbDpPin) == LOW); - uint32_t now = millis(); - if (rawClosed != gLastRawClosed) { - gLastRawClosed = rawClosed; - gLastRawChangeMs = now; - } - if ((now - gLastRawChangeMs) >= kContactDebounceMs && gStableClosed != gLastRawClosed) { - handleStableContact(gLastRawClosed); - } -} - -static void pollUserButton() { - bool down = digitalRead(PIN_USER_BTN) == LOW; - uint32_t now = millis(); - if (down != gUserButtonDown && (now - gUserButtonChangeMs) >= kButtonDebounceMs) { - gUserButtonDown = down; - gUserButtonChangeMs = now; - if (down) { - toggleSettings(); - } - } -} - -static uint8_t sliderValueFromX(const Rect &rect, int16_t x, uint8_t maxValue) { - int16_t left = rect.x + 22; - int16_t right = rect.x + rect.w - 22; - if (x < left) x = left; - if (x > right) x = right; - return (uint8_t)(((uint32_t)(x - left) * maxValue + (right - left) / 2) / (right - left)); -} - -static void handleSettingsTouch(int16_t x, int16_t y) { - if (contains(kLimitSlider, x, y)) { - uint8_t next = sliderValueFromX(kLimitSlider, x, 4); - if (next == gLimitIndex) { - return; - } - gLimitIndex = next; - } else if (contains(kTickSlider, x, y)) { - uint8_t next = sliderValueFromX(kTickSlider, x, 10); - if (next == gTickVolume) { - return; - } - gTickVolume = next; - playCycleTick(); - } else if (contains(kAlertSlider, x, y)) { - uint8_t next = sliderValueFromX(kAlertSlider, x, 10); - if (next == gAlertVolume) { - return; - } - gAlertVolume = next; - playAlertBeep(); - } else { - return; - } - saveSettings(); - gNeedRedraw = true; -} - -static void pollTouch() { - int16_t x = 0; - int16_t y = 0; - bool touching = gTouch.getPoint(&x, &y, 1) > 0; - if (touching && !gTouchDown) { - gTouchDown = true; - gTouchStartX = x; - gTouchStartY = y; - gTouchLastX = x; - gTouchLastY = y; - return; - } - if (touching && gTouchDown) { - gTouchLastX = x; - gTouchLastY = y; - return; - } - if (!touching && gTouchDown) { - gTouchDown = false; - int dx = abs(gTouchLastX - gTouchStartX); - int dy = abs(gTouchLastY - gTouchStartY); - if (dx >= 14 || dy >= 14) { - return; - } - if (gSettingsOpen) { - handleSettingsTouch(gTouchLastX, gTouchLastY); - } else if (!gStarted && contains(kStartButton, gTouchLastX, gTouchLastY)) { - enterSensorMode(); - } - } -} - -void setup() { - Serial.begin(115200); - Wire.begin(PIN_I2C_SDA, PIN_I2C_SCL); - pinMode(PIN_USER_BTN, INPUT_PULLUP); - loadSettings(); - initAudio(); - - gfx->begin(); - gBus->writeC8D8(0x36, 0xA0); - gfx->setBrightness(220); - gfx->fillScreen(C_BG); - - gTouch.setPins(PIN_TP_INT, -1); - bool touchOk = gTouch.begin(Wire, CST92XX_SLAVE_ADDRESS, PIN_I2C_SDA, PIN_I2C_SCL); - gTouch.setMaxCoordinates(DISP_W, DISP_H); - gTouch.setSwapXY(true); - gTouch.setMirrorXY(true, false); - - Serial.println("Breath monitor ready."); - Serial.println(touchOk ? "Touch init OK" : "Touch init failed"); - gNeedRedraw = true; -} - -void loop() { - pollUserButton(); - pollTouch(); - pollContact(); - if (gStarted && !gSettingsOpen && millis() - gLastUiMs >= kUiPeriodMs) { - updateMonitorValues(false); - gLastUiMs = millis(); - } - if (gNeedRedraw) { - redrawScreen(); - } - delay(10); -} diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/usb_contact_sensor_debug_test/usb_contact_sensor_debug_test.ino b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/usb_contact_sensor_debug_test/usb_contact_sensor_debug_test.ino deleted file mode 100644 index 1901a7cb..00000000 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/usb_contact_sensor_debug_test/usb_contact_sensor_debug_test.ino +++ /dev/null @@ -1,407 +0,0 @@ -#include -#include -#include -#include -#include "pin_config.h" -#include "TouchDrvCSTXXX.hpp" - -#define EXAMPLE_LVGL_TICK_PERIOD_MS 2 - -// ESP32-S3 native USB data pins. -static constexpr int kUsbDmPin = 19; // USB D- -static constexpr int kUsbDpPin = 20; // USB D+ -static constexpr int kUserButtonPin = 0; // BOOT/user button, active LOW. -static constexpr uint32_t kDebounceMs = 20; -static constexpr uint32_t kEnterDelayMs = 250; -static constexpr uint32_t kButtonDebounceMs = 35; - -static lv_disp_draw_buf_t gDrawBuf; -static lv_color_t *gBuf1 = nullptr; -static lv_color_t *gBuf2 = nullptr; - -static lv_obj_t *gRawLabel = nullptr; -static lv_obj_t *gEventLabel = nullptr; -static lv_obj_t *gModeLabel = nullptr; -static lv_obj_t *gStateLabel = nullptr; -static lv_obj_t *gActionButton = nullptr; -static lv_obj_t *gActionButtonLabel = nullptr; -static lv_obj_t *gMarker = nullptr; - -static TouchDrvCST92xx gTouch; -static int16_t gTouchX[5]; -static int16_t gTouchY[5]; - -static volatile bool gTouchPressed = false; -static volatile int16_t gLastTouchX = -1; -static volatile int16_t gLastTouchY = -1; -static volatile uint32_t gRawTouchCount = 0; -static uint32_t gButtonPressCount = 0; -static uint32_t gButtonClickCount = 0; -static bool gLastButtonRawPressed = false; -static bool gButtonStablePressed = false; -static uint32_t gLastButtonRawChangeMs = 0; - -static bool gSensorMode = false; -static bool gEnterPending = false; -static uint32_t gEnterAtMs = 0; -static bool gStableClosed = false; -static bool gLastRawClosed = false; -static uint32_t gLastRawChangeMs = 0; -static uint32_t gLastUiRefreshMs = 0; - -Arduino_DataBus *gBus = new Arduino_ESP32QSPI( - LCD_CS, LCD_SCLK, LCD_SDIO0, LCD_SDIO1, LCD_SDIO2, LCD_SDIO3); -Arduino_CO5300 *gfx = new Arduino_CO5300( - gBus, LCD_RESET, 0, LCD_WIDTH, LCD_HEIGHT, 0, 0, 0, 0); - -static void lvglFlushCb(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *colorP) { - uint32_t w = area->x2 - area->x1 + 1; - uint32_t h = area->y2 - area->y1 + 1; -#if (LV_COLOR_16_SWAP != 0) - gfx->draw16bitBeRGBBitmap(area->x1, area->y1, (uint16_t *)&colorP->full, w, h); -#else - gfx->draw16bitRGBBitmap(area->x1, area->y1, (uint16_t *)&colorP->full, w, h); -#endif - lv_disp_flush_ready(disp); -} - -static void lvglTick(void *arg) { - LV_UNUSED(arg); - lv_tick_inc(EXAMPLE_LVGL_TICK_PERIOD_MS); -} - -static void lvglTouchRead(lv_indev_drv_t *indevDrv, lv_indev_data_t *data) { - LV_UNUSED(indevDrv); - uint8_t touched = gTouch.getPoint(gTouchX, gTouchY, gTouch.getSupportTouchPoint()); - - if (touched > 0) { - gTouchPressed = true; - gLastTouchX = gTouchX[0]; - gLastTouchY = gTouchY[0]; - gRawTouchCount++; - - data->state = LV_INDEV_STATE_PR; - data->point.x = gTouchX[0]; - data->point.y = gTouchY[0]; - return; - } - - gTouchPressed = false; - data->state = LV_INDEV_STATE_REL; -} - -static void setStateUi(bool closed) { - if (closed) { - lv_label_set_text(gStateLabel, "CLOSED"); - lv_obj_set_style_text_color(gStateLabel, lv_color_hex(0x6DFF8B), 0); - } else { - lv_label_set_text(gStateLabel, "OPEN"); - lv_obj_set_style_text_color(gStateLabel, lv_color_hex(0xFFD166), 0); - } -} - -static void updateTouchDiagnostics() { - uint32_t now = millis(); - if (now - gLastUiRefreshMs < 40) return; - gLastUiRefreshMs = now; - - String raw = gTouchPressed ? "RAW: PRESSED" : "RAW: released"; - raw += "\nx=" + String((int)gLastTouchX) + " y=" + String((int)gLastTouchY); - raw += " n=" + String((uint32_t)gRawTouchCount); - lv_label_set_text(gRawLabel, raw.c_str()); - - if (gTouchPressed && gLastTouchX >= 0 && gLastTouchY >= 0) { - int markerX = gLastTouchX - 8; - int markerY = gLastTouchY - 8; - if (markerX < 0) markerX = 0; - if (markerY < 0) markerY = 0; - lv_obj_set_pos(gMarker, markerX, markerY); - lv_obj_clear_flag(gMarker, LV_OBJ_FLAG_HIDDEN); - } else { - lv_obj_add_flag(gMarker, LV_OBJ_FLAG_HIDDEN); - } -} - -static void actuallyEnterSensorMode() { - gEnterPending = false; - - // Make the visual transition happen BEFORE the USB data pins are repurposed. - lv_label_set_text(gModeLabel, "SENSOR MODE"); - lv_label_set_text(gActionButtonLabel, "Restart to USB"); - lv_obj_set_style_bg_color(gActionButton, lv_color_hex(0xA33D4F), LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_bg_color(gActionButton, lv_color_hex(0xC94F65), LV_PART_MAIN | LV_STATE_PRESSED); - lv_label_set_text(gEventLabel, "GPIO19=D- LOW GPIO20=D+ INPUT_PULLUP"); - lv_label_set_text(gStateLabel, "SWITCHING..."); - lv_obj_set_style_text_color(gStateLabel, lv_color_hex(0x72D6FF), 0); - lv_refr_now(nullptr); - delay(60); - - // Intentionally repurpose only USB D-/D+. These are not LCD or touch pins. - // Do NOT call Serial.flush() here: USB CDC may already be disappearing. - pinMode(kUsbDmPin, OUTPUT); - digitalWrite(kUsbDmPin, LOW); - pinMode(kUsbDpPin, INPUT_PULLUP); - - gSensorMode = true; - gLastRawClosed = (digitalRead(kUsbDpPin) == LOW); - gStableClosed = gLastRawClosed; - gLastRawChangeMs = millis(); - setStateUi(gStableClosed); -} - -static void actionButtonEventCb(lv_event_t *event) { - lv_event_code_t code = lv_event_get_code(event); - - if (code == LV_EVENT_PRESSED) { - gButtonPressCount++; - String text = "BUTTON PRESSED #" + String(gButtonPressCount); - lv_label_set_text(gEventLabel, text.c_str()); - - if (!gSensorMode && !gEnterPending) { - lv_label_set_text(gActionButtonLabel, "Starting..."); - lv_label_set_text(gStateLabel, "TOUCH OK"); - lv_obj_set_style_text_color(gStateLabel, lv_color_hex(0x7CFF8A), 0); - } - return; - } - - if (code != LV_EVENT_CLICKED) return; - - gButtonClickCount++; - - if (!gSensorMode) { - lv_label_set_text(gModeLabel, "USB MODE"); - lv_label_set_text(gActionButtonLabel, "TOUCH OK"); - lv_label_set_text(gStateLabel, "PRESS BOOT"); - lv_obj_set_style_text_color(gStateLabel, lv_color_hex(0xFFD166), 0); - String text = "TOUCH CLICK OK #" + String(gButtonClickCount) + " use BOOT button"; - lv_label_set_text(gEventLabel, text.c_str()); - lv_refr_now(nullptr); - return; - } - - lv_label_set_text(gModeLabel, "RESTARTING TO USB..."); - lv_label_set_text(gActionButtonLabel, "Restarting..."); - lv_label_set_text(gStateLabel, "USB NEXT BOOT"); - lv_refr_now(nullptr); - delay(180); - ESP.restart(); -} - -static void requestEnterSensorMode(const char *source) { - if (gSensorMode || gEnterPending) { - return; - } - - gEnterPending = true; - gEnterAtMs = millis() + kEnterDelayMs; - lv_label_set_text(gModeLabel, "START RECEIVED"); - lv_label_set_text(gActionButtonLabel, "Starting sensor..."); - String text = String(source) + " OK waiting 250 ms"; - lv_label_set_text(gEventLabel, text.c_str()); - lv_label_set_text(gStateLabel, "STARTING..."); - lv_obj_set_style_text_color(gStateLabel, lv_color_hex(0x7CFF8A), 0); - lv_refr_now(nullptr); -} - -static void pollUserButton() { - bool rawPressed = (digitalRead(kUserButtonPin) == LOW); - uint32_t now = millis(); - - if (rawPressed != gLastButtonRawPressed) { - gLastButtonRawPressed = rawPressed; - gLastButtonRawChangeMs = now; - } - - if ((now - gLastButtonRawChangeMs) < kButtonDebounceMs || rawPressed == gButtonStablePressed) { - return; - } - - gButtonStablePressed = rawPressed; - if (!gButtonStablePressed) { - return; - } - - gButtonClickCount++; - if (!gSensorMode) { - requestEnterSensorMode("BOOT BUTTON"); - return; - } - - lv_label_set_text(gModeLabel, "RESTARTING TO USB..."); - lv_label_set_text(gActionButtonLabel, "Restarting..."); - lv_label_set_text(gStateLabel, "USB NEXT BOOT"); - lv_refr_now(nullptr); - delay(180); - ESP.restart(); -} - -static void createUi() { - lv_obj_t *screen = lv_scr_act(); - lv_obj_set_style_bg_color(screen, lv_color_hex(0x000000), 0); - lv_obj_set_style_bg_opa(screen, LV_OPA_COVER, 0); - - lv_obj_t *title = lv_label_create(screen); - lv_label_set_text(title, "USB CONTACT DEBUG"); - lv_obj_set_style_text_font(title, &lv_font_montserrat_22, 0); - lv_obj_set_style_text_color(title, lv_color_hex(0xFFFFFF), 0); - lv_obj_align(title, LV_ALIGN_TOP_MID, 0, 10); - - gRawLabel = lv_label_create(screen); - lv_label_set_text(gRawLabel, "RAW: released\nx=-1 y=-1 n=0"); - lv_obj_set_style_text_font(gRawLabel, &lv_font_montserrat_16, 0); - lv_obj_set_style_text_color(gRawLabel, lv_color_hex(0x9EE493), 0); - lv_obj_align(gRawLabel, LV_ALIGN_TOP_LEFT, 14, 48); - - gModeLabel = lv_label_create(screen); - lv_label_set_text(gModeLabel, "USB MODE"); - lv_obj_set_style_text_font(gModeLabel, &lv_font_montserrat_18, 0); - lv_obj_set_style_text_color(gModeLabel, lv_color_hex(0x72D6FF), 0); - lv_obj_align(gModeLabel, LV_ALIGN_TOP_RIGHT, -14, 50); - - gEventLabel = lv_label_create(screen); - lv_label_set_text(gEventLabel, "Button events: waiting"); - lv_obj_set_width(gEventLabel, 440); - lv_label_set_long_mode(gEventLabel, LV_LABEL_LONG_WRAP); - lv_obj_set_style_text_align(gEventLabel, LV_TEXT_ALIGN_CENTER, 0); - lv_obj_set_style_text_font(gEventLabel, &lv_font_montserrat_16, 0); - lv_obj_set_style_text_color(gEventLabel, lv_color_hex(0xFFD166), 0); - lv_obj_align(gEventLabel, LV_ALIGN_TOP_MID, 0, 102); - - gStateLabel = lv_label_create(screen); - lv_label_set_text(gStateLabel, "READY"); - lv_obj_set_style_text_font(gStateLabel, &lv_font_montserrat_40, 0); - lv_obj_set_style_text_color(gStateLabel, lv_color_hex(0x72D6FF), 0); - lv_obj_align(gStateLabel, LV_ALIGN_CENTER, 0, -52); - - // Put the button in almost the same position/size as the known-working touch debug sketch. - gActionButton = lv_btn_create(screen); - lv_obj_set_size(gActionButton, 360, 110); - lv_obj_align(gActionButton, LV_ALIGN_CENTER, 0, 52); - lv_obj_set_style_radius(gActionButton, 18, 0); - lv_obj_set_style_bg_color(gActionButton, lv_color_hex(0x2A9D8F), LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_bg_color(gActionButton, lv_color_hex(0x47C7B6), LV_PART_MAIN | LV_STATE_PRESSED); - lv_obj_set_style_border_width(gActionButton, 3, 0); - lv_obj_set_style_border_color(gActionButton, lv_color_hex(0xBDE0FE), 0); - lv_obj_add_event_cb(gActionButton, actionButtonEventCb, LV_EVENT_ALL, nullptr); - - gActionButtonLabel = lv_label_create(gActionButton); - lv_label_set_text(gActionButtonLabel, "START"); - lv_obj_set_style_text_font(gActionButtonLabel, &lv_font_montserrat_28, 0); - lv_obj_set_style_text_color(gActionButtonLabel, lv_color_hex(0xFFFFFF), 0); - lv_obj_center(gActionButtonLabel); - - lv_obj_t *hint = lv_label_create(screen); - lv_label_set_text(hint, "Press BOOT button to START. Touch button only checks touch UI."); - lv_obj_set_width(hint, 440); - lv_label_set_long_mode(hint, LV_LABEL_LONG_WRAP); - lv_obj_set_style_text_align(hint, LV_TEXT_ALIGN_CENTER, 0); - lv_obj_set_style_text_font(hint, &lv_font_montserrat_14, 0); - lv_obj_set_style_text_color(hint, lv_color_hex(0xD9D9D9), 0); - lv_obj_align(hint, LV_ALIGN_BOTTOM_MID, 0, -18); - - gMarker = lv_obj_create(screen); - lv_obj_set_size(gMarker, 16, 16); - lv_obj_set_style_radius(gMarker, LV_RADIUS_CIRCLE, 0); - lv_obj_set_style_bg_color(gMarker, lv_color_hex(0xFF4D6D), 0); - lv_obj_set_style_border_width(gMarker, 2, 0); - lv_obj_set_style_border_color(gMarker, lv_color_hex(0xFFFFFF), 0); - lv_obj_add_flag(gMarker, LV_OBJ_FLAG_HIDDEN); -} - -static void pollContact() { - if (!gSensorMode) return; - - bool rawClosed = (digitalRead(kUsbDpPin) == LOW); - uint32_t now = millis(); - - if (rawClosed != gLastRawClosed) { - gLastRawClosed = rawClosed; - gLastRawChangeMs = now; - } - - if ((now - gLastRawChangeMs) >= kDebounceMs && gStableClosed != gLastRawClosed) { - gStableClosed = gLastRawClosed; - setStateUi(gStableClosed); - } -} - -void setup() { - Serial.begin(115200); - - pinMode(kUserButtonPin, INPUT_PULLUP); - - Wire.begin(IIC_SDA, IIC_SCL); - - pinMode(TP_RST, OUTPUT); - pinMode(TP_INT, INPUT); - digitalWrite(TP_RST, LOW); - delay(30); - digitalWrite(TP_RST, HIGH); - delay(50); - delay(1000); - - gTouch.setPins(TP_RST, TP_INT); - bool touchOk = gTouch.begin(Wire, 0x5A, IIC_SDA, IIC_SCL); - if (!touchOk) { - Serial.println("Touch init failed"); - } else { - Serial.print("Touch model: "); - Serial.println(gTouch.getModelName()); - gTouch.sleep(); - gTouch.reset(); - gTouch.setMaxCoordinates(480, 480); - gTouch.setSwapXY(true); - gTouch.setMirrorXY(true, false); - } - - gfx->begin(); - gBus->writeC8D8(0x36, 0xA0); - gfx->setBrightness(220); - gfx->fillScreen(0x0000); - - lv_init(); - - uint32_t screenWidth = gfx->width(); - uint32_t screenHeight = gfx->height(); - gBuf1 = (lv_color_t *)heap_caps_malloc(screenWidth * screenHeight / 4 * sizeof(lv_color_t), MALLOC_CAP_DMA); - gBuf2 = (lv_color_t *)heap_caps_malloc(screenWidth * screenHeight / 4 * sizeof(lv_color_t), MALLOC_CAP_DMA); - lv_disp_draw_buf_init(&gDrawBuf, gBuf1, gBuf2, screenWidth * screenHeight / 4); - - static lv_disp_drv_t dispDrv; - lv_disp_drv_init(&dispDrv); - dispDrv.hor_res = screenWidth; - dispDrv.ver_res = screenHeight; - dispDrv.flush_cb = lvglFlushCb; - dispDrv.draw_buf = &gDrawBuf; - lv_disp_drv_register(&dispDrv); - - static lv_indev_drv_t indevDrv; - lv_indev_drv_init(&indevDrv); - indevDrv.type = LV_INDEV_TYPE_POINTER; - indevDrv.read_cb = lvglTouchRead; - lv_indev_drv_register(&indevDrv); - - const esp_timer_create_args_t lvglTickTimerArgs = { - .callback = &lvglTick, - .name = "lvgl_tick"}; - esp_timer_handle_t lvglTickTimer = nullptr; - esp_timer_create(&lvglTickTimerArgs, &lvglTickTimer); - esp_timer_start_periodic(lvglTickTimer, EXAMPLE_LVGL_TICK_PERIOD_MS * 1000); - - createUi(); - Serial.println("USB contact sensor DEBUG ready. USB pins remain untouched until START click."); -} - -void loop() { - updateTouchDiagnostics(); - pollUserButton(); - pollContact(); - - if (gEnterPending && (int32_t)(millis() - gEnterAtMs) >= 0) { - actuallyEnterSensorMode(); - } - - lv_timer_handler(); - delay(5); -} diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/usb_contact_sensor_test/usb_contact_sensor_test.ino b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/usb_contact_sensor_test/usb_contact_sensor_test.ino deleted file mode 100644 index de55d2f8..00000000 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/test_sketches/usb_contact_sensor_test/usb_contact_sensor_test.ino +++ /dev/null @@ -1,250 +0,0 @@ -#include -#include -#include -#include -#include "pin_config.h" -#include "TouchDrvCSTXXX.hpp" - -#define EXAMPLE_LVGL_TICK_PERIOD_MS 2 - -// ESP32-S3 native USB pins. -static constexpr int kUsbDmPin = 19; // USB D- -static constexpr int kUsbDpPin = 20; // USB D+ -static constexpr uint32_t kDebounceMs = 20; - -static lv_disp_draw_buf_t gDrawBuf; -static lv_color_t *gBuf1 = nullptr; -static lv_color_t *gBuf2 = nullptr; -static lv_obj_t *gModeLabel = nullptr; -static lv_obj_t *gStateLabel = nullptr; -static lv_obj_t *gHintLabel = nullptr; -static lv_obj_t *gActionButton = nullptr; -static lv_obj_t *gActionButtonLabel = nullptr; - -static TouchDrvCST92xx gTouch; -static int16_t gTouchX[5]; -static int16_t gTouchY[5]; - -static bool gSensorMode = false; -static bool gStableClosed = false; -static bool gLastRawClosed = false; -static uint32_t gLastRawChangeMs = 0; - -Arduino_DataBus *gBus = new Arduino_ESP32QSPI( - LCD_CS, LCD_SCLK, LCD_SDIO0, LCD_SDIO1, LCD_SDIO2, LCD_SDIO3); -Arduino_CO5300 *gfx = new Arduino_CO5300( - gBus, LCD_RESET, 0, LCD_WIDTH, LCD_HEIGHT, 0, 0, 0, 0); - -static void lvglFlushCb(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *colorP) { - uint32_t w = area->x2 - area->x1 + 1; - uint32_t h = area->y2 - area->y1 + 1; -#if (LV_COLOR_16_SWAP != 0) - gfx->draw16bitBeRGBBitmap(area->x1, area->y1, (uint16_t *)&colorP->full, w, h); -#else - gfx->draw16bitRGBBitmap(area->x1, area->y1, (uint16_t *)&colorP->full, w, h); -#endif - lv_disp_flush_ready(disp); -} - -static void lvglTick(void *arg) { - LV_UNUSED(arg); - lv_tick_inc(EXAMPLE_LVGL_TICK_PERIOD_MS); -} - -static void lvglTouchRead(lv_indev_drv_t *indevDrv, lv_indev_data_t *data) { - LV_UNUSED(indevDrv); - uint8_t touched = gTouch.getPoint(gTouchX, gTouchY, gTouch.getSupportTouchPoint()); - if (touched > 0) { - data->state = LV_INDEV_STATE_PR; - data->point.x = gTouchX[0]; - data->point.y = gTouchY[0]; - return; - } - data->state = LV_INDEV_STATE_REL; -} - -static void setStateUi(bool closed) { - if (closed) { - lv_label_set_text(gStateLabel, "CLOSED"); - lv_obj_set_style_text_color(gStateLabel, lv_color_hex(0x7CFF8A), 0); - } else { - lv_label_set_text(gStateLabel, "OPEN"); - lv_obj_set_style_text_color(gStateLabel, lv_color_hex(0xFFCC66), 0); - } -} - -static void enterSensorMode() { - // From this moment the native USB data pair is no longer USB. - // D- is held LOW, D+ is read with the ESP32-S3 internal pull-up. - // A passive switch between D- and D+ therefore reads LOW when closed. - Serial.flush(); - delay(30); - - pinMode(kUsbDmPin, OUTPUT); - digitalWrite(kUsbDmPin, LOW); - pinMode(kUsbDpPin, INPUT_PULLUP); - - gSensorMode = true; - gLastRawClosed = (digitalRead(kUsbDpPin) == LOW); - gStableClosed = gLastRawClosed; - gLastRawChangeMs = millis(); - - lv_label_set_text(gModeLabel, "Sensor mode"); - lv_label_set_text(gHintLabel, "USB D- / D+ are now the contact input.\nDo not connect this port to a computer."); - lv_label_set_text(gActionButtonLabel, "Restart to USB"); - setStateUi(gStableClosed); -} - -static void actionButtonEventCb(lv_event_t *event) { - if (lv_event_get_code(event) != LV_EVENT_CLICKED) { - return; - } - - if (!gSensorMode) { - enterSensorMode(); - return; - } - - lv_label_set_text(gModeLabel, "Restarting..."); - lv_label_set_text(gHintLabel, "USB mode will return after reboot."); - lv_timer_handler(); - delay(150); - ESP.restart(); -} - -static void createUi() { - lv_obj_t *screen = lv_scr_act(); - lv_obj_set_style_bg_color(screen, lv_color_hex(0x0B1320), 0); - lv_obj_set_style_bg_opa(screen, LV_OPA_COVER, 0); - - lv_obj_t *title = lv_label_create(screen); - lv_label_set_text(title, "USB CONTACT TEST"); - lv_obj_set_style_text_color(title, lv_color_hex(0xFFFFFF), 0); - lv_obj_set_style_text_font(title, &lv_font_montserrat_22, 0); - lv_obj_align(title, LV_ALIGN_TOP_MID, 0, 26); - - gModeLabel = lv_label_create(screen); - lv_label_set_text(gModeLabel, "USB mode"); - lv_obj_set_style_text_color(gModeLabel, lv_color_hex(0xB8C8DC), 0); - lv_obj_set_style_text_font(gModeLabel, &lv_font_montserrat_18, 0); - lv_obj_align(gModeLabel, LV_ALIGN_TOP_MID, 0, 72); - - gStateLabel = lv_label_create(screen); - lv_label_set_text(gStateLabel, "READY"); - lv_obj_set_style_text_color(gStateLabel, lv_color_hex(0x72D6FF), 0); - lv_obj_set_style_text_font(gStateLabel, &lv_font_montserrat_40, 0); - lv_obj_align(gStateLabel, LV_ALIGN_CENTER, 0, -56); - - gHintLabel = lv_label_create(screen); - lv_label_set_text(gHintLabel, "USB is normal now.\nTap Start to use D- / D+ as a contact sensor."); - lv_obj_set_width(gHintLabel, 390); - lv_label_set_long_mode(gHintLabel, LV_LABEL_LONG_WRAP); - lv_obj_set_style_text_align(gHintLabel, LV_TEXT_ALIGN_CENTER, 0); - lv_obj_set_style_text_color(gHintLabel, lv_color_hex(0xD5DCE5), 0); - lv_obj_set_style_text_font(gHintLabel, &lv_font_montserrat_16, 0); - lv_obj_align(gHintLabel, LV_ALIGN_CENTER, 0, 18); - - gActionButton = lv_btn_create(screen); - lv_obj_set_size(gActionButton, 260, 72); - lv_obj_align(gActionButton, LV_ALIGN_BOTTOM_MID, 0, -48); - lv_obj_set_style_radius(gActionButton, 18, 0); - lv_obj_set_style_bg_color(gActionButton, lv_color_hex(0x2A9D8F), 0); - lv_obj_set_style_border_width(gActionButton, 0, 0); - lv_obj_add_event_cb(gActionButton, actionButtonEventCb, LV_EVENT_CLICKED, nullptr); - - gActionButtonLabel = lv_label_create(gActionButton); - lv_label_set_text(gActionButtonLabel, "Start"); - lv_obj_set_style_text_color(gActionButtonLabel, lv_color_hex(0xFFFFFF), 0); - lv_obj_set_style_text_font(gActionButtonLabel, &lv_font_montserrat_22, 0); - lv_obj_center(gActionButtonLabel); -} - -static void pollContact() { - if (!gSensorMode) { - return; - } - - bool rawClosed = (digitalRead(kUsbDpPin) == LOW); - uint32_t now = millis(); - - if (rawClosed != gLastRawClosed) { - gLastRawClosed = rawClosed; - gLastRawChangeMs = now; - } - - if ((now - gLastRawChangeMs) >= kDebounceMs && gStableClosed != gLastRawClosed) { - gStableClosed = gLastRawClosed; - setStateUi(gStableClosed); - } -} - -void setup() { - // With the project's FQBN this is the normal ESP32-S3 native USB serial mode. - // No sensor mode is persisted: every reset starts here with normal USB again. - Serial.begin(115200); - - Wire.begin(IIC_SDA, IIC_SCL); - - pinMode(TP_RST, OUTPUT); - pinMode(TP_INT, INPUT); - digitalWrite(TP_RST, LOW); - delay(30); - digitalWrite(TP_RST, HIGH); - delay(50); - delay(1000); - - gTouch.setPins(TP_RST, TP_INT); - bool touchOk = gTouch.begin(Wire, 0x5A, IIC_SDA, IIC_SCL); - if (!touchOk) { - Serial.println("Touch init failed"); - } else { - gTouch.sleep(); - gTouch.reset(); - gTouch.setMaxCoordinates(480, 480); - gTouch.setSwapXY(true); - gTouch.setMirrorXY(true, false); - } - - gfx->begin(); - gBus->writeC8D8(0x36, 0xA0); - gfx->setBrightness(220); - gfx->fillScreen(0x0000); - - lv_init(); - - uint32_t screenWidth = gfx->width(); - uint32_t screenHeight = gfx->height(); - gBuf1 = (lv_color_t *)heap_caps_malloc(screenWidth * screenHeight / 4 * sizeof(lv_color_t), MALLOC_CAP_DMA); - gBuf2 = (lv_color_t *)heap_caps_malloc(screenWidth * screenHeight / 4 * sizeof(lv_color_t), MALLOC_CAP_DMA); - lv_disp_draw_buf_init(&gDrawBuf, gBuf1, gBuf2, screenWidth * screenHeight / 4); - - static lv_disp_drv_t dispDrv; - lv_disp_drv_init(&dispDrv); - dispDrv.hor_res = screenWidth; - dispDrv.ver_res = screenHeight; - dispDrv.flush_cb = lvglFlushCb; - dispDrv.draw_buf = &gDrawBuf; - lv_disp_drv_register(&dispDrv); - - static lv_indev_drv_t indevDrv; - lv_indev_drv_init(&indevDrv); - indevDrv.type = LV_INDEV_TYPE_POINTER; - indevDrv.read_cb = lvglTouchRead; - lv_indev_drv_register(&indevDrv); - - const esp_timer_create_args_t lvglTickTimerArgs = { - .callback = &lvglTick, - .name = "lvgl_tick"}; - esp_timer_handle_t lvglTickTimer = nullptr; - esp_timer_create(&lvglTickTimerArgs, &lvglTickTimer); - esp_timer_start_periodic(lvglTickTimer, EXAMPLE_LVGL_TICK_PERIOD_MS * 1000); - - createUi(); - Serial.println("USB contact sensor test ready; native USB remains active until Start is tapped."); -} - -void loop() { - pollContact(); - lv_timer_handler(); - delay(5); -} diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/text_render_test/text_render_test.ino b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/text_render_test/text_render_test.ino deleted file mode 100644 index 57891cac..00000000 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/text_render_test/text_render_test.ino +++ /dev/null @@ -1,115 +0,0 @@ -#include -#include -#include -#include - -#define PIN_LCD_CS 12 -#define PIN_LCD_SCLK 38 -#define PIN_LCD_D0 4 -#define PIN_LCD_D1 5 -#define PIN_LCD_D2 6 -#define PIN_LCD_D3 7 -#define PIN_LCD_RST 2 -#define PIN_I2C_SDA 15 -#define PIN_I2C_SCL 14 - -#define DISP_W 480 -#define DISP_H 480 - -#define C_BG 0x0841u -#define C_PANEL 0x1082u -#define C_CARD 0x18C3u -#define C_BORDER 0x39C7u -#define C_TEXT 0xFFFFu -#define C_MUTE 0xBDF7u -#define C_OK 0x3666u -#define C_WARN 0xECA0u -#define C_BAD 0xD145u -#define C_BUTTON 0x2145u -#define C_BUTTON2 0x3186u - -#define FONT_HEAD u8g2_font_10x20_t_cyrillic -#define FONT_BODY u8g2_font_9x15_t_cyrillic -#define FONT_SMALL u8g2_font_6x13_t_cyrillic - -Arduino_DataBus *gBus = new Arduino_ESP32QSPI( - PIN_LCD_CS, PIN_LCD_SCLK, PIN_LCD_D0, PIN_LCD_D1, PIN_LCD_D2, PIN_LCD_D3); -Arduino_CO5300 *gfx = new Arduino_CO5300( - gBus, PIN_LCD_RST, 0, DISP_W, DISP_H, 0, 0, 0, 0); - -static void drawPanel(int x, int y, int w, int h, uint16_t fill, uint16_t border, int radius = 10) { - gfx->fillRoundRect(x, y, w, h, radius, fill); - gfx->drawRoundRect(x, y, w, h, radius, border); -} - -static void drawDefaultText(int x, int y, const char *text, uint16_t color, uint8_t size = 1) { - gfx->setFont(); - gfx->setTextSize(size); - gfx->setTextColor(color); - gfx->setCursor(x, y); - gfx->print(text); -} - -static void drawU8Text(int x, int y, const String &text, uint16_t color, const uint8_t *font) { - gfx->setTextSize(1); - gfx->setFont(font); - gfx->setTextColor(color); - gfx->setCursor(x, y); - gfx->print(text); -} - -static void drawButton(int x, int y, int w, int h, uint16_t fill, const String &label, const uint8_t *font, bool useDefaultFont = false) { - drawPanel(x, y, w, h, fill, C_BORDER, 12); - if (useDefaultFont) { - drawDefaultText(x + 14, y + 30, label.c_str(), C_TEXT, 2); - return; - } - drawU8Text(x + 14, y + 32, label, C_TEXT, font); -} - -static void drawScreen() { - gfx->fillScreen(C_BG); - - drawPanel(12, 12, 456, 456, C_PANEL, C_BORDER, 16); - drawDefaultText(28, 42, "TEXT TEST 123", C_TEXT, 2); - drawU8Text(28, 72, "Default ASCII above", C_MUTE, (const uint8_t *)FONT_SMALL); - - drawPanel(24, 90, 432, 72, C_CARD, C_BORDER, 12); - drawDefaultText(38, 118, "A: Default font ABC123", C_TEXT, 2); - drawDefaultText(38, 146, "Visible? then base path OK", C_WARN, 1); - - drawPanel(24, 174, 432, 84, C_CARD, C_BORDER, 12); - drawU8Text(38, 204, "B: U8g2 ASCII abc123", C_TEXT, (const uint8_t *)FONT_BODY); - drawU8Text(38, 230, "C: Русский текст 123", C_OK, (const uint8_t *)FONT_BODY); - - drawPanel(24, 270, 432, 84, C_CARD, C_BORDER, 12); - drawU8Text(38, 298, "D: Мелкий шрифт кнопок", C_TEXT, (const uint8_t *)FONT_SMALL); - drawU8Text(38, 320, "Если это видно, FONT_SMALL жив", C_MUTE, (const uint8_t *)FONT_SMALL); - - drawButton(24, 368, 128, 72, C_BUTTON, "BTN 1", nullptr, true); - drawButton(176, 368, 128, 72, C_OK, "abc123", (const uint8_t *)FONT_BODY); - drawButton(328, 368, 128, 72, C_BUTTON2, "Русский", (const uint8_t *)FONT_BODY); -} - -void setup() { - Serial.begin(115200); - Wire.begin(PIN_I2C_SDA, PIN_I2C_SCL); - - gfx->begin(); - gBus->writeC8D8(0x36, 0xA0); - gfx->setBrightness(220); - gfx->setUTF8Print(true); - - drawScreen(); - - Serial.println(); - Serial.println("=== text_render_test ==="); - Serial.println("A: default Arduino_GFX font"); - Serial.println("B: U8g2 ASCII"); - Serial.println("C: U8g2 Cyrillic"); - Serial.println("Buttons: default / ASCII / Cyrillic"); -} - -void loop() { - delay(1000); -} diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/official-demo/examples/Arduino-v3.3.5/libraries/lv_conf.h b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/official-demo/examples/Arduino-v3.3.5/libraries/lv_conf.h deleted file mode 100644 index 956381cb..00000000 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/official-demo/examples/Arduino-v3.3.5/libraries/lv_conf.h +++ /dev/null @@ -1,784 +0,0 @@ -/** - * @file lv_conf.h - * Configuration file for v8.4.0 - */ - -/* - * Copy this file as `lv_conf.h` - * 1. simply next to the `lvgl` folder - * 2. or any other places and - * - define `LV_CONF_INCLUDE_SIMPLE` - * - add the path as include path - */ - -/* clang-format off */ -#if 1 /*Set it to "1" to enable content*/ - -#ifndef LV_CONF_H -#define LV_CONF_H - -#include - -/*==================== - COLOR SETTINGS - *====================*/ - -/*Color depth: 1 (1 byte per pixel), 8 (RGB332), 16 (RGB565), 32 (ARGB8888)*/ -#define LV_COLOR_DEPTH 16 - -/*Swap the 2 bytes of RGB565 color. Useful if the display has an 8-bit interface (e.g. SPI)*/ -#define LV_COLOR_16_SWAP 0 - -/*Enable features to draw on transparent background. - *It's required if opa, and transform_* style properties are used. - *Can be also used if the UI is above another layer, e.g. an OSD menu or video player.*/ -#define LV_COLOR_SCREEN_TRANSP 0 - -/* Adjust color mix functions rounding. GPUs might calculate color mix (blending) differently. - * 0: round down, 64: round up from x.75, 128: round up from half, 192: round up from x.25, 254: round up */ -#define LV_COLOR_MIX_ROUND_OFS 0 - -/*Images pixels with this color will not be drawn if they are chroma keyed)*/ -#define LV_COLOR_CHROMA_KEY lv_color_hex(0x00ff00) /*pure green*/ - -/*========================= - MEMORY SETTINGS - *=========================*/ - -/*1: use custom malloc/free, 0: use the built-in `lv_mem_alloc()` and `lv_mem_free()`*/ -#define LV_MEM_CUSTOM 0 -#if LV_MEM_CUSTOM == 0 - /*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/ - #define LV_MEM_SIZE (48U * 1024U) /*[bytes]*/ - - /*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/ - #define LV_MEM_ADR 0 /*0: unused*/ - /*Instead of an address give a memory allocator that will be called to get a memory pool for LVGL. E.g. my_malloc*/ - #if LV_MEM_ADR == 0 - #undef LV_MEM_POOL_INCLUDE - #undef LV_MEM_POOL_ALLOC - #endif - -#else /*LV_MEM_CUSTOM*/ - #define LV_MEM_CUSTOM_INCLUDE /*Header for the dynamic memory function*/ - #define LV_MEM_CUSTOM_ALLOC malloc - #define LV_MEM_CUSTOM_FREE free - #define LV_MEM_CUSTOM_REALLOC realloc -#endif /*LV_MEM_CUSTOM*/ - -/*Number of the intermediate memory buffer used during rendering and other internal processing mechanisms. - *You will see an error log message if there wasn't enough buffers. */ -#define LV_MEM_BUF_MAX_NUM 16 - -/*Use the standard `memcpy` and `memset` instead of LVGL's own functions. (Might or might not be faster).*/ -#define LV_MEMCPY_MEMSET_STD 0 - -/*==================== - HAL SETTINGS - *====================*/ - -/*Default display refresh period. LVG will redraw changed areas with this period time*/ -#define LV_DISP_DEF_REFR_PERIOD 10 /*[ms]*/ - -/*Input device read period in milliseconds*/ -#define LV_INDEV_DEF_READ_PERIOD 10 /*[ms]*/ - -/*Use a custom tick source that tells the elapsed time in milliseconds. - *It removes the need to manually update the tick with `lv_tick_inc()`)*/ -#define LV_TICK_CUSTOM 0 -#if LV_TICK_CUSTOM - #define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/ - #define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/ - /*If using lvgl as ESP32 component*/ - // #define LV_TICK_CUSTOM_INCLUDE "esp_timer.h" - // #define LV_TICK_CUSTOM_SYS_TIME_EXPR ((esp_timer_get_time() / 1000LL)) -#endif /*LV_TICK_CUSTOM*/ - -/*Default Dot Per Inch. Used to initialize default sizes such as widgets sized, style paddings. - *(Not so important, you can adjust it to modify default sizes and spaces)*/ -#define LV_DPI_DEF 130 /*[px/inch]*/ - -/*======================= - * FEATURE CONFIGURATION - *=======================*/ - -/*------------- - * Drawing - *-----------*/ - -/*Enable complex draw engine. - *Required to draw shadow, gradient, rounded corners, circles, arc, skew lines, image transformations or any masks*/ -#define LV_DRAW_COMPLEX 1 -#if LV_DRAW_COMPLEX != 0 - - /*Allow buffering some shadow calculation. - *LV_SHADOW_CACHE_SIZE is the max. shadow size to buffer, where shadow size is `shadow_width + radius` - *Caching has LV_SHADOW_CACHE_SIZE^2 RAM cost*/ - #define LV_SHADOW_CACHE_SIZE 0 - - /* Set number of maximally cached circle data. - * The circumference of 1/4 circle are saved for anti-aliasing - * radius * 4 bytes are used per circle (the most often used radiuses are saved) - * 0: to disable caching */ - #define LV_CIRCLE_CACHE_SIZE 4 -#endif /*LV_DRAW_COMPLEX*/ - -/** - * "Simple layers" are used when a widget has `style_opa < 255` to buffer the widget into a layer - * and blend it as an image with the given opacity. - * Note that `bg_opa`, `text_opa` etc don't require buffering into layer) - * The widget can be buffered in smaller chunks to avoid using large buffers. - * - * - LV_LAYER_SIMPLE_BUF_SIZE: [bytes] the optimal target buffer size. LVGL will try to allocate it - * - LV_LAYER_SIMPLE_FALLBACK_BUF_SIZE: [bytes] used if `LV_LAYER_SIMPLE_BUF_SIZE` couldn't be allocated. - * - * Both buffer sizes are in bytes. - * "Transformed layers" (where transform_angle/zoom properties are used) use larger buffers - * and can't be drawn in chunks. So these settings affects only widgets with opacity. - */ -#define LV_LAYER_SIMPLE_BUF_SIZE (24 * 1024) -#define LV_LAYER_SIMPLE_FALLBACK_BUF_SIZE (3 * 1024) - -/*Default image cache size. Image caching keeps the images opened. - *If only the built-in image formats are used there is no real advantage of caching. (I.e. if no new image decoder is added) - *With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images. - *However the opened images might consume additional RAM. - *0: to disable caching*/ -#define LV_IMG_CACHE_DEF_SIZE 0 - -/*Number of stops allowed per gradient. Increase this to allow more stops. - *This adds (sizeof(lv_color_t) + 1) bytes per additional stop*/ -#define LV_GRADIENT_MAX_STOPS 2 - -/*Default gradient buffer size. - *When LVGL calculates the gradient "maps" it can save them into a cache to avoid calculating them again. - *LV_GRAD_CACHE_DEF_SIZE sets the size of this cache in bytes. - *If the cache is too small the map will be allocated only while it's required for the drawing. - *0 mean no caching.*/ -#define LV_GRAD_CACHE_DEF_SIZE 0 - -/*Allow dithering the gradients (to achieve visual smooth color gradients on limited color depth display) - *LV_DITHER_GRADIENT implies allocating one or two more lines of the object's rendering surface - *The increase in memory consumption is (32 bits * object width) plus 24 bits * object width if using error diffusion */ -#define LV_DITHER_GRADIENT 0 -#if LV_DITHER_GRADIENT - /*Add support for error diffusion dithering. - *Error diffusion dithering gets a much better visual result, but implies more CPU consumption and memory when drawing. - *The increase in memory consumption is (24 bits * object's width)*/ - #define LV_DITHER_ERROR_DIFFUSION 0 -#endif - -/*Maximum buffer size to allocate for rotation. - *Only used if software rotation is enabled in the display driver.*/ -#define LV_DISP_ROT_MAX_BUF (10*1024) - -/*------------- - * GPU - *-----------*/ - -/*Use Arm's 2D acceleration library Arm-2D */ -#define LV_USE_GPU_ARM2D 0 - -/*Use STM32's DMA2D (aka Chrom Art) GPU*/ -#define LV_USE_GPU_STM32_DMA2D 0 -#if LV_USE_GPU_STM32_DMA2D - /*Must be defined to include path of CMSIS header of target processor - e.g. "stm32f7xx.h" or "stm32f4xx.h"*/ - #define LV_GPU_DMA2D_CMSIS_INCLUDE -#endif - -/*Enable RA6M3 G2D GPU*/ -#define LV_USE_GPU_RA6M3_G2D 0 -#if LV_USE_GPU_RA6M3_G2D - /*include path of target processor - e.g. "hal_data.h"*/ - #define LV_GPU_RA6M3_G2D_INCLUDE "hal_data.h" -#endif - -/*Use SWM341's DMA2D GPU*/ -#define LV_USE_GPU_SWM341_DMA2D 0 -#if LV_USE_GPU_SWM341_DMA2D - #define LV_GPU_SWM341_DMA2D_INCLUDE "SWM341.h" -#endif - -/*Use NXP's PXP GPU iMX RTxxx platforms*/ -#define LV_USE_GPU_NXP_PXP 0 -#if LV_USE_GPU_NXP_PXP - /*1: Add default bare metal and FreeRTOS interrupt handling routines for PXP (lv_gpu_nxp_pxp_osa.c) - * and call lv_gpu_nxp_pxp_init() automatically during lv_init(). Note that symbol SDK_OS_FREE_RTOS - * has to be defined in order to use FreeRTOS OSA, otherwise bare-metal implementation is selected. - *0: lv_gpu_nxp_pxp_init() has to be called manually before lv_init() - */ - #define LV_USE_GPU_NXP_PXP_AUTO_INIT 0 -#endif - -/*Use NXP's VG-Lite GPU iMX RTxxx platforms*/ -#define LV_USE_GPU_NXP_VG_LITE 0 - -/*Use SDL renderer API*/ -#define LV_USE_GPU_SDL 0 -#if LV_USE_GPU_SDL - #define LV_GPU_SDL_INCLUDE_PATH - /*Texture cache size, 8MB by default*/ - #define LV_GPU_SDL_LRU_SIZE (1024 * 1024 * 8) - /*Custom blend mode for mask drawing, disable if you need to link with older SDL2 lib*/ - #define LV_GPU_SDL_CUSTOM_BLEND_MODE (SDL_VERSION_ATLEAST(2, 0, 6)) -#endif - -/*------------- - * Logging - *-----------*/ - -/*Enable the log module*/ -#define LV_USE_LOG 0 -#if LV_USE_LOG - - /*How important log should be added: - *LV_LOG_LEVEL_TRACE A lot of logs to give detailed information - *LV_LOG_LEVEL_INFO Log important events - *LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem - *LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail - *LV_LOG_LEVEL_USER Only logs added by the user - *LV_LOG_LEVEL_NONE Do not log anything*/ - #define LV_LOG_LEVEL LV_LOG_LEVEL_WARN - - /*1: Print the log with 'printf'; - *0: User need to register a callback with `lv_log_register_print_cb()`*/ - #define LV_LOG_PRINTF 0 - - /*Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs*/ - #define LV_LOG_TRACE_MEM 1 - #define LV_LOG_TRACE_TIMER 1 - #define LV_LOG_TRACE_INDEV 1 - #define LV_LOG_TRACE_DISP_REFR 1 - #define LV_LOG_TRACE_EVENT 1 - #define LV_LOG_TRACE_OBJ_CREATE 1 - #define LV_LOG_TRACE_LAYOUT 1 - #define LV_LOG_TRACE_ANIM 1 - -#endif /*LV_USE_LOG*/ - -/*------------- - * Asserts - *-----------*/ - -/*Enable asserts if an operation is failed or an invalid data is found. - *If LV_USE_LOG is enabled an error message will be printed on failure*/ -#define LV_USE_ASSERT_NULL 1 /*Check if the parameter is NULL. (Very fast, recommended)*/ -#define LV_USE_ASSERT_MALLOC 1 /*Checks is the memory is successfully allocated or no. (Very fast, recommended)*/ -#define LV_USE_ASSERT_STYLE 0 /*Check if the styles are properly initialized. (Very fast, recommended)*/ -#define LV_USE_ASSERT_MEM_INTEGRITY 0 /*Check the integrity of `lv_mem` after critical operations. (Slow)*/ -#define LV_USE_ASSERT_OBJ 0 /*Check the object's type and existence (e.g. not deleted). (Slow)*/ - -/*Add a custom handler when assert happens e.g. to restart the MCU*/ -#define LV_ASSERT_HANDLER_INCLUDE -#define LV_ASSERT_HANDLER while(1); /*Halt by default*/ - -/*------------- - * Others - *-----------*/ - -/*1: Show CPU usage and FPS count*/ -#define LV_USE_PERF_MONITOR 0 -#if LV_USE_PERF_MONITOR - #define LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT -#endif - -/*1: Show the used memory and the memory fragmentation - * Requires LV_MEM_CUSTOM = 0*/ -#define LV_USE_MEM_MONITOR 0 -#if LV_USE_MEM_MONITOR - #define LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_LEFT -#endif - -/*1: Draw random colored rectangles over the redrawn areas*/ -#define LV_USE_REFR_DEBUG 0 - -/*Change the built in (v)snprintf functions*/ -#define LV_SPRINTF_CUSTOM 0 -#if LV_SPRINTF_CUSTOM - #define LV_SPRINTF_INCLUDE - #define lv_snprintf snprintf - #define lv_vsnprintf vsnprintf -#else /*LV_SPRINTF_CUSTOM*/ - #define LV_SPRINTF_USE_FLOAT 0 -#endif /*LV_SPRINTF_CUSTOM*/ - -#define LV_USE_USER_DATA 1 - -/*Garbage Collector settings - *Used if lvgl is bound to higher level language and the memory is managed by that language*/ -#define LV_ENABLE_GC 0 -#if LV_ENABLE_GC != 0 - #define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/ -#endif /*LV_ENABLE_GC*/ - -/*===================== - * COMPILER SETTINGS - *====================*/ - -/*For big endian systems set to 1*/ -#define LV_BIG_ENDIAN_SYSTEM 0 - -/*Define a custom attribute to `lv_tick_inc` function*/ -#define LV_ATTRIBUTE_TICK_INC - -/*Define a custom attribute to `lv_timer_handler` function*/ -#define LV_ATTRIBUTE_TIMER_HANDLER - -/*Define a custom attribute to `lv_disp_flush_ready` function*/ -#define LV_ATTRIBUTE_FLUSH_READY - -/*Required alignment size for buffers*/ -#define LV_ATTRIBUTE_MEM_ALIGN_SIZE 1 - -/*Will be added where memories needs to be aligned (with -Os data might not be aligned to boundary by default). - * E.g. __attribute__((aligned(4)))*/ -#define LV_ATTRIBUTE_MEM_ALIGN - -/*Attribute to mark large constant arrays for example font's bitmaps*/ -#define LV_ATTRIBUTE_LARGE_CONST - -/*Compiler prefix for a big array declaration in RAM*/ -#define LV_ATTRIBUTE_LARGE_RAM_ARRAY - -/*Place performance critical functions into a faster memory (e.g RAM)*/ -#define LV_ATTRIBUTE_FAST_MEM - -/*Prefix variables that are used in GPU accelerated operations, often these need to be placed in RAM sections that are DMA accessible*/ -#define LV_ATTRIBUTE_DMA - -/*Export integer constant to binding. This macro is used with constants in the form of LV_ that - *should also appear on LVGL binding API such as Micropython.*/ -#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning /*The default value just prevents GCC warning*/ - -/*Extend the default -32k..32k coordinate range to -4M..4M by using int32_t for coordinates instead of int16_t*/ -#define LV_USE_LARGE_COORD 0 - -/*================== - * FONT USAGE - *===================*/ - -/*Montserrat fonts with ASCII range and some symbols using bpp = 4 - *https://fonts.google.com/specimen/Montserrat*/ -#define LV_FONT_MONTSERRAT_8 1 -#define LV_FONT_MONTSERRAT_10 1 -#define LV_FONT_MONTSERRAT_12 1 -#define LV_FONT_MONTSERRAT_14 1 -#define LV_FONT_MONTSERRAT_16 1 -#define LV_FONT_MONTSERRAT_18 1 -#define LV_FONT_MONTSERRAT_20 1 -#define LV_FONT_MONTSERRAT_22 1 -#define LV_FONT_MONTSERRAT_24 1 -#define LV_FONT_MONTSERRAT_26 1 -#define LV_FONT_MONTSERRAT_28 1 -#define LV_FONT_MONTSERRAT_30 1 -#define LV_FONT_MONTSERRAT_32 1 -#define LV_FONT_MONTSERRAT_34 1 -#define LV_FONT_MONTSERRAT_36 1 -#define LV_FONT_MONTSERRAT_38 1 -#define LV_FONT_MONTSERRAT_40 1 -#define LV_FONT_MONTSERRAT_42 1 -#define LV_FONT_MONTSERRAT_44 1 -#define LV_FONT_MONTSERRAT_46 1 -#define LV_FONT_MONTSERRAT_48 1 - -/*Demonstrate special features*/ -#define LV_FONT_MONTSERRAT_12_SUBPX 0 -#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /*bpp = 3*/ -#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /*Hebrew, Arabic, Persian letters and all their forms*/ -#define LV_FONT_SIMSUN_16_CJK 0 /*1000 most common CJK radicals*/ - -/*Pixel perfect monospace fonts*/ -#define LV_FONT_UNSCII_8 0 -#define LV_FONT_UNSCII_16 0 - -/*Optionally declare custom fonts here. - *You can use these fonts as default font too and they will be available globally. - *E.g. #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) LV_FONT_DECLARE(my_font_2)*/ -#define LV_FONT_CUSTOM_DECLARE - -/*Always set a default font*/ -#define LV_FONT_DEFAULT &lv_font_montserrat_14 - -/*Enable handling large font and/or fonts with a lot of characters. - *The limit depends on the font size, font face and bpp. - *Compiler error will be triggered if a font needs it.*/ -#define LV_FONT_FMT_TXT_LARGE 0 - -/*Enables/disables support for compressed fonts.*/ -#define LV_USE_FONT_COMPRESSED 0 - -/*Enable subpixel rendering*/ -#define LV_USE_FONT_SUBPX 0 -#if LV_USE_FONT_SUBPX - /*Set the pixel order of the display. Physical order of RGB channels. Doesn't matter with "normal" fonts.*/ - #define LV_FONT_SUBPX_BGR 0 /*0: RGB; 1:BGR order*/ -#endif - -/*Enable drawing placeholders when glyph dsc is not found*/ -#define LV_USE_FONT_PLACEHOLDER 1 - -/*================= - * TEXT SETTINGS - *=================*/ - -/** - * Select a character encoding for strings. - * Your IDE or editor should have the same character encoding - * - LV_TXT_ENC_UTF8 - * - LV_TXT_ENC_ASCII - */ -#define LV_TXT_ENC LV_TXT_ENC_UTF8 - -/*Can break (wrap) texts on these chars*/ -#define LV_TXT_BREAK_CHARS " ,.;:-_" - -/*If a word is at least this long, will break wherever "prettiest" - *To disable, set to a value <= 0*/ -#define LV_TXT_LINE_BREAK_LONG_LEN 0 - -/*Minimum number of characters in a long word to put on a line before a break. - *Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/ -#define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3 - -/*Minimum number of characters in a long word to put on a line after a break. - *Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/ -#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3 - -/*The control character to use for signalling text recoloring.*/ -#define LV_TXT_COLOR_CMD "#" - -/*Support bidirectional texts. Allows mixing Left-to-Right and Right-to-Left texts. - *The direction will be processed according to the Unicode Bidirectional Algorithm: - *https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/ -#define LV_USE_BIDI 0 -#if LV_USE_BIDI - /*Set the default direction. Supported values: - *`LV_BASE_DIR_LTR` Left-to-Right - *`LV_BASE_DIR_RTL` Right-to-Left - *`LV_BASE_DIR_AUTO` detect texts base direction*/ - #define LV_BIDI_BASE_DIR_DEF LV_BASE_DIR_AUTO -#endif - -/*Enable Arabic/Persian processing - *In these languages characters should be replaced with an other form based on their position in the text*/ -#define LV_USE_ARABIC_PERSIAN_CHARS 0 - -/*================== - * WIDGET USAGE - *================*/ - -/*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html*/ - -#define LV_USE_ARC 1 - -#define LV_USE_BAR 1 - -#define LV_USE_BTN 1 - -#define LV_USE_BTNMATRIX 1 - -#define LV_USE_CANVAS 1 - -#define LV_USE_CHECKBOX 1 - -#define LV_USE_DROPDOWN 1 /*Requires: lv_label*/ - -#define LV_USE_IMG 1 /*Requires: lv_label*/ - -#define LV_USE_LABEL 1 -#if LV_USE_LABEL - #define LV_LABEL_TEXT_SELECTION 1 /*Enable selecting text of the label*/ - #define LV_LABEL_LONG_TXT_HINT 1 /*Store some extra info in labels to speed up drawing of very long texts*/ -#endif - -#define LV_USE_LINE 1 - -#define LV_USE_ROLLER 1 /*Requires: lv_label*/ -#if LV_USE_ROLLER - #define LV_ROLLER_INF_PAGES 7 /*Number of extra "pages" when the roller is infinite*/ -#endif - -#define LV_USE_SLIDER 1 /*Requires: lv_bar*/ - -#define LV_USE_SWITCH 1 - -#define LV_USE_TEXTAREA 1 /*Requires: lv_label*/ -#if LV_USE_TEXTAREA != 0 - #define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/ -#endif - -#define LV_USE_TABLE 1 - -/*================== - * EXTRA COMPONENTS - *==================*/ - -/*----------- - * Widgets - *----------*/ -#define LV_USE_ANIMIMG 1 - -#define LV_USE_CALENDAR 1 -#if LV_USE_CALENDAR - #define LV_CALENDAR_WEEK_STARTS_MONDAY 0 - #if LV_CALENDAR_WEEK_STARTS_MONDAY - #define LV_CALENDAR_DEFAULT_DAY_NAMES {"Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"} - #else - #define LV_CALENDAR_DEFAULT_DAY_NAMES {"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"} - #endif - - #define LV_CALENDAR_DEFAULT_MONTH_NAMES {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"} - #define LV_USE_CALENDAR_HEADER_ARROW 1 - #define LV_USE_CALENDAR_HEADER_DROPDOWN 1 -#endif /*LV_USE_CALENDAR*/ - -#define LV_USE_CHART 1 - -#define LV_USE_COLORWHEEL 1 - -#define LV_USE_IMGBTN 1 - -#define LV_USE_KEYBOARD 1 - -#define LV_USE_LED 1 - -#define LV_USE_LIST 1 - -#define LV_USE_MENU 1 - -#define LV_USE_METER 1 - -#define LV_USE_MSGBOX 1 - -#define LV_USE_SPAN 1 -#if LV_USE_SPAN - /*A line text can contain maximum num of span descriptor */ - #define LV_SPAN_SNIPPET_STACK_SIZE 64 -#endif - -#define LV_USE_SPINBOX 1 - -#define LV_USE_SPINNER 1 - -#define LV_USE_TABVIEW 1 - -#define LV_USE_TILEVIEW 1 - -#define LV_USE_WIN 1 - -/*----------- - * Themes - *----------*/ - -/*A simple, impressive and very complete theme*/ -#define LV_USE_THEME_DEFAULT 1 -#if LV_USE_THEME_DEFAULT - - /*0: Light mode; 1: Dark mode*/ - #define LV_THEME_DEFAULT_DARK 0 - - /*1: Enable grow on press*/ - #define LV_THEME_DEFAULT_GROW 1 - - /*Default transition time in [ms]*/ - #define LV_THEME_DEFAULT_TRANSITION_TIME 80 -#endif /*LV_USE_THEME_DEFAULT*/ - -/*A very simple theme that is a good starting point for a custom theme*/ -#define LV_USE_THEME_BASIC 1 - -/*A theme designed for monochrome displays*/ -#define LV_USE_THEME_MONO 1 - -/*----------- - * Layouts - *----------*/ - -/*A layout similar to Flexbox in CSS.*/ -#define LV_USE_FLEX 1 - -/*A layout similar to Grid in CSS.*/ -#define LV_USE_GRID 1 - -/*--------------------- - * 3rd party libraries - *--------------------*/ - -/*File system interfaces for common APIs */ - -/*API for fopen, fread, etc*/ -#define LV_USE_FS_STDIO 0 -#if LV_USE_FS_STDIO - #define LV_FS_STDIO_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ - #define LV_FS_STDIO_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/ - #define LV_FS_STDIO_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ -#endif - -/*API for open, read, etc*/ -#define LV_USE_FS_POSIX 0 -#if LV_USE_FS_POSIX - #define LV_FS_POSIX_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ - #define LV_FS_POSIX_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/ - #define LV_FS_POSIX_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ -#endif - -/*API for CreateFile, ReadFile, etc*/ -#define LV_USE_FS_WIN32 0 -#if LV_USE_FS_WIN32 - #define LV_FS_WIN32_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ - #define LV_FS_WIN32_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/ - #define LV_FS_WIN32_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ -#endif - -/*API for FATFS (needs to be added separately). Uses f_open, f_read, etc*/ -#define LV_USE_FS_FATFS 0 -#if LV_USE_FS_FATFS - #define LV_FS_FATFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ - #define LV_FS_FATFS_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ -#endif - -/*API for LittleFS (library needs to be added separately). Uses lfs_file_open, lfs_file_read, etc*/ -#define LV_USE_FS_LITTLEFS 0 -#if LV_USE_FS_LITTLEFS - #define LV_FS_LITTLEFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ - #define LV_FS_LITTLEFS_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ -#endif - -/*PNG decoder library*/ -#define LV_USE_PNG 0 - -/*BMP decoder library*/ -#define LV_USE_BMP 0 - -/* JPG + split JPG decoder library. - * Split JPG is a custom format optimized for embedded systems. */ -#define LV_USE_SJPG 0 - -/*GIF decoder library*/ -#define LV_USE_GIF 0 - -/*QR code library*/ -#define LV_USE_QRCODE 1 - -/*FreeType library*/ -#define LV_USE_FREETYPE 0 -#if LV_USE_FREETYPE - /*Memory used by FreeType to cache characters [bytes] (-1: no caching)*/ - #define LV_FREETYPE_CACHE_SIZE (16 * 1024) - #if LV_FREETYPE_CACHE_SIZE >= 0 - /* 1: bitmap cache use the sbit cache, 0:bitmap cache use the image cache. */ - /* sbit cache:it is much more memory efficient for small bitmaps(font size < 256) */ - /* if font size >= 256, must be configured as image cache */ - #define LV_FREETYPE_SBIT_CACHE 0 - /* Maximum number of opened FT_Face/FT_Size objects managed by this cache instance. */ - /* (0:use system defaults) */ - #define LV_FREETYPE_CACHE_FT_FACES 0 - #define LV_FREETYPE_CACHE_FT_SIZES 0 - #endif -#endif - -/*Tiny TTF library*/ -#define LV_USE_TINY_TTF 0 -#if LV_USE_TINY_TTF - /*Load TTF data from files*/ - #define LV_TINY_TTF_FILE_SUPPORT 0 -#endif - -/*Rlottie library*/ -#define LV_USE_RLOTTIE 0 - -/*FFmpeg library for image decoding and playing videos - *Supports all major image formats so do not enable other image decoder with it*/ -#define LV_USE_FFMPEG 0 -#if LV_USE_FFMPEG - /*Dump input information to stderr*/ - #define LV_FFMPEG_DUMP_FORMAT 0 -#endif - -/*----------- - * Others - *----------*/ - -/*1: Enable API to take snapshot for object*/ -#define LV_USE_SNAPSHOT 0 - -/*1: Enable Monkey test*/ -#define LV_USE_MONKEY 0 - -/*1: Enable grid navigation*/ -#define LV_USE_GRIDNAV 0 - -/*1: Enable lv_obj fragment*/ -#define LV_USE_FRAGMENT 0 - -/*1: Support using images as font in label or span widgets */ -#define LV_USE_IMGFONT 0 - -/*1: Enable a published subscriber based messaging system */ -#define LV_USE_MSG 0 - -/*1: Enable Pinyin input method*/ -/*Requires: lv_keyboard*/ -#define LV_USE_IME_PINYIN 0 -#if LV_USE_IME_PINYIN - /*1: Use default thesaurus*/ - /*If you do not use the default thesaurus, be sure to use `lv_ime_pinyin` after setting the thesauruss*/ - #define LV_IME_PINYIN_USE_DEFAULT_DICT 1 - /*Set the maximum number of candidate panels that can be displayed*/ - /*This needs to be adjusted according to the size of the screen*/ - #define LV_IME_PINYIN_CAND_TEXT_NUM 6 - - /*Use 9 key input(k9)*/ - #define LV_IME_PINYIN_USE_K9_MODE 1 - #if LV_IME_PINYIN_USE_K9_MODE == 1 - #define LV_IME_PINYIN_K9_CAND_TEXT_NUM 3 - #endif // LV_IME_PINYIN_USE_K9_MODE -#endif - -/*================== -* EXAMPLES -*==================*/ - -/*Enable the examples to be built with the library*/ -#define LV_BUILD_EXAMPLES 1 - -/*=================== - * DEMO USAGE - ====================*/ - -/*Show some widget. It might be required to increase `LV_MEM_SIZE` */ -#define LV_USE_DEMO_WIDGETS 1 -#if LV_USE_DEMO_WIDGETS -#define LV_DEMO_WIDGETS_SLIDESHOW 1 -#endif - -/*Demonstrate the usage of encoder and keyboard*/ -#define LV_USE_DEMO_KEYPAD_AND_ENCODER 0 - -/*Benchmark your system*/ -#define LV_USE_DEMO_BENCHMARK 1 -#if LV_USE_DEMO_BENCHMARK -/*Use RGB565A8 images with 16 bit color depth instead of ARGB8565*/ -#define LV_DEMO_BENCHMARK_RGB565A8 0 -#endif - -/*Stress test for LVGL*/ -#define LV_USE_DEMO_STRESS 1 - -/*Music player demo*/ -#define LV_USE_DEMO_MUSIC 1 -#if LV_USE_DEMO_MUSIC - #define LV_DEMO_MUSIC_SQUARE 0 - #define LV_DEMO_MUSIC_LANDSCAPE 0 - #define LV_DEMO_MUSIC_ROUND 0 - #define LV_DEMO_MUSIC_LARGE 0 - #define LV_DEMO_MUSIC_AUTO_PLAY 0 -#endif - -/*--END OF LV_CONF_H--*/ - -#endif /*LV_CONF_H*/ - -#endif /*End of "Content enable"*/ diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_homeserver_main/README.md b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/old_version/shine_homeserver_main/README.md similarity index 100% rename from ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_homeserver_main/README.md rename to ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/old_version/shine_homeserver_main/README.md diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_homeserver_main/shine_core_content.h b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/old_version/shine_homeserver_main/shine_core_content.h similarity index 100% rename from ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_homeserver_main/shine_core_content.h rename to ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/old_version/shine_homeserver_main/shine_core_content.h diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_homeserver_main/shine_homeserver_main.ino b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/old_version/shine_homeserver_main/shine_homeserver_main.ino similarity index 99% rename from ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_homeserver_main/shine_homeserver_main.ino rename to ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/old_version/shine_homeserver_main/shine_homeserver_main.ino index 4d3a6f8a..e07b097b 100644 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_homeserver_main/shine_homeserver_main.ino +++ b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/old_version/shine_homeserver_main/shine_homeserver_main.ino @@ -4610,7 +4610,7 @@ static void processPendingRemoteAddBlockRequests() { if (resolvedBlockchainName != blockchainName || nextBlockNumber < 0 || !shine_core::buildPair(msgType, msgSubType, msgVersion, bodyBytes, (uint32_t)nextBlockNumber, shineNowMs()/1000ULL, prevHash32, blockchainPub, blockchainSec, - "test5595", hash256, hash384, sign, fullBlock)) { + "test5599", hash256, hash384, sign, fullBlock)) { responseData = String("{\"ok\":false,\"error\":\"sign_failed\",\"errorMessage\":\"Failed to sign CORE/CONTENT pair\",\"requestId\":\"") + jsonEscape(item.signalRequestId) + "\"}"; sendSignalResponse(item.fromLogin, item.fromSessionId, "remote_addblock_result", item.signalRequestId, responseData); diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_homeserver_main/shine_secret_generation.cpp b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/old_version/shine_homeserver_main/shine_secret_generation.cpp similarity index 100% rename from ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_homeserver_main/shine_secret_generation.cpp rename to ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/old_version/shine_homeserver_main/shine_secret_generation.cpp diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_homeserver_main/shine_secret_generation.h b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/old_version/shine_homeserver_main/shine_secret_generation.h similarity index 100% rename from ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_homeserver_main/shine_secret_generation.h rename to ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/old_version/shine_homeserver_main/shine_secret_generation.h diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_homeserver_ui/README.md b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/old_version/shine_homeserver_ui/README.md similarity index 100% rename from ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_homeserver_ui/README.md rename to ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/old_version/shine_homeserver_ui/README.md diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_homeserver_ui/qrcode_bridge.c b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/old_version/shine_homeserver_ui/qrcode_bridge.c similarity index 100% rename from ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_homeserver_ui/qrcode_bridge.c rename to ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/old_version/shine_homeserver_ui/qrcode_bridge.c diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_homeserver_ui/shine_homeserver_ui.ino b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/old_version/shine_homeserver_ui/shine_homeserver_ui.ino similarity index 100% rename from ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_homeserver_ui/shine_homeserver_ui.ino rename to ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/old_version/shine_homeserver_ui/shine_homeserver_ui.ino diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/original-firmware/README.md b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/original-firmware/README.md deleted file mode 100644 index 7b647878..00000000 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/original-firmware/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# Factory Firmware Backup - -Здесь хранится полный дамп флеша текущего состояния платы. - -Файлы: -- `factory-full-16mb.bin` — полный дамп флеша `0x000000..0xFFFFFF` -- `factory-full-16mb.bin.sha256` — контрольная сумма - -Скрипты: -- `backup_factory.sh` — снять резервную копию -- `restore_factory_backup.sh` — восстановить резервную копию на плату diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/original-firmware/backup_factory.sh b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/original-firmware/backup_factory.sh deleted file mode 100755 index 39bdede1..00000000 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/original-firmware/backup_factory.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -PORT="${PORT:-/dev/ttyACM0}" -ESPTOOL="${ESPTOOL:-$HOME/.arduino15/packages/esp32/tools/esptool_py/5.1.0/esptool}" -BAUD="${BAUD:-921600}" -OUT_BIN="${ROOT_DIR}/factory-full-16mb.bin" - -echo "== Port: ${PORT}" -echo "== Output: ${OUT_BIN}" -echo "== Esptool: ${ESPTOOL}" -echo "== Baud: ${BAUD}" - -"${ESPTOOL}" --port "${PORT}" --baud "${BAUD}" read-flash 0 0x1000000 "${OUT_BIN}" -sha256sum "${OUT_BIN}" | tee "${OUT_BIN}.sha256" - -echo -echo "== Backup done." diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/original-firmware/restore_factory_backup.sh b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/original-firmware/restore_factory_backup.sh deleted file mode 100755 index c6070784..00000000 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/original-firmware/restore_factory_backup.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -PORT="${PORT:-/dev/ttyACM0}" -ESPTOOL="${ESPTOOL:-$HOME/.arduino15/packages/esp32/tools/esptool_py/5.1.0/esptool}" -IN_BIN="${IN_BIN:-${ROOT_DIR}/factory-full-16mb.bin}" - -if [[ ! -f "${IN_BIN}" ]]; then - echo "Backup file not found: ${IN_BIN}" >&2 - exit 1 -fi - -echo "== Port: ${PORT}" -echo "== Input: ${IN_BIN}" -echo "== Esptool: ${ESPTOOL}" - -"${ESPTOOL}" --port "${PORT}" --baud 921600 write-flash 0 "${IN_BIN}" - -echo -echo "== Restore done." diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/reference/README.md b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/reference/README.md deleted file mode 100644 index 571f438f..00000000 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/reference/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# Reference Notes - -Модель: Waveshare `ESP32-S3-Touch-AMOLED-2.16` (SKU 33969/33970) - -Полезные страницы: -- Product: https://www.waveshare.com/product/arduino/boards-kits/esp32-s3/esp32-s3-touch-amoled-2.16.htm -- Docs home: https://docs.waveshare.com/ESP32-S3-Touch-AMOLED-2.16 -- Arduino setup: https://docs.waveshare.com/ESP32-S3-Touch-AMOLED-2.16/Development-Environment-Setup-Arduino -- Official examples: https://github.com/waveshareteam/ESP32-S3-Touch-AMOLED-2.16 - -Ключевое по железу (по документации): -- ESP32-S3R8, 16MB flash, 8MB PSRAM -- AMOLED 2.16" 480x480 -- Capacitive touch (CST9220) -- IMU QMI8658 -- Audio codec ES8311 (playback) и ES7210 (microphones) -- TF slot (SD), сейчас без карты diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/reference/shine_homeserver_ui_nav_minimal_spec.md b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/reference/shine_homeserver_ui_nav_minimal_spec.md deleted file mode 100644 index 8ee0811f..00000000 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/reference/shine_homeserver_ui_nav_minimal_spec.md +++ /dev/null @@ -1,353 +0,0 @@ -# SHiNE ESP32 Homeserver UI Nav Minimal Spec - -Легаси-спецификация старого навигационного теста для `Waveshare ESP32-S3-Touch-AMOLED-2.16`. -Актуальный основной скетч теперь находится в `../main-device/shine_homeserver_main/`; этот документ оставлен только как историческая справка по старому тестовому UI. - -## Цель - -Этот прототип проверяет базовую механику экранов, крупных кнопок, свайпов, первичную настройку Wi-Fi и настройку серверных адресов через общий экран редактирования текста. - -На этом этапе отсутствуют: -- логин/пароль учётной записи SHiNE; -- PIN; -- кошелёк; -- QR; -- регистрация; -- PDA update/create транзакции; -- входящие запросы. - -## Экраны - -Прототип содержит 10 экранов: -- `HOME` -- `SETTINGS_MENU` -- `WIFI_SCREEN` -- `SERVER_SCREEN` -- `ACCOUNT_SCREEN` -- `ACCOUNT_HOMESERVER_SCREEN` -- `ACCOUNT_SECRET_SCREEN` -- `SECRET_SHOW_SCREEN` -- `SECRET_GENERATE_*` -- `TEXT_EDIT_SCREEN` -- `REGISTER_ACCOUNT_PLACEHOLDER` - -## HOME - -Показывает: -- сверху слева значение homeserver или `homeserver not set`; -- ниже значение логина или `login not set`; -- справа от строки логина индикатор статуса Solana-аккаунта: - - зелёный — все ключи совпадают; - - красный — есть mismatch; - - белый контур — пользователь не найден в Solana PDA; -- рядом с индикатором краткий текст ошибки, если статус не зелёный; -- третьей строкой `secret not set`, если секрет ещё не помечен как установленный; -- сверху справа один ряд индикаторов: - - процент батареи; - - иконка батареи; - - индикатор Wi-Fi уровня сигнала; -- по центру крупный текст `STATUS`; -- одна строка Wi-Fi вида `Wi-Fi () connected/disconnected`; -- кнопка баланса вида `Balance: ` или `Balance: failed to load`, по нажатию выполняет повторный запрос; -- строка `SHiNE: connected/account not configured/unavailable`; -- при отсутствии пользователя в Solana PDA слева снизу появляется кнопка `REGISTER ACCOUNT`; -- снизу кнопку `SETTINGS`, уменьшенную примерно до половины ширины экрана и сдвинутую к правому краю. -- внизу на тёмной полосе подпись `SHiNE homeserver (v.0.18)`. - -Строка Wi-Fi на `HOME`: -- `Wi-Fi (not configured) not configured` -- `Wi-Fi () disconnected` -- `Wi-Fi () connected` - -Переходы: -- кнопка `REGISTER ACCOUNT` -> `REGISTER_ACCOUNT_PLACEHOLDER`, только если пользователь не найден; -- кнопка `SETTINGS` -> `SETTINGS_MENU`; -- свайп влево -> `SETTINGS_MENU`. - -Примечание: -- поведение `REGISTER ACCOUNT -> REGISTER_ACCOUNT_PLACEHOLDER` относится к старой тестовой версии и не является актуальным для основного скетча. - -Фоновая логика: -- пока открыт `HOME`, экран сам обновляется примерно раз в секунду; -- при наличии `login + secret + homeserver` и Wi-Fi устройство читает Solana `user_pda` напрямую через RPC; -- сравниваются `root key`, `blockchain key`, `client key` и `homeserver` session-запись типа `100`; -- для строки `SHiNE:` устройство держит отдельную WebSocket-сессию с сервером SHiNE: - - авторизация через `AuthChallenge/CreateAuthSession` или `SessionChallenge/SessionLogin`; - - session key = публичный `homeserver key`; - - подтверждение создания сессии подписывается `client key`; - - heartbeat выполняется `Ping` раз в минуту. - -## SETTINGS_MENU - -Показывает вертикальное меню из 3 пунктов: -- `Wi-Fi` -- `Server` -- `Account` - -Одновременно видны только 2 пункта. - -Начальное состояние: -- `Wi-Fi` -- `Server` - -После свайпа вверх: -- `Server` -- `Account` - -После свайпа вниз: -- `Wi-Fi` -- `Server` - -Обе видимые карточки меню имеют одинаковый цвет. - -Переходы: -- нажатие `Wi-Fi` -> `WIFI_SCREEN`; -- нажатие `Server` -> `SERVER_SCREEN`; -- нажатие `Account` -> `ACCOUNT_SCREEN`; -- свайп вправо -> `HOME`. - -## WIFI_SCREEN - -Экран содержит 2 внутренних режима. - -### 1. Overview - -Показывает: -- текущий Wi-Fi статус; -- сохранённый SSID и число известных сетей; -- статусное сообщение; -- кнопку `SELECT NETWORK`; -- кнопку `CLEAR SAVED WI-FI`; -- кнопку `BACK`. - -### 2. Scan Results - -После `SELECT NETWORK` выполняется скан доступных Wi-Fi сетей. - -Показывает: -- заголовок `SELECT NETWORK`; -- количество или результат сканирования; -- список найденных SSID как крупные кнопки; -- кнопку `SCAN AGAIN`; -- кнопку `BACK`. - -Нажатие на SSID открывает `TEXT_EDIT_SCREEN` для ввода пароля. - -Поведение: -- если для выбранного SSID пароль уже был сохранён раньше, он сразу подставляется в поле ввода; -- если пароль меняют для другого SSID, старые сохранённые пароли других сетей не теряются; -- после успешного подключения выбранная сеть становится текущей `wifi_ssid/wifi_pass`; -- одновременно хранится до `8` известных сетей `SSID -> password`; -- `CLEAR SAVED WI-FI` очищает все сохранённые сети и текущую сеть. - -Переходы: -- свайп вправо из любого режима `WIFI_SCREEN` -> `SETTINGS_MENU` -- кнопка `BACK` -> `SETTINGS_MENU` - -## SERVER_SCREEN - -Показывает: -- статусное сообщение; -- текущий `Solana RPC` адрес; -- кнопку `SOLANA RPC`; -- текущий `SHiNE server login` или уже резолвленный адрес; -- кнопку `SHiNE SERVER LOGIN`, если обычный `user PDA` ещё не зарегистрирован. - -Значения по умолчанию: -- Solana RPC: `https://api.mainnet-beta.solana.com` -- SHiNE server login: `shineupme` - -Нажатие на любую из двух кнопок открывает `TEXT_EDIT_SCREEN`. - -Переходы: -- свайп вправо -> `SETTINGS_MENU` - -## ACCOUNT_SCREEN - -Показывает: -- заголовок `ACCOUNT`; -- статусное сообщение; -- кнопку `Login ()`; -- кнопку `Homeserver ()`; -- кнопку `Secret (<*****|not set>)`. - -Переходы: -- свайп вправо -> `SETTINGS_MENU` -- `Login` -> `TEXT_EDIT_SCREEN` -- `Homeserver` -> `ACCOUNT_HOMESERVER_SCREEN` -- `Secret` -> `ACCOUNT_SECRET_SCREEN` - -## ACCOUNT_HOMESERVER_SCREEN - -Показывает: -- текущий `homeserver`; -- рекомендацию оставить `homeserver1`, если устройство одно; -- кнопку `USE HOMESERVER1`; -- кнопку `EDIT MANUALLY`; -- кнопку `BACK`. - -Переходы: -- `USE HOMESERVER1` -> сохраняет `homeserver1` и возвращает в `ACCOUNT_SCREEN` -- `EDIT MANUALLY` -> `TEXT_EDIT_SCREEN` -- свайп вправо -> `ACCOUNT_SCREEN` - -## ACCOUNT_SECRET_SCREEN - -Показывает: -- кнопку `SHOW SECRET` или серую `SECRET NOT SET`, если секрета ещё нет; -- кнопку `ENTER SECRET MANUALLY (NOT RECOMMENDED)`; -- кнопку `GENERATE SECRET`. - -Переходы: -- свайп вправо -> `ACCOUNT_SCREEN` -- `SHOW SECRET` -> экран просмотра секрета -- `ENTER SECRET MANUALLY (NOT RECOMMENDED)` -> `TEXT_EDIT_SCREEN` -- `GENERATE SECRET` -> экран подтверждения генерации - -## SECRET_SHOW_SCREEN - -Показывает: -- заголовок `SECRET`; -- вертикально прокручиваемый список ключей; -- `Secret (base58)`; -- `Root key (base58)`; -- `Root key priv (base58)`; -- `Blockchain key (base58)`; -- `Blockchain key priv (base58)`; -- `Client key (base58)`; -- `Client key priv (base58)`; -- `Homeserver key (base58)`; -- `Homeserver key priv (base58)`; -- для каждого поля показывается формула derivation; -- значения ключей показываются полными строками увеличенным шрифтом; -- кнопку `BACK`. - -## TEXT_EDIT_SCREEN - -Общий экран редактирования строковых значений. - -Используется для: -- пароля Wi-Fi; -- Solana RPC; -- SHiNE server login. - -Показывает: -- заголовок; -- поле ввода, уже заполненное старым значением; -- новые символы всегда добавляются только в конец текста; -- визуальный курсор не показывается; -- пароль Wi-Fi показывается открыто, без маскировки точками; -- кнопки `SAVE`, `CANCEL`, `DEL`, `CLR`; -- большую экранную клавиатуру. - -## REGISTER_ACCOUNT_PLACEHOLDER - -Временный экран-заглушка регистрации. - -Показывает: -- заголовок `REGISTER ACCOUNT`; -- сообщение, что регистрационный flow пока не реализован; -- кнопку `BACK`. - -## Клавиатура - -Клавиатура единая для всех текстовых вводов. - -Особенности: -- занимает нижнюю часть экрана; -- разбита на 2 страницы; -- переключение страниц выполняется свайпом влево/вправо внутри `TEXT_EDIT_SCREEN`; -- страница 1 содержит в основном буквы и базовые URL-символы; -- страница 2 содержит цифры и дополнительные URL/символьные кнопки; -- на символьных страницах должны быть доступны как минимум `!` и отдельная кнопка `SPACE`; -- переключение `ABC/123` и `SHIFT` не должно очищать уже введённый текст; -- переключение страниц клавиатуры свайпом тоже не должно очищать уже введённый текст, включая цифры, символы и уже набранные заглавные буквы; -- есть специальные действия `DEL` и `CLR`. - -## Хранение Wi-Fi - -Используется `Preferences` (NVS памяти ESP32): -- `wifi_ssid` -- `wifi_pass` -- `wifi_known_good` -- до `8` сохранённых пар `SSID -> password` - -При старте устройства, если сохранён SSID, выполняется попытка подключения к текущей сохранённой сети. - -Если пользователь уже вводил пароль для сети раньше: -- при повторном выборе этого SSID старый пароль сразу подставляется в editor screen; -- сохранение пароля для другой сети не удаляет уже сохранённые пароли остальных сетей. - -Если сеть раньше уже была успешно подключена и помечена как валидная: -- после потери связи устройство автоматически пытается переподключиться; -- первые повторные попытки идут раз в `10` секунд; -- если связи нет долго, интервал увеличивается до `30` секунд. -- пока открыт `HOME`, экран сам обновляется примерно раз в секунду и подтягивает актуальные: - - статус Wi-Fi; - - SSID; - - уровень сигнала; - - процент батареи. - -## Хранение серверов - -Используется `Preferences` (NVS памяти ESP32): -- `solana_rpc` -- `shine_server_login` - -## Хранение аккаунта - -Используется `Preferences` (NVS памяти ESP32): -- `login` -- `homeserver` -- `secret_set` - -## Детали клавиатуры - -- клавиатура занимает примерно `2/3`-`3/4` высоты экрана; -- сверху остаются только заголовок и поле ввода; -- буквы занимают 3 ряда; -- половина букв находится на левой странице, половина на правой; -- на правой странице кнопки тоже стоят в ровных колонках, без сдвига рядов вправо; -- отдельный режим `symbols` тоже разделён на 2 страницы; -- в режиме `symbols` на правой странице есть отдельная кнопка `SPACE` и отдельная кнопка `!`; -- 3 основных ряда клавиш и нижний служебный ряд увеличены по высоте; -- клавиши дополнительно увеличены по высоте по сравнению с предыдущим промежуточным вариантом; -- четвёртый ряд содержит: - - переключение `ABC/123` - - `SHIFT` - - `DEL` - - `SAVE` - - `CANCEL` -- ниже рамки клавиатурного блока остаётся отдельная тёмная полоса с версией `SHiNE homeserver (v.0.18)`. - -## Жесты - -Поддерживаются направления: -- `SWIPE_LEFT` -- `SWIPE_RIGHT` -- `SWIPE_UP` -- `SWIPE_DOWN` - -Маршруты: -- `HOME`: свайп влево -> `SETTINGS_MENU` -- `SETTINGS_MENU`: свайп вправо -> `HOME` -- `SETTINGS_MENU`: свайп вверх/вниз -> прокрутка списка -- `WIFI_SCREEN`: свайп вправо -> `SETTINGS_MENU` -- `SERVER_SCREEN`: свайп вправо -> `SETTINGS_MENU` -- `ACCOUNT_SCREEN`: свайп вправо -> `SETTINGS_MENU` -- `ACCOUNT_HOMESERVER_SCREEN`: свайп вправо -> `ACCOUNT_SCREEN` -- `ACCOUNT_SECRET_SCREEN`: свайп вправо -> `ACCOUNT_SCREEN` -- `TEXT_EDIT_SCREEN`: свайп влево/вправо -> переключение страниц клавиатуры -- переключение страниц клавиатуры срабатывает только если свайп начался в зоне самой клавиатуры, а не по всему экрану редактора - -## Особенность обработки жестов - -- если палец ушёл из зоны обычного тапа и жест определяется как свайп, случайное попадание на кнопку по пути не должно превращать свайп в нажатие; -- приоритет у свайпа, а не у `click`. -- одно непрерывное касание может вызвать не более одного действия кнопки; -- скольжение пальцем по экранной клавиатуре не должно вызывать цепочку из нескольких нажатий; -- периодический refresh на `HOME` не должен срабатывать во время активного касания. - -## Язык - -Пока интерфейс отображается в ASCII/English, чтобы использовать подтверждённый рабочий шрифтовой путь на устройстве. diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/reference/shine_homeserver_ui_spec.md b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/reference/shine_homeserver_ui_spec.md deleted file mode 100644 index 5a310d9f..00000000 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/reference/shine_homeserver_ui_spec.md +++ /dev/null @@ -1,681 +0,0 @@ -# SHiNE ESP32 Homeserver UI Spec - -## Назначение - -Этот документ описывает актуальный UI-прототип homeserver `SHiNE` для платы `Waveshare ESP32-S3-Touch-AMOLED-2.16`. -Актуальный основной Arduino-скетч лежит в `../main-device/shine_homeserver_main/`. - -Документ является источником истины для Arduino-скетча: - -- если меняется этот документ, должен меняться и скетч; -- если меняется скетч, должен обновляться и этот документ; -- экраны, кнопки, поля, статусы, переходы и тексты не должны расходиться. - -## Текущий объём реализации - -Текущая реализация является интерактивным прототипом экрана устройства, пригодным для ручной проверки на железе. - -Что уже входит в прототип: - -- локальный UI на тач-экране; -- хранение настроек и секретов во внутренней памяти `ESP32` через `NVS`; -- экранный UI устройства работает на английском языке, потому что кириллица на этом шрифтовом пути пока не поддерживается стабильно; -- экран пополнения с реальным `solana:` URI и рисованием QR-кода через `LVGL`; -- реальное подключение к `Wi-Fi` по сохранённым `SSID/паролю`; -- реальная проверка доступности `API`, `RPC` и `WS`-адресов; -- реальное чтение баланса кошелька из `Solana RPC`; -- проверка обязательных условий перед регистрацией; -- живая on-chain регистрация серверного `user_pda` в `shine_users` по нажатию кнопки на главном экране; -- живой экран заявок на подключение новых устройств через доверенную homeserver-сессию; -- PIN-блокировка (в текущей временной сборке вход по PIN отключён, устройство открывает `HOME` сразу после старта); -- базовые настройки, статус и главный экран; -- сохранение `PDA` и `tx signature` после успешной регистрации. -- создание и возобновление серверной сессии `SHiNE` через WebSocket с `sessionType = 100` и `clientPlatform = "ESP32"`. - -Что пока считается именно прототипом, а не финальной интеграцией: - -- пока реализован только сценарий заявок на подключение устройств через доверенную сессию; -- другие типы входящих запросов на подпись и произвольные approval-flow на этом устройстве ещё не подключены. - -## Основная идея устройства - -Устройство работает как отдельный homeserver: - -- хранит секрет на самом устройстве; -- позволяет ввести логин, секрет и имя homeserver; -- показывает адрес кошелька устройства; -- позволяет пополнить баланс перед регистрацией; -- после выполнения условий даёт зарегистрировать устройство как homeserver; -- после авторизации в SHiNE может подтверждать заявки на подключение новых устройств пользователя. - -`SD`-карта не нужна для постоянного хранения секрета в этом прототипе. -Основное сохранение идёт во внутреннюю flash-память через `NVS`. - -## Данные, которые хранятся на устройстве - -Прототип хранит: - -- `PIN`; -- `Wi-Fi SSID`; -- `Wi-Fi password`; -- `login`; -- `session/homeserver name`; -- `master secret`; -- `wallet address`; -- `user pda address`; -- `registration signature`; -- `balance`; -- `server login` для первичной привязки; -- `resolved server api url` / `rpc url` / `ws url` после чтения PDA сервера; -- флаги: - `wifiReady`, `serversReady`, `secretReady`, `registered`, `online`. - -Для первой регистрации обычного `user PDA` устройство берёт `createdAtMs` из NTP прямо перед отправкой транзакции в Solana. При последующих обновлениях `user PDA` устройство так же берёт актуальный `updatedAtMs` из NTP перед отправкой update-транзакции. Дальше в `user PDA` сохраняется `accessServers`, где по умолчанию лежит `shineupme`. - -## Правило серверной сессии SHiNE - -При подключении к серверу `SHiNE` устройство должно авторизовываться как homeserver-сеанс: - -- `sessionType = 100` -- `clientPlatform = "ESP32"` -- `clientInfo = "ESP32 homeserver:"` - -Это относится и к `CreateAuthSession`, и к `SessionLogin`. - -## Правила готовности к регистрации - -Кнопка регистрации доступна только если одновременно выполнены условия: - -1. настроен и подтверждён `Wi-Fi`; -2. задан и подтверждён `SHiNE server login`; -3. задан логин; -4. сгенерирован или введён секрет; -5. баланс кошелька не меньше `0.20 SOL`; -6. устройство ещё не зарегистрировано. - -Если хотя бы одно условие не выполнено, главный экран показывает, чего именно не хватает. - -## Экранная модель - -В прототипе используются следующие экраны: - -1. `LOCK` -2. `HOME` -3. `STATUS` -4. `CONNECTION` -5. `WIFI_EDIT` -6. `SERVERS` -7. `ACCOUNT` -8. `WALLET` -9. `WALLET_QR` -10. `WALLET_SIGN_REQUEST` -11. `REQUESTS` -12. `REQUEST_DETAIL` -13. `SETTINGS` -14. `PIN_EDIT` -15. `TEXT_INPUT` -16. `CONFIRM` -17. `REGISTER_ACCOUNT_CONFIRM` -18. `REGISTER_ACCOUNT_RESULT` - -## Общие правила интерфейса - -- Верхняя строка всегда показывает краткий статус устройства: - `PIN`, `Wi-Fi`, `сервер`, `регистрация`. -- В правом верхнем углу рядом с батареей: - - сначала процент заряда; - - затем, если устройство реально заряжается, маленькая иконка молнии; - - затем контур батареи; - - затем индикатор `Wi-Fi`. -- Основной язык прототипа: английский. -- Для вывода текста в текущей временной сборке используется стандартный шрифт `Arduino_GFX`. -- Русские строки в UI устройства пока не использовать. -- Кнопки крупные, с тач-ориентированным размером. -- Опасные действия подтверждаются отдельным диалогом. -- После изменения данных конфигурация сразу сохраняется в `NVS`. - -## Экран LOCK - -Назначение: - -- экран блокировки предусмотрен в UI, но в текущей временной сборке после запуска пропускается; -- вход по PIN временно отключён для отладки остальных экранов. - -Отображается: - -- заголовок `SHiNE Device`; -- статус `Устройство заблокировано`; -- поле ввода PIN в виде маски; -- кнопки цифровой клавиатуры; -- кнопки `Стереть` и `Открыть`. - -Поведение: - -- если PIN введён верно, открывается `HOME`; -- если PIN неверный, показывается ошибка `Неверный PIN`; -- в текущей временной сборке этот экран не показывается автоматически при старте. - -## Экран HOME - -Это основной экран устройства. - -Показывает: - -- крупный статус регистрации; -- имя логина; -- имя homeserver; -- строку `Wi-Fi: connected|disconnected`; -- строку `SHiNE: connected|unavailable`; -- короткий статус баланса. - -Особенности верхнего блока: - -- зелёный/контурный статусный кружок аккаунта расположен слева от строки логина; -- блок `STATUS` поднят выше относительно предыдущей версии; -- если состояние хорошее, слово `connected` в строках `Wi-Fi` и `SHiNE` показывается зелёным. - -В зоне кошелька: - -- вместо старых двух кнопок `баланс` и `QR` показывается одна широкая кнопка; -- текст кнопки: `Wallet: `; -- доступные имена: - - `ClientKey` - - `RootKey` - - либо сохранённое имя `custom`-кошелька; -- после старта устройства баланс активного выбранного кошелька пытается загрузиться автоматически, если уже есть секрет и `Wi-Fi`; -- нажатие на эту кнопку открывает экран `WALLET`. - -Нижние кнопки: - -- `Статус` -- `Подключение` -- `Аккаунт` -- `Wallet` -- `Запросы` -- `Настройки` - -Дополнительная большая кнопка: - -- `REGISTER ACCOUNT` -- либо жёлтая `ADD HOMESERVER` -- либо жёлтая `FIX HOMESERVER PASSWORD` - -Если регистрация уже сделана: - -- если пользователь создан, но в `PDA` ещё нет сессии текущего homeserver, показывается жёлтая кнопка `ADD HOMESERVER`; -- если в `PDA` есть homeserver с тем же именем, но с другим ключом, показывается жёлтая кнопка `FIX HOMESERVER PASSWORD`; -- если и пользователь, и homeserver-сессия уже корректны, вместо призыва к регистрации показывается статус `Homeserver активен`. -- две нижние кнопки внизу экрана не прилегают вплотную друг к другу, между ними есть небольшой зазор. - -## Экран REGISTER_ACCOUNT_CONFIRM - -Показывает предварительную проверку перед отправкой транзакции регистрации. - -Отображается: - -- повторный `login`; -- сообщение о том, что логин свободен или уже занят; -- баланс кошелька с проверкой порога `0.020 SOL`; -- имя homeserver; -- пометка, если используется стандартное значение `homeserver1`; -- отдельное предупреждение, если `Wi-Fi` не подключён. - -Кнопки: - -- `ЗАРЕГИСТРИРОВАТЬ В СИЯНИИ` -- `BACK` - -Поведение: - -- если `Wi-Fi` не подключён, на экране прямо показывается уведомление об этом и кнопка регистрации недоступна; -- если `login` уже занят в `shine_users`, регистрация недоступна; -- если баланс меньше `0.020 SOL`, на экране показывается соответствующая ошибка; -- если все проверки пройдены, кнопка регистрации активна и запускает on-chain регистрацию. - -## Экран REGISTER_ACCOUNT_RESULT - -Показывает результат отправки регистрации. - -Отображается: - -- текст успеха или ошибки; -- подробное сообщение; -- при успехе краткий `user_pda`; -- при успехе краткий `tx signature`. - -Кнопки: - -- `BACK HOME` -- `ACCOUNT` - -Поведение: - -- после успешной регистрации данные `user_pda` и `tx signature` сохраняются в `NVS`; -- при ошибке на экране показывается причина отказа; -- если ошибку вернул `sendTransaction`, экран старается показать не только общий текст, но и детали `RPC`/preflight/simulate-логов. - -## Экран HOMESERVER_PDA_CONFIRM - -Показывает, что именно не так с homeserver-секцией уже существующей пользовательской `PDA`. - -Отображается: - -- причина (`homeserver` отсутствует в `PDA` или ключ не совпадает с локальным секретом); -- `login`; -- имя `homeserver`; -- короткое пояснение, что именно будет сделано. - -Кнопки: - -- `ADD HOMESERVER` или `FIX HOMESERVER PASSWORD` -- `BACK` - -Поведение: - -- если `Wi-Fi` не подключён, действие недоступно; -- экран не создаёт нового пользователя, а запускает `update_user_pda`; -- при `ADD HOMESERVER` в блок `sessions` добавляется запись `session_type=100`; -- при `FIX HOMESERVER PASSWORD` обновляется публичный ключ уже существующей записи `homeserver`. - -## Экран HOMESERVER_PDA_RESULT - -Показывает результат обновления `sessions` в пользовательской `PDA`. - -Отображается: - -- успех или ошибка; -- короткое сообщение; -- при успехе краткий `tx signature`. - -Кнопки: - -- `BACK HOME` -- `ACCOUNT` - -Поведение: - -- при ошибке текст ошибки сохраняется в ту же USB/NVS-диагностику, что и регистрация; -- после успешного обновления выполняется повторная проверка `PDA`, и основной экран должен перейти в состояние `ok`. - -## Экран STATUS - -Показывает сводку: - -- логин; -- homeserver; -- есть ли секрет; -- зарегистрировано ли устройство; -- подключён ли Wi-Fi; -- доступны ли серверы; -- хватает ли баланса; -- находится ли устройство онлайн; -- краткий отпечаток `PDA` или `tx`. - -Кнопки: - -- `Назад` -- `Обновить статус` - -`Обновить статус` в прототипе не делает сеть, а просто перерисовывает текущие вычисленные состояния. - -## Экран CONNECTION - -Показывает: - -- `Wi-Fi`: готов / не готов; -- `Серверы`: готовы / не готовы; -- `Онлайн`: да / нет. - -Кнопки: - -- `Wi-Fi` -- `Серверы` -- `Подключить` -- `Отключить` -- `Назад` - -Поведение: - -- `Подключить` переводит устройство в `online=true`, если `Wi-Fi` реально подключён и серверы реально проверены; -- `Отключить` переводит устройство в `online=false`. - -## Экран WIFI_EDIT - -Поля: - -- `SSID` -- `Пароль` - -Кнопки: - -- `Изменить SSID` -- `Изменить пароль` -- `Проверить` -- `Сбросить` -- `Назад` - -Поведение: - -- `Проверить` делает реальную попытку подключения к `Wi-Fi`; -- `Сбросить` очищает обе строки и ставит `wifiReady=false`. - -## Экран SERVERS - -Поля: - -- `API URL` -- `RPC URL` -- `WS URL` - -Кнопки: - -- `Изменить API` -- `Изменить RPC` -- `Изменить WS` -- `Проверить` -- `Тестовые` -- `Назад` - -Поведение: - -- `Тестовые` подставляет дефолтные тестовые значения; -- `Проверить` делает реальные сетевые проверки: - - `API URL` должен отвечать по `HTTP/HTTPS`; - - `RPC URL` должен отвечать на `Solana JSON-RPC`; - - `WS URL` должен принимать `TCP/TLS`-соединение. - -## Экран ACCOUNT - -Показывает: - -- логин; -- имя homeserver; -- статус секрета; -- короткий отпечаток секрета; -- статус регистрации; -- короткий отпечаток `PDA` или `tx`. - -Кнопки: - -- `Изменить логин` -- `Секрет` -- `Имя homeserver` -- `Сгенерировать` -- `Очистить` -- `Назад` - -Поведение: - -- `Сгенерировать` создаёт новый `master secret` и пересчитывает из него `device`-кошелёк; -- `Очистить` удаляет секрет, адрес кошелька, `PDA`, `tx`, регистрацию и онлайн-статус; -- логин приводится к нижнему регистру и trim. -- после успешной регистрации на экране сохраняются и отображаются краткие отпечатки `PDA` и `TX`. - -## Экран WALLET - -Показывает: - -- кнопку `Wallet: `; -- строку текущего статуса/баланса активного кошелька; -- сокращённый публичный ключ активного кошелька. - -Кнопки: - -- `Wallet: ` -- `SHOW BALANCE` -- `SHOW WALLET QR` - -Поведение: - -- верхняя кнопка открывает экран выбора кошелька `WALLET_SELECT`; -- `Показать баланс кошелька` читает реальный баланс именно активного выбранного кошелька из `Solana RPC`; -- `Показать QR-код кошелька` открывает экран `WALLET_QR`; -- этот экран не меняет логику Solana-регистрации пользователя: on-chain регистрация и проверки `PDA` по-прежнему завязаны на `client key`. - -## Экран WALLET_SELECT - -Показывает: - -- строку `Current: `; -- три кнопки выбора: - - `ClientKey` - - `RootKey` - - `Custom` или `Custom: <имя>`; -- у текущего выбора видна галочка. - -Поведение: - -- `ClientKey` активирует кошелёк, выведенный из suffix `client.key`; -- `RootKey` активирует кошелёк, выведенный из suffix `root.key`; -- `Custom` использует derivation: - `sha256(base64(secret32) + "|wallet." + customName)`; -- если имя `custom`-кошелька ещё не задано, нажатие `Custom` открывает экран текстового ввода; -- если `custom` уже выбран, повторное нажатие на него открывает экран редактирования имени; -- после выбора кошелька устройство возвращается на экран `WALLET`. - -## Экран WALLET_QR - -Экран показывает: - -- крупный реальный `QR` для строки `solana:`; -- снизу крупный текст самого адреса кошелька. - -Поведение: - -- отдельная текстовая подсказка возврата не показывается; -- возврат на главный экран выполняется обычным тапом по экрану. - -Показывает: - -- QR-код для строки вида: - `solana:`; -- мелкую подпись с полным адресом кошелька под QR. - -Поведение: - -- QR должен быть сканируемым, а не декоративным; -- адрес кошелька берётся из текущего активного выбранного кошелька; -- нажатие в любую точку экрана возвращает пользователя на `WALLET`. - -## Экран WALLET_SIGN_REQUEST - -Экран показывается, когда браузерное wallet-расширение присылает на ESP32 запрос `sign_transaction`. - -Показывает: - -- заголовок `SIGN REQUEST`; -- вопрос о подписи транзакции текущим активным кошельком; -- сокращённый публичный ключ кошелька; -- комментарий, присланный полем `comment`; -- две кнопки: - - `REJECT` - - `APPROVE` - -Поведение: - -- если пользователь нажимает `APPROVE`, ESP32 подписывает транзакцию текущим активным кошельком и отправляет ответ в расширение; -- если пользователь нажимает `REJECT`, ESP32 отправляет отказ `rejected_by_user`; -- пока запрос активен, свайпом этот экран не закрывается; -- после ответа расширению устройство возвращается на предыдущий экран. - -## Экран REQUESTS - -Экран доступен только если homeserver уже авторизован в SHiNE. - -Показывает: - -- слева сверху кнопку `REFRESH`; -- заголовок `REQUESTS:` немного правее стандартного левого положения; -- справа сверху только большую цифру числа активных заявок; -- ниже прокручиваемый список активных pairing-заявок; -- на экране одновременно видны примерно две плитки. - -Каждая плитка показывает: - -- код подключения из `10` цифр в виде `5` пар: `XX XX XX XX XX`; -- строку `Session: `; -- строку `Kind: Client session` или `Kind: Wallet session`. - -Поведение: - -- список берётся из живой операции `ListTrustedDeviceLoginRequests`; -- если заявок нет, экран показывает `No active requests`; -- отдельная строка вида `Active requests: N` на этом экране не показывается; -- вертикальный скролл позволяет просматривать все активные заявки; -- нажатие по плитке открывает `REQUEST_DETAIL`; -- свайп вправо возвращает в `SETTINGS`. - -## Экран REQUEST_DETAIL - -Показывает детали выбранной pairing-заявки: - -- вопрос `Connect session ...?`; -- код подключения `XX XX XX XX XX`; -- строку `Session: `; -- строку `Kind: Client session` или `Kind: Wallet session`; -- пояснение: - - для client session: `Only client key will be transferred. No additional keys will be sent.` - - для wallet session: `No keys will be transferred.` - -Кнопки: - -- `YES` -- `NO` - -Поведение: - -- `YES` подтверждает заявку: - - для client session устройство передаёт только `client key`; - - для wallet session устройство выпускает отдельную `wallet-session` без передачи ключей; -- `NO` отклоняет заявку; -- после любого решения устройство возвращается в список `REQUESTS` и обновляет его; -- свайп вправо возвращает в `REQUESTS`. - -## Экран SETTINGS - -Показывает вертикальное меню крупных пунктов. - -Если homeserver ещё не авторизован в SHiNE: - -- `1. Wi-Fi` -- `2. Server` -- `3. Account` - -Если homeserver уже авторизован: - -- `1. Device requests` -- `2. Wi-Fi` -- `3. Server` -- `4. Account` - -Поведение: - -- одновременно видны только две карточки; -- список листается свайпом вверх/вниз; -- свайп вправо возвращает на `HOME`; -- пункт `Device requests` должен быть первым и появляется только для авторизованного homeserver. - -## Экран PIN_EDIT - -Используется для ввода нового PIN. - -Правила: - -- допустимы только цифры; -- длина PIN: 4..8 символов; -- после сохранения новый PIN немедленно пишется в `NVS`. - -## Экран TEXT_INPUT - -Это общий экран редактирования текстовых полей. - -Используется для: - -- `SSID` -- `Пароль Wi-Fi` -- `Логин` -- `Имя homeserver` -- `API URL` -- `RPC URL` -- `WS URL` - -Состав экрана: - -- заголовок поля; -- текущее значение; -- программная клавиатура; -- кнопки `Стереть`, `OK`, `Отмена`. - -## Экран CONFIRM - -Это модальный экран подтверждения. - -Используется для: - -- регистрации; -- очистки секрета; -- полного сброса. - -Кнопки: - -- `Подтвердить` -- `Отмена` - -## Сценарий первой настройки - -Ожидаемый путь пользователя: - -1. открыть устройство сразу после старта; экран PIN временно не требуется; -2. открыть `Подключение -> Wi-Fi`; -3. ввести `SSID` и пароль, нажать `Проверить`; -4. открыть `Подключение -> Серверы`; -5. проверить или задать `SHiNE server login` (по умолчанию `shineupme`); -6. открыть `Аккаунт`; -7. ввести логин; -8. задать имя homeserver; -9. сгенерировать секрет; -10. открыть `Кошелёк`; -11. при необходимости пополнить баланс; -12. вернуться на `HOME`; -13. нажать `REGISTER ACCOUNT`; -14. на экране проверки ещё раз увидеть `login`, статус свободного `PDA`, баланс, `homeserver1`, серверный login и при необходимости сообщение о неподключённом `Wi-Fi`; -15. нажать `ЗАРЕГИСТРИРОВАТЬ В СИЯНИИ`; -16. после завершения увидеть либо экран успеха с `user_pda` и `tx signature`, либо подробную ошибку; -17. после успешной регистрации увидеть статус `Homeserver активен`. - -Примечание: - -- устройство реально отправляет `create_user_pda` в `shine_users`, а после подтверждения сохраняет `PDA` и `tx signature`; -- при первой регистрации для обычного `user PDA` не заполняется `serverAddress`, а `accessServers` получает `shineupme` или другой выбранный `SHiNE server login`. - -## Сценарий входящего запроса - -1. открыть `Запросы`; -2. выбрать один из запросов; -3. прочитать детали; -4. нажать `Разрешить` или `Отклонить`; -5. убедиться, что статус запроса изменился. - -## Временный режим текста - -В текущей диагностической версии: - -- строковые литералы экранного UI должны оставаться английскими ASCII-совместимыми; -- возвращение кириллицы допустимо только после отдельной доработки шрифтов и реальной проверки на устройстве; -- рендер выполняется стандартным шрифтом `Arduino_GFX`; -- это обходной режим, пока `U8g2`-шрифты на устройстве не начнут рисоваться стабильно. - -## Критерии ручной проверки - -Минимально нужно проверить: - -1. устройство загружается и сразу открывает `HOME`; экран блокировки временно отключён; -2. весь экранный текст отображается читаемо на английском без замены символов; -3. ввод по экранной клавиатуре работает; -4. после перезагрузки сохранённые поля остаются в памяти; -5. секрет и адрес кошелька сохраняются на устройстве; -6. экран `QR и URI` рисует читаемый QR-код; -7. регистрация блокируется, пока условия не выполнены; -8. после выполнения условий регистрация становится доступной; -9. список запросов и экран подтверждения работают; -10. полный сброс действительно очищает сохранённое состояние. diff --git a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/reference/usb_contact_sensor_test_spec.md b/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/reference/usb_contact_sensor_test_spec.md deleted file mode 100644 index 1f81ff9c..00000000 --- a/ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/reference/usb_contact_sensor_test_spec.md +++ /dev/null @@ -1,203 +0,0 @@ -# USB contact sensor test - -Diagnostic sketches: - -- `main-device/test_sketches/usb_contact_sensor_test/usb_contact_sensor_test.ino` -- `main-device/test_sketches/usb_contact_sensor_debug_test/usb_contact_sensor_debug_test.ino` -- `main-device/test_sketches/breath_dual_mode_monitor/breath_dual_mode_monitor.ino` -- `main-device/test_sketches/usb_contact_resistance_test/usb_contact_resistance_test.ino` -- `main-device/test_sketches/usb_contact_screen_start_stub/usb_contact_screen_start_stub.ino` - -## Purpose - -Use the ESP32-S3 native USB data pair as a removable two-wire dry-contact input without making this mode persistent. - -- `GPIO19` = native USB `D-` -- `GPIO20` = native USB `D+` - -## Boot behavior - -Every normal reset starts in ordinary native USB mode. The sketch does not save sensor mode in NVS or any other persistent storage. - -Initial screen: - -- title: `USB CONTACT TEST` -- mode: `USB mode` -- state: `READY` -- action button: `Start` - -Until `Start` is pressed, the sketch does not reconfigure GPIO19/20. - -## Sensor mode - -After `Start`: - -- GPIO19 is configured as `OUTPUT LOW` -- GPIO20 is configured as `INPUT_PULLUP` -- a passive switch/contact is connected between USB `D-` and `D+` -- open contact => GPIO20 reads HIGH => UI shows `OPEN` -- closed contact => GPIO20 reads LOW => UI shows `CLOSED` -- contact changes use a 20 ms debounce - -Native USB data is intentionally unavailable while sensor mode owns GPIO19/20. The UI warns not to connect the port to a computer in this state. - -The action button changes to `Restart to USB`. Pressing it calls `ESP.restart()`; after reboot normal USB mode is restored. - -A physical reset/power cycle has the same effect. The ESP32-S3 ROM download mode remains available through the board's BOOT procedure if recovery is needed. - -## Debug version - -The debug sketch starts in normal USB mode and shows raw touch diagnostics on screen. The on-screen `START` button is intentionally diagnostic only: it confirms touch/LVGL button events and does not reconfigure GPIO19/20. - -Sensor mode starts from the physical BOOT/user button on GPIO0, active LOW. The button is debounced for 35 ms, then the UI shows `START RECEIVED` / `STARTING...`, waits 250 ms so the visual transition is rendered, and only then reconfigures USB D-/D+ as the contact input. - -While in sensor mode, pressing the BOOT/user button again restarts the device and returns normal USB mode on the next boot. - -## Resistance version - -The `usb_contact_resistance_test` sketch starts in normal USB mode and does not reconfigure GPIO19/20 until `Start` is tapped. - -Initial screen: - -- title: `USB RESISTANCE TEST` -- mode: `USB mode` -- state: `READY` -- action button: `Start` - -After `Start`: - -- GPIO19 / USB `D-` is configured as `OUTPUT HIGH` -- GPIO20 / USB `D+` is configured as ADC input -- the measured resistance is connected between `D-` and `D+` -- a known external 10 kΩ pulldown resistor must be connected from `D+` to `GND` for meaningful ohm calculation -- UI shows calculated resistance, raw ADC value, and measured `D+` millivolts -- very low ADC voltage is shown as `OPEN` -- near-source voltage is shown as `SHORT / LOW` - -The calculation assumes a divider where the unknown resistance is the high-side resistor from 3.3 V to ADC and the known 10 kΩ resistor is the low-side resistor from ADC to GND: - -`Rx = 10000 * (3300 / Vadc - 1)` - -This test is intended to check whether the USB contact pair can be reused as an ADC-measured resistance input, for example before wiring a 10 kΩ potentiometer. Native USB data is unavailable while resistance mode owns GPIO19/20. Pressing `Restart to USB` calls `ESP.restart()`; after reboot normal USB mode is restored. - -## GFX breath monitor version - -The `usb_contact_screen_start_stub` sketch is a breath monitor firmware based on the production `Arduino_GFX` display path instead of LVGL. - -Initial screen: - -- title: `USB CONTACT` -- title in the current version: `BREATH MONITOR` -- state: `READY` -- action button: `START` - -After tapping `START`: - -- GPIO19 is configured as `OUTPUT LOW` -- GPIO20 is configured as `INPUT_PULLUP` -- closed contact is treated as `EXHALE` -- open contact is treated as `INHALE` -- one breathing cycle is measured from one stable `EXHALE` start to the next stable `EXHALE` start -- contact changes use an 80 ms debounce -- UI shows current cycle duration, arithmetic average duration over the last 5 completed cycles, and elapsed time from start -- the physical user/BOOT button opens and closes the settings screen -- settings screen has three touch sliders: limit `5/7/10/15/20` seconds, quiet cycle tick volume `0..10`, and alert volume `0..10` -- settings are persisted in NVS and restored after power off/on -- quiet cycle tick volume uses a compressed quiet scale: previous low audible levels are moved near `9..10` -- alert volume uses a gentler low range; level `5` equals the previous maximum alert level -- the working screen uses a static frame and only updates value regions to avoid display flicker -- the main screen header/status line and the bottom short-average streak line redraw only when their text changes -- the `START` button is a flat rounded rectangle with a border; there is no pause button in this version -- every new cycle start plays one quiet confirmation beep -- if the arithmetic average of the last up to 5 completed cycles is shorter than the selected limit, the device plays warning beeps: 1 beep for the first short average in a row, 2 beeps for the second, up to 5 beeps -- completed cycles shorter than 1.5 seconds are ignored as contact bounce -- if the current cycle exceeds 60 seconds, the main screen shows `PAUSE`; that long cycle is skipped and the next `EXHALE` start begins a fresh cycle from zero -- reset/power cycle restores ordinary native USB boot - -This version is intended to monitor breathing cadence from a dry-contact USB D-/D+ sensor. - -## Dual-mode GFX breath monitor version - -The `breath_dual_mode_monitor` sketch reuses the production-style `Arduino_GFX` visual approach, audio path, settings sliders, and average-cycle alert behavior from the USB contact breath monitor. It supports two start modes on one firmware: USB contact sensor mode and external button mode. - -Initial screen: - -- title: `BREATH MONITOR` -- state: `READY` -- action button: `START USB SENSOR` -- action button: `START MANUAL MONITOR` -- action button: `START POT 3-WIRE` -- action button: `START POT 2-WIRE` -- action button: `START POT CAL` -- action button: `START PIN DIAG` - -After `START USB SENSOR`: - -- GPIO19 / USB `D-` is configured as `OUTPUT LOW` -- GPIO20 / USB `D+` is configured as `INPUT_PULLUP` -- closed contact is treated as `EXHALE` -- open contact is treated as `INHALE` -- USB sensor cycles shorter than 3 seconds are ignored without resetting the current cycle timer -- a short `KEY3 / GPIO18` press opens or closes settings in USB sensor mode -- the bottom line shows the durations of the last 5 accepted USB sensor cycles - -After `START MANUAL MONITOR`: - -- `KEY3 / GPIO18` is the external `INHALE` button, active LOW -- `BOOT / GPIO0` is the external `EXHALE` button, active LOW -- do not hold `BOOT` while booting or resetting the board -- the mode title is `MANUAL MONITOR` -- accepted manual phases strictly alternate: `INHALE`, then `EXHALE`; a repeated current button or `EXHALE` before the first `INHALE` is ignored without a beep or timer reset -- each accepted button press plays one quiet confirmation beep and starts a fresh `Phase time` timer for that inhale or exhale -- the working screen does not show touch `INHALE`/`EXHALE` buttons -- long-holding `KEY3 / INHALE` for about 850 ms opens settings; the long press still counts as an inhale press -- while settings are open, the next `KEY3 / INHALE` press closes settings and also counts as an inhale press - -After `START POT 3-WIRE`: - -- `GPIO19 / USB D-` is configured as `OUTPUT HIGH` and works as the 3.3 V side of the potentiometer test -- `GPIO20 / USB D+` is configured as ADC input and must be connected to the potentiometer wiper -- `USB GND` must be connected to the other edge pin of the potentiometer -- the screen shows position `0..100%`, a bar, ADC raw value, measured millivolts, and estimated `0..50 kΩ` resistance -- if ADC saturates or reaches an unsafe high-voltage threshold, the firmware releases `D-` and `D+` to `INPUT`, beeps, and shows `USB/PIN FAULT` -- this is only best-effort software protection; ESP32-S3 GPIO pins are not 5 V tolerant, so external wiring must still prevent 5 V from reaching `D+` or `D-` - -After `START POT 2-WIRE`: - -- `GPIO19 / USB D-` is configured as `OUTPUT HIGH` -- `GPIO20 / USB D+` is configured as ADC input with internal pulldown -- connect only two potentiometer pins between `D-` and `D+`: the wiper and one edge pin -- the screen shows rough position, raw ADC, millivolts, and rough estimated resistance -- this mode is intentionally approximate because the ESP32 internal pulldown value is not precise and can vary between boards -- use `START POT 3-WIRE` for stable and more linear future breath sensing - -After `START POT CAL`: - -- `GPIO19 / USB D-` is configured as `OUTPUT HIGH` -- `GPIO20 / USB D+` is configured as ADC input with internal pulldown -- connect only two potentiometer pins between `D-` and `D+`: the wiper and one edge pin -- the firmware tracks the observed minimum and maximum ADC millivolts -- the screen shows a calibrated `0..100%` position within the observed range, current millivolts, raw ADC, min-max range, and state -- `KEY3 / GPIO18` resets the learned min-max calibration -- this mode is for relative position testing on weak or shifted USB-pin ranges; it does not report real resistance - -After `START PIN DIAG`: - -- the firmware runs two alternating USB pin drive/read checks -- Test A drives `GPIO19 / USB D-` HIGH and reads `GPIO20 / USB D+` as ADC -- Test B drives `GPIO20 / USB D+` HIGH and reads `GPIO19 / USB D-` as ADC -- shorting `D-` and `D+` should make the ADC side rise if the pins are actually controllable as GPIO -- if both tests stay near 0 mV, the USB cable/host, USB PHY, or board wiring is likely holding the lines and the USB data pins are not usable as an analog sensor in that setup - -In both modes: - -- one breathing cycle is measured from one `EXHALE` tap to the next `EXHALE` tap -- inhale before any exhale does not create a cycle -- button-mode cycles shorter than 1.5 seconds are ignored -- USB sensor cycles shorter than 3 seconds are ignored -- the UI shows current cycle time, arithmetic average over the last 5 completed cycles, elapsed session time, selected limit, long-pause count, short-average count, and current short-average streak -- the lower numeric fields use a larger font than before -- if the average of the last up to 5 completed cycles is shorter than the selected limit, warning beeps are played like in the USB contact breath monitor -- if the current cycle reaches 60 seconds, 5 loud warning beeps are played, then after 5 seconds another 5 loud warning beeps are played, repeating until the user changes phase / exits the long cycle -- in manual monitor mode, a single loud warning beep is also played at 35, 40, 45, 50, and 55 seconds of an unchanged inhale or exhale; the repeated five-beep alarm starts at 60 seconds -- settings keep the same sliders: limit `5/7/10/15/20` seconds, quiet cycle tick volume `0..10`, and alert volume `0..10` diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..163a9ccc --- /dev/null +++ b/LICENSE @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + + Preamble + +The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + +The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + +Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + +A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + +The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + +An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + +The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + +0. Definitions. + +"This License" refers to version 3 of the GNU Affero General Public License. + +"Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + +"The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + +To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + +A "covered work" means either the unmodified Program or a work based +on the Program. + +To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + +To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + +An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + +1. Source Code. + +The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + +A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + +The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + +The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + +The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + +The Corresponding Source for a work in source code form is that +same work. + +2. Basic Permissions. + +All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + +3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + +When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + +4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + +5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + +A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + +6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + +A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + +"Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + +If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + +7. Additional Terms. + +"Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + +All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + +8. Termination. + +You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + +However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + +9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + +10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + +An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + +11. Patents. + +A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + +A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + +In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + +If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + +A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + +12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + +13. Remote Network Interaction; Use with the GNU General Public License. + +Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + +Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + +14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + +Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + +15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + +17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + +You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. diff --git a/PUBLIC_DATA_WARNING.md b/PUBLIC_DATA_WARNING.md new file mode 100644 index 00000000..ce8ef51d --- /dev/null +++ b/PUBLIC_DATA_WARNING.md @@ -0,0 +1,41 @@ +# SHiNE — Public Data and Immutability Warning / Предупреждение о публичных данных и их неизменяемости + +## Русский + +**Прежде чем опубликовать что-либо в SHiNE, учитывайте, что публичные данные могут сохраниться навсегда. Полное удаление опубликованных данных из децентрализованной сети может оказаться крайне затруднительным или невозможным.** + +SHiNE разделяет личную переписку и публичные данные: + +- Личные сообщения и их вложения предназначены для приватного обмена. Они не являются публичными публикациями пользовательского блокчейна; для защиты содержимого личной переписки предусмотрено сквозное шифрование. Получатели, однако, могут сохранить или передать полученные материалы другим лицам. +- Публичные публикации, сведения профиля, публичные взаимодействия и другие публичные записи пользовательского блокчейна подписываются цифровой подписью и предназначены для долговременного хранения, в том числе в сети Arweave. Такие записи могут независимо храниться, копироваться, проверяться и распространяться другими участниками сети. + +Уже опубликованные записи не предназначены для перезаписи. Редактирование создаёт новую запись и не уничтожает предыдущую. Удаление или скрытие данных в интерфейсе, прекращение их распространения отдельным сервером или закрытие учётной записи не гарантируют удаления оригинальных записей, истории и копий у других участников. + +Файлы, связанные с публичными записями, могут храниться отдельно от блокчейна. Их доступность зависит от используемого хранилища и наличия копий. Удаление файла из одного хранилища не гарантирует исчезновения всех его копий или соответствующих записей в блокчейне. + +Публичные материалы могут использоваться и распространяться другими лицами на условиях предоставленных вами лицензий, включая CC BY-NC 4.0 и SHiNE Commercial Distribution License (SCDL), если вы предоставили соответствующие разрешения. Удаление публикации само по себе не отменяет ранее предоставленных лицензионных прав. Это не ограничивает права, которые не могут быть исключены в силу применимого законодательства. + +**Публикуйте осознанно.** Не размещайте в публичном блокчейне пароли, закрытые ключи, конфиденциальную информацию, персональные данные, которые не предназначены для публичного доступа, или материалы, на публикацию и лицензирование которых у вас нет необходимых прав. Перед публикацией проверьте её содержимое, вложения и выбранный режим доступа. + +**Относитесь к каждой публичной записи как к потенциально необратимой — даже в версии 0.9 Alpha.** + +--- + +## English + +**Before publishing anything on SHiNE, bear in mind that public data may remain available forever. Completely removing published data from a decentralized network may be extremely difficult or impossible.** + +SHiNE distinguishes between private correspondence and public data: + +- Direct messages and their attachments are intended for private exchange. They are not public publications in a user's blockchain; end-to-end encryption is designed to protect the contents of private correspondence. Recipients may, however, retain or share the materials they receive. +- Public posts, profile information, public interactions and other public records in a user's blockchain are digitally signed and intended for long-term storage, including on the Arweave network. Other network participants may independently store, copy, verify and distribute such records. + +Published records are not designed to be overwritten. Editing creates a new record and does not destroy the previous one. Deleting or hiding data in the interface, stopping its distribution by an individual server, or closing an account does not guarantee removal of the original records, their history or copies held by other participants. + +Files associated with public records may be stored separately from the blockchain. Their availability depends on the storage system used and the existence of copies. Removing a file from one storage location does not guarantee the disappearance of all its copies or the corresponding blockchain records. + +Public materials may be used and distributed by others under the licenses you have granted, including CC BY-NC 4.0 and the SHiNE Commercial Distribution License (SCDL), if you have granted the relevant permissions. Deleting a publication does not in itself revoke previously granted license rights. This does not limit rights that cannot be excluded under applicable law. + +**Publish responsibly.** Do not put passwords, private keys, confidential information, personal data not intended for public access, or materials you lack the necessary rights to publish and license into the public blockchain. Before publishing, check the content, attachments and selected access mode. + +**Treat every public record as potentially irreversible — even in version 0.9 Alpha.** diff --git a/SHiNE-CORE-CONTENT-docs-patch-2026.11.29.zip b/SHiNE-CORE-CONTENT-docs-patch-2026.11.29.zip deleted file mode 100644 index 36ca149b..00000000 Binary files a/SHiNE-CORE-CONTENT-docs-patch-2026.11.29.zip and /dev/null differ diff --git a/SHiNE-browser-plugin-wallet/README.md b/SHiNE-browser-plugin-wallet/README.md index 209dc4ad..2d4c140b 100644 --- a/SHiNE-browser-plugin-wallet/README.md +++ b/SHiNE-browser-plugin-wallet/README.md @@ -1,5 +1,7 @@ # SHiNE Browser Plugin Wallet +> Статус: старая версия. Плагин находится в разработке и пока не работает. + Chrome-compatible Manifest V3 plugin for SHiNE wallet-session login. ## Что уже умеет diff --git a/SHiNE-browser-plugin-wallet/package-lock.json b/SHiNE-browser-plugin-wallet/package-lock.json index abe9aea4..76c9f65e 100644 --- a/SHiNE-browser-plugin-wallet/package-lock.json +++ b/SHiNE-browser-plugin-wallet/package-lock.json @@ -7,7 +7,7 @@ "": { "name": "shine-browser-plugin-wallet", "version": "1.0.0", - "license": "UNLICENSED", + "license": "AGPL-3.0-or-later", "dependencies": { "@noble/curves": "^1.5.0", "@solana/web3.js": "^1.98.4" diff --git a/SHiNE-browser-plugin-wallet/package.json b/SHiNE-browser-plugin-wallet/package.json index 85591caf..7c218e92 100644 --- a/SHiNE-browser-plugin-wallet/package.json +++ b/SHiNE-browser-plugin-wallet/package.json @@ -9,7 +9,7 @@ }, "keywords": [], "author": "", - "license": "UNLICENSED", + "license": "AGPL-3.0-or-later", "dependencies": { "@noble/curves": "^1.5.0", "@solana/web3.js": "^1.98.4" diff --git a/SHiNE-server/ABOUT.txt b/SHiNE-server/ABOUT.txt new file mode 100644 index 00000000..0be87ba5 --- /dev/null +++ b/SHiNE-server/ABOUT.txt @@ -0,0 +1 @@ +OpenMindSoft LLC (Georgia) diff --git a/SHiNE-server/AGENTS.md b/SHiNE-server/AGENTS.md index 916aed88..311c2963 100644 --- a/SHiNE-server/AGENTS.md +++ b/SHiNE-server/AGENTS.md @@ -29,9 +29,9 @@ SHiNE-server — серверная часть мессенджера SHiNE: Web ## Настройка сервера в Solana (Solana PDA) -Серверный аккаунт SHiNE регистрируется как обычный `user_pda` формата 1.2 с присутствующим `ServerProfileBlock`. Отдельного `is_server` в PDA нет: наличие server profile означает, что аккаунт объявляет серверный endpoint. +Серверный аккаунт SHiNE регистрируется как обычный `user_pda` формата 1.0 с присутствующим `ServerProfileBlock`. Отдельного `is_server` в PDA нет: наличие server profile означает, что аккаунт объявляет серверный endpoint. -PDA 1.2 сейчас допускает **один** адрес сервера (`address_format_type + address_format_version + address`). Бинарный блок использует count/array, чтобы будущая версия протокола могла увеличить лимит без смены структуры блока. Прямой список `sync_servers` удалён: пользовательские blockchain синхронизируются через Arweave. +PDA 1.0 сейчас допускает **один** адрес сервера (`address_format_type + address_format_version + address`). Бинарный блок использует count/array, чтобы будущая версия протокола могла увеличить лимит без смены структуры блока. Прямой список `sync_servers` удалён: пользовательские blockchain синхронизируются через Arweave. Клиенты читают server PDA из Solana, получают опубликованный endpoint и подключаются к нему. Межсерверная доставка DM через access-server routing остаётся отдельным механизмом. @@ -45,7 +45,7 @@ shine-UI/server-ui.html - `shine-UI/server-ui/create-server-pda.html` — первичная регистрация серверного аккаунта; - `shine-UI/server-ui/update-server-pda.html` — обновление адреса сервера. -PDA 1.2 использует три постоянные роли ключей: `root` (cold recovery), `blockchain` (обычный authority и подпись блоков) и `client` (клиент/кошелёк). Обычный update авторизуется активным последним blockchain key; root используется для recovery и может менять root. +PDA 1.0 использует три постоянные роли ключей: `root` (cold recovery), `blockchain` (обычный authority и подпись блоков) и `client` (клиент/кошелёк). Обычный update авторизуется активным последним blockchain key; root используется для recovery и может менять root. Актуальные адреса программ Solana (devnet): - `shine_users`: `SHiNEPr1APdAgNBteUyBXcNovaHctpSjUu8oH2ZJdN6` diff --git a/SHiNE-server/shine-server-archive/src/main/java/server/archive/registration/ExternalRegistrar.java b/SHiNE-server/shine-server-archive/src/main/java/server/archive/registration/ExternalRegistrar.java new file mode 100644 index 00000000..238b785d --- /dev/null +++ b/SHiNE-server/shine-server-archive/src/main/java/server/archive/registration/ExternalRegistrar.java @@ -0,0 +1,83 @@ +package server.archive.registration; + +import server.logic.ws_protocol.JSON.handlers.registration.RegistrationServiceException; +import utils.crypto.Ed25519Util; +import javax.sql.DataSource; +import java.nio.charset.StandardCharsets; +import java.util.*; +import java.util.concurrent.*; +import java.security.SecureRandom; + +/** Один активный аппаратный регистратор; транспорт не имеет доступа к приватному ключу. */ +public final class ExternalRegistrar implements RegistrationCertificateSigner, AutoCloseable { + public interface Peer { + boolean open(); + void send(Map request) throws Exception; + void disconnect(); + } + public record Challenge(String nonce, long expiresAtMs, String serverLogin) {} + private record Pending(Peer peer, CompletableFuture result) {} + private final DataSource db; + private final String namespace, serverLogin; + private final byte[] initialKey; + private final Map pending = new ConcurrentHashMap<>(); + private Peer peer; + private long lastPing; + private final ScheduledExecutorService timer=Executors.newSingleThreadScheduledExecutor(r->{Thread t=new Thread(r,"registrar-watchdog");t.setDaemon(true);return t;}); + public ExternalRegistrar(DataSource db,String namespace,String serverLogin) throws Exception { + this.db=db; this.namespace=namespace; this.serverLogin=serverLogin.trim(); + this.initialKey=FreeRegistrationIssuer.configuredNamespaceKey(db,namespace,this.serverLogin); + timer.scheduleAtFixedRate(this::expire,5,5,TimeUnit.SECONDS); + } + public String namespace(){return namespace;} + public byte[] publicKey32(){return initialKey.clone();} + public Challenge challenge(String ns) { + if(!namespace.equals(ns)) throw new IllegalArgumentException("Wrong namespace"); + byte[] nonce=new byte[32]; new SecureRandom().nextBytes(nonce); + return new Challenge(Base64.getUrlEncoder().withoutPadding().encodeToString(nonce),System.currentTimeMillis()+30000,serverLogin); + } + public boolean authenticate(Challenge c,String ns,long timeMs,byte[] sig) throws Exception { + long now=System.currentTimeMillis(); + if(c==null || !namespace.equals(ns) || now>c.expiresAtMs() || timeMsnow+60000) return false; + byte[] current=FreeRegistrationIssuer.configuredNamespaceKey(db,namespace,serverLogin); + if(!Arrays.equals(current,initialKey)) return false; // ротация ключа требует перезапуска конфигурации + String msg="SHINE_REGISTRAR_CONNECT_V1:"+serverLogin+":"+ns+":"+timeMs+":"+c.nonce(); + return Ed25519Util.verify(msg.getBytes(StandardCharsets.UTF_8),sig,current); + } + public synchronized boolean attach(Peer p) { + if(!p.open() || (connected() && peer!=p)) return false; + if(peer!=null && peer!=p)detach(peer); + peer=p; lastPing=System.nanoTime(); return true; + } + public synchronized boolean connected(){return peer!=null && peer.open() && System.nanoTime()-lastPing{if(job.peer()==p && pending.remove(id,job))job.result().completeExceptionally(new RegistrationServiceException(503));}); + } + private void expire(){Peer stale; synchronized(this){stale=connected()?null:peer;if(stale!=null)detach(stale);} if(stale!=null)stale.disconnect();} + public void result(Peer p,String id,int status,byte[] raw){ + Pending job=pending.get(id); + if(job==null || job.peer()!=p || !isPeer(p) || !pending.remove(id,job))return; + if(status==200 && raw!=null && raw.length<=4096)job.result().complete(raw); + else job.result().completeExceptionally(new RegistrationServiceException(switch(status){case 400,403,409,429,500,503->status;default->500;})); + } + @Override public byte[] issue(String login,byte[] root,byte[] blockchain,byte[] client,byte[] emailHash) throws Exception { + if(!login.endsWith("@"+namespace)) throw new IllegalArgumentException("Wrong namespace"); + if(!Arrays.equals(initialKey,FreeRegistrationIssuer.configuredNamespaceKey(db,namespace,serverLogin))) throw new RegistrationServiceException(503); + String id=UUID.randomUUID().toString(); + Pending job; + synchronized(this){if(!connected())throw new RegistrationServiceException(503);job=new Pending(peer,new CompletableFuture<>());pending.put(id,job);} + try { + job.peer().send(Map.of("op","RegistrarSignRegistration","requestId",id,"payload",Map.of( + "login",login,"rootPublicKey",b64(root),"blockchainPublicKey",b64(blockchain),"clientPublicKey",b64(client),"emailSha256",b64(emailHash)))); + return job.result().get(25,TimeUnit.SECONDS); + } catch(ExecutionException e){if(e.getCause() instanceof RegistrationServiceException x)throw x;throw new RegistrationServiceException(503);} + catch(InterruptedException e){Thread.currentThread().interrupt();throw new RegistrationServiceException(503);} + catch(Exception e){throw new RegistrationServiceException(503);} + finally{pending.remove(id,job);} + } + private static String b64(byte[] b){return Base64.getEncoder().encodeToString(b);} + @Override public void close(){timer.shutdownNow();Peer p; synchronized(this){p=peer;if(p!=null)detach(p);} if(p!=null)p.disconnect();} +} diff --git a/SHiNE-server/shine-server-archive/src/main/java/server/archive/registration/FreeRegistrationApiBootstrap.java b/SHiNE-server/shine-server-archive/src/main/java/server/archive/registration/FreeRegistrationApiBootstrap.java index c694678c..e9bf3a78 100644 --- a/SHiNE-server/shine-server-archive/src/main/java/server/archive/registration/FreeRegistrationApiBootstrap.java +++ b/SHiNE-server/shine-server-archive/src/main/java/server/archive/registration/FreeRegistrationApiBootstrap.java @@ -23,12 +23,15 @@ import java.util.logging.Logger; public final class FreeRegistrationApiBootstrap { private static volatile FreeRegistrationWorkflow workflow; private static volatile LocalRegistrarSigner signer; + private static volatile ExternalRegistrar external; + public static ExternalRegistrar externalRegistrar() { return external; } private FreeRegistrationApiBootstrap() {} public static synchronized void startOrThrow() throws Exception { if (workflow != null) return; AppConfig cfg=AppConfig.getInstance(); LocalRegistrarSigner newSigner=null; + ExternalRegistrar newExternal=null; FreeRegistrationIssuer issuer=null; FreeRegistrationPublisher publisher=null; RegistrationEmailSender emailSender=null; @@ -45,10 +48,16 @@ public final class FreeRegistrationApiBootstrap { ArweaveBlocksConfig transport=ArweaveBlocksConfig.load(); if(transport.publishMode()!=ArweaveBlocksConfig.PublishMode.TURBO) throw new IllegalStateException("Free registration requires Turbo transport"); - newSigner=LocalRegistrarSigner.fromConfig(cfg); - FreeRegistrationIssuer.validateConfiguredNamespace(dbSource(), newSigner, freeNamespace, - cfg.getStringOrEmpty("server.SHiNE.login")); - issuer=new FreeRegistrationIssuer(dbSource(),newSigner,allowEmailReuse); + String mode=cfg.getStringOrEmpty("freeRegistration.signerMode").trim(); + if ("external".equals(mode)) { + newExternal = new ExternalRegistrar(dbSource(), freeNamespace, cfg.getStringOrEmpty("server.SHiNE.login")); + issuer = new FreeRegistrationIssuer(dbSource(), newExternal, allowEmailReuse); + } else if (mode.isEmpty() || "local".equals(mode)) { + newSigner=LocalRegistrarSigner.fromConfig(cfg); + FreeRegistrationIssuer.validateConfiguredNamespace(dbSource(), newSigner, freeNamespace, + cfg.getStringOrEmpty("server.SHiNE.login")); + issuer=new FreeRegistrationIssuer(dbSource(),newSigner,allowEmailReuse); + } else throw new IllegalStateException("Unknown freeRegistration.signerMode"); publisher=new FreeRegistrationPublisher(issuer,new TurboDataItemUploader(transport), new VerifiedFreeRegistrationImporter(allowEmailReuse)); // Секрет берём ТОЛЬКО из окружения, не из файлов репозитория. @@ -65,13 +74,15 @@ public final class FreeRegistrationApiBootstrap { cfg.getBoolean("freeRegistration.email.allowReuse",false), allowedEmailDomains, freeRegistrationEnabled ? freeNamespace : ""); RegistrationApiBridge.install((op,req)->dispatch(newWorkflow,op,req)); - signer=newSigner; workflow=newWorkflow; + signer=newSigner; external=newExternal; workflow=newWorkflow; } public static synchronized void close() { RegistrationApiBridge.uninstall(); workflow=null; if(signer!=null) signer.close(); signer=null; + if(external!=null) external.close(); + external=null; } public static Map dispatch(FreeRegistrationWorkflow w, String op,Net_Registration_Request req) throws Exception { Map out=new LinkedHashMap<>(); diff --git a/SHiNE-server/shine-server-archive/src/main/java/server/archive/registration/FreeRegistrationCertificateV1.java b/SHiNE-server/shine-server-archive/src/main/java/server/archive/registration/FreeRegistrationCertificateV1.java index f2948f68..9db77d4f 100644 --- a/SHiNE-server/shine-server-archive/src/main/java/server/archive/registration/FreeRegistrationCertificateV1.java +++ b/SHiNE-server/shine-server-archive/src/main/java/server/archive/registration/FreeRegistrationCertificateV1.java @@ -59,13 +59,19 @@ public final class FreeRegistrationCertificateV1 { public static byte[] issue(String login, byte[] root32, byte[] blockchain32, byte[] client32, String email, RegistrarSigner signer) { + return issueWithEmailHash(login, root32, blockchain32, client32, emailHash(email), signer); + } + + public static byte[] issueWithEmailHash(String login, byte[] root32, byte[] blockchain32, + byte[] client32, byte[] emailHash, RegistrarSigner signer) { + require32(emailHash); byte[] fields = identityFields(login, root32, blockchain32, client32); byte[] inner = signer.sign(innerMessage(fields)); if (inner.length != 64) throw new IllegalStateException("Invalid inner signature length"); ByteArrayOutputStream payload = new ByteArrayOutputStream(); payload.writeBytes(fields); payload.writeBytes(inner); - payload.writeBytes(emailHash(email)); + payload.writeBytes(emailHash); byte[] data = payload.toByteArray(); byte[] owner = signer.publicKey32(); require32(owner); diff --git a/SHiNE-server/shine-server-archive/src/main/java/server/archive/registration/FreeRegistrationIssuer.java b/SHiNE-server/shine-server-archive/src/main/java/server/archive/registration/FreeRegistrationIssuer.java index 821bd2c9..0492e125 100644 --- a/SHiNE-server/shine-server-archive/src/main/java/server/archive/registration/FreeRegistrationIssuer.java +++ b/SHiNE-server/shine-server-archive/src/main/java/server/archive/registration/FreeRegistrationIssuer.java @@ -11,7 +11,7 @@ import java.util.Arrays; /** Выдача (без публикации). Stage 8 публикует через Turbo и импортирует тот же raw DataItem. */ public final class FreeRegistrationIssuer { private final DataSource db; - private final RegistrarSigner signer; + private final RegistrationCertificateSigner signer; private final boolean allowEmailReuse; public FreeRegistrationIssuer(DataSource db, RegistrarSigner signer) { @@ -19,6 +19,15 @@ public final class FreeRegistrationIssuer { } public FreeRegistrationIssuer(DataSource db, RegistrarSigner signer, boolean allowEmailReuse) { + this(db, new RegistrationCertificateSigner() { + public byte[] publicKey32() { return signer.publicKey32(); } + public byte[] issue(String login, byte[] root, byte[] blockchain, byte[] client, byte[] emailHash) { + return FreeRegistrationCertificateV1.issueWithEmailHash(login, root, blockchain, client, emailHash, signer); + } + }, allowEmailReuse); + } + + public FreeRegistrationIssuer(DataSource db, RegistrationCertificateSigner signer, boolean allowEmailReuse) { this.db = java.util.Objects.requireNonNull(db); this.signer = java.util.Objects.requireNonNull(signer); this.allowEmailReuse = allowEmailReuse; @@ -27,6 +36,11 @@ public final class FreeRegistrationIssuer { /** Проверяет привязку локального ключа и сервера до открытия бесплатной регистрации. */ static void validateConfiguredNamespace(DataSource db, RegistrarSigner signer, String namespace, String localServerLogin) throws Exception { + if (!Arrays.equals(configuredNamespaceKey(db, namespace, localServerLogin), signer.publicKey32())) + throw new IllegalStateException("Registrar public key does not match configured namespace"); + } + + static byte[] configuredNamespaceKey(DataSource db, String namespace, String localServerLogin) throws Exception { if (localServerLogin == null || localServerLogin.isBlank()) throw new IllegalStateException("server.SHiNE.login is required for free registration"); try (Connection conn = db.getConnection(); @@ -39,11 +53,11 @@ public final class FreeRegistrationIssuer { if (!rs.next() || rs.getInt("namespace_type") != 2) throw new IllegalStateException("Configured free registration namespace is unavailable"); byte[] namespaceKey = Base58Util.decode(rs.getString("registrar_pubkey")); - if (!Arrays.equals(namespaceKey, signer.publicKey32())) - throw new IllegalStateException("Registrar public key does not match configured namespace"); + if (namespaceKey.length != 32) throw new IllegalStateException("Invalid namespace key"); String namespaceServer = rs.getString("default_server_login"); if (namespaceServer == null || !namespaceServer.equalsIgnoreCase(localServerLogin.trim())) throw new IllegalStateException("Configured free namespace belongs to another access server"); + return namespaceKey; } } } @@ -93,6 +107,12 @@ public final class FreeRegistrationIssuer { } // Это только подписанный артефакт, не активная регистрация. Перед Turbo // и локальным импортом обязательно повторять уникальность в транзакции БД. - return FreeRegistrationCertificateV1.issue(fullLogin, root32, blockchain32, client32, email, signer); + byte[] signed = signer.issue(fullLogin, root32, blockchain32, client32, expectedEmail); + var verified = FreeRegistrationCertificateV1.verify(signed, signer.publicKey32()); + if (!fullLogin.equals(verified.login()) || !Arrays.equals(root32, verified.rootKey()) || + !Arrays.equals(blockchain32, verified.blockchainKey()) || !Arrays.equals(client32, verified.clientKey()) || + !Arrays.equals(expectedEmail, verified.emailSha256())) + throw new IllegalStateException("Registrar returned mismatched certificate"); + return signed; } } diff --git a/SHiNE-server/shine-server-archive/src/main/java/server/archive/registration/RegistrationCertificateSigner.java b/SHiNE-server/shine-server-archive/src/main/java/server/archive/registration/RegistrationCertificateSigner.java new file mode 100644 index 00000000..9fe43c07 --- /dev/null +++ b/SHiNE-server/shine-server-archive/src/main/java/server/archive/registration/RegistrationCertificateSigner.java @@ -0,0 +1,7 @@ +package server.archive.registration; + +/** Выдаёт только полный регистрационный сертификат, не произвольную подпись. */ +public interface RegistrationCertificateSigner { + byte[] publicKey32(); + byte[] issue(String login, byte[] root, byte[] blockchain, byte[] client, byte[] emailHash) throws Exception; +} diff --git a/SHiNE-server/shine-server-archive/src/test/java/server/archive/ExternalRegistrarCheck.java b/SHiNE-server/shine-server-archive/src/test/java/server/archive/ExternalRegistrarCheck.java new file mode 100644 index 00000000..7935952d --- /dev/null +++ b/SHiNE-server/shine-server-archive/src/test/java/server/archive/ExternalRegistrarCheck.java @@ -0,0 +1,43 @@ +package server.archive; +import server.archive.registration.*; +import server.logic.ws_protocol.JSON.handlers.registration.RegistrationServiceException; +import sync.util.Base58Util; +import utils.crypto.Ed25519Util; +import javax.sql.DataSource; +import java.sql.*; +import java.lang.reflect.Proxy; +import java.util.*; +import java.nio.charset.StandardCharsets; +import java.util.concurrent.*; +public class ExternalRegistrarCheck { + static T mock(Class cls,java.lang.reflect.InvocationHandler h){return cls.cast(Proxy.newProxyInstance(cls.getClassLoader(),new Class[]{cls},h));} + static DataSource db(byte[] owner){return mock(DataSource.class,(obj,m,a)->{ + if(!m.getName().equals("getConnection"))throw new UnsupportedOperationException(m.getName()); + return mock(Connection.class,(o,method,args)->switch(method.getName()){ + case "close","setReadOnly"->null; + case "prepareStatement"->mock(PreparedStatement.class,(po,pm,pa)->switch(pm.getName()){ + case "close","setString"->null; + case "executeQuery"->mock(ResultSet.class,(ro,rm,ra)->switch(rm.getName()){ + case "close"->null;case "next"->true;case "getInt"->2;case "getString"->ra[0].equals("registrar_pubkey")?Base58Util.encode(owner):"testserver";default->throw new UnsupportedOperationException(rm.getName());}); + default->throw new UnsupportedOperationException(pm.getName());}); + default->throw new UnsupportedOperationException(method.getName());});});} + static void require(boolean x){if(!x)throw new AssertionError();} + static void expect503(ExternalRegistrar reg) throws Exception {try{reg.issue("Example@free",new byte[32],new byte[32],new byte[32],new byte[32]);throw new AssertionError("Expected failure");}catch(RegistrationServiceException e){require(e.status()==503);}} + public static void main(String[] args)throws Exception{ + byte[] seed=new byte[32],owner=Ed25519Util.derivePublicKey(seed); + try(ExternalRegistrar reg=new ExternalRegistrar(db(owner),"free","testserver")){ + expect503(reg);var c=reg.challenge("free");long t=System.currentTimeMillis();byte[] msg=("SHINE_REGISTRAR_CONNECT_V1:testserver:free:"+t+":"+c.nonce()).getBytes(StandardCharsets.UTF_8);byte[] sig=Ed25519Util.sign(msg,seed); + require(reg.authenticate(c,"free",t,sig));sig[0]^=1;require(!reg.authenticate(c,"free",t,sig)); + BlockingQueue> queue=new LinkedBlockingQueue<>(); + ExternalRegistrar.Peer peer=new ExternalRegistrar.Peer(){public boolean open(){return true;}public void send(Map request){queue.add(request);}public void disconnect(){}}; + ExternalRegistrar.Peer stranger=new ExternalRegistrar.Peer(){public boolean open(){return true;}public void send(Map request){}public void disconnect(){}}; + require(reg.attach(peer));require(!reg.attach(stranger)); + var executor=Executors.newSingleThreadExecutor();try{ + var f=executor.submit(()->reg.issue("Example@free",new byte[32],new byte[32],new byte[32],new byte[32])); + var request=queue.poll(2,TimeUnit.SECONDS);require(request!=null);String id=(String)request.get("requestId"); + reg.result(stranger,id,200,new byte[]{9});require(!f.isDone());reg.result(peer,"unknown",200,new byte[]{9});require(!f.isDone());reg.result(peer,id,200,new byte[]{1,2});require(Arrays.equals(f.get(2,TimeUnit.SECONDS),new byte[]{1,2})); + var f2=executor.submit(()->reg.issue("Example@free",new byte[32],new byte[32],new byte[32],new byte[32]));require(queue.poll(2,TimeUnit.SECONDS)!=null);reg.detach(peer);try{f2.get(2,TimeUnit.SECONDS);throw new AssertionError("Expected disconnect");}catch(ExecutionException e){require(e.getCause() instanceof RegistrationServiceException x&&x.status()==503);} + }finally{executor.shutdownNow();} + }System.out.println("PASS: challenge signature, wrong key, disconnected, exclusive peer, request correlation, wrong peer, disconnect while pending"); + } +} diff --git a/SHiNE-server/shine-server-archive/src/test/java/server/archive/registration/ExternalRegistrarVectorTest.java b/SHiNE-server/shine-server-archive/src/test/java/server/archive/registration/ExternalRegistrarVectorTest.java new file mode 100644 index 00000000..22978244 --- /dev/null +++ b/SHiNE-server/shine-server-archive/src/test/java/server/archive/registration/ExternalRegistrarVectorTest.java @@ -0,0 +1,22 @@ +package server.archive.registration; + +import org.junit.jupiter.api.Test; +import utils.crypto.Ed25519Util; +import java.util.HexFormat; +import static org.junit.jupiter.api.Assertions.*; + +class ExternalRegistrarVectorTest { + @Test void firmwareReferenceVector() { + byte[] seed=new byte[32],root=new byte[32],chain=new byte[32],client=new byte[32],email=new byte[32]; + for(int i=0;i<32;i++){seed[i]=(byte)i;root[i]=(byte)(i+32);chain[i]=(byte)(i+64);client[i]=(byte)(i+96);email[i]=(byte)(i+128);} + try(var signer=new LocalRegistrarSigner(seed)) { + byte[] item=FreeRegistrationCertificateV1.issueWithEmailHash("Example@free",root,chain,client,email,signer); + assertEquals(EXPECTED,HexFormat.of().formatHex(item)); + assertArrayEquals(email,FreeRegistrationCertificateV1.verify(item,signer.publicKey32()).emailSha256()); + item[item.length-1]^=1; + assertThrows(IllegalArgumentException.class,()->FreeRegistrationCertificateV1.verify(item,signer.publicKey32())); + } + } + // Synthetic public test vector; never use its seed for a real namespace. + private static final String EXPECTED = "02003830de5c252e8d4da7dab6de28fdc2f8693dc709f4688895c2e92e2092113f4172cd21a1c7e9842c4cac6fd0cb0537c958d8ad22a00f0297082275df4edf730e03a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b800000300000000000000390000000000000006064170701074657374353539390274067265671050726f746f636f6c345348694e452d467265652d526567697374726174696f6e2d56310001000c4578616d706c654066726565202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f779d957dfe14d4d4097cfcb567944a1a3b4ee04024b71c189d95cfe15ed1bba8a5cf7b7a314e264437a0361f7422c287da24e70d785a0e7c2b1f8cc7073e6d05808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f"; +} diff --git a/SHiNE-server/shine-server-blockchain/src/main/java/blockchain/BodyRecordParser.java b/SHiNE-server/shine-server-blockchain/src/main/java/blockchain/BodyRecordParser.java index 91e28680..386c1f4a 100644 --- a/SHiNE-server/shine-server-blockchain/src/main/java/blockchain/BodyRecordParser.java +++ b/SHiNE-server/shine-server-blockchain/src/main/java/blockchain/BodyRecordParser.java @@ -16,10 +16,10 @@ public final class BodyRecordParser { int v = version & 0xFFFF; int st = subType & 0xFFFF; - // TECH supports Header v1 and CreateChannel current format (ver=1). + // TECH accepts only the current 1.0 body format. if (t == (CreateChannelBody.TYPE & 0xFFFF)) { if (st == (HeaderBody.SUBTYPE_COMPAT & 0xFFFF) - && (v == (HeaderBody.VER & 0xFFFF) || v == (HeaderBody.VER_LICENSE & 0xFFFF) || v == HeaderBody.VER_IDENTITY)) { + && v == (HeaderBody.VER & 0xFFFF)) { return new HeaderBody(subType, version, bodyBytes).check(); } if (st == (CreateChannelBody.SUBTYPE & 0xFFFF) diff --git a/SHiNE-server/shine-server-blockchain/src/main/java/blockchain/ContentBodyParser.java b/SHiNE-server/shine-server-blockchain/src/main/java/blockchain/ContentBodyParser.java index 7db83d4f..451772cd 100644 --- a/SHiNE-server/shine-server-blockchain/src/main/java/blockchain/ContentBodyParser.java +++ b/SHiNE-server/shine-server-blockchain/src/main/java/blockchain/ContentBodyParser.java @@ -18,7 +18,7 @@ public final class ContentBodyParser { if (!java.util.Arrays.equals(core.contentHash32(), content.contentHash32())) throw new IllegalArgumentException("CONTENT hash не совпадает с CORE"); boolean header = content.type() == 0 && content.subType() == MsgSubType.HEADER_COMPAT; - if (content.version() != 1 && !(header && (content.version() == HeaderBody.VER_LICENSE || content.version() == HeaderBody.VER_IDENTITY))) + if (content.version() != 1) throw new IllegalArgumentException("Неподдерживаемая версия CONTENT body"); if (header != (core.blockNumber() == 0)) throw new IllegalArgumentException("HEADER только в CORE №0"); CoreRecord.Line line = core.line(); diff --git a/SHiNE-server/shine-server-blockchain/src/main/java/blockchain/ShineProtocolTags.java b/SHiNE-server/shine-server-blockchain/src/main/java/blockchain/ShineProtocolTags.java index de7e26f6..66037cbf 100644 --- a/SHiNE-server/shine-server-blockchain/src/main/java/blockchain/ShineProtocolTags.java +++ b/SHiNE-server/shine-server-blockchain/src/main/java/blockchain/ShineProtocolTags.java @@ -9,7 +9,7 @@ package blockchain; public final class ShineProtocolTags { private ShineProtocolTags() {} - public static final String CORE_NAMESPACE = "test5595"; + public static final String CORE_NAMESPACE = "test5599"; /** Новый регистрационный сертификат остаётся отдельным объектом; используется при переключении эпохи. */ public static final java.util.List CORE_REGISTRATION_TAGS = java.util.List.of( new Ans104DataItem.Tag("App", CORE_NAMESPACE), diff --git a/SHiNE-server/shine-server-blockchain/src/main/java/blockchain/body/HeaderBody.java b/SHiNE-server/shine-server-blockchain/src/main/java/blockchain/body/HeaderBody.java index 0b243bc3..728873fb 100644 --- a/SHiNE-server/shine-server-blockchain/src/main/java/blockchain/body/HeaderBody.java +++ b/SHiNE-server/shine-server-blockchain/src/main/java/blockchain/body/HeaderBody.java @@ -6,37 +6,23 @@ import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.charset.StandardCharsets; import java.util.Arrays; +import java.util.List; +import java.util.Locale; import java.util.Objects; /** - * HeaderBody — TECH type=0, subType=0; version=1 legacy / version=2 license / version=3 identity. + * HEADER 1.0 — TECH type=0, subType=0, version=1. * * bodyBytes (BigEndian): - * [TAG_LEN] tag ASCII - * [1] loginLength (uint8) - * [N] login UTF-8 - * [1] accountType (v3 only, 0 alternative / 1 primary) - * [2+N] previous accounts CSV (v3 primary only, u16 length) - * [1] licenseLength (uint8, version>=2) - * [M] license UTF-8 (version>=2) - * Historical v2: fixed ASCII "license:CC0-1.0" instead of length + text. - * [32] initialBlockchainKey32 - * - * initialBlockchainKey32 is the public blockchain-signing key that created fork #1. - * It is historical identity metadata and MUST remain byte-for-byte unchanged when a - * preserved prefix (including block #0) is republished into later forks. + * [TAG_LEN] tag ASCII; [1] login length; [N] login UTF-8; + * [1] accountType (0 alternative / 1 primary); + * [2+N] previous accounts CSV for Primary only; + * [1] license length; [M] arbitrary license UTF-8; [32] initial blockchain key. */ public final class HeaderBody implements BodyRecord { public static final short TYPE = 0; - public static final short VER = 1; // Legacy Frame v1 and new CONTENT v1 (without CC0) - public static final short VER_LICENSE = 2; - public static final short VER_IDENTITY = 3; + public static final short VER = 1; public static final int ALTERNATIVE = 0, PRIMARY = 1; - public static final short VER_CC0 = VER_LICENSE; // historical source compatibility - public static final String LICENSE_CC0 = "CC0-1.0"; - public static final String LICENSE_FIELD_CC0 = "license:" + LICENSE_CC0; - private static final byte[] LICENSE_BYTES = LICENSE_FIELD_CC0.getBytes(StandardCharsets.US_ASCII); - public static final int KEY = ((TYPE & 0xFFFF) << 16) | (VER & 0xFFFF); public static final short SUBTYPE_COMPAT = 0; public static final String TAG = ShineSignatureConstants.BLOCKCHAIN_HEADER_TAG; @@ -48,153 +34,108 @@ public final class HeaderBody implements BodyRecord { public final String tag; public final String login; public final byte[] initialBlockchainKey32; - public final Integer accountType; // null for legacy HEADER - public final java.util.List previousAccounts; - public final String license; // null for legacy HEADER v1 - private final boolean legacyCc0Encoding; + public final int accountType; + public final List previousAccounts; + public final String license; public HeaderBody(short subType, short version, byte[] bodyBytes) { Objects.requireNonNull(bodyBytes, "bodyBytes == null"); this.subType = subType; this.version = version; - if ((subType & 0xFFFF) != 0) throw new IllegalArgumentException("HeaderBody subType must be 0"); - if (version != VER && version != VER_CC0 && version != VER_IDENTITY) throw new IllegalArgumentException("HeaderBody version must be 1, 2 or 3"); - if (bodyBytes.length < TAG_LEN + 1 + 1 + 32 + (version == VER_LICENSE ? 1 : 0)) - throw new IllegalArgumentException("HeaderBody too short"); + if ((subType & 0xFFFF) != SUBTYPE_COMPAT) throw new IllegalArgumentException("HeaderBody subType must be 0"); + if (version != VER) throw new IllegalArgumentException("HeaderBody version must be 1.0"); + if (bodyBytes.length < TAG_LEN + 1 + 1 + 1 + 32) throw new IllegalArgumentException("HeaderBody too short"); ByteBuffer bb = ByteBuffer.wrap(bodyBytes).order(ByteOrder.BIG_ENDIAN); byte[] tagBytes = new byte[TAG_LEN]; bb.get(tagBytes); - String parsedTag = new String(tagBytes, StandardCharsets.US_ASCII); - if (!TAG.equals(parsedTag)) throw new IllegalArgumentException("Bad tag: " + parsedTag); - this.tag = parsedTag; + this.tag = new String(tagBytes, StandardCharsets.US_ASCII); + if (!TAG.equals(tag)) throw new IllegalArgumentException("Bad tag: " + tag); int loginLen = Byte.toUnsignedInt(bb.get()); - if (loginLen <= 0 || bb.remaining() < loginLen + 32 + (version == VER_LICENSE ? 1 : 0)) - throw new IllegalArgumentException("Bad HeaderBody login/key/license length"); + if (loginLen == 0 || bb.remaining() < loginLen + 34) throw new IllegalArgumentException("Bad HEADER login length"); byte[] loginBytes = new byte[loginLen]; bb.get(loginBytes); - this.login = BodyTargetSupport.decodeStrictUtf8(loginBytes, "HeaderBody login"); - if (version == VER_IDENTITY) { - if (bb.remaining() < 34) throw new IllegalArgumentException("Truncated HEADER identity"); - this.accountType = Byte.toUnsignedInt(bb.get()); - if (accountType == PRIMARY) { - if (bb.remaining() < 35) throw new IllegalArgumentException("Truncated HEADER previous accounts"); - int size = Short.toUnsignedInt(bb.getShort()); - if (size > bb.remaining() - 33) throw new IllegalArgumentException("Bad HEADER previous accounts length"); - byte[] previous = new byte[size]; bb.get(previous); - String csv = BodyTargetSupport.decodeStrictUtf8(previous, "HEADER previous accounts"); - this.previousAccounts = csv.isEmpty() ? java.util.List.of() : java.util.List.of(csv.split(",", -1)); - } else { - this.previousAccounts = java.util.List.of(); - } - int size = Byte.toUnsignedInt(bb.get()); - if (bb.remaining() != size + 32) throw new IllegalArgumentException("Bad HEADER license length"); - byte[] field = new byte[size]; bb.get(field); - this.license = BodyTargetSupport.decodeStrictUtf8(field, "HEADER license"); - this.legacyCc0Encoding = false; - } else if (version == VER_LICENSE) { - this.accountType = null; - this.previousAccounts = java.util.List.of(); - int fieldLength = bb.remaining() - 32; - if (fieldLength > 256) throw new IllegalArgumentException("HEADER license too long"); - byte[] field = new byte[fieldLength]; - bb.get(field); - legacyCc0Encoding = Arrays.equals(field, LICENSE_BYTES); - if (legacyCc0Encoding) { - this.license = LICENSE_CC0; - } else { - int length = Byte.toUnsignedInt(field[0]); - if (fieldLength != 1 + length) throw new IllegalArgumentException("Bad HEADER license length"); - this.license = BodyTargetSupport.decodeStrictUtf8(Arrays.copyOfRange(field, 1, fieldLength), "HEADER license"); - } + this.login = BodyTargetSupport.decodeStrictUtf8(loginBytes, "HEADER login"); + + this.accountType = Byte.toUnsignedInt(bb.get()); + List parsedPrevious; + if (accountType == PRIMARY) { + if (bb.remaining() < 35) throw new IllegalArgumentException("Truncated HEADER previous accounts"); + int size = Short.toUnsignedInt(bb.getShort()); + if (size > bb.remaining() - 33) throw new IllegalArgumentException("Bad HEADER previous accounts length"); + byte[] previous = new byte[size]; + bb.get(previous); + String csv = BodyTargetSupport.decodeStrictUtf8(previous, "HEADER previous accounts"); + parsedPrevious = csv.isEmpty() ? List.of() : List.of(csv.split(",", -1)); + } else if (accountType == ALTERNATIVE) { + parsedPrevious = List.of(); } else { - this.accountType = null; - this.previousAccounts = java.util.List.of(); - legacyCc0Encoding = false; - this.license = null; + throw new IllegalArgumentException("Bad HEADER account type"); } + this.previousAccounts = parsedPrevious; + + int licenseSize = Byte.toUnsignedInt(bb.get()); + if (bb.remaining() != licenseSize + 32) throw new IllegalArgumentException("Bad HEADER license length"); + byte[] licenseBytes = new byte[licenseSize]; + bb.get(licenseBytes); + this.license = BodyTargetSupport.decodeStrictUtf8(licenseBytes, "HEADER license"); this.initialBlockchainKey32 = new byte[32]; - bb.get(this.initialBlockchainKey32); - requireNonZeroKey(this.initialBlockchainKey32); + bb.get(initialBlockchainKey32); if (bb.hasRemaining()) throw new IllegalArgumentException("Unexpected HeaderBody tail"); + check(); } - // Legacy constructor is kept for historical fixtures and importing v1 blocks. + /** Creates the canonical 1.0 HEADER for a Primary account. */ public HeaderBody(String login, byte[] initialBlockchainKey32) { - this(login, initialBlockchainKey32, VER, null, false); + this(login, initialBlockchainKey32, "", PRIMARY, List.of()); } - /** HEADER для CORE v2 / CONTENT v1: сохраняет login и начальный ключ, без поля лицензии. */ public static HeaderBody forCoreContent(String login, byte[] initialBlockchainKey32) { - return new HeaderBody(login, initialBlockchainKey32, VER, null, false); - } - - public static HeaderBody licensedCc0(String login, byte[] initialBlockchainKey32) { - return new HeaderBody(login, initialBlockchainKey32, VER_LICENSE, LICENSE_CC0, true); - } - - /** Новый HEADER v2: произвольная строка лицензии, включая пустую. */ - public static HeaderBody licensed(String login, byte[] initialBlockchainKey32, String license) { - return new HeaderBody(login, initialBlockchainKey32, VER_LICENSE, Objects.requireNonNull(license), false); + return new HeaderBody(login, initialBlockchainKey32); } public static HeaderBody identity(String login, byte[] initialBlockchainKey32, String license, - int accountType, java.util.List previousAccounts) { - return new HeaderBody(login, initialBlockchainKey32, VER_IDENTITY, license, false, accountType, previousAccounts); + int accountType, List previousAccounts) { + return new HeaderBody(login, initialBlockchainKey32, license, accountType, previousAccounts); } - private HeaderBody(String login, byte[] initialBlockchainKey32, short version, String license, boolean legacyCc0Encoding) { - this(login, initialBlockchainKey32, version, license, legacyCc0Encoding, null, java.util.List.of()); - } - - private HeaderBody(String login, byte[] initialBlockchainKey32, short version, String license, boolean legacyCc0Encoding, - Integer accountType, java.util.List previousAccounts) { - Objects.requireNonNull(login, "login == null"); - Objects.requireNonNull(initialBlockchainKey32, "initialBlockchainKey32 == null"); + private HeaderBody(String login, byte[] initialBlockchainKey32, String license, + int accountType, List previousAccounts) { this.subType = SUBTYPE_COMPAT; - this.version = version; + this.version = VER; this.tag = TAG; - this.login = login; - this.initialBlockchainKey32 = Arrays.copyOf(initialBlockchainKey32, initialBlockchainKey32.length); - this.license = license; + this.login = Objects.requireNonNull(login, "login == null"); + this.initialBlockchainKey32 = Arrays.copyOf(Objects.requireNonNull(initialBlockchainKey32, "initialBlockchainKey32 == null"), initialBlockchainKey32.length); + this.license = Objects.requireNonNull(license, "license == null"); this.accountType = accountType; - this.previousAccounts = java.util.List.copyOf(previousAccounts); - this.legacyCc0Encoding = legacyCc0Encoding; + this.previousAccounts = List.copyOf(Objects.requireNonNull(previousAccounts, "previousAccounts == null")); check(); } @Override public HeaderBody check() { - if ((subType & 0xFFFF) != 0) throw new IllegalArgumentException("HeaderBody subType must be 0"); - if (version != VER && version != VER_CC0 && version != VER_IDENTITY) throw new IllegalArgumentException("Bad HeaderBody version"); - if (version != VER && (license == null || !StandardCharsets.UTF_8.newEncoder().canEncode(license) - || license.getBytes(StandardCharsets.UTF_8).length > 255)) + if ((subType & 0xFFFF) != SUBTYPE_COMPAT || version != VER) throw new IllegalArgumentException("Bad HeaderBody version"); + if (!StandardCharsets.UTF_8.newEncoder().canEncode(license) || license.getBytes(StandardCharsets.UTF_8).length > 255) throw new IllegalArgumentException("HEADER license must be 0..255 UTF-8 bytes"); - if (version == VER && license != null) throw new IllegalArgumentException("Legacy HEADER must not contain a license"); - if (login == null || login.isBlank()) throw new IllegalArgumentException("Login is blank"); + if (login.isBlank()) throw new IllegalArgumentException("Login is blank"); byte[] loginUtf8 = login.getBytes(StandardCharsets.UTF_8); - // В HEADER хранится неизменяемое написание зарегистрированного login@namespace. - // Namespace остаётся lowercase, регистр локальной части сохраняется байт-в-байт. boolean legacyLogin = login.matches("^[A-Za-z0-9_]+$"); boolean namespacedLogin = loginUtf8.length <= 30 && login.matches("^[A-Za-z0-9_]+@[a-z0-9_]+$"); - if (!legacyLogin && !namespacedLogin) { - throw new IllegalArgumentException("Login must be legacy [A-Za-z0-9_]+ or registered-case login@namespace (max 30 bytes)"); - } - if (loginUtf8.length == 0 || loginUtf8.length > 255) throw new IllegalArgumentException("Login utf8 len must be 1..255"); - if (version == VER_IDENTITY) { - if (accountType == null || (accountType != ALTERNATIVE && accountType != PRIMARY)) - throw new IllegalArgumentException("Bad HEADER account type"); - if (previousAccounts.size() > 10 || (accountType == ALTERNATIVE && !previousAccounts.isEmpty())) - throw new IllegalArgumentException("Bad HEADER previous account count"); - java.util.Set seen = new java.util.HashSet<>(); - seen.add(login.toLowerCase(java.util.Locale.ROOT)); - for (String prev : previousAccounts) { - if (!(prev.matches("^[A-Za-z0-9_]{1,255}$") || (prev.length() <= 30 && prev.matches("^[A-Za-z0-9_]+@[a-z0-9_]+$"))) - || !seen.add(prev.toLowerCase(java.util.Locale.ROOT))) - throw new IllegalArgumentException("Bad, duplicate or self HEADER previous account"); - } + if (!legacyLogin && !namespacedLogin) throw new IllegalArgumentException("Login must be legacy [A-Za-z0-9_]+ or registered-case login@namespace (max 30 bytes)"); + if (loginUtf8.length > 255) throw new IllegalArgumentException("Login utf8 len must be 1..255"); + if (accountType != ALTERNATIVE && accountType != PRIMARY) throw new IllegalArgumentException("Bad HEADER account type"); + if (previousAccounts.size() > 10 || (accountType == ALTERNATIVE && !previousAccounts.isEmpty())) + throw new IllegalArgumentException("Bad HEADER previous account count"); + var seen = new java.util.HashSet(); + seen.add(login.toLowerCase(Locale.ROOT)); + for (String prev : previousAccounts) { + if (!(prev.matches("^[A-Za-z0-9_]{1,255}$") || (prev.length() <= 30 && prev.matches("^[A-Za-z0-9_]+@[a-z0-9_]+$"))) + || !seen.add(prev.toLowerCase(Locale.ROOT))) + throw new IllegalArgumentException("Bad, duplicate or self HEADER previous account"); } + byte[] previous = String.join(",", previousAccounts).getBytes(StandardCharsets.UTF_8); + if (previous.length > 0xFFFF) throw new IllegalArgumentException("HEADER previous accounts are too long"); requireNonZeroKey(initialBlockchainKey32); return this; } @@ -203,23 +144,13 @@ public final class HeaderBody implements BodyRecord { public byte[] toBytes() { check(); byte[] loginUtf8 = login.getBytes(StandardCharsets.UTF_8); - byte[] licenseUtf8 = version != VER ? license.getBytes(StandardCharsets.UTF_8) : new byte[0]; - int licenseSize = version != VER ? (legacyCc0Encoding ? LICENSE_BYTES.length : 1 + licenseUtf8.length) : 0; + byte[] licenseUtf8 = license.getBytes(StandardCharsets.UTF_8); byte[] previous = String.join(",", previousAccounts).getBytes(StandardCharsets.UTF_8); - int identitySize = version == VER_IDENTITY ? 1 + (accountType == PRIMARY ? 2 + previous.length : 0) : 0; - ByteBuffer bb = ByteBuffer.allocate(TAG_LEN + 1 + loginUtf8.length + 32 + licenseSize + identitySize).order(ByteOrder.BIG_ENDIAN); - bb.put(TAG_ASCII); - bb.put((byte) loginUtf8.length); - bb.put(loginUtf8); - if (version == VER_IDENTITY) { - bb.put((byte)(int)accountType); - if (accountType == PRIMARY) bb.putShort((short)previous.length).put(previous); - } - if (version != VER) { - if (legacyCc0Encoding) bb.put(LICENSE_BYTES); - else bb.put((byte) licenseUtf8.length).put(licenseUtf8); - } - bb.put(initialBlockchainKey32); + int identitySize = 1 + (accountType == PRIMARY ? 2 + previous.length : 0); + ByteBuffer bb = ByteBuffer.allocate(TAG_LEN + 1 + loginUtf8.length + identitySize + 1 + licenseUtf8.length + 32).order(ByteOrder.BIG_ENDIAN); + bb.put(TAG_ASCII).put((byte) loginUtf8.length).put(loginUtf8).put((byte) accountType); + if (accountType == PRIMARY) bb.putShort((short) previous.length).put(previous); + bb.put((byte) licenseUtf8.length).put(licenseUtf8).put(initialBlockchainKey32); return bb.array(); } @@ -232,6 +163,6 @@ public final class HeaderBody implements BodyRecord { @Override public String toString() { - return "HeaderBody{version=" + version + ", login='" + login + "', license=" + license + ", initialBlockchainKey32=<32 bytes>}"; + return "HeaderBody{version=1.0, login='" + login + "', accountType=" + accountType + ", license=" + license + ", initialBlockchainKey32=<32 bytes>}"; } } diff --git a/SHiNE-server/shine-server-blockchain/src/test/java/blockchain/Ans104DataItemTest.java b/SHiNE-server/shine-server-blockchain/src/test/java/blockchain/Ans104DataItemTest.java index d53edea2..a74fe3b5 100644 --- a/SHiNE-server/shine-server-blockchain/src/test/java/blockchain/Ans104DataItemTest.java +++ b/SHiNE-server/shine-server-blockchain/src/test/java/blockchain/Ans104DataItemTest.java @@ -55,7 +55,7 @@ final class Ans104DataItemTest { ); byte[] actual = Ans104DataItem.buildSigningMessage(owner, tags, data); - byte[] expected = hex("1abe0371d12268b34be32ca5ebf3d3d2189f9d311d9004c142538ca8a4312faa329d1a4873df72dd01b632a2ecce6b87"); + byte[] expected = hex("507e6879ff233333fb4116c9495fcf695f0cabbb2c2d956b3fb32b6dc1f894b67e4d23170444f0cecdb805eec3494234"); assertArrayEquals(expected, actual); } diff --git a/SHiNE-server/shine-server-blockchain/src/test/java/blockchain/StageAProtocolChecks.java b/SHiNE-server/shine-server-blockchain/src/test/java/blockchain/StageAProtocolChecks.java index 99254ded..6a0f5301 100644 --- a/SHiNE-server/shine-server-blockchain/src/test/java/blockchain/StageAProtocolChecks.java +++ b/SHiNE-server/shine-server-blockchain/src/test/java/blockchain/StageAProtocolChecks.java @@ -41,43 +41,41 @@ public final class StageAProtocolChecks { private static void checkBodies() throws Exception { var header = HeaderBody.forCoreContent("Alice@shine", OWNER); testBody(0,HEADER_COMPAT,header,null,0); - ok(header.license == null,"HEADER без CC0"); - var old = HeaderBody.licensedCc0("Alice", OWNER); - eq(parseSemantic(new ContentRecord(0,0,2,old.toBytes())).toBytes(), old.toBytes(), "historical CC0 HEADER"); + ok(header.license.isEmpty() && header.accountType == HeaderBody.PRIMARY,"canonical HEADER 1.0"); for (String license : new String[]{"", "CC0-1.0", "CC-BY-NC-4.0", "Лицензия 🌞", "x".repeat(255)}) { - var h = HeaderBody.licensed("Alice@shine", OWNER, license); - var c = new ContentRecord(0,0,2,h.toBytes()); + var h = HeaderBody.identity("Alice@shine", OWNER, license, HeaderBody.PRIMARY, List.of()); + var c = new ContentRecord(0,0,1,h.toBytes()); var parsed = (HeaderBody) parseSemantic(c); ok(license.equals(parsed.license), "arbitrary license"); - eq(h.toBytes(), parsed.toBytes(), "HEADER v2 roundtrip"); - eq(ContentBodyParser.parseForCreate(core(0,null,c,HASH),c).toBytes(), h.toBytes(), "HEADER v2 create"); + eq(h.toBytes(), parsed.toBytes(), "HEADER 1.0 roundtrip"); + eq(ContentBodyParser.parseForCreate(core(0,null,c,HASH),c).toBytes(), h.toBytes(), "HEADER 1.0 create"); var contentItem = CoreContentTransport.sign(c.toBytes(), List.of(), SEED); var coreRecord = core(0,null,c,contentItem.id32()); var coreItem = sign(coreRecord,CoreContentTransport.coreTags(coreRecord)); var pair = BchBlockEntry.fromCoreContent(CoreContentContainer.pack(coreItem, contentItem)); - ok(license.equals(((HeaderBody)pair.body).license), "signed HEADER v2 pair"); - eq(pair.getContentRecord().bodyBytes(), h.toBytes(), "signed HEADER v2 exact bytes"); - bad(() -> parseSemantic(new ContentRecord(0,0,2,Arrays.copyOf(h.toBytes(),h.toBytes().length-1))), "truncated HEADER v2"); + ok(license.equals(((HeaderBody)pair.body).license), "signed HEADER 1.0 pair"); + eq(pair.getContentRecord().bodyBytes(), h.toBytes(), "signed HEADER 1.0 exact bytes"); + bad(() -> parseSemantic(new ContentRecord(0,0,1,Arrays.copyOf(h.toBytes(),h.toBytes().length-1))), "truncated HEADER 1.0"); } - bad(() -> HeaderBody.licensed("Alice",OWNER,"x".repeat(256)), "license too long"); - byte[] invalidUtf8 = HeaderBody.licensed("Alice",OWNER,"x").toBytes(); - invalidUtf8[12] = (byte)0xff; - bad(() -> parseSemantic(new ContentRecord(0,0,2,invalidUtf8)), "invalid license UTF8"); + bad(() -> HeaderBody.identity("Alice",OWNER,"x".repeat(256),HeaderBody.PRIMARY,List.of()), "license too long"); + byte[] invalidUtf8 = HeaderBody.identity("Alice",OWNER,"x",HeaderBody.PRIMARY,List.of()).toBytes(); + invalidUtf8[15] = (byte)0xff; + bad(() -> parseSemantic(new ContentRecord(0,0,1,invalidUtf8)), "invalid license UTF8"); for (int type : new int[]{0,1}) { for (List prev : type == 0 ? List.of(List.of()) : List.of(List.of(), List.of("Bob@free", "Old@shine"), java.util.stream.IntStream.range(0,10).mapToObj(n -> "old"+n+"@free").toList())) { var h = HeaderBody.identity("Alice@shine",OWNER,"Лицензия",type,prev); - var c = new ContentRecord(0,0,3,h.toBytes()); + var c = new ContentRecord(0,0,1,h.toBytes()); var parsed = (HeaderBody) parseSemantic(c); - ok(parsed.accountType == type && parsed.previousAccounts.equals(prev) && parsed.license.equals("Лицензия"), "HEADER v3 role and predecessors"); - eq(parsed.toBytes(), h.toBytes(), "HEADER v3 byte roundtrip"); - eq(ContentBodyParser.parseForCreate(core(0,null,c,HASH),c).toBytes(),h.toBytes(),"HEADER v3 create"); + ok(parsed.accountType == type && parsed.previousAccounts.equals(prev) && parsed.license.equals("Лицензия"), "HEADER 1.0 role and predecessors"); + eq(parsed.toBytes(), h.toBytes(), "HEADER 1.0 byte roundtrip"); + eq(ContentBodyParser.parseForCreate(core(0,null,c,HASH),c).toBytes(),h.toBytes(),"HEADER 1.0 create"); var contentItem = CoreContentTransport.sign(c.toBytes(),List.of(),SEED); var coreRecord = core(0,null,c,contentItem.id32()); var pair = BchBlockEntry.fromCoreContent(CoreContentContainer.pack(sign(coreRecord,CoreContentTransport.coreTags(coreRecord)),contentItem)); - ok(((HeaderBody)pair.body).previousAccounts.equals(prev),"signed HEADER v3 pair"); + ok(((HeaderBody)pair.body).previousAccounts.equals(prev),"signed HEADER 1.0 pair"); for(int n=0;nparseSemantic(new ContentRecord(0,0,3,cut)),"truncated HEADER v3"); + bad(()->parseSemantic(new ContentRecord(0,0,1,cut)),"truncated HEADER 1.0"); } } } @@ -89,7 +87,7 @@ public final class StageAProtocolChecks { bad(()->HeaderBody.identity("Alice@shine",OWNER,"",1,java.util.stream.IntStream.range(0,11).mapToObj(n->"old"+n+"@free").toList()),"eleven predecessors"); byte[] invalidRole = HeaderBody.identity("Alice@shine",OWNER,"",0,List.of()).toBytes(); invalidRole[6+"Alice@shine".length()] = 2; - bad(()->parseSemantic(new ContentRecord(0,0,3,invalidRole)),"invalid parsed role"); + bad(()->parseSemantic(new ContentRecord(0,0,1,invalidRole)),"invalid parsed role"); var create=new CreateChannelContentBody("Новости","Описание",(short)1,(short)1); testBody(0,TECH_CREATE_CHANNEL,create,line(CoreRecord.TECH),1); eq(create.toBytes(),Arrays.copyOfRange(new CreateChannelBody(0,0,HASH,1,"Новости","Описание",(short)1,(short)1).toBytes(),44, @@ -209,21 +207,21 @@ public final class StageAProtocolChecks { var foreignCore=core(128,line(0),content,other.id32()); var foreign=sign(foreignCore,CoreContentTransport.coreTags(foreignCore)); bad(() -> CoreContentTransport.verifyPair(foreign,foreign.id32(),other,OWNER,NOW),"different owner with matching content ID"); bad(() -> CoreContentTransport.verifyContent(c,other,other.owner32()),"wrong content ID"); - var tagged=CoreContentTransport.sign(content.toBytes(),List.of(tag("App","test5595"),tag("n","128")),SEED); + var tagged=CoreContentTransport.sign(content.toBytes(),List.of(tag("App","test5599"),tag("n","128")),SEED); bad(() -> CoreContentTransport.verifyContent(core(128,line(0),content,tagged.id32()),tagged,OWNER),"tagged CONTENT"); rejectTags(c,List.of(tag("App","test5592"),tag("n","128"),tag("l","0"))); - rejectTags(c,List.of(tag("App","test5595"),tag("n","0128"),tag("l","0"))); - rejectTags(c,List.of(tag("App","test5595"),tag("n","129"),tag("l","0"))); - rejectTags(c,List.of(tag("App","test5595"),tag("n","128"),tag("l","P"))); - rejectTags(c,List.of(tag("App","test5595"),tag("n","128"))); - rejectTags(c,List.of(tag("App","test5595"),tag("App","test5595"),tag("n","128"),tag("l","0"))); - rejectTags(c,List.of(tag("App","test5595"),tag("n","128"),tag("n","128"),tag("l","0"))); - rejectTags(c,List.of(tag("App","test5595"),tag("n","128"),tag("l","0"),tag("l","0"))); - rejectTags(c,List.of(tag("App","test5595"),tag("n","128"),tag("l","0"),tag("c","news"))); - rejectTags(c,List.of(tag("App","test5595"),tag("n","128"),tag("l","0"),tag("t","tech"))); - rejectTags(core(128,null,content,item.id32()),List.of(tag("App","test5595"),tag("n","128"),tag("l","0"))); - rejectTags(core(128,line(CoreRecord.TECH),content,item.id32()),List.of(tag("App","test5595"),tag("n","128"),tag("l",Integer.toString(CoreRecord.TECH)))); - ok(ShineProtocolTags.CORE_REGISTRATION_TAGS.equals(List.of(tag("App","test5595"), tag("t","reg"), tag("Protocol","SHiNE-Free-Registration-V1"))), "separate registration tags"); + rejectTags(c,List.of(tag("App","test5599"),tag("n","0128"),tag("l","0"))); + rejectTags(c,List.of(tag("App","test5599"),tag("n","129"),tag("l","0"))); + rejectTags(c,List.of(tag("App","test5599"),tag("n","128"),tag("l","P"))); + rejectTags(c,List.of(tag("App","test5599"),tag("n","128"))); + rejectTags(c,List.of(tag("App","test5599"),tag("App","test5599"),tag("n","128"),tag("l","0"))); + rejectTags(c,List.of(tag("App","test5599"),tag("n","128"),tag("n","128"),tag("l","0"))); + rejectTags(c,List.of(tag("App","test5599"),tag("n","128"),tag("l","0"),tag("l","0"))); + rejectTags(c,List.of(tag("App","test5599"),tag("n","128"),tag("l","0"),tag("c","news"))); + rejectTags(c,List.of(tag("App","test5599"),tag("n","128"),tag("l","0"),tag("t","tech"))); + rejectTags(core(128,null,content,item.id32()),List.of(tag("App","test5599"),tag("n","128"),tag("l","0"))); + rejectTags(core(128,line(CoreRecord.TECH),content,item.id32()),List.of(tag("App","test5599"),tag("n","128"),tag("l",Integer.toString(CoreRecord.TECH)))); + ok(ShineProtocolTags.CORE_REGISTRATION_TAGS.equals(List.of(tag("App","test5599"), tag("t","reg"), tag("Protocol","SHiNE-Free-Registration-V1"))), "separate registration tags"); rejectTags(core(128,null,content,item.id32()),ShineProtocolTags.CORE_REGISTRATION_TAGS); var oldFrame=new byte[109]; oldFrame[1]=1; bad(() -> CoreRecord.parse(oldFrame),"old Frame v1"); @@ -242,7 +240,7 @@ public final class StageAProtocolChecks { return result; } private static void checkRawTagSignatures() { - var original = CoreContentTransport.sign(new byte[]{7},List.of(tag("App","test5595")),SEED); + var original = CoreContentTransport.sign(new byte[]{7},List.of(tag("App","test5599")),SEED); byte[] raw = original.rawTags(); // Эквивалентный Avro-массив с отрицательным count и явным размером блока. byte[] alternative = new byte[raw.length+1]; diff --git a/SHiNE-server/shine-server-blockchain/src/test/java/blockchain/TargetLoginFormatTest.java b/SHiNE-server/shine-server-blockchain/src/test/java/blockchain/TargetLoginFormatTest.java index 5b98ccca..fc984483 100644 --- a/SHiNE-server/shine-server-blockchain/src/test/java/blockchain/TargetLoginFormatTest.java +++ b/SHiNE-server/shine-server-blockchain/src/test/java/blockchain/TargetLoginFormatTest.java @@ -84,10 +84,9 @@ final class TargetLoginFormatTest { } @Test - void forkZeroIsReservedButStillDecodableAsHistoricalUnknown() { - ReactionBody source = new ReactionBody(MsgSubType.REACTION_LIKE, "alice", 0, 42, HASH); - ReactionBody parsed = new ReactionBody(MsgSubType.REACTION_LIKE, ReactionBody.VER, source.toBytes()).check(); - assertEquals(0, parsed.toForkNumber()); + void forkZeroIsRejectedByCurrentFormat() { + assertThrows(IllegalArgumentException.class, + () -> new ReactionBody(MsgSubType.REACTION_LIKE, "alice", 0, 42, HASH)); } @Test @@ -109,38 +108,19 @@ final class TargetLoginFormatTest { } @Test - void licensedHeaderV2IncludesExactCc0ConstantAndParsesAlongsideV1() { - HeaderBody v2 = HeaderBody.licensedCc0("Alice@shine", INITIAL_KEY); - assertEquals(HeaderBody.VER_CC0, v2.version); - assertEquals("CC0-1.0", v2.license); - HeaderBody parsed = new HeaderBody(HeaderBody.SUBTYPE_COMPAT, HeaderBody.VER_CC0, v2.toBytes()).check(); - assertEquals("Alice@shine", parsed.login); - assertEquals("CC0-1.0", parsed.license); - assertArrayEquals(INITIAL_KEY, parsed.initialBlockchainKey32); - assertArrayEquals(v2.toBytes(), parsed.toBytes()); + void headerV10CarriesIdentityAndArbitraryLicense() { + HeaderBody header = HeaderBody.identity("Alice@shine", INITIAL_KEY, "Лицензия 🌞", HeaderBody.PRIMARY, java.util.List.of("Bob@free")); + HeaderBody parsed = new HeaderBody(HeaderBody.SUBTYPE_COMPAT, HeaderBody.VER, header.toBytes()).check(); + assertEquals(1, parsed.version); + assertEquals("Лицензия 🌞", parsed.license); + assertEquals(HeaderBody.PRIMARY, parsed.accountType); + assertEquals(java.util.List.of("Bob@free"), parsed.previousAccounts); + assertArrayEquals(header.toBytes(), parsed.toBytes()); - HeaderBody legacy = new HeaderBody("Alice@shine", INITIAL_KEY); - assertNull(new HeaderBody(HeaderBody.SUBTYPE_COMPAT, HeaderBody.VER, legacy.toBytes()).license); - assertEquals(legacy.toBytes().length + 15, v2.toBytes().length); - byte[] expectedLicenseMarker = "license:CC0-1.0".getBytes(java.nio.charset.StandardCharsets.US_ASCII); - int markerOffset = 5 + 1 + "Alice@shine".getBytes(java.nio.charset.StandardCharsets.UTF_8).length; - assertArrayEquals(expectedLicenseMarker, java.util.Arrays.copyOfRange(v2.toBytes(), markerOffset, markerOffset + 15)); - assertArrayEquals(INITIAL_KEY, java.util.Arrays.copyOfRange(v2.toBytes(), markerOffset + 15, v2.toBytes().length)); - - byte[] invalid = v2.toBytes(); - invalid[markerOffset + 8] = (byte)'X'; assertThrows(IllegalArgumentException.class, - () -> new HeaderBody(HeaderBody.SUBTYPE_COMPAT, HeaderBody.VER_CC0, invalid)); + () -> new HeaderBody(HeaderBody.SUBTYPE_COMPAT, (short) 2, header.toBytes())); assertThrows(IllegalArgumentException.class, - () -> new HeaderBody(HeaderBody.SUBTYPE_COMPAT, HeaderBody.VER, v2.toBytes())); - assertThrows(IllegalArgumentException.class, - () -> new HeaderBody(HeaderBody.SUBTYPE_COMPAT, HeaderBody.VER_CC0, legacy.toBytes())); - - byte[] swapped = v2.toBytes(); - System.arraycopy(INITIAL_KEY, 0, swapped, markerOffset, 32); - System.arraycopy(expectedLicenseMarker, 0, swapped, markerOffset + 32, 15); - assertThrows(IllegalArgumentException.class, - () -> new HeaderBody(HeaderBody.SUBTYPE_COMPAT, HeaderBody.VER_CC0, swapped)); + () -> HeaderBody.identity("Alice@shine", INITIAL_KEY, "x".repeat(256), HeaderBody.PRIMARY, java.util.List.of())); } @Test diff --git a/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/ConnectionContext.java b/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/ConnectionContext.java index fcc783dd..68f4ed24 100644 --- a/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/ConnectionContext.java +++ b/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/ConnectionContext.java @@ -25,6 +25,7 @@ public class ConnectionContext { // Статусы аутентификации public static final int AUTH_STATUS_NONE = 0; // анонимный / не авторизован public static final int AUTH_STATUS_AUTH_IN_PROGRESS = 1; // выполнен challenge (AuthChallenge или SessionChallenge) + public static final int AUTH_STATUS_REGISTRAR = 3; public static final int AUTH_STATUS_USER = 2; // авторизованный пользователь // При успешной авторизации отдельно фиксируем отношение пользователя к этому серверу. diff --git a/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/auth/SolanaUserPdaImportService.java b/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/auth/SolanaUserPdaImportService.java index 0e84239f..32908d86 100644 --- a/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/auth/SolanaUserPdaImportService.java +++ b/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/auth/SolanaUserPdaImportService.java @@ -59,7 +59,7 @@ public final class SolanaUserPdaImportService { } /** - * Чтение server PDA 1.2 по логину сервера. В 1.2 разрешён ровно один endpoint. + * Чтение server PDA 1.0 по логину сервера. В 1.0 разрешён ровно один endpoint. */ public static ParsedServerProfile fetchServerProfileByLogin(String loginRaw) throws Exception { String login = normalizeLogin(loginRaw); @@ -143,7 +143,7 @@ public final class SolanaUserPdaImportService { if (!MAGIC.equals(new String(raw, 0, 5, StandardCharsets.UTF_8))) return null; int major = u8(raw, 5); int minor = u8(raw, 6); - if (major != 1 || (minor != 2 && minor != 3)) return null; + if (major != 1 || minor != 0) return null; return parseUserPdaV12(raw); } @@ -256,7 +256,7 @@ public final class SolanaUserPdaImportService { if (!MAGIC.equals(new String(raw, 0, 5, StandardCharsets.UTF_8))) return null; int major = u8(raw, 5); int minor = u8(raw, 6); - if (major != 1 || (minor != 2 && minor != 3)) return null; + if (major != 1 || minor != 0) return null; return parseServerProfileV12(raw); } diff --git a/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/blockchain/Net_AddBlock_Handler.java b/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/blockchain/Net_AddBlock_Handler.java index b174fabb..caddcdc4 100644 --- a/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/blockchain/Net_AddBlock_Handler.java +++ b/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/blockchain/Net_AddBlock_Handler.java @@ -238,7 +238,7 @@ public final class Net_AddBlock_Handler implements JsonMessageHandler { case "limit_check_failed" -> "Ошибка проверки лимита размера"; case "bad_block_format" -> "Некорректный формат блока"; case "bad_block_body" -> "Некорректное тело блока"; - case "header_v3_required" -> "Для нового блокчейна требуется HEADER V3 с типом аккаунта"; + case "header_v1_required" -> "Для нового блокчейна требуется HEADER 1.0 с типом аккаунта"; case "previous_account_not_found" -> "Указанный предыдущий аккаунт не найден"; case "primary_vote_not_allowed" -> "Подтверждать официальность могут только разные основные аккаунты"; case "shine_vote_not_allowed" -> "Подтверждать сияние может только сияющий основной аккаунт другого основного аккаунта, принимающего подтверждения"; @@ -433,9 +433,8 @@ public final class Net_AddBlock_Handler implements JsonMessageHandler { // HEADER фиксирует написание из регистрационной записи, а не lower-case имя цепочки. // Проверка точная: другой регистр не может создать альтернативное "официальное" имя. try { - // Исторические V1/V2 принимаются при импорте; новый прямой AddBlock требует V3. - if (publishToArweave && headerBody.version != HeaderBody.VER_IDENTITY) - return new AddBlockResult(WireCodes.Status.BAD_REQUEST, "header_v3_required", serverLastNum, serverLastHashHex); + if (headerBody.version != HeaderBody.VER) + return new AddBlockResult(WireCodes.Status.BAD_REQUEST, "header_v1_required", serverLastNum, serverLastHashHex); if (publishToArweave) { for (String previous : headerBody.previousAccounts) { if (currentUsersDAO.getByLogin(previous) == null) diff --git a/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/blockchain/Net_AddBlock_Handler_utils/BlockchainWriter.java b/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/blockchain/Net_AddBlock_Handler_utils/BlockchainWriter.java index 3c80cabd..a376d4a8 100644 --- a/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/blockchain/Net_AddBlock_Handler_utils/BlockchainWriter.java +++ b/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/blockchain/Net_AddBlock_Handler_utils/BlockchainWriter.java @@ -77,7 +77,7 @@ public final class BlockchainWriter { st.setUpdatedAtMs(nowMs); stateDAO.upsert(c, st); - if (block.body instanceof HeaderBody header && header.accountType != null) { + if (block.body instanceof HeaderBody header) { blocksDAO.insert(c, be, header.accountType, header.previousAccounts); try (var ps = c.prepareStatement("SELECT shine_refresh_header_identity(?)")) { ps.setString(1, be.getLogin()); ps.execute(); diff --git a/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/registration/Net_Registration_Handler.java b/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/registration/Net_Registration_Handler.java index a34f621c..70b6f3c9 100644 --- a/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/registration/Net_Registration_Handler.java +++ b/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/registration/Net_Registration_Handler.java @@ -37,6 +37,8 @@ public final class Net_Registration_Handler implements JsonMessageHandler { out.setOp(request.getOp()); out.setRequestId(request.getRequestId()); out.setStatus(WireCodes.Status.OK); out.setValues(values); return out; + } catch (RegistrationServiceException e) { + return NetExceptionResponseFactory.error(request,e.status(),"REGISTRAR_ERROR","Регистратор не выдал сертификат"); } catch (IllegalArgumentException e) { // Без echo исходного email, чтобы не публиковать PII в ответе/логе. return NetExceptionResponseFactory.error(request,400,"INVALID_REGISTRATION_INPUT","Данные регистрации не прошли проверку"); diff --git a/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/registration/RegistrationServiceException.java b/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/registration/RegistrationServiceException.java new file mode 100644 index 00000000..5d8d3f4d --- /dev/null +++ b/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/registration/RegistrationServiceException.java @@ -0,0 +1,8 @@ +package server.logic.ws_protocol.JSON.handlers.registration; + +/** Ошибка внешнего регистратора, безопасная для публичного API. */ +public final class RegistrationServiceException extends Exception { + private final int status; + public RegistrationServiceException(int status) { super("Registration signer unavailable: " + status); this.status=status; } + public int status() { return status; } +} diff --git a/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/system/Net_GetServerInfo_Handler.java b/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/system/Net_GetServerInfo_Handler.java index 0c51e7c7..6a24d8be 100644 --- a/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/system/Net_GetServerInfo_Handler.java +++ b/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/system/Net_GetServerInfo_Handler.java @@ -33,6 +33,7 @@ public class Net_GetServerInfo_Handler implements JsonMessageHandler { resp.setOrigin(CONFIG.getStringOrEmpty("server.info.origin")); resp.setExtraInfo(CONFIG.getStringOrEmpty("server.info.extraInfo")); resp.setSolanaCluster(CONFIG.getStringOrEmpty("solana.cluster")); + resp.setAboutText(ServerAboutText.readServerAbout(java.nio.file.Path.of("."))); return resp; } diff --git a/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/system/ServerAboutText.java b/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/system/ServerAboutText.java new file mode 100644 index 00000000..ec9d0789 --- /dev/null +++ b/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/system/ServerAboutText.java @@ -0,0 +1,34 @@ +package server.logic.ws_protocol.JSON.handlers.system; + +import java.io.IOException; +import java.io.InputStream; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; + +/** Публичное описание узла; читается заново, без перезапуска сервера. */ +final class ServerAboutText { + static final int MAX_BYTES = 16 * 1024; + + private ServerAboutText() {} + + static String readServerAbout(Path directory) { + String text = read(directory.resolve("ABOUT.txt")); + return text.isBlank() ? "" : text; + } + + static String read(Path file) { + try { + if (!Files.isRegularFile(file)) return ""; + try (InputStream input = Files.newInputStream(file)) { + byte[] bytes = input.readNBytes(MAX_BYTES + 1); + if (bytes.length > MAX_BYTES) return ""; + return StandardCharsets.UTF_8.newDecoder().decode(ByteBuffer.wrap(bytes)).toString(); + } + } catch (IOException | SecurityException e) { + // Отсутствие публичного описания не ломает GetServerInfo. + return ""; + } + } +} diff --git a/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/system/entyties/Net_GetServerInfo_Request.java b/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/system/entyties/Net_GetServerInfo_Request.java index 0c08da33..fc02cf60 100644 --- a/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/system/entyties/Net_GetServerInfo_Request.java +++ b/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/system/entyties/Net_GetServerInfo_Request.java @@ -11,4 +11,9 @@ import server.logic.ws_protocol.JSON.entyties.Net_Request; * } */ public class Net_GetServerInfo_Request extends Net_Request { + // Совместимость с предыдущим клиентом: язык больше не влияет на описание узла. + private String language; + + public String getLanguage() { return language; } + public void setLanguage(String language) { this.language = language; } } diff --git a/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/system/entyties/Net_GetServerInfo_Response.java b/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/system/entyties/Net_GetServerInfo_Response.java index 1d25ced5..54ae6c0a 100644 --- a/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/system/entyties/Net_GetServerInfo_Response.java +++ b/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/system/entyties/Net_GetServerInfo_Response.java @@ -27,6 +27,10 @@ public class Net_GetServerInfo_Response extends Net_Response { private String origin; private String extraInfo; private String solanaCluster; + private String aboutText; + + public String getAboutText() { return aboutText; } + public void setAboutText(String aboutText) { this.aboutText = aboutText; } public String getSolanaCluster() { return solanaCluster; } public void setSolanaCluster(String cluster) { this.solanaCluster = cluster; } diff --git a/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/userParams/Net_UpsertUserParam_Handler.java b/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/userParams/Net_UpsertUserParam_Handler.java index b704fa0a..15d97e00 100644 --- a/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/userParams/Net_UpsertUserParam_Handler.java +++ b/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/userParams/Net_UpsertUserParam_Handler.java @@ -65,7 +65,7 @@ public class Net_UpsertUserParam_Handler implements JsonMessageHandler { final String param = req.getParam().trim(); if ("account_role".equalsIgnoreCase(param) || "official".equalsIgnoreCase(param)) { return NetExceptionResponseFactory.error(req, WireCodes.Status.BAD_REQUEST, - "account_type_immutable", "Тип аккаунта определяется только HEADER V3"); + "account_type_immutable", "Тип аккаунта определяется только HEADER 1.0"); } if ("gender".equalsIgnoreCase(param)) { return NetExceptionResponseFactory.error(req, WireCodes.Status.BAD_REQUEST, "gender_disabled", "Пол не используется"); diff --git a/SHiNE-server/shine-server-solana-users-sync/src/main/java/sync/codec/ShineUsersCodec.java b/SHiNE-server/shine-server-solana-users-sync/src/main/java/sync/codec/ShineUsersCodec.java index 7fd19120..059bd882 100644 --- a/SHiNE-server/shine-server-solana-users-sync/src/main/java/sync/codec/ShineUsersCodec.java +++ b/SHiNE-server/shine-server-solana-users-sync/src/main/java/sync/codec/ShineUsersCodec.java @@ -254,18 +254,9 @@ public final class ShineUsersCodec { int formatMajor = raw[5] & 0xFF; int formatMinor = raw[6] & 0xFF; - if (formatMajor != 1) { - throw new IllegalArgumentException("Unsupported PDA format " + formatMajor + "." + formatMinor); - } - if (formatMinor == 2 || formatMinor == 3) { + if (formatMajor == 1 && formatMinor == 0) { return parseUserPdaAccountV12(pdaAddress, slot, rawDataBase64, lastTxSignature, raw); } - if (formatMinor == 0) { - // Временная read-only совместимость: legacy PDA 1.0 снова читается - // server-sync только для bootstrap старых server-записей. Новые записи - // и update по-прежнему работают только с текущим форматом 1.2. - return parseUserPdaAccountV10(pdaAddress, slot, rawDataBase64, lastTxSignature, raw); - } throw new IllegalArgumentException("Unsupported PDA format " + formatMajor + "." + formatMinor); } @@ -274,8 +265,6 @@ public final class ShineUsersCodec { if (raw == null || raw.length < 9) throw new IllegalArgumentException("PDA record too short"); int recordLen = u16le(raw, 7); if (recordLen > raw.length) throw new IllegalArgumentException("Invalid record_len"); - if (recordLen == raw.length || raw[recordLen] == 0) return new SupportStats(0, 0L, 0L, 0L); - if ((raw[recordLen] & 0xFF) == 1) return new SupportStats(2, 0L, 0L, 0L); // старые lamports игнорируем if ((raw[recordLen] & 0xFF) != 2) throw new IllegalArgumentException("Unsupported support stats version; required Stars v2"); if (recordLen + 25 > raw.length) throw new IllegalArgumentException("Truncated support stats"); return new SupportStats(2, u64le(raw, recordLen + 1), u64le(raw, recordLen + 9), u64le(raw, recordLen + 17)); diff --git a/SHiNE-server/shine-server-solana-users-sync/src/main/java/sync/service/SolanaUsersSyncService.java b/SHiNE-server/shine-server-solana-users-sync/src/main/java/sync/service/SolanaUsersSyncService.java index 7f191c24..a0edd3c5 100644 --- a/SHiNE-server/shine-server-solana-users-sync/src/main/java/sync/service/SolanaUsersSyncService.java +++ b/SHiNE-server/shine-server-solana-users-sync/src/main/java/sync/service/SolanaUsersSyncService.java @@ -528,7 +528,7 @@ public final class SolanaUsersSyncService fetchResult.signatures() .get(0); - // PDA 1.2 содержит поля, вычисляемые программой и подписанные как единый документ. + // PDA 1.0 содержит поля, вычисляемые программой и подписанные как единый документ. // Поэтому для нового формата не реконструируем байты из instruction args, а читаем // фактическое текущее состояние затронутых PDA из Solana. if (!exactFetchPdaAddresses.isEmpty()) { diff --git a/SHiNE-server/shine-server-solana-users-sync/src/test/java/sync/codec/ShineUsersCodecLegacyV10Test.java b/SHiNE-server/shine-server-solana-users-sync/src/test/java/sync/codec/ShineUsersCodecLegacyV10Test.java index 852c790b..64a23364 100644 --- a/SHiNE-server/shine-server-solana-users-sync/src/test/java/sync/codec/ShineUsersCodecLegacyV10Test.java +++ b/SHiNE-server/shine-server-solana-users-sync/src/test/java/sync/codec/ShineUsersCodecLegacyV10Test.java @@ -11,25 +11,11 @@ import static org.junit.jupiter.api.Assertions.*; class ShineUsersCodecLegacyV10Test { @Test - void readsLegacyV10ServerPdaForBootstrap() { + void rejectsLegacyServerPdaLayout() { byte[] raw = buildLegacyServerPda(); - ShineUsersCodec.UserPdaSnapshot snapshot = ShineUsersCodec.parseUserPdaAccount( + assertThrows(IllegalArgumentException.class, () -> ShineUsersCodec.parseUserPdaAccount( "legacy-pda", 123L, Base64.getEncoder().encodeToString(raw), "legacy-tx" - ); - - assertEquals("legacy_server", snapshot.login()); - assertEquals("legacy_server-001", snapshot.blockchainName()); - assertEquals(100_000L, snapshot.paidLimitBytes()); - assertEquals(12_345L, snapshot.usedBytes()); - assertEquals(7, snapshot.lastBlockNumber()); - assertTrue(snapshot.isServer()); - assertEquals(1, snapshot.addressFormatType()); - assertEquals(0, snapshot.addressFormatVersion()); - assertEquals("wss://legacy.example/ws", snapshot.serverAddress()); - assertEquals(java.util.List.of("sync-old"), snapshot.syncServers()); - assertEquals(java.util.List.of("access-old"), snapshot.accessServers()); - assertEquals(1, snapshot.blockchainForks().size()); - assertEquals(snapshot.blockchainKey(), snapshot.blockchainForks().get(0).blockchainKey()); + )); } private static byte[] buildLegacyServerPda() { diff --git a/SHiNE-server/shine-server-solana-users-sync/src/test/java/sync/codec/ShineUsersCodecStarsTest.java b/SHiNE-server/shine-server-solana-users-sync/src/test/java/sync/codec/ShineUsersCodecStarsTest.java index 4db363fc..a5ddc0b7 100644 --- a/SHiNE-server/shine-server-solana-users-sync/src/test/java/sync/codec/ShineUsersCodecStarsTest.java +++ b/SHiNE-server/shine-server-solana-users-sync/src/test/java/sync/codec/ShineUsersCodecStarsTest.java @@ -36,14 +36,12 @@ class ShineUsersCodecStarsTest { var parsed = ShineUsersCodec.parseShineUsersInstruction(instruction, "test_program"); assertEquals(ShineUsersCodec.TxKind.SUPPORT_DAO, parsed.kind()); } - @Test void v1LamportCountersAreNotConvertedToStars() { + @Test void onlyV2StarsCountersAreAccepted() { byte[] raw = new byte[105]; raw[7] = 80; raw[80] = 1; raw[81] = 75; - var stats = ShineUsersCodec.parseSupportStats(raw); - assertEquals(2, stats.version()); - assertEquals(0L, stats.supportSent()); + assertThrows(IllegalArgumentException.class, () -> ShineUsersCodec.parseSupportStats(raw)); raw[80] = 2; - stats = ShineUsersCodec.parseSupportStats(raw); + var stats = ShineUsersCodec.parseSupportStats(raw); assertEquals(75L, stats.supportSent()); } } diff --git a/SHiNE-server/src/main/java/server/ws/BlockchainWsEndpoint.java b/SHiNE-server/src/main/java/server/ws/BlockchainWsEndpoint.java index 8f464e2a..119bb9ff 100644 --- a/SHiNE-server/src/main/java/server/ws/BlockchainWsEndpoint.java +++ b/SHiNE-server/src/main/java/server/ws/BlockchainWsEndpoint.java @@ -37,7 +37,13 @@ public class BlockchainWsEndpoint { new ThreadPoolExecutor.AbortPolicy() ); - private Session session; + // Подтверждение регистрации может ожидать сеть; ответ регистратора никогда не ждёт этот пул. + private static final ExecutorService REGISTRATION_EXECUTOR = new ThreadPoolExecutor(2, 2, 0L, TimeUnit.SECONDS, + new ArrayBlockingQueue<>(128), r -> {Thread t = new Thread(r, "registration-worker"); t.setDaemon(true); return t;}, new ThreadPoolExecutor.AbortPolicy()); + private static final ExecutorService REGISTRAR_EXECUTOR = new ThreadPoolExecutor(2, 2, 0L, TimeUnit.SECONDS, + new ArrayBlockingQueue<>(128), r -> {Thread t = new Thread(r, "registrar-worker"); t.setDaemon(true); return t;}, new ThreadPoolExecutor.AbortPolicy()); + private volatile Session session; + private volatile RegistrarSocket registrar; /** Контекст для текущего WebSocket-соединения. */ private final ConnectionContext connectionContext = new ConnectionContext(); @@ -55,6 +61,7 @@ public class BlockchainWsEndpoint { public void onConnect(Session session) { this.session = session; connectionContext.setWsSession(session); + registrar = new RegistrarSocket(session, connectionContext); log.info("WS connected: {}", session.getRemoteAddress()); } @@ -65,10 +72,14 @@ public class BlockchainWsEndpoint { if (message == null || message.isBlank()) return; // Добавляем обработку в очередь данного соединения (строго по порядку) - enqueue(() -> processJsonAndReply(message)); + String op = RegistrarSocket.operation(message); + Executor executor = (registrar != null && registrar.dedicated() || op.startsWith("Registrar")) + ? REGISTRAR_EXECUTOR : (op.equals("ConfirmFreeRegistration") || op.equals("StartFreeRegistration")) + ? REGISTRATION_EXECUTOR : WS_EXECUTOR; + enqueue(() -> processJsonAndReply(message), executor); } - private void enqueue(Runnable task) { + private void enqueue(Runnable task, Executor executor) { synchronized (queueLock) { queueTail = queueTail.thenRunAsync(() -> { try { @@ -78,14 +89,26 @@ public class BlockchainWsEndpoint { log.error("❌ Unhandled error in ws task", t); trySendJsonError(); } - }, WS_EXECUTOR); + }, executor).exceptionally(ex -> { + Session current = session; if (current != null) current.close(1013,"Server busy"); + return null; + }); } } private void processJsonAndReply(String message) { if (session == null || !session.isOpen()) return; - log.info("📥 Получено TEXT-сообщение от клиента: {}", message); + String op = RegistrarSocket.operation(message); + RegistrarSocket r = registrar; + if (r != null && (r.dedicated() || op.startsWith("Registrar"))) { + try { r.process(message); } catch (Exception e) { r.disconnect(); } + return; + } + // В заявках есть email и коды подтверждения — не печатаем их в журнал. + if (op.equals("StartFreeRegistration") || op.equals("ConfirmFreeRegistration") || op.equals("CheckRegistrationEmail")) + log.info("Registration request: {}",op); + else log.info("📥 Получено TEXT-сообщение от клиента: {}", message); String respJson; try { @@ -118,6 +141,7 @@ public class BlockchainWsEndpoint { public void onClose(int statusCode, String reason) { log.info("WS closed: {} {}", statusCode, reason); + RegistrarSocket r = registrar; if (r != null) r.closed(); ActiveConnectionsRegistry.getInstance().remove(connectionContext); connectionContext.reset(); diff --git a/SHiNE-server/src/main/java/server/ws/RegistrarSocket.java b/SHiNE-server/src/main/java/server/ws/RegistrarSocket.java new file mode 100644 index 00000000..56e80a79 --- /dev/null +++ b/SHiNE-server/src/main/java/server/ws/RegistrarSocket.java @@ -0,0 +1,66 @@ +package server.ws; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.eclipse.jetty.websocket.api.Session; +import server.archive.registration.ExternalRegistrar; +import server.archive.registration.FreeRegistrationApiBootstrap; +import server.logic.ws_protocol.JSON.ConnectionContext; +import server.logic.ws_protocol.JSON.JsonInboundProcessor; +import java.util.Base64; +import java.util.Map; + +/** Отдельная роль на /ws. Не допускает перехода в обычную пользовательскую авторизацию. */ +final class RegistrarSocket implements ExternalRegistrar.Peer { + private static final ObjectMapper JSON=new ObjectMapper(); + private final Session session; + private final ConnectionContext ctx; + private ExternalRegistrar.Challenge challenge; + private volatile boolean dedicated; + RegistrarSocket(Session session,ConnectionContext ctx){this.session=session;this.ctx=ctx;} + boolean dedicated(){return dedicated;} + static String operation(String raw){try{return JSON.readTree(raw).path("op").asText();}catch(Exception e){return "";}} + @Override public boolean open(){return session.isOpen();} + @Override public synchronized void send(Map request) throws Exception {session.getRemote().sendString(JSON.writeValueAsString(request));} + private synchronized void sendRaw(String raw) throws Exception {if(raw!=null)session.getRemote().sendString(raw);} + @Override public void disconnect(){session.close(1008,"Registrar connection expired");} + void closed(){ExternalRegistrar r=FreeRegistrationApiBootstrap.externalRegistrar();if(r!=null)r.detach(this);} + void process(String raw) throws Exception { + JsonNode node=JSON.readTree(raw), p=node.path("payload"); + String op=node.path("op").asText(), id=node.path("requestId").asText(); + ExternalRegistrar r=FreeRegistrationApiBootstrap.externalRegistrar(); + if(id.isBlank() || id.length()>128 || raw.length()>8192){disconnect();return;} + if(r==null){reply(op,id,503,Map.of());return;} + switch(op){ + case "RegistrarChallenge" -> { + if(!ctx.isAnonymous() || ctx.isServerConnection() || r.isPeer(this)){reply(op,id,403,Map.of());return;} + dedicated=true; + try{challenge=r.challenge(p.path("namespace").asText());reply(op,id,200,Map.of("nonce",challenge.nonce(),"expiresAtMs",challenge.expiresAtMs(),"serverLogin",challenge.serverLogin()));} + catch(IllegalArgumentException e){challenge=null;reply(op,id,403,Map.of());} + } + case "RegistrarConnect" -> { + var c=challenge;challenge=null; + boolean ok=false; + try{ok=dedicated && ctx.isAnonymous() && "1.0".equals(p.path("version").asText()) && + r.authenticate(c,p.path("namespace").asText(),p.path("timeMs").asLong(),Base64.getDecoder().decode(p.path("signatureB64").asText())) && r.attach(this);} + catch(Exception ignored){} + if(ok){ctx.setAuthenticationStatus(ConnectionContext.AUTH_STATUS_REGISTRAR);reply(op,id,200,Map.of());} + else {reply(op,id,403,Map.of());disconnect();} + } + case "RegistrarSignResult" -> { + if(!r.isPeer(this)){disconnect();return;} + int status=node.path("status").asInt(500);byte[] item=null; + if(status==200)try{item=Base64.getDecoder().decode(p.path("dataItemB64").asText());}catch(IllegalArgumentException ignored){} + r.result(this,id,status,item); // событие-ответ, без дополнительного ACK + } + case "Ping" -> { + if(!r.isPeer(this)){disconnect();return;} + r.ping(this);sendRaw(JsonInboundProcessor.processJson(raw,ctx)); + } + default -> {reply(op,id,403,Map.of());disconnect();} + } + } + private void reply(String op,String id,int status,Map payload) throws Exception { + send(Map.of("op",op,"requestId",id,"status",status,"payload",payload)); + } +} diff --git a/SHiNE-server/src/main/java/server/ws/ServerStatusServlet.java b/SHiNE-server/src/main/java/server/ws/ServerStatusServlet.java new file mode 100644 index 00000000..7361a859 --- /dev/null +++ b/SHiNE-server/src/main/java/server/ws/ServerStatusServlet.java @@ -0,0 +1,54 @@ +package server.ws; + +import com.fasterxml.jackson.databind.ObjectMapper; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import server.archive.registration.FreeRegistrationApiBootstrap; +import server.logic.ws_protocol.JSON.ActiveConnectionsRegistry; +import shine.db.DbController; +import utils.config.AppConfig; +import java.io.IOException; +import java.util.*; + +/** Публичные агрегаты; не содержит идентификаторов пользователей/сессий или секретов. */ +final class ServerStatusServlet extends HttpServlet { + private static final ObjectMapper JSON=new ObjectMapper(); + private static Map cached; + private static long cacheAt; + private static synchronized Map registered() throws Exception { + if(cached!=null && System.nanoTime()-cacheAt<10_000_000_000L)return cached; + long total=0,free=0,paid=0;List> namespaces=new ArrayList<>(); + try(var c=DbController.getInstance().getConnection();var q=c.prepareStatement(""" + SELECT COALESCE(n.namespace,i.namespace,'') AS namespace, count(i.normalized_login) AS total, + count(*) FILTER (WHERE i.registration_status='FREE_CERT') AS free, + count(*) FILTER (WHERE i.registration_status='PAID') AS paid + FROM shine_namespace_current n FULL OUTER JOIN user_identity_current i ON i.namespace=n.namespace + GROUP BY COALESCE(n.namespace,i.namespace,'') ORDER BY 1 + """);var rs=q.executeQuery()){ + while(rs.next()){long t=rs.getLong("total"),f=rs.getLong("free"),p=rs.getLong("paid");total+=t;free+=f;paid+=p; + namespaces.add(Map.of("namespace",rs.getString("namespace"),"total",t,"free",f,"paid",p));} + } + cached=Map.of("total",total,"free",free,"paid",paid,"namespaces",List.copyOf(namespaces));cacheAt=System.nanoTime();return cached; + } + @Override protected void doGet(HttpServletRequest req,HttpServletResponse resp)throws IOException{ + resp.setHeader("Cache-Control","no-store");resp.setHeader("X-Content-Type-Options","nosniff"); + if("/status".equals(req.getServletPath())){resp.setContentType("text/html;charset=UTF-8");resp.getWriter().write(HTML);return;} + resp.setContentType("application/json;charset=UTF-8"); + try{ + var active=ActiveConnectionsRegistry.getInstance().getAllConnectionsSnapshot().stream().filter(c->c.isAuthenticatedUser() && c.getWsSession()!=null && c.getWsSession().isOpen()).toList(); + long users=active.stream().map(c->c.getLogin()).filter(Objects::nonNull).map(s->s.toLowerCase(Locale.ROOT)).distinct().count(); + long sessions=active.stream().map(c->c.getSessionId()).filter(Objects::nonNull).distinct().count(); + var external=FreeRegistrationApiBootstrap.externalRegistrar();var cfg=AppConfig.getInstance(); + Map registrar=Map.of("mode",external!=null?"external":cfg.getBoolean("freeRegistration.enabled",false)?"local":"disabled", + "namespace",cfg.getStringOrEmpty("freeRegistration.namespace"),"connected",external!=null && external.connected()); + JSON.writeValue(resp.getWriter(),Map.of("serverVersion",cfg.getStringOrEmpty("server.version"),"serverStatus","ONLINE","updatedAtMs",System.currentTimeMillis(),"registered",registered(),"online",Map.of("users",users,"sessions",sessions),"registrar",registrar)); + }catch(Exception e){resp.setStatus(503);JSON.writeValue(resp.getWriter(),Map.of("serverStatus","DEGRADED","error","Statistics unavailable"));} + } + private static final String HTML=""" + SHiNE Server Status + +

SHiNE Server Status

Loading…

Registrar

Registered users

NamespaceTotalFreePaid

Online

+ + """; +} diff --git a/SHiNE-server/src/main/java/server/ws/WsServer.java b/SHiNE-server/src/main/java/server/ws/WsServer.java index 90274303..3ca6bbc0 100644 --- a/SHiNE-server/src/main/java/server/ws/WsServer.java +++ b/SHiNE-server/src/main/java/server/ws/WsServer.java @@ -79,6 +79,9 @@ public final class WsServer { // Universal Solana HTTP JSON-RPC gateway context.addServlet(new ServletHolder(new SolanaRpcGateway()), "/solana-rpc"); + context.addServlet(new ServletHolder(new ServerStatusServlet()), "/status"); + context.addServlet(new ServletHolder(new ServerStatusServlet()), "/api/status"); + // HTTP debug API DebugApiConfigurator.register(context); diff --git a/SHiNE-server/src/test/java/server/logic/ws_protocol/JSON/handlers/system/ServerAboutTextTest.java b/SHiNE-server/src/test/java/server/logic/ws_protocol/JSON/handlers/system/ServerAboutTextTest.java new file mode 100644 index 00000000..85f3d2b1 --- /dev/null +++ b/SHiNE-server/src/test/java/server/logic/ws_protocol/JSON/handlers/system/ServerAboutTextTest.java @@ -0,0 +1,41 @@ +package server.logic.ws_protocol.JSON.handlers.system; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; + +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +class ServerAboutTextTest { + @TempDir Path temp; + + @Test void readsPublicTextAgainAfterEdit() throws Exception { + Path file = temp.resolve("ABOUT.txt"); + assertEquals("", ServerAboutText.readServerAbout(temp)); + Files.writeString(file, "OpenMindSoft LLC (Georgia)\nhttps://example.org/", StandardCharsets.UTF_8); + assertEquals("OpenMindSoft LLC (Georgia)\nhttps://example.org/", ServerAboutText.readServerAbout(temp)); + Files.writeString(file, "Другой сервер", StandardCharsets.UTF_8); + assertEquals("Другой сервер", ServerAboutText.readServerAbout(temp)); + } + + @Test void rejectsOversizeInvalidUtf8AndDirectories() throws Exception { + Path file = temp.resolve("ABOUT.txt"); + Files.write(file, new byte[ServerAboutText.MAX_BYTES + 1]); + assertEquals("", ServerAboutText.readServerAbout(temp)); + Files.write(file, new byte[]{(byte) 0xC3, 0x28}); + assertEquals("", ServerAboutText.readServerAbout(temp)); + assertEquals("", ServerAboutText.read(temp)); + } + @Test void readsOnlyAboutAndIgnoresLegacyReadmes() throws Exception { + Files.writeString(temp.resolve("README.en.txt"), "Old English"); + Files.writeString(temp.resolve("README.ru.txt"), "Старый текст"); + assertEquals("", ServerAboutText.readServerAbout(temp)); + Files.writeString(temp.resolve("ABOUT.txt"), "OpenMindSoft LLC (Georgia)"); + assertEquals("OpenMindSoft LLC (Georgia)", ServerAboutText.readServerAbout(temp)); + Files.writeString(temp.resolve("ABOUT.txt"), " "); + assertEquals("", ServerAboutText.readServerAbout(temp)); + } +} diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md index 0ee02d99..4f72ef45 100644 --- a/THIRD_PARTY_NOTICES.md +++ b/THIRD_PARTY_NOTICES.md @@ -93,7 +93,7 @@ This section extends, rather than replaces, the original notices above. It is ba **Scope and limitations.** This is an attribution and license *inventory*, not a legal opinion or a certification of complete license compliance. Package-lock license fields are recorded metadata and are not a substitute for reviewing each installed package’s LICENSE/NOTICE files. Cargo.lock contains no license metadata. Java transitive dependencies, build tools, upstream bundled-code composition, and individual image provenance are not exhaustively resolved in the provided snapshot. -**Project licensing is separate.** `"license": "UNLICENSED"` and `"private": true` in SHiNE-owned npm manifests describe these two SHiNE packages; they do not revoke, replace, or override any third-party license. A public GitHub repository is not automatically licensed to others simply because it is public. Any later AGPL-3.0 adoption for SHiNE must preserve and comply with upstream third-party notices. +**Project licensing is separate.** SHiNE-owned source code is licensed under GNU AGPL version 3 or (at the recipient’s option) any later version (`AGPL-3.0-or-later`); see `COPYRIGHT` and `LICENSE`. The `"license": "AGPL-3.0-or-later"` fields in SHiNE-owned npm manifests identify the project license, while `"private": true` prevents accidental npm publication. These settings do not revoke, replace, or override any third-party license. All applicable upstream third-party notices and license obligations must be preserved and complied with. **Definitions:** "direct" = explicitly declared in a project manifest; "transitive" = installed as a dependency of another package; "vendored" = third-party library code stored as a file in the repository; "CDN" = loaded at runtime from an external network URL. *Source availability and redistribution requirements may differ for each.* diff --git a/VERSION.properties b/VERSION.properties index 4ffa798a..74fd7df5 100644 --- a/VERSION.properties +++ b/VERSION.properties @@ -1,2 +1,2 @@ -client.version=1.21.11 -server.version=1.17.8 +client.version=1.21.18 +server.version=1.17.11 diff --git a/application.properties.example b/application.properties.example index a3dded2f..3b4585e8 100644 --- a/application.properties.example +++ b/application.properties.example @@ -42,3 +42,9 @@ r2.publicBucket=shine-files # R2 DM encrypted attachments (publicly downloadable ciphertext, 14-day lifecycle) r2.dmBucket=shine-dm # Configure R2 credentials via R2_ENDPOINT, R2_ACCESS_KEY_ID, R2_SECRET_ACCESS_KEY + +# Registration signer: local (development) or external (production; no seed on server). +freeRegistration.enabled=false +freeRegistration.namespace=free +freeRegistration.signerMode=external +# freeRegistration.registrarSeedFile=/absolute/path/outside/repository.b64 diff --git a/deploy/README.md b/deploy/README.md index 7465348b..59c66541 100644 --- a/deploy/README.md +++ b/deploy/README.md @@ -77,3 +77,9 @@ bash deploy/scripts/test_t2_ui.sh ```bash bash deploy/scripts/test_t2_server.sh ``` + +## Публичное описание сервера + +Файл `SHiNE-server/ABOUT.txt` содержит только сведения о владельце конкретного узла (название, при необходимости сайт и контакты на отдельных строках). Подписи о принадлежности к сети SHiNE и владельце задаются языковыми словарями клиента. Общий статус ПО и версии SHiNE находится в словарях интерфейса, а не в этом файле. Общий скрипт `deploy_server.sh` и wrapper `test_t2_server.sh` копируют `ABOUT.txt` рядом с `shine-server.jar`, если файл там ещё отсутствует. Для другого узла передайте собственный файл через `LOCAL_ABOUT` в общий скрипт или отредактируйте его непосредственно на сервере. При ручной установке положите файл в рабочий каталог сервера; локальный запуск `startLocal` использует `SHiNE-server/`. + +Файл читается как UTF-8 (до 16 КиБ) при каждом запросе `GetServerInfo`. Перезапуск не нужен. Текст общедоступен: не включайте секреты. Существующий `ABOUT.txt` при обновлении сохраняется. Если вы применяли предыдущие варианты alpha-патча, замените старое общее описание в `ABOUT.txt` на сведения о владельце без повторения подписей интерфейса; файлы `README.en.txt` и `README.ru.txt` из тех патчей больше не используются и могут быть удалены. Обычный README репозитория не затрагивается. diff --git a/deploy/scripts/deploy_server.sh b/deploy/scripts/deploy_server.sh index c915823d..261145f7 100755 --- a/deploy/scripts/deploy_server.sh +++ b/deploy/scripts/deploy_server.sh @@ -15,6 +15,7 @@ REMOTE_SERVICE_NAME="${REMOTE_SERVICE_NAME:?REMOTE_SERVICE_NAME is required}" SERVER_PORT="${SERVER_PORT:?SERVER_PORT is required}" LOCAL_JAR="${LOCAL_JAR:-$ROOT_DIR/SHiNE-server/build/libs/shine-server.jar}" LOCAL_EMAIL_DOMAINS="${LOCAL_EMAIL_DOMAINS:-$ROOT_DIR/allowed-email-domains.txt}" +LOCAL_ABOUT="${LOCAL_ABOUT:-$ROOT_DIR/SHiNE-server/ABOUT.txt}" BUILD_JAR="${BUILD_JAR:-1}" REQUIRE_BACKUP="${REQUIRE_BACKUP:-0}" BACKUP_DIR="${BACKUP_DIR:-$ROOT_DIR/deploy/backup/archive}" @@ -75,6 +76,10 @@ REMOTE_EXTRA_DIRS="" ssh "$REMOTE_HOST" "mkdir -p '$REMOTE_SERVER_DIR' '$REMOTE_DATA_DIR' '$REMOTE_LOGS_DIR'$REMOTE_EXTRA_DIRS" rsync -az --timeout=120 "$LOCAL_JAR" "$REMOTE_HOST:$REMOTE_SERVER_DIR/shine-server.jar" rsync -az --timeout=120 "$LOCAL_EMAIL_DOMAINS" "$REMOTE_HOST:$REMOTE_SERVER_DIR/allowed-email-domains.txt" +# Не перезаписываем описание, которое администратор уже отредактировал на сервере. +if [[ -f "$LOCAL_ABOUT" ]]; then + rsync -az --ignore-existing --timeout=120 "$LOCAL_ABOUT" "$REMOTE_HOST:$REMOTE_SERVER_DIR/ABOUT.txt" +fi rsync -az "$TMP_DIR/$REMOTE_SERVICE_NAME.service" "$REMOTE_HOST:/tmp/$REMOTE_SERVICE_NAME.service" ssh "$REMOTE_HOST" "set -euo pipefail; \ diff --git a/deploy/scripts/test_t2_server.sh b/deploy/scripts/test_t2_server.sh index 61fdeda4..a5069653 100755 --- a/deploy/scripts/test_t2_server.sh +++ b/deploy/scripts/test_t2_server.sh @@ -22,6 +22,10 @@ echo "==> Deploy server to t2.shineup.me ($REMOTE_HOST)" ssh -o BatchMode=yes -o ConnectTimeout=20 "$REMOTE_HOST" "echo SSH OK" >/dev/null rsync -az --timeout=120 "$LOCAL_JAR" "$ROOT_DIR/allowed-email-domains.txt" \ "$REMOTE_HOST:$REMOTE_SERVER_DIR/" +if [[ -f "$ROOT_DIR/SHiNE-server/ABOUT.txt" ]]; then + rsync -az --ignore-existing --timeout=120 "$ROOT_DIR/SHiNE-server/ABOUT.txt" \ + "$REMOTE_HOST:$REMOTE_SERVER_DIR/ABOUT.txt" +fi ssh "$REMOTE_HOST" "sudo systemctl restart '$REMOTE_SERVICE_NAME'; sudo systemctl --no-pager --full status '$REMOTE_SERVICE_NAME'" echo "Всё хорошо: сервер t2.shineup.me обновлён и сервис $REMOTE_SERVICE_NAME перезапущен" diff --git a/docs/API/05_Technical_Requests_API.md b/docs/API/05_Technical_Requests_API.md index ccdb7aba..ac3c8bdb 100644 --- a/docs/API/05_Technical_Requests_API.md +++ b/docs/API/05_Technical_Requests_API.md @@ -93,6 +93,7 @@ ### Источник данных - `version` берётся из Gradle build и подставляется в `application.properties`; +- `aboutText` читается при каждом запросе из публичного файла `ABOUT.txt` в рабочем каталоге сервера (UTF-8, до 16 КиБ). Это многострочные сведения о владельце конкретного узла, одинаковые для всех языков; подписи интерфейса в файл не включаются. При отсутствии, пустом содержимом, превышении размера или некорректном UTF-8 возвращается пустая строка; - остальные поля читаются из настроек сервера; - если значение в конфиге не задано, сервер возвращает пустую строку. @@ -102,11 +103,12 @@ { "op": "GetServerInfo", "requestId": "srv-001", - "payload": { - } + "payload": {} } ``` +Переданное старым клиентом поле `language` допускается, но не влияет на ответ. + ### Успешный ответ ```json @@ -122,7 +124,8 @@ "description": "Public community SHiNE node", "origin": "Community-operated node", "extraInfo": "IPv4 + IPv6", - "solanaCluster": "devnet" + "solanaCluster": "devnet", + "aboutText": "OpenMindSoft LLC (Georgia)" } } ``` @@ -136,6 +139,7 @@ - `origin` — комментарий о том, какой это сервер. - `extraInfo` — любая дополнительная информация о сервере. - `solanaCluster` — кластер Solana, настроенный для этого экземпляра. +- `aboutText` — публичные сведения о владельце конкретного сервера для раздела «О приложении»; дополнительное поле, старые клиенты могут его игнорировать. Не включать секреты или приватные данные. ### Специфические коды ошибок `GetServerInfo` diff --git a/docs/API/09_Operations_Index.md b/docs/API/09_Operations_Index.md index d8d28961..d5081d87 100644 --- a/docs/API/09_Operations_Index.md +++ b/docs/API/09_Operations_Index.md @@ -57,7 +57,7 @@ | `GetMyBlockchain` | [`20_Get_My_Blockchain_API.md`](20_Get_My_Blockchain_API.md) | постранично читать текущую активную собственную цепочку для аудита и выбора fork point | | `ServerHello` | [`16_Server_Connection_Pool_API.md`](16_Server_Connection_Pool_API.md) | объявление server-to-server соединения и возможностей peer без криптографической проверки | | `Ping` | [`05_Technical_Requests_API.md`](05_Technical_Requests_API.md) | keep-alive | -| `GetServerInfo` | [`05_Technical_Requests_API.md`](05_Technical_Requests_API.md) | публичная информация о сервере | +| `GetServerInfo` | [`05_Technical_Requests_API.md`](05_Technical_Requests_API.md) | публичная информация о сервере, сведения о владельце конкретного узла из ABOUT.txt | | `ListBlockchainHeads` | [`05_Technical_Requests_API.md`](05_Technical_Requests_API.md) | список heads всех локальных блокчейнов | | `SendSignal` | [`05_Technical_Requests_API.md`](05_Technical_Requests_API.md) | общий межсессионный технический сигнал в одну или все сессии пользователя | | `GetCallIceConfig` | [`05_Technical_Requests_API.md`](05_Technical_Requests_API.md) | STUN/TURN конфигурация звонков | @@ -134,3 +134,7 @@ `PAID` применяется и к первоначально платным, и к ранее бесплатным пользователям; `NOT_FOUND` остаётся техническим ответом для отсутствующего логина. Поля сертификата для `FREE_CERT` и остальные поля ответа описаны в профильном контракте регистрации. + +## Специальный WebSocket-регистратор (отдельный обработчик) + +`RegistrarChallenge`, `RegistrarConnect`, `RegistrarSignRegistration`, `RegistrarSignResult` — [контракт аппаратного регистратора 1.0](23_External_Registrar_API.md). Это не обычные операции `JsonHandlerRegistry`; они обслуживаются в `RegistrarSocket`. diff --git a/docs/API/23_External_Registrar_API.md b/docs/API/23_External_Registrar_API.md new file mode 100644 index 00000000..81132481 --- /dev/null +++ b/docs/API/23_External_Registrar_API.md @@ -0,0 +1,33 @@ +# Аппаратный регистратор 1.0 и публичный статус сервера + +Используется существующий `/ws` (production: WSS с проверкой CA и hostname). Операции регистратора обрабатываются непосредственно `RegistrarSocket` в `BlockchainWsEndpoint`, отдельно от `JsonHandlerRegistry`. Роль `AUTH_STATUS_REGISTRAR` изолирована от обычных пользовательских операций. Один активный регистратор на настроенный namespace; новый подключается после закрытия или истечения тайм-аута старого. Ожидание регистрации вынесено из общего WS-пула в отдельный ограниченный пул; ответы ESP обслуживаются независимо. + +## Авторизация + +1. ESP → `{"op":"RegistrarChallenge","requestId":"1","payload":{"namespace":"free"}}`. +2. Server → `status:200`, `payload:{nonce,expiresAtMs,serverLogin}`. Nonce — 32 случайных байта Base64URL без padding, живёт 30 секунд и связан с конкретным WS. +3. ESP подписывает UTF-8 строку `SHINE_REGISTRAR_CONNECT_V1::::` и отправляет `RegistrarConnect` с `payload:{version:"1.0",namespace,timeMs,signatureB64}`. Подпись — стандартный Base64 Ed25519 64 байт; время — Unix ms, допустимое расхождение 60 секунд. Сервер сверяет актуальный `registrar_pubkey`, type=2 и `default_server_login` в синхронизированной Solana БД. Challenge одноразовый. При ошибке авторизации WS закрывается. +4. После `status:200` ESP отправляет стандартный `Ping` каждые 45 секунд, ожидает ответ 10 секунд. Сервер фиксирует активность, после 100 секунд без Ping закрывает WS. ESP переподключается автоматически. Никаких дополнительных heartbeat-операций. + +## Выдача сертификата + +Server → ESP: + +```json +{"op":"RegistrarSignRegistration","requestId":"unique-request-id","payload":{"login":"Example@free","rootPublicKey":"base64-32","blockchainPublicKey":"base64-32","clientPublicKey":"base64-32","emailSha256":"base64-32"}} +``` + +Namespace извлекается из логина; отдельного поля нет. ESP не получает исходный email и не подписывает произвольные bytes. Ответ ESP → Server: + +```json +{"op":"RegistrarSignResult","requestId":"unique-request-id","status":200,"payload":{"dataItemB64":"base64-of-signed-ANS-104"}} +``` + +В случае ошибки `payload:{}` и один из статусов 400 (формат), 403 (namespace), 409 (логин занят другим набором полей), 429 (10 новых сертификатов за последние 5 часов), 500 (SD/подпись), 503 (отключён, пауза, время). Сервер не отвечает на `RegistrarSignResult`. Только ответ от того же авторизованного WS с ожидающим requestId принимается. Сервер ждёт до 25 секунд, при disconnect завершает ожидание 503; поздний ответ игнорируется. Перед публикацией проверяются обе подписи, формат, все поля исходной заявки и действующий namespace. Повтор идентичного запроса возвращает сохранённый DataItem, не расходуя квоту. Данные разных заявок на один логин не переподписываются. + +## Публичный HTTP + +- `GET /status` — HTML, обновляет `/api/status` каждые 60 секунд. +- `GET /api/status` — JSON: `serverVersion`, `serverStatus`, `updatedAtMs`, `registered:{total,free,paid,namespaces:[{namespace,total,free,paid}]}`, `online:{users,sessions}`, `registrar:{mode,namespace,connected}`. + +Агрегаты регистраций берутся из `user_identity_current` и `shine_namespace_current`, включая legacy аккаунты без namespace. `FREE_CERT` — бесплатные, `PAID` — платные (включая upgrade). Кэш DB 10 секунд. Онлайн — уникальные логины и sessionId открытых авторизованных WS конкретного сервера, без регистратора. `connected` означает авторизованный живой WS, не обещает готовность SD или доступную квоту. При отказе БД JSON HTTP 503. Не раскрываются IP, логины, идентификаторы сессий или ключи. Для доступа через reverse proxy нужно направить оба пути в Jetty. diff --git a/docs/API/README.md b/docs/API/README.md index d59cba74..61b31c7b 100644 --- a/docs/API/README.md +++ b/docs/API/README.md @@ -25,6 +25,7 @@ | Публичные файлы и подготовка загрузки в R2 | [публичное файловое хранилище](21_Public_File_Storage_API.md) | R2 — текущий поток; локальный SHA-256 маршрут — legacy | | Зашифрованные DM-файлы | [хранилище файлов DM](18_DM_File_Storage_API.md) | R2 — текущий поток новых DM v3; локальный `/dm-files` — legacy | | Поиск файлового сервера пользователя | [описание маршрута в техническом API](05_Technical_Requests_API.md#http-endpoints) | Используется UI для маршрутизации загрузок | +| Статус сервера и аппаратный регистратор | [регистратор 1.0](23_External_Registrar_API.md) | `/status`, `/api/status`, специальная роль WS | | HTTP debug endpoints | [диагностика WebSocket](22_HTTP_Debug_API.md) | Внутренний диагностический интерфейс | | Solana JSON-RPC gateway | `/solana-rpc` в `SHiNE-server/src/main/java/server/ws/WsServer.java` | Транспортный gateway; контракт Solana JSON-RPC задаёт upstream RPC | diff --git a/docs/Blockchain/10_TECH_Blocks.md b/docs/Blockchain/10_TECH_Blocks.md index cdad6ebe..095169b6 100644 --- a/docs/Blockchain/10_TECH_Blocks.md +++ b/docs/Blockchain/10_TECH_Blocks.md @@ -1,4 +1,4 @@ -# TECH блоки (`type=0`; версия 1, а для HEADER также 2 и 3) +# TECH блоки (`type=0`; версия 1.0) TECH-тип покрывает системные записи. HEADER — без линии; CREATE_CHANNEL и FORK имеют `lineCode=2147483647`, `l=T` в CORE. HEADER является корнем TECH. Порядковый индекс вычисляется сервером. @@ -6,33 +6,9 @@ TECH-тип покрывает системные записи. HEADER — бе ### `subType=0` — `HEADER_COMPAT` -Стартовый блок цепочки (`block #0`). Новый клиент создаёт `HEADER v3`, а старые `HEADER v1/v2` продолжают читаться. +Стартовый блок цепочки (`block #0`). Принимается и создаётся только `HEADER 1.0`. -Формат `HEADER v1`: - -```text -[5] ASCII "SHiNE" -[1] loginLength (uint8) -[N] login UTF-8 -[32] initialBlockchainKey32 -``` - -Формат `HEADER v2`, строго в указанном порядке: - -```text -[5] ASCII "SHiNE" -[1] loginLength (uint8) -[N] login UTF-8 -[1] licenseLength (uint8) -[M] license UTF-8 -[32] initialBlockchainKey32 -``` - -В новом `v2` строка лицензии — произвольный корректный UTF-8 длиной 0–255 **байт**, без обязательного префикса или списка допустимых значений. По умолчанию новый клиент записывает пустую строку до утверждения лицензии. Исторический `v2` с фиксированными 15 байтами ASCII `license:CC0-1.0` без длины по-прежнему читается и сериализуется без изменений. Это отдельное однозначно различимое представление: первый байт `l` (108) не равен длине оставшейся строки (14). - -`HEADER v1` остаётся исторически допустимым и не означает автоматически принятую CC0. Существующие блоки #0 не переписываются. Все новые цепочки создаются с `HEADER v3`. - -Формат `HEADER v3` (BigEndian): +Формат `HEADER 1.0` (BigEndian): ```text [5] ASCII "SHiNE" @@ -47,7 +23,9 @@ TECH-тип покрывает системные записи. HEADER — бе [32] initialBlockchainKey32 ``` -Список 0–10 существующих аккаунтов, без повторов и ссылки на себя (сравнение без регистра). Проверка существования выполняется при новой записи через AddBlock, не при архивном восстановлении. Это публичное заявление, не подтверждение владения; оно не изменяет статус, голоса или доступ прежних аккаунтов. Имя и фамилия необязательны. Тип неизменяем. Новые USER_PARAM `account_role` и `official` запрещены; исторические значения не дают Primary. V1/V2 читаются и восстанавливаются, но не считаются Primary. Производные представления `account_identity_state` и `account_predecessors` используют канонический HEADER; отдельного анализатора нет. +Список 0–10 существующих аккаунтов, без повторов и ссылки на себя (сравнение без регистра). Проверка существования выполняется при новой записи через AddBlock. Это публичное заявление, не подтверждение владения; оно не изменяет статус, голоса или доступ прежних аккаунтов. Имя и фамилия необязательны. Тип неизменяем. Новые USER_PARAM `account_role` и `official` запрещены; исторические значения не дают Primary. Производные представления `account_identity_state` и `account_predecessors` используют канонический HEADER; отдельного анализатора нет. + +Лицензия — произвольная корректная UTF-8 строка длиной 0–255 **байт**; обязательного префикса и списка допустимых значений нет. По умолчанию клиент записывает пустую строку до утверждения лицензии. Поле `login` хранит **точное неизменяемое написание идентичности при регистрации**: для новой регистрации `login@namespace` соответствует `[A-Za-z0-9_]+@[a-z0-9_]+`, длина не более 30 байт. Регистр локальной части сохраняется побайтно из Solana PDA или сертификата Arweave; `@namespace` остаётся строчным. `AlexSmith@shine` и `alexsmith@shine` идентифицируют одного человека (по lower-case), но только первый вариант допустим в его HEADER, если именно так он зарегистрирован. `@` не меняет бинарную структуру HEADER: `[loginLength:uint8][login UTF-8 bytes]`. При следующих fork исходный HEADER остаётся в родительском сегменте. Исторические legacy `[A-Za-z0-9_]+` по-прежнему декодируются, но в новую регистрацию не допускаются. @@ -57,7 +35,7 @@ AddBlock сверяет HEADER #0 с точным именем в `user_identity HEADER CORE не содержит линии, но является root TECH-линии. -После успешной регистрации и автоматического входа клиент вызывает `ensureBlockchainHeader(login, storagePwd)` один раз в общем завершении регистрации (как Solana, так и Arweave). При отсутствии блока №0 клиент создаёт и подписывает HEADER и отправляет его через обычный `AddBlock`. Неудачная отправка **не отменяет** уже подтверждённую регистрацию: существующая логика создания первого пользовательского блока проверит и при необходимости создаст HEADER перед ним. Дополнительной проверки при каждом входе нет. Схема `HEADER v3` допускает произвольную строку лицензии; сетевой API AddBlock не меняется. Выбор типа и списка сохраняется до отправки HEADER, чтобы повтор не изменил заявление. +После успешной регистрации и автоматического входа клиент вызывает `ensureBlockchainHeader(login, storagePwd)` один раз в общем завершении регистрации (как Solana, так и Arweave). При отсутствии блока №0 клиент создаёт и подписывает HEADER и отправляет его через обычный `AddBlock`. Неудачная отправка **не отменяет** уже подтверждённую регистрацию: существующая логика создания первого пользовательского блока проверит и при необходимости создаст HEADER перед ним. Дополнительной проверки при каждом входе нет. Схема `HEADER 1.0` допускает произвольную строку лицензии; сетевой API AddBlock не меняется. Выбор типа и списка сохраняется до отправки HEADER, чтобы повтор не изменил заявление. ### `subType=1` — `TECH_CREATE_CHANNEL` diff --git a/docs/Blockchain/13_CONNECTION_Blocks.md b/docs/Blockchain/13_CONNECTION_Blocks.md index 7979fd41..606e2618 100644 --- a/docs/Blockchain/13_CONNECTION_Blocks.md +++ b/docs/Blockchain/13_CONNECTION_Blocks.md @@ -53,7 +53,7 @@ toBlockHash32=SHA-256(CORE HEADER) CORE имеет подписанный тег `l=C`; CONTENT не имеет поисковых тегов. -## Действующие подтверждения (HEADER V3) +## Действующие подтверждения (HEADER 1.0) `80` — только между разными Primary; `70` — между разными аккаунтами: отправитель обязательно Primary и сияющий, получатель обязательно сияющий (любого типа). При выключении сияния любой стороной подтверждение временно не учитывается; при повторном включении восстанавливается, если остальные условия выполнены. Старые `70/80` остаются в архиве, но в графе/счётчиках учитываются только при выполнении этих правил. `71/81` могут отзывать старое заявление. Формат CONNECTION не менялся. diff --git a/docs/Blockchain/14_USER_PROFILE_Blocks.md b/docs/Blockchain/14_USER_PROFILE_Blocks.md index f48c28db..fe714a99 100644 --- a/docs/Blockchain/14_USER_PROFILE_Blocks.md +++ b/docs/Blockchain/14_USER_PROFILE_Blocks.md @@ -31,7 +31,7 @@ Big-endian: CORE имеет подписанный тег `l=P`; CONTENT не имеет поисковых тегов. -`account_role` / `official` — исторические поля. Новая запись запрещена (в том числе через UpsertUserParam); роль определяется HEADER V3. Сияние (`shine`) остаётся изменяемым. +`account_role` / `official` — исторические поля. Новая запись запрещена (в том числе через UpsertUserParam); роль определяется HEADER 1.0. Сияние (`shine`) остаётся изменяемым. `gender` — отключённый исторический параметр. Новая запись отклоняется (`gender_disabled`), при архивном восстановлении блок сохраняется без применения параметра к действующему профилю. diff --git a/docs/Blockchain/17_ANS104_Arweave_Transport.md b/docs/Blockchain/17_ANS104_Arweave_Transport.md index 901db592..7fbc8942 100644 --- a/docs/Blockchain/17_ANS104_Arweave_Transport.md +++ b/docs/Blockchain/17_ANS104_Arweave_Transport.md @@ -1,10 +1,10 @@ # ANS-104 / Arweave transport -Активный тестовый namespace — `App=test5595` (`CORE_NAMESPACE` в `ShineProtocolTags.java`, `protocol-tags.js`, актуальный Arweave Viewer). Старые константы Frame не определяют активную эпоху. Namespace Solana не меняется автоматически. +Активный тестовый namespace — `App=test5599` (`CORE_NAMESPACE` в `ShineProtocolTags.java`, `protocol-tags.js`, актуальный Arweave Viewer). Старые константы Frame не определяют активную эпоху. Namespace Solana не меняется автоматически. ## Теги -CORE: `App=test5595`, `n=` (каноничная десятичная строка), `l=` только для CORE с линией: `P`, `C`, `T` либо десятичный номер корня канала (включая 0). Проверяется единственное точное значение каждого обязательного тега; `t`/`c` запрещены для CORE. CONTENT не имеет поисковых тегов SHiNE (`App`, `n`, `l`, `t`, `c`). Теги подписаны в ANS-104. Сертификат регистрации — отдельный DataItem с `App=test5595`, `t=reg`, `Protocol=SHiNE-Free-Registration-V1`, не пользовательский блок. +CORE: `App=test5599`, `n=` (каноничная десятичная строка), `l=` только для CORE с линией: `P`, `C`, `T` либо десятичный номер корня канала (включая 0). Проверяется единственное точное значение каждого обязательного тега; `t`/`c` запрещены для CORE. CONTENT не имеет поисковых тегов SHiNE (`App`, `n`, `l`, `t`, `c`). Теги подписаны в ANS-104. Сертификат регистрации — отдельный DataItem с `App=test5599`, `t=reg`, `Protocol=SHiNE-Free-Registration-V1`, не пользовательский блок. ## Режимы публикации diff --git a/docs/Blockchain/21_Block_Creation_and_Validation.md b/docs/Blockchain/21_Block_Creation_and_Validation.md index 67de51fd..92ba5349 100644 --- a/docs/Blockchain/21_Block_Creation_and_Validation.md +++ b/docs/Blockchain/21_Block_Creation_and_Validation.md @@ -41,7 +41,7 @@ coreId = SHA256(coreItem.signature64) ## 3. HEADER и пример линии -Если история отсутствует, создать HEADER V3 (type=0/subType=0/version=3). CORE: номер 0, prevCoreHash=zero32, без линии. Логин, accountType, список прежних аккаунтов при Primary, лицензия и исходный ключ находятся в CONTENT. HEADER служит корнем всех системных линий и канала 0. +Если история отсутствует, создать HEADER 1.0 (type=0/subType=0/version=1). CORE: номер 0, prevCoreHash=zero32, без линии. Логин, accountType, список прежних аккаунтов при Primary, лицензия и исходный ключ находятся в CONTENT. HEADER служит корнем всех системных линий и канала 0. Пример последовательности (H0/H1/H2/H3 — SHA-256 соответствующих CORE; это схема ссылок, не подписанный тестовый вектор): diff --git a/docs/Blockchain/22_Content_Body_Reference.md b/docs/Blockchain/22_Content_Body_Reference.md index d5d29ddc..cfb7198e 100644 --- a/docs/Blockchain/22_Content_Body_Reference.md +++ b/docs/Blockchain/22_Content_Body_Reference.md @@ -17,7 +17,7 @@ compactTarget = i32(toBlockGlobalNumber) || hash32(toBlockHash32) | type | subType | Событие | Линия CORE | Body (в порядке полей) | |---:|---:|---|---|---| -| 0 | 0 | HEADER | нет | HEADER v1/v2/v3 (ниже) | +| 0 | 0 | HEADER | нет | HEADER 1.0 (ниже) | | 0 | 1 | TECH_CREATE_CHANNEL | T | str8(name), str16(description), u16(channelType), u16(channelTypeVersion) | | 0 | 2 | TECH_FORK | T | fork body (ниже) | | 1 | 10 | TEXT_POST | канал | text | @@ -56,19 +56,17 @@ compactTarget = i32(toBlockGlobalNumber) || hash32(toBlockHash32) | 5 | 140 | STATUS_ABANDONED | нет | externalTarget, text | | 5 | 150 | STATUS_COMPLETED | нет | externalTarget, text | -Все version=1, кроме HEADER. CORE с линией — 149 байт, без линии — 109. `T=2147483647`, `C=2147483646`, `P=2147483645`; канал — номер своего root (0 или CREATE_CHANNEL). Неизвестный type/subType/version может быть представлен raw ContentRecord, но не проходит семантический парсинг активного runtime. +Все body имеют version=1 (для HEADER это версия 1.0). CORE с линией — 149 байт, без линии — 109. `T=2147483647`, `C=2147483646`, `P=2147483645`; канал — номер своего root (0 или CREATE_CHANNEL). Неизвестный type/subType/version может быть представлен raw ContentRecord, но не проходит семантический парсинг активного runtime. ## HEADER ```text -v1 = ASCII("SHiNE") || str8(login) || initialBlockchainKey32 -v2 = ASCII("SHiNE") || str8(login) || str8(license) || initialBlockchainKey32 -v3 = ASCII("SHiNE") || str8(login) || u8(accountType) +v1.0 = ASCII("SHiNE") || str8(login) || u8(accountType) || [str16(previousAccountsCsv) if accountType == 1] || str8(license) || initialBlockchainKey32 ``` -V2 имеет отдельное историческое представление ASCII `license:CC0-1.0` без длины. Новая прямая запись требует V3. Alternative=0, Primary=1; список только для Primary (0–10 логинов). Полный набор правил: [TECH](10_TECH_Blocks.md). Не путать HEADER body version с CORE v2. +Принимается только этот layout с body version=1. Лицензия — произвольная UTF-8 строка 0–255 байт. Alternative=0, Primary=1; список только для Primary (0–10 логинов). Полный набор правил: [TECH](10_TECH_Blocks.md). Не путать HEADER body version с версией контейнеров CORE/CONTENT. ## TECH_FORK body diff --git a/docs/Blockchain/CHANGELOG.md b/docs/Blockchain/CHANGELOG.md index 394fe531..9e783f3c 100644 --- a/docs/Blockchain/CHANGELOG.md +++ b/docs/Blockchain/CHANGELOG.md @@ -2,6 +2,12 @@ Записи ниже описывают состояние на указанную дату; старые Frame v1, теги и промежуточные стадии не являются текущей спецификацией. Действующий контракт: [Blockchain](README.md). +## 2026-12-02 — единый HEADER 1.0 + +- Для новых и принимаемых блоков оставлен единственный HEADER layout: body version `1` / публичное название `1.0`. +- Его структура соответствует прежнему расширенному HEADER v3: `accountType`, список прежних аккаунтов Primary, произвольная UTF-8 лицензия и исходный blockchain key. +- HEADER с body versions 2 и 3, а также прежняя короткая структура version 1 больше не принимаются активными server/UI/viewer-парсерами. + ## 2026-12-01 — клиентская публикация блоков - Добавлены серверная очередь публикации, `BlockPublication`, проверка двух DataItem через Turbo API и подтверждение Arweave после сравнения исходных bytes. diff --git a/docs/Blockchain/README.md b/docs/Blockchain/README.md index 275831f0..14942a98 100644 --- a/docs/Blockchain/README.md +++ b/docs/Blockchain/README.md @@ -19,7 +19,7 @@ ## Поток события -Клиент подписывает CONTENT, затем CORE с его хешем и ID; передаёт пару через AddBlock. Сервер проверяет квоту, обе подписи, полномочия, семантику и хвосты, атомарно записывает одну пару и производные индексы. Браузер публикует CONTENT, затем CORE в Turbo; сервер проверяет доступность обеих частей, а другие серверы импортируют полные пары из Arweave. `none` оставляет данные локально; прямой L1 publisher планируется. Хеш истории — SHA-256 CORE, namespace тестовой эпохи — `test5595`. +Клиент подписывает CONTENT, затем CORE с его хешем и ID; передаёт пару через AddBlock. Сервер проверяет квоту, обе подписи, полномочия, семантику и хвосты, атомарно записывает одну пару и производные индексы. Браузер публикует CONTENT, затем CORE в Turbo; сервер проверяет доступность обеих частей, а другие серверы импортируют полные пары из Arweave. `none` оставляет данные локально; прямой L1 publisher планируется. Хеш истории — SHA-256 CORE, namespace тестовой эпохи — `test5599`. Сертификаты `t=reg` — [отдельный протокол](../Протоколы/SHINE_FREE_REGISTRATION_CERTIFICATE_V1.md), не AddBlock. [Регистрация](../registration-v2/README.md). [Правила регистра логина](CASE_INSENSITIVE_LOGIN.md). diff --git a/docs/Blockchain/vectors/core-content-v1.tsv b/docs/Blockchain/vectors/core-content-v1.tsv index 6a34ff7d..67715507 100644 --- a/docs/Blockchain/vectors/core-content-v1.tsv +++ b/docs/Blockchain/vectors/core-content-v1.tsv @@ -1,9 +1,9 @@ name owner core coreHash content contentHash coreItem coreItemId contentItem contentItemId -header 03a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b8 01000000000000000000000000000000000000000000000000000000000000000000000000000000006553f1005fa9a66d8d932f7bcd279dbb9a064202a038b3a76ada549097c1224ae160c98575027d1099f686cc67fc2c1b554df7852c4c8d564cb71e2e21b8949a5e384312 d4e9cb315c9988eaadc9356d467c418a2c07ecd66a2cae0cba02ace302d9c758 010000000000015348694e4505416c69636503a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b8 5fa9a66d8d932f7bcd279dbb9a064202a038b3a76ada549097c1224ae160c985 020055f3883d32d25332bf1f87f516155d03291b8d051fb627daefa33e9fb3a2adb3362a1882b812349094a71dfafca72786aba9e2113f1d39d2335cc9148743970603a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b80000020000000000000013000000000000000406417070107465737435353935026e02300001000000000000000000000000000000000000000000000000000000000000000000000000000000006553f1005fa9a66d8d932f7bcd279dbb9a064202a038b3a76ada549097c1224ae160c98575027d1099f686cc67fc2c1b554df7852c4c8d564cb71e2e21b8949a5e384312 7f4280f81cb8f7d8338fc00184fdd00e1386ae335e690d2e9421d0655ba48b72 0200ec0ca45138cfb8be431a4bae749e302d1fefe6ff4d0d05d1bb2a9dfa1c63a02488cdf67b0fd2669521b88adfd4ea13c859129364cab5616ba8e27c3ee5c49c0503a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b800000000000000000000010000000000000000010000000000015348694e4505416c69636503a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b8 75027d1099f686cc67fc2c1b554df7852c4c8d564cb71e2e21b8949a5e384312 -channel 03a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b8 01d4e9cb315c9988eaadc9356d467c418a2c07ecd66a2cae0cba02ace302d9c75800000001000000006553f101da118ee835b4c1344243254050f566abda2421ffdafa43cecebf1fe32ee0868ce04e40d4b030e6c09e36de77b50fc442a071ced3477b87dfa4304e002f8ca73d7fffffff00000000d4e9cb315c9988eaadc9356d467c418a2c07ecd66a2cae0cba02ace302d9c758 4e02ff8faa792b8955e7e2187aed62a3b21f4ceef25a848d9af564d443a199ce 01000000010001044e657773000000010001 da118ee835b4c1344243254050f566abda2421ffdafa43cecebf1fe32ee0868c 02000fcd18a5076609762a4f23a5c50e0a067e47b5e7d1dd126858cedbc226015163ceb0dc293c175ebc0508213ea02287c5d2142f2a0dbab247c38fffa17ebf540403a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b80000030000000000000017000000000000000606417070107465737435353935026e0231026c02540001d4e9cb315c9988eaadc9356d467c418a2c07ecd66a2cae0cba02ace302d9c75800000001000000006553f101da118ee835b4c1344243254050f566abda2421ffdafa43cecebf1fe32ee0868ce04e40d4b030e6c09e36de77b50fc442a071ced3477b87dfa4304e002f8ca73d7fffffff00000000d4e9cb315c9988eaadc9356d467c418a2c07ecd66a2cae0cba02ace302d9c758 81a994cd58dbab10e0ffadd10294147fb5bced85c08e693a654f1d99f43fb6c7 02008914124304a49b2a176b5e425362b1d1fe516b6b1856adfbe344101d0887fbcb3fd5e8e61e3aef20df9bfa28e5602ce922ed67e35e700c65863cfa3cb2d6d00503a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b80000000000000000000001000000000000000001000000010001044e657773000000010001 e04e40d4b030e6c09e36de77b50fc442a071ced3477b87dfa4304e002f8ca73d -post 03a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b8 014e02ff8faa792b8955e7e2187aed62a3b21f4ceef25a848d9af564d443a199ce00000002000000006553f102a1b12783f0b937540fc6a9e94bb4f09b0aa3adde34e9e51e33495e672c7ad28bd6b4f230ee21cb2adc1618f8cd1f4fbfe63aeef2d66302339ecc653f3aae5f5300000001000000014e02ff8faa792b8955e7e2187aed62a3b21f4ceef25a848d9af564d443a199ce 55b39766f6cacb599e122fb1234612a090f8b67dbd30a94221d5ec673cd00a93 010001000a0001000548656c6c6f a1b12783f0b937540fc6a9e94bb4f09b0aa3adde34e9e51e33495e672c7ad28b 02002a0a0a623ee55165fbf9c4dac545e26a8e8cdc8ac2c7d8c605c9607806ae07ffd7a3caeb049f00c0b41d475dfe109e09a3f5a222842556cc7e28004ec8b3200e03a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b80000030000000000000017000000000000000606417070107465737435353935026e0232026c023100014e02ff8faa792b8955e7e2187aed62a3b21f4ceef25a848d9af564d443a199ce00000002000000006553f102a1b12783f0b937540fc6a9e94bb4f09b0aa3adde34e9e51e33495e672c7ad28bd6b4f230ee21cb2adc1618f8cd1f4fbfe63aeef2d66302339ecc653f3aae5f5300000001000000014e02ff8faa792b8955e7e2187aed62a3b21f4ceef25a848d9af564d443a199ce ed2438ac899b35dce3747f0fe3c04a71a31737d3d97e77d9cd6181c147a8d29d 020077d98c807e66feb411ecaa1e534e29d1bd0c88ea0d8014432cfb0be178302e38124dea3e10b988a5aa4e1e04b9ec75225c3b82d930b420601878116af9e37c0e03a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b800000000000000000000010000000000000000010001000a0001000548656c6c6f d6b4f230ee21cb2adc1618f8cd1f4fbfe63aeef2d66302339ecc653f3aae5f53 -reply 03a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b8 0155b39766f6cacb599e122fb1234612a090f8b67dbd30a94221d5ec673cd00a9300000003000000006553f1037e3d27c291240043c4e3206f14f07e7e2a0ab5813d69708362bab0ac1dcf90809ecbcd365ba18cc052d453a99b887057df811ea0a5ba05c970eaee55e2020fc6 1fe1b80413e409b229fd84b059101dfe92544e2a3e22696f3151f7e74fd39fd8 0100010014000105416c696365000100000002111111111111111111111111111111111111111111111111111111111111111100024869 7e3d27c291240043c4e3206f14f07e7e2a0ab5813d69708362bab0ac1dcf9080 02002a47ad84b951a8fdb490e563996581aee21a4eebd667335ac96b49f2565050a624adfd865904b059fff09edb53497d5a494188eba74ae1fd04a921a2cd13f90c03a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b80000020000000000000013000000000000000406417070107465737435353935026e0233000155b39766f6cacb599e122fb1234612a090f8b67dbd30a94221d5ec673cd00a9300000003000000006553f1037e3d27c291240043c4e3206f14f07e7e2a0ab5813d69708362bab0ac1dcf90809ecbcd365ba18cc052d453a99b887057df811ea0a5ba05c970eaee55e2020fc6 f400835b5e5d0758b13887b427b40478e7492227cc4f07bb0885e80415188d50 02003fbf4abf4ac5075d959c4918dbb1a156691d5d8268094596d0d5faa175a92d9c52801a4742c833d711296a402aa48961d17975c0e6792dd38a0da548c0e7240703a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b8000000000000000000000100000000000000000100010014000105416c696365000100000002111111111111111111111111111111111111111111111111111111111111111100024869 9ecbcd365ba18cc052d453a99b887057df811ea0a5ba05c970eaee55e2020fc6 -profile 03a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b8 011fe1b80413e409b229fd84b059101dfe92544e2a3e22696f3151f7e74fd39fd800000004000000006553f104b338eab66c69e43c1fa13e96307b92493a85d512d50a93079d578c686a48cc54ac7587e5fa28fc42a4c946d4cf42e7c63a13e6eee836c98f9994c5d88efeb3857ffffffd00000000d4e9cb315c9988eaadc9356d467c418a2c07ecd66a2cae0cba02ace302d9c758 d46ec507d8c38c42dc17f53148912747d133c115d0040c0af18f154c058a0e87 0100040001000100046e616d650005416c696365 b338eab66c69e43c1fa13e96307b92493a85d512d50a93079d578c686a48cc54 0200736a9c01fe383c8383d93798c65558929d8bea8a5ce216b7a4d6789e6e58394e2f629fd8ce0d09f211b708d765b50fbfaa1a19eae5ff6d1e012027601e447d0903a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b80000030000000000000017000000000000000606417070107465737435353935026e0234026c025000011fe1b80413e409b229fd84b059101dfe92544e2a3e22696f3151f7e74fd39fd800000004000000006553f104b338eab66c69e43c1fa13e96307b92493a85d512d50a93079d578c686a48cc54ac7587e5fa28fc42a4c946d4cf42e7c63a13e6eee836c98f9994c5d88efeb3857ffffffd00000000d4e9cb315c9988eaadc9356d467c418a2c07ecd66a2cae0cba02ace302d9c758 d5f6a51757093276f91debb4443f501d4a39b3a80df6b9bf3fe901e21b1360a9 020020a99cd1c10b15542f37cae6cdf474468f9ea00246ec3281a39e8aafd8b743adf338a7730f4a2f774576e70d56387f63e79ccd6160f6ce67361a697fe808380503a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b8000000000000000000000100000000000000000100040001000100046e616d650005416c696365 ac7587e5fa28fc42a4c946d4cf42e7c63a13e6eee836c98f9994c5d88efeb385 -connection 03a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b8 01d46ec507d8c38c42dc17f53148912747d133c115d0040c0af18f154c058a0e8700000005000000006553f105950d3042460649d01e6e29412b5aeb7c9f3e6828dd19f7b8080bf43bebd4a2be72f7b2cb07200a6b0f93e26570de5ea52b5c523a978a0b5f959d4c6345ecf0637ffffffe00000000d4e9cb315c9988eaadc9356d467c418a2c07ecd66a2cae0cba02ace302d9c758 0b6581ea323167e05460ee339d3ebe2c99d38b8e180642f888d8597b22d1a025 010003000e000105416c6963650001000000001111111111111111111111111111111111111111111111111111111111111111 950d3042460649d01e6e29412b5aeb7c9f3e6828dd19f7b8080bf43bebd4a2be 0200507df9eb5fd689c40a93f20e0dbb8dc63e6578719d53e215335bfed75bd301692adfeb294108b1a80655b7fa41cd997f2a6a3d127f138d0acd3d340f95dc9e0303a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b80000030000000000000017000000000000000606417070107465737435353935026e0235026c02430001d46ec507d8c38c42dc17f53148912747d133c115d0040c0af18f154c058a0e8700000005000000006553f105950d3042460649d01e6e29412b5aeb7c9f3e6828dd19f7b8080bf43bebd4a2be72f7b2cb07200a6b0f93e26570de5ea52b5c523a978a0b5f959d4c6345ecf0637ffffffe00000000d4e9cb315c9988eaadc9356d467c418a2c07ecd66a2cae0cba02ace302d9c758 96b413e094aadb202dceb022374591c090e04351becd2472ef18831674f4685b 020005d1b7413b55a959a850d83714939716742dd614f668906c84f00b4ab7a2feb5a5fbfe0ed9bdf9e329aef129538d36167c6e09e86d101f987e83f7729de01d0803a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b800000000000000000000010000000000000000010003000e000105416c6963650001000000001111111111111111111111111111111111111111111111111111111111111111 72f7b2cb07200a6b0f93e26570de5ea52b5c523a978a0b5f959d4c6345ecf063 -default 03a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b8 010b6581ea323167e05460ee339d3ebe2c99d38b8e180642f888d8597b22d1a02500000006000000006553f1061a43385479db2ad171f01d966e2cad04f52846af7aee945c4393e919fb5b8e2dfd82e56fcbf5d954941e3aec421bd555e97832ecafd43abf36ff7a7c157634830000000000000000d4e9cb315c9988eaadc9356d467c418a2c07ecd66a2cae0cba02ace302d9c758 197e2a8c493cbfcfbc9032f7dcf82a5c2d847c2d83814437a73c7bb2e9aa1b8b 010001000a00010004486f6d65 1a43385479db2ad171f01d966e2cad04f52846af7aee945c4393e919fb5b8e2d 0200c7775914a9b2f81abf4e8c4002785ff3a2903e8852688aa03dd1c9ad8fd9b44adb14b7f0c55795eb91e3a9069520b18611f79d54b51e1475944975c294cd010803a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b80000030000000000000017000000000000000606417070107465737435353935026e0236026c023000010b6581ea323167e05460ee339d3ebe2c99d38b8e180642f888d8597b22d1a02500000006000000006553f1061a43385479db2ad171f01d966e2cad04f52846af7aee945c4393e919fb5b8e2dfd82e56fcbf5d954941e3aec421bd555e97832ecafd43abf36ff7a7c157634830000000000000000d4e9cb315c9988eaadc9356d467c418a2c07ecd66a2cae0cba02ace302d9c758 b62729b36b55afd5d6301dd067e7ecbef0aa4339d7207bfd11a4ff471ea2f2f5 0200050ccf27a7afa2ecd8b9d3893025aa4ddd3cee6ce2fbeab578cf077eef95cfd4e1902a84071a0697c87e5535b93641a3c2d77823fbbe396a022459443fecf00403a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b800000000000000000000010000000000000000010001000a00010004486f6d65 fd82e56fcbf5d954941e3aec421bd555e97832ecafd43abf36ff7a7c15763483 -post2 03a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b8 01197e2a8c493cbfcfbc9032f7dcf82a5c2d847c2d83814437a73c7bb2e9aa1b8b00000007000000006553f1075cb1ba6fd9ca7e7bf7d0dace4f5f9e39b1041c37a1c82573429ed8d428927af09d0aa699d09f58b6abb0c9f7eaa1d3aea6cc981268998bb7f4b905bdf64c24fb000000010000000255b39766f6cacb599e122fb1234612a090f8b67dbd30a94221d5ec673cd00a93 2ec125026627e1f73cb854ece546613dfee1f6d1bb0e02f71ee8d215fdca51d8 010001000a00010005416761696e 5cb1ba6fd9ca7e7bf7d0dace4f5f9e39b1041c37a1c82573429ed8d428927af0 02008157ed9b3310905a85a04e0986d88bdec7bdf8616a7df5cab8ec3240d94ac2d9ca29c76d75da47017ddacae72bc76a8fb2252c8dae58f46fed0a41552c3e6f0803a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b80000030000000000000017000000000000000606417070107465737435353935026e0237026c02310001197e2a8c493cbfcfbc9032f7dcf82a5c2d847c2d83814437a73c7bb2e9aa1b8b00000007000000006553f1075cb1ba6fd9ca7e7bf7d0dace4f5f9e39b1041c37a1c82573429ed8d428927af09d0aa699d09f58b6abb0c9f7eaa1d3aea6cc981268998bb7f4b905bdf64c24fb000000010000000255b39766f6cacb599e122fb1234612a090f8b67dbd30a94221d5ec673cd00a93 4a9488975b0a85a542c51d239d2b84239511518a9d5ae5337aa33a5019015422 02007d03c7259593e93a05cae5d55c4d57f68549cd4268e2ba1177a6f743534d9a5eb06f23b5ff3191afc0df5c025446db6d696c81378a65c0079a983d4b8fa1380103a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b800000000000000000000010000000000000000010001000a00010005416761696e 9d0aa699d09f58b6abb0c9f7eaa1d3aea6cc981268998bb7f4b905bdf64c24fb +header 03a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b8 01000000000000000000000000000000000000000000000000000000000000000000000000000000006553f100f96dc9bd4b1439010365dfbeb6f6f3832fa4aef2bd99bceb7776a79d7322e7c505ac3b7081592720043cee57fafae2514e3e1cc5424e3d41283fb2becdbcb2e6 40445a1b15c3791576f2f0b6c4f24899e9ffe461481421960540461eccfd8292 010000000000015348694e4505416c6963650100000003a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b8 f96dc9bd4b1439010365dfbeb6f6f3832fa4aef2bd99bceb7776a79d7322e7c5 02008ceec1236c8877fe0f3375bee5e3e102d22f7bb8173eed55ac863d24326e9a1d159a5b3c54e5efee4f1d6b33896d0e6e0b83a504e18f8ffd8bdc10c8bdbe260803a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b80000020000000000000013000000000000000406417070107465737435353939026e02300001000000000000000000000000000000000000000000000000000000000000000000000000000000006553f100f96dc9bd4b1439010365dfbeb6f6f3832fa4aef2bd99bceb7776a79d7322e7c505ac3b7081592720043cee57fafae2514e3e1cc5424e3d41283fb2becdbcb2e6 3e1a9e57ab7170e9ecb3e3725f04ea499b9b128cc910769580d02888ae6e862e 0200b4bbc4180fe6558c01bd46e6d555dac7e03ceab04d92596a5dfaaff42cf132a9231f55ffd30e1e39cd4b8d0d15ace25ae0790e65ed637514d069b973ae72710003a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b800000000000000000000010000000000000000010000000000015348694e4505416c6963650100000003a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b8 05ac3b7081592720043cee57fafae2514e3e1cc5424e3d41283fb2becdbcb2e6 +channel 03a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b8 0140445a1b15c3791576f2f0b6c4f24899e9ffe461481421960540461eccfd829200000001000000006553f101da118ee835b4c1344243254050f566abda2421ffdafa43cecebf1fe32ee0868ce04e40d4b030e6c09e36de77b50fc442a071ced3477b87dfa4304e002f8ca73d7fffffff0000000040445a1b15c3791576f2f0b6c4f24899e9ffe461481421960540461eccfd8292 abe349b0244fb22ac8255b4515a8b78dccbbe6a5bd092a1220bd0fb93d73c34e 01000000010001044e657773000000010001 da118ee835b4c1344243254050f566abda2421ffdafa43cecebf1fe32ee0868c 0200c316ed6b9b7d376f634bb8c5f53507cdbcc0eea417684a5daaac7e8e720837fd99c74e650fadcfe6b114ad2cc9ee2fb6b358ff1af6680361ff9ff4bc2332330d03a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b80000030000000000000017000000000000000606417070107465737435353939026e0231026c0254000140445a1b15c3791576f2f0b6c4f24899e9ffe461481421960540461eccfd829200000001000000006553f101da118ee835b4c1344243254050f566abda2421ffdafa43cecebf1fe32ee0868ce04e40d4b030e6c09e36de77b50fc442a071ced3477b87dfa4304e002f8ca73d7fffffff0000000040445a1b15c3791576f2f0b6c4f24899e9ffe461481421960540461eccfd8292 97e6d948468673eceece53938181a61b439475c5a739242e0fa7d4a648444269 02008914124304a49b2a176b5e425362b1d1fe516b6b1856adfbe344101d0887fbcb3fd5e8e61e3aef20df9bfa28e5602ce922ed67e35e700c65863cfa3cb2d6d00503a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b80000000000000000000001000000000000000001000000010001044e657773000000010001 e04e40d4b030e6c09e36de77b50fc442a071ced3477b87dfa4304e002f8ca73d +post 03a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b8 01abe349b0244fb22ac8255b4515a8b78dccbbe6a5bd092a1220bd0fb93d73c34e00000002000000006553f102a1b12783f0b937540fc6a9e94bb4f09b0aa3adde34e9e51e33495e672c7ad28bd6b4f230ee21cb2adc1618f8cd1f4fbfe63aeef2d66302339ecc653f3aae5f530000000100000001abe349b0244fb22ac8255b4515a8b78dccbbe6a5bd092a1220bd0fb93d73c34e b59e0c2acf49db6acade80104090911c028cc1b51693ba57a9d1beb84a0823c9 010001000a0001000548656c6c6f a1b12783f0b937540fc6a9e94bb4f09b0aa3adde34e9e51e33495e672c7ad28b 020037f989fd82b1c33384c8457edd764be2dd5165d59f60fc23067a91033ee186b9c5cfaa30dd513f050a21b38199a4a3ec635cc2286eca546c4d8602aa8bd48e0403a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b80000030000000000000017000000000000000606417070107465737435353939026e0232026c02310001abe349b0244fb22ac8255b4515a8b78dccbbe6a5bd092a1220bd0fb93d73c34e00000002000000006553f102a1b12783f0b937540fc6a9e94bb4f09b0aa3adde34e9e51e33495e672c7ad28bd6b4f230ee21cb2adc1618f8cd1f4fbfe63aeef2d66302339ecc653f3aae5f530000000100000001abe349b0244fb22ac8255b4515a8b78dccbbe6a5bd092a1220bd0fb93d73c34e cc01688faae95862efe0237c05eaf58297e8e907771314567e42d0aded7ad7f3 020077d98c807e66feb411ecaa1e534e29d1bd0c88ea0d8014432cfb0be178302e38124dea3e10b988a5aa4e1e04b9ec75225c3b82d930b420601878116af9e37c0e03a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b800000000000000000000010000000000000000010001000a0001000548656c6c6f d6b4f230ee21cb2adc1618f8cd1f4fbfe63aeef2d66302339ecc653f3aae5f53 +reply 03a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b8 01b59e0c2acf49db6acade80104090911c028cc1b51693ba57a9d1beb84a0823c900000003000000006553f1037e3d27c291240043c4e3206f14f07e7e2a0ab5813d69708362bab0ac1dcf90809ecbcd365ba18cc052d453a99b887057df811ea0a5ba05c970eaee55e2020fc6 b3e5e31c160894a7b79e6f1a0c4385d25e131e3228d20cedf299b7e83f1b07ed 0100010014000105416c696365000100000002111111111111111111111111111111111111111111111111111111111111111100024869 7e3d27c291240043c4e3206f14f07e7e2a0ab5813d69708362bab0ac1dcf9080 0200962dde4e638c41117a8d665eac9a136c354af8a2bf3e349a6562e432320cc1c4a9ffe1bb83199e7e33dd756e8a14b9861cafdede880506c02382519a3f6f850403a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b80000020000000000000013000000000000000406417070107465737435353939026e02330001b59e0c2acf49db6acade80104090911c028cc1b51693ba57a9d1beb84a0823c900000003000000006553f1037e3d27c291240043c4e3206f14f07e7e2a0ab5813d69708362bab0ac1dcf90809ecbcd365ba18cc052d453a99b887057df811ea0a5ba05c970eaee55e2020fc6 7535bc1244a4c2064360a93731ea8db3344b5e0f623361452811edf6b085a867 02003fbf4abf4ac5075d959c4918dbb1a156691d5d8268094596d0d5faa175a92d9c52801a4742c833d711296a402aa48961d17975c0e6792dd38a0da548c0e7240703a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b8000000000000000000000100000000000000000100010014000105416c696365000100000002111111111111111111111111111111111111111111111111111111111111111100024869 9ecbcd365ba18cc052d453a99b887057df811ea0a5ba05c970eaee55e2020fc6 +profile 03a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b8 01b3e5e31c160894a7b79e6f1a0c4385d25e131e3228d20cedf299b7e83f1b07ed00000004000000006553f104b338eab66c69e43c1fa13e96307b92493a85d512d50a93079d578c686a48cc54ac7587e5fa28fc42a4c946d4cf42e7c63a13e6eee836c98f9994c5d88efeb3857ffffffd0000000040445a1b15c3791576f2f0b6c4f24899e9ffe461481421960540461eccfd8292 1e0040683f86f946ea1f210cb5a8c8d7dc72f8b97b8b842d9e769fd9777f5f67 0100040001000100046e616d650005416c696365 b338eab66c69e43c1fa13e96307b92493a85d512d50a93079d578c686a48cc54 02002fc0906f2a73de0fdb82e06dc83c522821a6019181b238203a95629d781d69bd091574277e1e788a7a3ba1a1829205b647ae7993616ad6c1f5080e7b0c9de30103a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b80000030000000000000017000000000000000606417070107465737435353939026e0234026c02500001b3e5e31c160894a7b79e6f1a0c4385d25e131e3228d20cedf299b7e83f1b07ed00000004000000006553f104b338eab66c69e43c1fa13e96307b92493a85d512d50a93079d578c686a48cc54ac7587e5fa28fc42a4c946d4cf42e7c63a13e6eee836c98f9994c5d88efeb3857ffffffd0000000040445a1b15c3791576f2f0b6c4f24899e9ffe461481421960540461eccfd8292 437cfdbf4346854926e213d5268497101135742dcf82b421bb9b96939c438ae7 020020a99cd1c10b15542f37cae6cdf474468f9ea00246ec3281a39e8aafd8b743adf338a7730f4a2f774576e70d56387f63e79ccd6160f6ce67361a697fe808380503a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b8000000000000000000000100000000000000000100040001000100046e616d650005416c696365 ac7587e5fa28fc42a4c946d4cf42e7c63a13e6eee836c98f9994c5d88efeb385 +connection 03a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b8 011e0040683f86f946ea1f210cb5a8c8d7dc72f8b97b8b842d9e769fd9777f5f6700000005000000006553f105950d3042460649d01e6e29412b5aeb7c9f3e6828dd19f7b8080bf43bebd4a2be72f7b2cb07200a6b0f93e26570de5ea52b5c523a978a0b5f959d4c6345ecf0637ffffffe0000000040445a1b15c3791576f2f0b6c4f24899e9ffe461481421960540461eccfd8292 73041b2802830761424341e827b555c877cddf9f36abe56d6c2e674374a58e36 010003000e000105416c6963650001000000001111111111111111111111111111111111111111111111111111111111111111 950d3042460649d01e6e29412b5aeb7c9f3e6828dd19f7b8080bf43bebd4a2be 0200d519670a3144aeb8c450abe8bc4095189a40ae00111dbf779dc6df2c4676a2ba269ce36bc51b40226f9e50009325f110ad0b7936ab9a0a906dd120c36bbb170903a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b80000030000000000000017000000000000000606417070107465737435353939026e0235026c024300011e0040683f86f946ea1f210cb5a8c8d7dc72f8b97b8b842d9e769fd9777f5f6700000005000000006553f105950d3042460649d01e6e29412b5aeb7c9f3e6828dd19f7b8080bf43bebd4a2be72f7b2cb07200a6b0f93e26570de5ea52b5c523a978a0b5f959d4c6345ecf0637ffffffe0000000040445a1b15c3791576f2f0b6c4f24899e9ffe461481421960540461eccfd8292 6995d8e432e32aa32c335b55d8cb0d9965fb12f5b845bcdd3488737e2a8a598e 020005d1b7413b55a959a850d83714939716742dd614f668906c84f00b4ab7a2feb5a5fbfe0ed9bdf9e329aef129538d36167c6e09e86d101f987e83f7729de01d0803a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b800000000000000000000010000000000000000010003000e000105416c6963650001000000001111111111111111111111111111111111111111111111111111111111111111 72f7b2cb07200a6b0f93e26570de5ea52b5c523a978a0b5f959d4c6345ecf063 +default 03a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b8 0173041b2802830761424341e827b555c877cddf9f36abe56d6c2e674374a58e3600000006000000006553f1061a43385479db2ad171f01d966e2cad04f52846af7aee945c4393e919fb5b8e2dfd82e56fcbf5d954941e3aec421bd555e97832ecafd43abf36ff7a7c15763483000000000000000040445a1b15c3791576f2f0b6c4f24899e9ffe461481421960540461eccfd8292 8e480cc70d4f872e03aab2dde1f2f8c9131787ba0ba9475348866420da2da6f0 010001000a00010004486f6d65 1a43385479db2ad171f01d966e2cad04f52846af7aee945c4393e919fb5b8e2d 0200c61f724dc0bfbd5cdd0590994bfa9ac9262bcf1224c18cde04398b4a286e6d610dfc930a53289a5d7b9b9d7f46e65e3eb9a4cb12af0da8140f22f44357db100703a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b80000030000000000000017000000000000000606417070107465737435353939026e0236026c0230000173041b2802830761424341e827b555c877cddf9f36abe56d6c2e674374a58e3600000006000000006553f1061a43385479db2ad171f01d966e2cad04f52846af7aee945c4393e919fb5b8e2dfd82e56fcbf5d954941e3aec421bd555e97832ecafd43abf36ff7a7c15763483000000000000000040445a1b15c3791576f2f0b6c4f24899e9ffe461481421960540461eccfd8292 4f0da033c2b1c9eb177a84271629ad665557989a5a5c18675817f8b0b1505aab 0200050ccf27a7afa2ecd8b9d3893025aa4ddd3cee6ce2fbeab578cf077eef95cfd4e1902a84071a0697c87e5535b93641a3c2d77823fbbe396a022459443fecf00403a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b800000000000000000000010000000000000000010001000a00010004486f6d65 fd82e56fcbf5d954941e3aec421bd555e97832ecafd43abf36ff7a7c15763483 +post2 03a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b8 018e480cc70d4f872e03aab2dde1f2f8c9131787ba0ba9475348866420da2da6f000000007000000006553f1075cb1ba6fd9ca7e7bf7d0dace4f5f9e39b1041c37a1c82573429ed8d428927af09d0aa699d09f58b6abb0c9f7eaa1d3aea6cc981268998bb7f4b905bdf64c24fb0000000100000002b59e0c2acf49db6acade80104090911c028cc1b51693ba57a9d1beb84a0823c9 6f68ebabe6b68a4a8f8118cb26e9ed1cf0f75b4d5f384c00c6702d99eebfd740 010001000a00010005416761696e 5cb1ba6fd9ca7e7bf7d0dace4f5f9e39b1041c37a1c82573429ed8d428927af0 02003a2cf0018c090d022f7dab822a545deb76c7cc6a28ef0580994bffd90cf5410a843461a39305a140d85403b0f2256735e673f1c442e4344d8bea6f6308875e0d03a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b80000030000000000000017000000000000000606417070107465737435353939026e0237026c023100018e480cc70d4f872e03aab2dde1f2f8c9131787ba0ba9475348866420da2da6f000000007000000006553f1075cb1ba6fd9ca7e7bf7d0dace4f5f9e39b1041c37a1c82573429ed8d428927af09d0aa699d09f58b6abb0c9f7eaa1d3aea6cc981268998bb7f4b905bdf64c24fb0000000100000002b59e0c2acf49db6acade80104090911c028cc1b51693ba57a9d1beb84a0823c9 e4d7d2142671f7c74695891a028f18266d2bab6a676cef0f887ee4289e238590 02007d03c7259593e93a05cae5d55c4d57f68549cd4268e2ba1177a6f743534d9a5eb06f23b5ff3191afc0df5c025446db6d696c81378a65c0079a983d4b8fa1380103a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b800000000000000000000010000000000000000010001000a00010005416761696e 9d0aa699d09f58b6abb0c9f7eaa1d3aea6cc981268998bb7f4b905bdf64c24fb diff --git a/docs/Blockchain/vectors/generate_core_content_vectors.py b/docs/Blockchain/vectors/generate_core_content_vectors.py index 854f41e5..c38ec8ba 100644 --- a/docs/Blockchain/vectors/generate_core_content_vectors.py +++ b/docs/Blockchain/vectors/generate_core_content_vectors.py @@ -21,10 +21,10 @@ seed=bytes(range(32)); key=Ed25519PrivateKey.from_private_bytes(seed); owner=key def item(payload,tags): raw=tagsraw(tags); sig=key.sign(deep([b'dataitem',b'1',b'2',owner,b'',b'',raw,payload])); return struct.pack('BHHH',1,t,s,1)+body; ci,cid=item(content,[]) - core=struct.pack('>B32siq32s32s',1,prev,n,ts,sha(content),cid); tags=[('App','test5595'),('n',str(n))] + core=struct.pack('>B32siq32s32s',1,prev,n,ts,sha(content),cid); tags=[('App','test5599'),('n',str(n))] if lc is not None: ln,lh=last.get(lc,channel if lc==1 else root) core+=struct.pack('>ii32s',lc,ln,lh); tags.append(('l',{2147483645:'P',2147483646:'C',2147483647:'T'}.get(lc,str(lc)))) diff --git a/docs/Solana_Architecture/README.md b/docs/Solana_Architecture/README.md index ad070c25..6a21c197 100644 --- a/docs/Solana_Architecture/README.md +++ b/docs/Solana_Architecture/README.md @@ -38,7 +38,7 @@ DAO в текущем виде не является отдельной Anchor- | --- | --- | --- | --- | | 1 | `shine_login_guard` | `classify_login` | Временная on-chain проверка логина перед регистрацией. | | 2 | `shine_users` | `init_users_economy_config`, `update_users_economy_config`, `create_namespace`, `create_user_pda`, `update_user_pda`, `close_legacy_user_pda` | Namespace, регистрация, обновление записи и комиссия изменения PDA. | -| 3 | `shine_payments` | `init`, `update_coef_limit`, `grant_manager_limits`, `buy_ticket`, `buy_ticket_usd`, `buy_ticket_sol`, `manager_add_ticket`, `step_payout`, `change_ticket_recipient` | Vault, билеты, очереди, выплаты, DAO-настройки, лимиты менеджеров. | +| 3 | `shine_payments` | `init`, `update_coef_limit`, `grant_manager_limits`, `update_dao_treasury`, `buy_ticket`, `buy_ticket_usd`, `buy_ticket_sol`, `manager_add_ticket`, `step_payout`, `change_ticket_recipient` | Vault, билеты, очереди, выплаты, DAO-настройки, лимиты менеджеров. | | DAO | governance/authority | Вызовы через governance и управляющие ключи | Управление правами, казной, настройками и будущими обновлениями программ. | ## Актуальные program id @@ -68,12 +68,12 @@ Program ID в этом checkout заданы в `Anchor.toml` и `declare_id!` 2. `key_2` / authority программы `shine_users`. - Отвечает за деплой/upgrade второй программы. - - Защищенное обновление economy-конфига в коде уже проверяет `DAO_AUTHORITY`. + - Защищенное обновление economy-конфига в коде проверяет текущую upgrade authority ProgramData. - В целевой модели upgrade-authority второй программы нужно передать DAO. 3. `key_3` / authority программы `shine_payments`. - Отвечает за деплой/upgrade третьей программы. - - Защищенные методы `update_coef_limit` и `grant_manager_limits` проверяют `dao_wallet` из `ConfigState`. + - Защищенные методы `update_coef_limit`, `grant_manager_limits` и `update_dao_treasury` проверяют текущую upgrade authority ProgramData этой программы. - В целевой модели upgrade-authority третьей программы нужно передать DAO. 4. DAO-ключи. @@ -97,7 +97,7 @@ Program ID в этом checkout заданы в `Anchor.toml` и `declare_id!` - `users_economy_config_pda` — комиссия изменения PDA (economy v2). 2. `shine_payments` - - `config_pda` — хранит `dao_wallet` и адрес `inflow_vault`. + - `config_pda` — хранит `dao_treasury` и адрес `inflow_vault`. - `coef_limit_pda` — хранит коэффициент выплат, лимит очереди и награду вызывающему `step_payout`. - `queues_pda` — агрегаты очередей выплат. - `inflow_vault_pda` — PDA-вольт, куда `shine_users` переводит остаток оплаты регистрации и комиссию обновления PDA. @@ -105,7 +105,7 @@ Program ID в этом checkout заданы в `Anchor.toml` и `declare_id!` - `manager_allowance_pda` — PDA лимитов конкретного менеджера. 3. DAO - - `dao_wallet` / treasury — казна DAO. + - `dao_treasury` — native treasury DAO, задаваемая для конкретного кластера в `config_pda`. - governance-аккаунты DAO — realm, governance, proposal/vote records и связанные аккаунты SPL Governance, если используется эта модель. ## Правило разделения с основным сервером @@ -129,14 +129,14 @@ Solana-модуль лежит в основном репозитории как 3. Покупка тикета через `shine_payments::buy_ticket*`. - Платит покупатель. - - Деньги сразу идут в `dao_wallet`. + - Деньги сразу идут в `dao_treasury` из Config PDA. - Одновременно создается тикет на выплату. 4. Выплата через `shine_payments::step_payout`. - Вызвать может любой подписант. - Деньги берутся из `inflow_vault_pda`. - Часть идет получателю тикета. - - Часть идет в `dao_wallet`. + - Часть идет в `dao_treasury`. - Небольшая награда идет вызвавшему шаг выплат. - Если очереди пустые, весь доступный остаток `inflow_vault_pda` переводится в DAO. @@ -153,7 +153,7 @@ Solana-модуль лежит в основном репозитории как - Upgrade-authority программы после проверки можно передать DAO. 3. `shine_payments` - - DAO уже управляет настройками выплат и лимитами менеджеров через `dao_wallet`. + - Настройками выплат, лимитами менеджеров и адресом казны управляет текущая upgrade authority; после её передачи governance PDA это делает DAO. - Upgrade-authority программы после проверки можно передать DAO. 4. DAO diff --git a/docs/Solana_Architecture/details/accounts_and_money_flow.md b/docs/Solana_Architecture/details/accounts_and_money_flow.md index c8cfb071..89847a32 100644 --- a/docs/Solana_Architecture/details/accounts_and_money_flow.md +++ b/docs/Solana_Architecture/details/accounts_and_money_flow.md @@ -15,8 +15,8 @@ 1. `key_1` — deploy/upgrade authority `shine_login_guard`. 2. `key_2` — deploy/upgrade authority `shine_users`. 3. `key_3` — deploy/upgrade authority `shine_payments`. -4. `DAO_AUTHORITY` — адрес, который имеет право менять защищенные настройки. -5. `DAO_TREASURY_WALLET` / `dao_wallet` — казна DAO. +4. `upgrade_authority` ProgramData `shine_payments` — адрес, который имеет право менять защищенные настройки и `dao_treasury`. +5. `DAO_TREASURY_WALLET` / `dao_treasury` — казна DAO, получатель доходов программы. 6. `manager_wallet` — кошелек менеджера, которому DAO выдает лимиты на создание тикетов. 7. `user root_key` — корневой ключ пользователя для подписи пользовательской записи. 8. `user client_key` — ключ устройства пользователя. @@ -29,8 +29,8 @@ Program ID сверяйте с `Anchor.toml` и `declare_id!` в исходни | `SHINE_LOGIN_GUARD_PROGRAM_ID` | `SHiGxGsXGioQYCYhchQ5R7KWoxN5UjFAFsucPf6sfnh` | | `SHINE_USERS_PROGRAM_ID` | `SHiNEPr1APdAgNBteUyBXcNovaHctpSjUu8oH2ZJdN6` | | `SHINE_PAYMENTS_PROGRAM_ID` | `SHiPmXbM9Fs9khzRUW3TGKsS2W84aqaXTxs3ZkajW9v` | -| `DAO_AUTHORITY` | `aiShm43fZjm3YkMs22sYL1bpXaL3bVxv7SSraPHzVgq` | -| `DAO_TREASURY_WALLET` | `aiShm43fZjm3YkMs22sYL1bpXaL3bVxv7SSraPHzVgq` | +| `upgrade_authority` (проверять по ProgramData) | текущий адрес ProgramData `shine_payments`; после передачи — governance PDA DAO | +| `DAO_TREASURY_WALLET` (mainnet target) | `AcJRevXj3Yux2ecxXromMwwxEpPBz6AN53hH6KdqWJ9A` | ## Постоянные PDA @@ -74,7 +74,7 @@ user signer -> shine_users::update_user_pda -> shine_payments::inflow_vault_pda ### Покупка тикета ```text -buyer signer -> shine_payments::buy_ticket* -> dao_wallet +buyer signer -> shine_payments::buy_ticket* -> dao_treasury ``` При этом создается `ticket_pda`, но деньги в `inflow_vault_pda` на этом шаге не идут. @@ -83,14 +83,14 @@ buyer signer -> shine_payments::buy_ticket* -> dao_wallet ```text shine_payments::inflow_vault_pda -> ticket_recipient_wallet -shine_payments::inflow_vault_pda -> dao_wallet +shine_payments::inflow_vault_pda -> dao_treasury shine_payments::inflow_vault_pda -> step_payout caller ``` Если очереди пустые: ```text -shine_payments::inflow_vault_pda -> dao_wallet +shine_payments::inflow_vault_pda -> dao_treasury ``` ## Что нужно создать на старте diff --git a/docs/Solana_Architecture/details/shine_dao.md b/docs/Solana_Architecture/details/shine_dao.md index ce8ea982..48a29afa 100644 --- a/docs/Solana_Architecture/details/shine_dao.md +++ b/docs/Solana_Architecture/details/shine_dao.md @@ -7,7 +7,7 @@ DAO — управляющий слой Solana-части SHiNE. В текуще ## Что DAO должно уметь 1. Управлять казной. - - Принимать средства на `dao_wallet`. + - Принимать средства на `dao_treasury`. - Выплачивать средства со счета DAO по решениям голосования. 2. Управлять настройками `shine_users`. @@ -40,22 +40,21 @@ DAO — управляющий слой Solana-части SHiNE. В текуще ## Текущие адреса управления -В общем deploy-конфиге сейчас есть два важных адреса: +Для `shine_payments` важно разделять две роли: -- `DAO_AUTHORITY` — используется `shine_users` для проверки права менять economy-конфиг. -- `DAO_TREASURY_WALLET` — используется `shine_payments` как `dao_wallet`. +- текущая upgrade authority ProgramData — кто имеет право исполнять защищённые инструкции; +- `dao_treasury` из Config PDA — счёт, куда приходят деньги DAO. -Сейчас они могут совпадать. В целевой DAO-модели их лучше рассматривать как разные роли: - -- authority/governance signer — кто имеет право исполнять управленческие инструкции; -- treasury wallet — счет, куда приходят деньги DAO. +В mainnet целевая native treasury: `AcJRevXj3Yux2ecxXromMwwxEpPBz6AN53hH6KdqWJ9A`. +Она не должна использоваться как signer административных инструкций. После передачи upgrade +authority governance PDA выполняет эти инструкции через proposal. ## Передача прав Рекомендуемый порядок: 1. Сначала стабилизировать и проверить `shine_users` и `shine_payments`. -2. Передать DAO право обновлять настройки, если оно еще не передано. +2. Через текущую upgrade authority установить `dao_treasury` в Config PDA. 3. Передать DAO upgrade-authority второй и третьей программ. 4. Оставить `shine_login_guard` на отдельном ключе до стабилизации словарей и правил логинов. 5. После стабилизации решить отдельным голосованием, передавать ли первую программу DAO. @@ -66,7 +65,7 @@ DAO — управляющий слой Solana-части SHiNE. В текуще 1. Право вызвать защищенную функцию программы. - Например, `update_coef_limit` или `grant_manager_limits`. - - Проверяется внутри программы по `dao_wallet` или `DAO_AUTHORITY`. + - Для `shine_payments` проверяется по текущей upgrade authority ProgramData. 2. Право обновить саму программу. - Это upgrade-authority Solana ProgramData. diff --git a/docs/Solana_Architecture/details/shine_payments.md b/docs/Solana_Architecture/details/shine_payments.md index 8c653209..359947c9 100644 --- a/docs/Solana_Architecture/details/shine_payments.md +++ b/docs/Solana_Architecture/details/shine_payments.md @@ -10,33 +10,37 @@ 1. `init` - Создает основные PDA: `config_pda`, `coef_limit_pda`, `queues_pda`, `inflow_vault_pda`. - - Записывает `dao_wallet` и стартовые параметры выплат. + - Записывает дефолтный `dao_treasury` и стартовые параметры выплат. 2. `update_coef_limit` - Обновляет коэффициент выплаты, лимит очереди и награду вызвавшему `step_payout`. - - Требует подпись DAO-кошелька из `ConfigState`. + - Требует подпись текущей upgrade authority ProgramData. 3. `grant_manager_limits` - - DAO выдает менеджеру лимиты на создание тикетов в очередях Q1/Q2. + - Текущая upgrade authority выдаёт менеджеру лимиты на создание тикетов в очередях Q1/Q2/Q3; отдельный signer оплачивает rent нового allowance PDA. - Создает или обновляет `manager_allowance_pda`. -4. `buy_ticket` +4. `update_dao_treasury` + - Меняет получателя доходов DAO в Config PDA. + - Требует подпись текущей upgrade authority ProgramData. + +5. `buy_ticket` - Покупка тикета с суммой в lamports, пересчетом через Pyth SOL/USD. -5. `buy_ticket_usd` +6. `buy_ticket_usd` - Покупка тикета от USD-центов с защитой по максимальному платежу в lamports. -6. `buy_ticket_sol` +7. `buy_ticket_sol` - Покупка тикета в lamports с проверкой минимального ожидаемого USD-эквивалента. -7. `manager_add_ticket` +8. `manager_add_ticket` - Менеджер создает тикет за счет выданного ему DAO-лимита. -8. `step_payout` +9. `step_payout` - Любой подписант может вызвать шаг выплат. - Программа выплачивает следующий тикет, DAO-часть и награду вызывающему. -9. `change_ticket_recipient` +10. `change_ticket_recipient` - Текущий получатель тикета может поменять адрес получателя, если тикет еще не следующий на выплату. ## Аргументы инструкций @@ -82,11 +86,15 @@ - `new_recipient_wallet: Pubkey` +`update_dao_treasury`: + +- `new_treasury: Pubkey` + ## Главные PDA 1. `config_pda` - Seed: `shine_payments_config`. - - Хранит `dao_wallet` и `inflow_vault`. + - Хранит `dao_treasury` и `inflow_vault`. - Размер PDA: `8 + 160` байт. 2. `coef_limit_pda` @@ -140,12 +148,12 @@ Входы: - из `shine_users` в `inflow_vault_pda` при регистрации и увеличении лимита; -- от покупателя тикета сразу в `dao_wallet` при `buy_ticket*`. +- от покупателя тикета сразу в `dao_treasury` при `buy_ticket*`. Выходы: - из `inflow_vault_pda` получателю тикета; -- из `inflow_vault_pda` в `dao_wallet`; +- из `inflow_vault_pda` в `dao_treasury`; - из `inflow_vault_pda` вызвавшему `step_payout`; - если очереди пустые, весь доступный остаток `inflow_vault_pda` переводится в DAO. @@ -165,7 +173,7 @@ Получателем нельзя указать системные и зарезервированные адреса (System Program, sysvar, встроенные и SPL-программы, сжигатель, программы SHiNE). Полный список, байт статуса тикета -и правила пропуска — в `shine-solana/shine/doc/programs/shine_payments.md` (§4.4, §10.2, §11). +и правила пропуска — в `shine-solana/shine/doc/programs/shine_payments.md` (§4.4, §11.2, §12). `change_ticket_recipient` запрещает менять получателя у тикета, который является следующим на выплату. @@ -175,7 +183,6 @@ Целевая модель: -- `update_coef_limit` вызывает DAO; -- `grant_manager_limits` вызывает DAO; -- upgrade-authority программы после проверки передается DAO; +- `update_coef_limit`, `grant_manager_limits` и `update_dao_treasury` вызывает текущая upgrade authority; +- после передачи upgrade authority governance PDA эти действия выполняет DAO proposal; - `step_payout` остается открытым для любого подписанта, чтобы выплаты не зависели от одного оператора. diff --git a/docs/Solana_Architecture/schemes/architecture.svg b/docs/Solana_Architecture/schemes/architecture.svg index 9ef76d39..40c31f2e 100644 --- a/docs/Solana_Architecture/schemes/architecture.svg +++ b/docs/Solana_Architecture/schemes/architecture.svg @@ -66,7 +66,7 @@ SHiNE DAO governance / authority - treasury dao_wallet + treasury dao_treasury ключи через голосование @@ -86,7 +86,7 @@ DAO treasury - dao_wallet + dao_treasury регистрация / update diff --git a/docs/UI-Design/README.md b/docs/UI-Design/README.md index be4c695d..48c9936e 100644 --- a/docs/UI-Design/README.md +++ b/docs/UI-Design/README.md @@ -50,3 +50,13 @@ ## Проверка Результаты проверки и ограничения приведены в [VALIDATION.md](VALIDATION.md). Визуальная проверка в браузере в текущей сессии недоступна: подключённых браузеров нет. Это рабочие HTML-макеты для обсуждения, не проверенная на устройствах реализация приложения. + +# Профиль и связи + +Поле города скрыто в редакторе и карточке своего и чужого профиля. На карте связей нажатие на центральный аватар сразу открывает карточку человека с переходом в профиль. + +## Интерфейс 0.9 Alpha + +- В общих настройках раздел «О приложении» показывает локализованное описание ПО из словарей (с английским fallback) и отдельную карточку «О сервере» с локализованными подписями о принадлежности к сети и владельце, а также многострочным полем только для чтения (минимум четыре строки) с публичным текстом `GetServerInfo.payload.aboutText` из `ABOUT.txt`. Ошибка загрузки сведений о сервере не скрывает общую информацию о ПО. Для всей страницы включена штатная вертикальная полоса прокрутки. Пять быстрых нажатий на логотип открывают настройки разработчика; отдельный вход по заголовку в дополнительные настройки сохранён. +- В разделе «Мой блокчейн» находятся настройки серверов, история и файлы Arweave, загруженные с текущего клиента. Страница внешнего ключа информационная, без выбора homeserver-сессии; существующий механизм удалённой подписи и ранее сохранённые настройки не меняются. +- В списке личных сообщений поиск и новый чат доступны через общее меню TopBar. Перед исходящим аудио- или видеозвонком по умолчанию требуется подтверждение предупреждения об ограничениях PWA; его можно отключить галочкой в диалоге или переключателем в настройках приложения для текущего аккаунта на устройстве; входящие звонки не меняются. diff --git a/docs/registration-v2/README.md b/docs/registration-v2/README.md index 10cdd2a0..7b7b206f 100644 --- a/docs/registration-v2/README.md +++ b/docs/registration-v2/README.md @@ -9,6 +9,7 @@ | WS-операции | [индекс API](../API/09_Operations_Index.md), [контракт регистрации](WS_REGISTRATION_V2_API.md) | `JsonHandlerRegistry.java`, `Net_Registration_Handler.java` | | Email и подтверждение | [настройка и проверка Resend](RESEND_EMAIL_VERIFICATION.md) | `FreeRegistrationWorkflow.java`, `RegistrationEmailCode.java` | | Конфигурация регистратора | [параметры](REGISTRAR_CONFIGURATION.md) | `FreeRegistrationApiBootstrap.java` | +| Аппаратный регистратор и статус | [специальный WS и HTTP API](../API/23_External_Registrar_API.md) | `ExternalRegistrar`, `RegistrarSocket`, `ServerStatusServlet` | | Сертификат Arweave | [бинарный формат](../Протоколы/SHINE_FREE_REGISTRATION_CERTIFICATE_V1.md) | `FreeRegistrationCertificateV1.java` | | Solana PDA | [namespace](../../shine-solana/shine/doc/formats/shine-namespace-pda-format-v1.md), [пользователь PDA 1.3](../Solana/SHINE_USER_PDA_V13_ROOT_LIMITS.md) | `programs/shine_users/src/lib.rs` | | UI регистрации | [три шага](REGISTRATION_UI_3_STEPS_2026-11-04.md) | `shine-UI/js/` | diff --git a/docs/registration-v2/REGISTRAR_CONFIGURATION.md b/docs/registration-v2/REGISTRAR_CONFIGURATION.md index 5a5f4250..b0923342 100644 --- a/docs/registration-v2/REGISTRAR_CONFIGURATION.md +++ b/docs/registration-v2/REGISTRAR_CONFIGURATION.md @@ -1,16 +1,37 @@ -# Локальный регистратор SHiNE, этап 7 +# Регистратор SHiNE — local / external -Модуль `shine-server-archive/server.archive.registration` выдаёт **сырой signed ANS-104 DataItem**, но **не публикует** его и **не создаёт пользователя** (это этап 8). В этот патч публичный WS/API не добавлялся. +Модуль выдаёт полный signed ANS-104 DataItem 1.0; workflow публикует его через Turbo и импортирует. Внешний режим описан в [API регистратора](../API/23_External_Registrar_API.md). ## Конфигурация - `freeRegistration.enabled=false` по умолчанию. Для включения обязательно одновременно задать `freeRegistration.namespace=`: это единственный type-2 namespace, в котором данный сервер выдаёт бесплатные аккаунты. Если namespace не задан или `enabled=false`, сервер публикует только платные namespace и не показывает в UI вариант бесплатной регистрации. -- При включении сервер до начала работы сверяет, что указанный namespace имеет type 2, его `default_server_login` совпадает с `server.SHiNE.login`, а `registrar_pubkey` — с публичным ключом из seed. При несовпадении запуск прекращается; чужой namespace нельзя случайно обслужить. -- `freeRegistration.registrarSeedFile` — абсолютный путь к файлу вне Git, внутри одна Base64-строка **32-byte Ed25519 seed**. Пример имени `/var/lib/shine/secrets/registrar-seed.b64`; не создавать файл с тестовым ключом внутри репозитория. +- При включении сервер до начала работы сверяет type 2, `default_server_login` и существование корректного `registrar_pubkey`. В режиме local дополнительно проверяется seed, в external — владение ключом при WS-авторизации. При несовпадении запуск прекращается; чужой namespace нельзя случайно обслужить. +- Только для local: `freeRegistration.registrarSeedFile` — абсолютный путь к файлу вне Git, внутри одна Base64-строка **32-byte Ed25519 seed**. Пример имени `/var/lib/shine/secrets/registrar-seed.b64`; не создавать файл с тестовым ключом внутри репозитория. - `LocalRegistrarSigner.fromConfig(AppConfig)` проверяет enabled и наличие пути, не печатает секрет или bytes в лог. - Публичный ключ signer должен совпадать с `shine_namespace_current.registrar_pubkey` (из on-chain namespace), иначе `FreeRegistrationIssuer.issue` отказывает. - При включённой бесплатной регистрации обязательно задать `RESEND_API_KEY` в окружении процесса (или `freeRegistration.email.apiKey` в защищённом внешнем конфиге). Настройки: `freeRegistration.email.allowTestCode=false` — временный обход `777777`, `freeRegistration.email.allowReuse=false` — запрет повторного использования одного email, `freeRegistration.email.from=SHiNE ` — отправитель. `allowReuse=true` допустим только в закрытом тестовом окружении: при этом один email может завершить несколько регистраций. Тестовый обход включать исключительно в закрытом тестовом окружении. 6-значный код отправляется на email через Resend и проверяется до выдачи сертификата. Подробности: [RESEND_EMAIL_VERIFICATION.md](RESEND_EMAIL_VERIFICATION.md). Регистрация окончательно не активируется до Turbo ACK и проверенного импорта. -**Безопасность:** на реальном сервере ограничить права файла регистратором/пользователем Java-процесса (0600), не сохранять секрет в stdout, crash reports, Git, backup без шифрования. В будущем заменить реализацию `RegistrarSigner` на аппаратный модуль. +**Безопасность:** на реальном сервере ограничить права файла регистратором/пользователем Java-процесса (0600), не сохранять секрет в stdout, crash reports, Git, backup без шифрования. В production использовать `external`, а `local` оставлять только для разработки. В `issue()` проверяются текущие известные login/email и namespace; эта проверка сама по себе не резервирует имя. Этап 8 обязан транзакционно повторить проверки и гарантировать уникальность с `UNIQUE` индексами БД. + +## Внешний регистратор (production) + +```properties +freeRegistration.enabled=true +freeRegistration.namespace=free +freeRegistration.signerMode=external +``` + +В режиме external seed-файл не читается, локальный fallback запрещён. Удалите старую настройку и секрет с сервера. Для обратной совместимости отсутствие `signerMode` означает `local`. Сервер запускается без подключённого ESP, если namespace настроен корректно. Бесплатная регистрация при попытке выдачи сертификата получает 503, пока ESP не авторизован; остальные функции работают. После изменения registrar_pubkey требуется перезапуск сервера. Прочие настройки email/Turbo прежние. + +Скетч и инструкция: [ESP32 Registration Signer](../../ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_registration_signer/README.md). Публичные `/status` и `/api/status` показывают агрегаты и состояние подключения. Для reverse proxy (подставить локальный порт Jetty) добавьте отдельный matcher: + +```caddyfile +@shineStatus path /status /api/status +handle @shineStatus { + reverse_proxy 127.0.0.1:7070 +} +``` + +Старый ESP32 homeserver не изменяется. Формат сертификата и смарт-контракты не меняются. Запускать production только после сборки и аппаратной приёмки. diff --git a/docs/registration-v2/WS_REGISTRATION_V2_API.md b/docs/registration-v2/WS_REGISTRATION_V2_API.md index 1a0d511a..79d957df 100644 --- a/docs/registration-v2/WS_REGISTRATION_V2_API.md +++ b/docs/registration-v2/WS_REGISTRATION_V2_API.md @@ -22,3 +22,5 @@ **Ограничения приватности:** публичный boolean `emailAvailable` допускает подбор адресов. Действует глобальный/per-WebSocket счётчик запросов; пересоздание WebSocket может обходить персональную квоту, перед production нужен rate limit на edge по IP/ASN и CAPTCHA, а также контроль доставки и хранения email-кода. Код генерируется случайно и отправляется через Resend. См. `RESEND_EMAIL_VERIFICATION.md`. **Ограничения надёжности:** challenge и единожды подписанные bytes пока живут в памяти сервера до 1 часа (`FreeRegistrationWorkflow.TTL_MS`). Если сервер перезапущен после Turbo ACK, пользователь проверяет `GetRegistrationStatus`, но повтор той же challenge невозможен. Для нескольких инстансов нужна общая очередь заявок/подписанных артефактов с защитой от повторного выпуска. + +В режиме `external` `ConfirmFreeRegistration` может вернуть `REGISTRAR_ERROR` с HTTP-подобным WS status 400/403/409/429/500/503. Повторять тот же challenge после временной ошибки; идентичный запрос не расходует квоту ESP повторно. См. [регистратор 1.0](../API/23_External_Registrar_API.md). diff --git a/docs/Инициализация_Solana_регистрации/README.md b/docs/Инициализация_Solana_регистрации/README.md index 955ff90d..6e0ecc10 100644 --- a/docs/Инициализация_Solana_регистрации/README.md +++ b/docs/Инициализация_Solana_регистрации/README.md @@ -19,9 +19,12 @@ - `shine_payments`: `SHiPmXbM9Fs9khzRUW3TGKsS2W84aqaXTxs3ZkajW9v` -Временный on-chain admin для `shine_users` и `shine_payments` до перевода управления на DAO: +Текущая mainnet upgrade authority всех трёх программ проверяется по ProgramData; на момент +последней проверки это `SHiJ58FvbJQJnPEUa5mZNVpWd1ym9CkjjPgeHYzUJmh`. Она управляет +обновлением кода. Для `shine_payments` она также управляет коэффициентом, manager limits и +адресом казны через защищённые инструкции. Native treasury mainnet DAO: -- `aiShm43fZjm3YkMs22sYL1bpXaL3bVxv7SSraPHzVgq` +- `AcJRevXj3Yux2ecxXromMwwxEpPBz6AN53hH6KdqWJ9A`. ## Подтверждение текущего mainnet deploy @@ -40,8 +43,8 @@ - `shine_users` внутри кода вызывает `shine_login_guard`. - `shine_users` внутри кода знает `shine_payments` и переводит оплату в `inflow_vault PDA` этой программы. -- `shine_users` и `shine_payments` пока управляются временным адресом `aiShm...`. -- Позже эти hardcoded authority-адреса планируется заменить на адреса DAO через upgrade программ. +- `shine_users` и `shine_payments` используют фактическую upgrade authority своих ProgramData для защищённых настроек. +- Для `shine_payments` казна хранится в Config PDA и меняется `update_dao_treasury`; после передачи upgrade authority governance PDA её и остальные защищённые действия исполняет DAO proposal. ## Куда вписаны адреса в проекте diff --git a/logo.jpg b/logo.jpg new file mode 100644 index 00000000..8e1487cd Binary files /dev/null and b/logo.jpg differ diff --git a/shine-UI/img/logo.jpg b/shine-UI/img/logo-1.jpg similarity index 100% rename from shine-UI/img/logo.jpg rename to shine-UI/img/logo-1.jpg diff --git a/shine-UI/img/logo-2.jpg b/shine-UI/img/logo-2.jpg new file mode 100644 index 00000000..8e1487cd Binary files /dev/null and b/shine-UI/img/logo-2.jpg differ diff --git a/shine-UI/img/logo-3.svg b/shine-UI/img/logo-3.svg new file mode 100644 index 00000000..b7a8d587 --- /dev/null +++ b/shine-UI/img/logo-3.svg @@ -0,0 +1,112 @@ + +SHiNE — polished gold, original contours + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/shine-UI/img/logo.svg b/shine-UI/img/logo.svg new file mode 100644 index 00000000..b7a8d587 --- /dev/null +++ b/shine-UI/img/logo.svg @@ -0,0 +1,112 @@ + +SHiNE — polished gold, original contours + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/shine-UI/index.html b/shine-UI/index.html index 288867ae..fcd181e8 100644 --- a/shine-UI/index.html +++ b/shine-UI/index.html @@ -9,8 +9,8 @@ - - + + СИЯНИЕ \nhttps://v2.realms.today/dao/abc/\nhttps://user:pass@example.org/\njavascript:alert(1)'; + appendAboutText({ append: node => nodes.push(node) }, input); + assert.equal(nodes.map(n => n.textContent).join(''), input); + const links = nodes.filter(n => n.tag === 'a'); + assert.equal(links.length, 1); + assert.equal(links[0].href, 'https://v2.realms.today/dao/abc/'); + assert.equal(links[0].rel, 'noopener noreferrer'); + assert.equal(links[0].target, '_blank'); + } finally { globalThis.document = previous; } +}); + +test('маршрут About сохраняет вкладку профиля и корректно разбирается', () => { + const code = source('router.js').replace(/^import .*$/gm, '').replace(/^export /gm, ''); + const router = vm.runInNewContext(code + '\n({toPrettyPath,parseRouteFromPath,resolveToolbarActive})', { + window: { location: { pathname: '/settings' } }, parseShineRouteParts: () => null, + }); + assert.equal(router.toPrettyPath('about-app-view'), 'settings/about'); + assert.equal(router.parseRouteFromPath('/settings/about').pageId, 'about-app-view'); + assert.equal(router.resolveToolbarActive('about-app-view'), 'profile-view'); +}); + +test('пять быстрых нажатий на логотип, медленные нажатия сбрасывают счётчик', () => { + const code = source('pages/settings-view.js'); + const handler = code.slice(code.indexOf(' let logoTapCount'), code.indexOf(' const card =')); + let click, now = 10000; + const routes = []; + vm.runInNewContext(handler, { + logo: { addEventListener: (_, cb) => { click = cb; } }, + Date: { now: () => now }, navigate: route => routes.push(route), + }); + for (let i = 0; i < 4; i++) { click(); now += 100; } + assert.deepEqual(routes, []); + now += 1000; + for (let i = 0; i < 4; i++) { click(); now += 100; } + assert.deepEqual(routes, []); + click(); + assert.deepEqual(routes, ['developer-settings-view']); +}); + +test('отмена диалога при уходе со страницы и повторное завершение безопасны', async () => { + const old = globalThis.document; + const events = new Map(); + let removed = 0; + const buttons = new Map(); + const modal = { + querySelector: key => { + if (!buttons.has(key)) buttons.set(key, { focus() {} }); + return buttons.get(key); + }, + addEventListener: (key, cb) => events.set(key, cb), + remove: () => { removed++; }, + }; + try { + globalThis.document = { + activeElement: { focus() {} }, createElement: () => modal, + addEventListener: (key, cb) => events.set(key, cb), + removeEventListener: key => events.delete(key), body: { append() {} }, + }; + const controller = new AbortController(); + const pending = confirmDialog({ title: 'Call', confirmLabel: 'Continue', cancelLabel: 'Cancel', signal: controller.signal }); + controller.abort(); + assert.equal(await pending, false); + assert.equal(removed, 1); + events.get('click')({ target: modal }); + assert.equal(removed, 1); + assert.equal(events.has('keydown'), false); + assert.equal(await confirmDialog({ signal: controller.signal }), false); + } finally { globalThis.document = old; } +}); + +function aboutHarness(request) { + const code = source('pages/about-app-view.js').replace(/^import .*$/gm, '').replace(/^export /gm, ''); + const node = () => ({ children: [], append(...items) { this.children.push(...items); }, replaceChildren(...items) { this.children = items; } }); + let language = 'ru'; + const result = vm.runInNewContext(code + '\n({render,pageMeta})', { + document: { createElement: node }, + t: key => key === 'screens.about_app_view.software_description' ? `Software ${language}` : ['network_membership', 'owner_label'].some(name => key.endsWith('.' + name)) ? `${key} ${language}` : key, + createTopBar: () => ({}), createErrorState: opts => ({ error: true, ...opts }), createLoadingState: () => ({ loading: true }), + appendAboutText: (el, text) => el.append({ textContent: text }), + authService: { ws: { request } }, + }); + return { ...result, setLanguage: value => { language = value; } }; +} +const tick = () => new Promise(resolve => setImmediate(resolve)); + +test('About: версия локализована, описание узла одинаковое, полоса прокрутки включена', async () => { + const requests = []; + const { render, pageMeta, setLanguage } = aboutHarness(async (op, payload) => { + requests.push([op, Object.keys(payload)]); + return { payload: { aboutText: 'OpenMindSoft LLC (Georgia)\nhttps://example.org/' } }; + }); + assert.equal(pageMeta.shellMode.scrollbar, 'auto'); + assert.equal(pageMeta.shellMode.scrollContainer, 'screen'); + const ru = render({}); + setLanguage('en'); + const en = render({}); + await tick(); + assert.equal(ru.children[0].children[0].textContent, 'Software ru'); + assert.equal(en.children[0].children[0].textContent, 'Software en'); + for (const [screen, lang] of [[ru, 'ru'], [en, 'en']]) { + const [, network, label, owner] = screen.children[1].children; + assert.equal(network.textContent, `screens.about_app_view.network_membership ${lang}`); + assert.equal(label.textContent, `screens.about_app_view.owner_label ${lang}`); + assert.match(owner.className, /about-app-owner/); + assert.equal(owner.children[0].textContent, 'OpenMindSoft LLC (Georgia)\nhttps://example.org/'); + } + assert.deepEqual(requests, [['GetServerInfo', []], ['GetServerInfo', []]]); +}); + +test('About: ошибка, пустое описание и повторный запрос не скрывают сведения о ПО', async () => { + let count = 0; + const { render } = aboutHarness(async () => { + count++; + if (count === 1) throw Error('Offline'); + return { payload: { aboutText: count === 2 ? '' : 'Owner' } }; + }); + const screen = render({}); + const software = screen.children[0]; + const description = screen.children[1].children[3]; + await tick(); + assert.equal(description.children[0].error, true); + await description.children[0].onRetry(); + assert.equal(description.children[0].title, 'screens.about_app_view.unavailable'); + await description.children[0].onRetry(); + assert.equal(description.children[0].textContent, 'Owner'); + assert.equal(screen.children[0], software); +}); + +test('About: словари содержат версию, DAO и не содержат владельца узла', () => { + for (const lang of ['ru', 'en']) { + const dictionary = JSON.parse(source(`i18n/locales/${lang}.json`)); + const text = dictionary.screens.about_app_view.software_description; + assert.match(text, /0\.9 Alpha/); + assert.match(text, /https:\/\/v2.realms.today\/dao\/FcMg5G3RpAYvW3vvztrcMuFXifWYR3HYiTuPfVgwuN4K\//); + assert.doesNotMatch(text, /OpenMindSoft/); + assert.ok(dictionary.screens.about_app_view.network_membership); + assert.match(dictionary.screens.about_app_view.owner_label, /:$/); + } +}); diff --git a/shine-UI/tests/arweave-app-namespace.test.mjs b/shine-UI/tests/arweave-app-namespace.test.mjs index f922d4be..bf83883b 100644 --- a/shine-UI/tests/arweave-app-namespace.test.mjs +++ b/shine-UI/tests/arweave-app-namespace.test.mjs @@ -12,10 +12,10 @@ test('CORE эпоха одинакова в UI, Server, discovery и серти const viewer = read('shine-UI/static-sites/arweave-viewer/index.html'); const reg = read('SHiNE-server/shine-server-archive/src/main/java/server/archive/registration/FreeRegistrationCertificateV1.java'); const archive = read('SHiNE-server/shine-server-archive/src/main/java/server/archive/ArweaveBlocksConfig.java'); - assert.match(ui, /SHINE_CORE_NAMESPACE\s*=\s*'test5595'/); + assert.match(ui, /SHINE_CORE_NAMESPACE\s*=\s*'test5599'/); assert.match(archive, /TEST_TAG_VALUE\s*=\s*ShineProtocolTags\.CORE_NAMESPACE/); - assert.match(server, /CORE_NAMESPACE\s*=\s*"test5595"/); - assert.match(viewer, /SHINE_PROTOCOL_NAMESPACE\s*=\s*'test5595'/); + assert.match(server, /CORE_NAMESPACE\s*=\s*"test5599"/); + assert.match(viewer, /SHINE_PROTOCOL_NAMESPACE\s*=\s*'test5599'/); assert.match(reg, /ShineProtocolTags\.CORE_REGISTRATION_TAGS/); for (const txt of [ui, server, viewer, reg]) assert.doesNotMatch(txt, /test5591/); }); diff --git a/shine-UI/tests/core-content-vectors.test.mjs b/shine-UI/tests/core-content-vectors.test.mjs index 59f23cc1..7954b3de 100644 --- a/shine-UI/tests/core-content-vectors.test.mjs +++ b/shine-UI/tests/core-content-vectors.test.mjs @@ -15,8 +15,8 @@ const special = new Map([[SHINE_CORE_LINE_PROFILE,'P'],[SHINE_CORE_LINE_CONNECTI test('CORE v2 namespace и числовые линии согласованы в Java и UI', () => { const server=fs.readFileSync(new URL('../../SHiNE-server/shine-server-blockchain/src/main/java/blockchain/ShineProtocolTags.java',import.meta.url),'utf8'); - assert.equal(SHINE_CORE_NAMESPACE,'test5595'); - assert.match(server,/CORE_NAMESPACE\s*=\s*"test5595"/); + assert.equal(SHINE_CORE_NAMESPACE,'test5599'); + assert.match(server,/CORE_NAMESPACE\s*=\s*"test5599"/); assert.equal(SHINE_CORE_MAX_BLOCK_NUMBER,2147482623); assert.deepEqual([...special.keys()],[2147483645,2147483646,2147483647]); }); @@ -92,20 +92,20 @@ test('Minimal pair codec and container: exact vectors, tampering, unsigned lengt import { inspectBlockchainDataItem } from '../js/services/blockchain-entry-inspector.js'; -test('HEADER v2 signed CORE/CONTENT and inspector accept arbitrary UTF-8 license', async () => { +test('HEADER 1.0 signed CORE/CONTENT and inspector accept arbitrary UTF-8 license', async () => { const pkcs8=Buffer.concat([unhex('302e020100300506032b657004220420'),Buffer.from(Array.from({length:32},(_,i)=>i))]); const key=await crypto.subtle.importKey('pkcs8',pkcs8,{name:'Ed25519'},false,['sign']); const owner=unhex(rows[0][1]); const login=Buffer.from('Alice@shine'); for (const license of ['', 'CC-BY-NC-4.0', 'Лицензия 🌞', '\ufeffx', 'x'.repeat(255)]) { const bytes=Buffer.from(license); - const body=Buffer.concat([Buffer.from('SHiNE'),Buffer.of(login.length),login,Buffer.of(bytes.length),bytes,owner]); - const content={type:0,subType:0,version:2,body}; + const body=Buffer.concat([Buffer.from('SHiNE'),Buffer.of(login.length),login,Buffer.of(1, 0, 0, bytes.length),bytes,owner]); + const content={type:0,subType:0,version:1,body}; const signed=await signCoreContentPair({owner32:owner,privateKey:key,content,prevCoreHash32:new Uint8Array(32),blockNumber:0,timestamp:1700001000n,line:null}); const raw=packCoreContent(signed.coreDataItem,signed.contentDataItem); const result=await inspectBlockchainDataItem(Buffer.from(raw).toString('base64')); assert.equal(result.frame.body.license,license); - assert.equal(result.frame.version,2); + assert.equal(result.frame.version,1); await assert.rejects(signCoreContentPair({owner32:owner,privateKey:key,content:{...content,version:4},prevCoreHash32:new Uint8Array(32),blockNumber:0,timestamp:1700001000n,line:null})); } }); diff --git a/shine-UI/tests/header-v2-cc0-order.test.mjs b/shine-UI/tests/header-v2-cc0-order.test.mjs index 483c64b7..fbe9646d 100644 --- a/shine-UI/tests/header-v2-cc0-order.test.mjs +++ b/shine-UI/tests/header-v2-cc0-order.test.mjs @@ -16,85 +16,54 @@ const encode = vm.runInNewContext(`function makeHeaderBodyBytes(${source}\nmakeH Uint8Array, }); -test('client writes HEADER v2 as SHiNE → login → length + license → key', () => { +function inspectorParser() { + const stripped = inspector.replace(/^import .+;\s*$/gm, '').replace(/^export /gm, ''); + return vm.runInNewContext(`${stripped}\nparseShineFrame`, { + TextDecoder, DataView, Uint8Array, BigInt, + bytesToBase64Url: bytes => Buffer.from(bytes).toString('base64url'), Buffer, + }); +} + +function headerFrame(body, version = 1) { + const frame = new Uint8Array(88 + body.length); + const view = new DataView(frame.buffer); + view.setUint16(0, 1, false); + view.setInt32(66, frame.length, false); + view.setInt32(70, 0, false); + view.setBigInt64(74, 0n, false); + view.setUint16(82, 0, false); + view.setUint16(84, 0, false); + view.setUint16(86, version, false); + frame.set(body, 88); + return frame; +} + +test('client writes only HEADER 1.0: identity, arbitrary license, then initial key', () => { const key = Uint8Array.from({ length: 32 }, (_, i) => i + 1); const login = 'Alice@shine'; const license = 'Лицензия 🌞'; - const body = encode({ login, initialBlockchainKey32: key, license }); - const loginBytes = utf8(login); + const previous = 'Bob@free,Older'; + const body = encode({ login, initialBlockchainKey32: key, accountType: 1, previousAccounts: ['Bob@free', 'Older'], license }); const expected = Uint8Array.from([ - ...utf8('SHiNE'), loginBytes.length, ...loginBytes, - utf8(license).length, ...utf8(license), ...key, + ...utf8('SHiNE'), utf8(login).length, ...utf8(login), + 1, 0, utf8(previous).length, ...utf8(previous), utf8(license).length, ...utf8(license), ...key, ]); assert.deepEqual(Array.from(body), Array.from(expected)); - assert.match(auth, /msgSubType: MSG_SUBTYPE_TECH_HEADER,\s*msgVersion: HEADER_VERSION/); - assert.match(auth, /export const HEADER_VERSION = 3/); + assert.match(auth, /export const HEADER_VERSION = 1/); }); -test('inspector decodes both v1 and v2 and supports arbitrary license and rejects malformed v2', () => { - const stripped = inspector.replace(/^import .+;\s*$/gm, '').replace(/^export /gm, ''); - const inspect = vm.runInNewContext(`${stripped}\nparseShineFrame`, { - TextDecoder, DataView, Uint8Array, BigInt, - bytesToBase64Url: bytes => Buffer.from(bytes).toString('base64url'), - Buffer, - }); +test('inspector accepts only HEADER 1.0 and validates its identity and license', () => { + const inspect = inspectorParser(); const key = Uint8Array.from({ length: 32 }, (_, i) => i + 1); - const login = utf8('Alice@shine'); - const prefix = Uint8Array.from([...utf8('SHiNE'), login.length, ...login]); - const bodyV1 = Uint8Array.from([...prefix, ...key]); - const bodyV2 = Uint8Array.from([...prefix, ...utf8('license:CC0-1.0'), ...key]); - const frameFor = (version, body) => { - const frame = new Uint8Array(88 + body.length); - const view = new DataView(frame.buffer); - view.setUint16(0, 1, false); // frameCode - view.setInt32(66, frame.length, false); - view.setInt32(70, 0, false); // blockNumber - view.setBigInt64(74, 0n, false); - view.setUint16(82, 0, false); // type TECH - view.setUint16(84, 0, false); // subtype HEADER - view.setUint16(86, version, false); - frame.set(body, 88); - return frame; - }; - const old = inspect(frameFor(1, bodyV1)); - assert.equal(old.body.kind, 'header'); - assert.equal(old.body.license, null); - const current = inspect(frameFor(2, bodyV2)); - assert.equal(current.body.kind, 'header'); - assert.equal(current.body.license, 'CC0-1.0'); - assert.equal(current.body.initialBlockchainKey, Buffer.from(key).toString('base64url')); - assert.throws(() => inspect(frameFor(2, Uint8Array.from([...prefix, ...key, ...utf8('license:CC0-1.0')])))); - const invalid = bodyV2.slice(); - invalid[prefix.length + 8] = 'X'.charCodeAt(0); - assert.throws(() => inspect(frameFor(2, invalid))); for (const license of ['', 'CC-BY-NC-4.0', 'Лицензия 🌞', 'x'.repeat(255)]) { - const body = encode({ login: 'Alice@shine', initialBlockchainKey32: key, license }); - assert.equal(inspect(frameFor(2, body)).body.license, license); - assert.throws(() => inspect(frameFor(2, body.slice(0, -1)))); + const body = encode({ login: 'Alice@shine', initialBlockchainKey32: key, accountType: 1, previousAccounts: ['Bob@free'], license }); + const parsed = inspect(headerFrame(body)).body; + assert.equal(parsed.accountType, 1); + assert.deepEqual(Array.from(parsed.previousAccounts), ['Bob@free']); + assert.equal(parsed.license, license); + assert.throws(() => inspect(headerFrame(body.slice(0, -1)))); + assert.equal(inspect(headerFrame(body, 2)).body.kind, 'unsupported_version'); } assert.throws(() => encode({ login: 'Alice@shine', initialBlockchainKey32: key, license: 'x'.repeat(256) })); - assert.throws(() => inspect(frameFor(2, Uint8Array.from([...prefix, 1, 255, ...key])))); - assert.throws(() => inspect(frameFor(2, new Uint8Array(0)))); -}); - -test('HEADER v3: actual serializer and inspector agree on identity and reject malformed declarations', () => { - const stripped = inspector.replace(/^import .+;\s*$/gm, '').replace(/^export /gm, ''); - const inspect = vm.runInNewContext(`${stripped}\nparseShineFrame`, {TextDecoder, DataView, Uint8Array, BigInt, bytesToBase64Url: b => Buffer.from(b).toString('base64url'), Buffer}); - const login = 'Alice@shine', key = Uint8Array.from({length:32}, (_,i)=>i+1); - const prefix = [...utf8('SHiNE'), utf8(login).length, ...utf8(login)]; - const frame = body => {const a=new Uint8Array(88+body.length), v=new DataView(a.buffer);v.setUint16(0,1);v.setInt32(66,a.length);v.setUint16(86,3);a.set(body,88);return a;}; - const make = (accountType,previousAccounts=[],license='')=>encode({login,initialBlockchainKey32:key,accountType,previousAccounts,license}); - assert.deepEqual([...make(0)], [...prefix,0,0,...key]); - assert.deepEqual([...make(1)], [...prefix,1,0,0,0,...key]); - for(const previousAccounts of [[],['Bob@free','Older'],Array.from({length:10},(_,i)=>'old'+i+'@free')]) { - const body=make(1,previousAccounts,'Лицензия'); - const parsed=inspect(frame(body)).body; - assert.equal(parsed.accountType,1);assert.deepEqual(Array.from(parsed.previousAccounts),previousAccounts);assert.equal(parsed.license,'Лицензия'); - assert.throws(()=>inspect(frame(body.slice(0,-1)))); - } - assert.equal(inspect(frame(make(0))).body.accountType,0); - for(const list of [['ALICE@shine'],['Bob@free','bob@free'],['a,b'],Array.from({length:11},(_,i)=>'old'+i)]) assert.throws(()=>make(1,list)); - assert.throws(()=>make(0,['Bob@free']));assert.throws(()=>make(2)); - const bad=make(1);bad[prefix.length]=2;assert.throws(()=>inspect(frame(bad))); - const csv=utf8('Bob@free,bob@free');assert.throws(()=>inspect(frame(Uint8Array.from([...prefix,1,0,csv.length,...csv,0,...key])))); + assert.throws(() => encode({ login: 'Alice@shine', initialBlockchainKey32: key, accountType: 0, previousAccounts: ['Bob@free'] })); }); diff --git a/shine-UI/tests/m6-viewer-pair.test.mjs b/shine-UI/tests/m6-viewer-pair.test.mjs index 2bb4efbc..1cb23931 100644 --- a/shine-UI/tests/m6-viewer-pair.test.mjs +++ b/shine-UI/tests/m6-viewer-pair.test.mjs @@ -29,11 +29,11 @@ test('viewer: rejects tampered CONTENT, invalid CORE and wrong indexed tags',asy test('viewer: requests CORE then CONTENT by ID and never claims signature verification',async()=>{ const f=find('post'),id=itemid(f.coreItemId),cid=itemid(f.contentItemId),calls=[]; ctx.fetch=async url=>{calls.push(url);const raw=url.endsWith(cid)?f.content:f.core;return {ok:true,arrayBuffer:async()=>bytes(raw).buffer};}; - const r=await v.loadArweavePairs('https://mock.invalid',[{id,owner:{address:'indexed'},tags:[{name:'App',value:'test5595'},{name:'n',value:'2'},{name:'l',value:'1'}]}]); + const r=await v.loadArweavePairs('https://mock.invalid',[{id,owner:{address:'indexed'},tags:[{name:'App',value:'test5599'},{name:'n',value:'2'},{name:'l',value:'1'}]}]); assert.deepEqual(calls,[`https://mock.invalid/${id}`,`https://mock.invalid/${cid}`]);assert.equal(r.blocks[0].hashHex,f.coreHash); const checks=v.v3Verification(r.blocks);assert.equal(checks.signature.ok,0);assert.equal(checks.signature.na,1);assert.equal(checks.global.na,1); ctx.fetch=async url=>url.endsWith(cid)?{ok:false,status:404}:{ok:true,arrayBuffer:async()=>bytes(f.core).buffer}; - await assert.rejects(v.loadArweavePairs('https://mock.invalid',[{id,tags:[{name:'App',value:'test5595'},{name:'n',value:'2'},{name:'l',value:'1'}]}]),/CONTENT.*404/); + await assert.rejects(v.loadArweavePairs('https://mock.invalid',[{id,tags:[{name:'App',value:'test5599'},{name:'n',value:'2'},{name:'l',value:'1'}]}]),/CONTENT.*404/); }); test('viewer: parses historical v2 and v3 primary declaration',async()=>{ const f=find('header'), old=bytes(f.content), key=old.slice(-32), prefix=old.slice(7,-32); diff --git a/shine-UI/tests/registration-cc0-header.test.mjs b/shine-UI/tests/registration-cc0-header.test.mjs index 02f4b3fd..f2539a22 100644 --- a/shine-UI/tests/registration-cc0-header.test.mjs +++ b/shine-UI/tests/registration-cc0-header.test.mjs @@ -24,18 +24,21 @@ const context = { }; const makeHeaderBodyBytes = vm.runInNewContext(`function makeHeaderBodyBytes(${makeBytesFunction}\nmakeHeaderBodyBytes`, context); -test('CORE/CONTENT HEADER v2 contains login, empty license and initial key', () => { +test('CORE/CONTENT HEADER 1.0 contains identity, arbitrary license and initial key', () => { const key = Uint8Array.from({ length: 32 }, (_, n) => n + 1); const result = makeHeaderBodyBytes({ login: 'Alice@shine', initialBlockchainKey32: key }); const login = new TextEncoder().encode('Alice@shine'); assert.equal(new TextDecoder().decode(result.slice(0,5)), 'SHiNE'); assert.equal(result[5], login.length); assert.deepEqual(Array.from(result.slice(6, 6+login.length)), Array.from(login)); - assert.deepEqual(Array.from(result.slice(7+login.length)), Array.from(key)); - assert.equal(result[6+login.length], 0); - assert.equal(result.length, 5 + 1 + login.length + 1 + 32); + const identityOffset = 6 + login.length; + assert.equal(result[identityOffset], 1); + assert.deepEqual(Array.from(result.slice(identityOffset + 1, identityOffset + 3)), [0, 0]); + assert.equal(result[identityOffset + 3], 0); + assert.deepEqual(Array.from(result.slice(identityOffset + 4)), Array.from(key)); + assert.equal(result.length, 5 + 1 + login.length + 1 + 2 + 1 + 32); assert.match(auth, /msgSubType: MSG_SUBTYPE_TECH_HEADER,\s*msgVersion: HEADER_VERSION/); - assert.match(auth, /export const HEADER_VERSION = 3/); + assert.match(auth, /export const HEADER_VERSION = 1/); }); test('free and paid registration both require accepted documents before any registration operation', { skip: !hasRegistrationTerms }, () => { diff --git a/shine-UI/tests/server-pda-v2-ui.test.mjs b/shine-UI/tests/server-pda-v2-ui.test.mjs index 89fc9b0f..89e1129f 100644 --- a/shine-UI/tests/server-pda-v2-ui.test.mjs +++ b/shine-UI/tests/server-pda-v2-ui.test.mjs @@ -17,5 +17,5 @@ test('форма создания требует namespace type1 и правил assert.match(page, /namespace\.type !== 1/); assert.match(page, /getNamespace\(/); assert.match(html, /maxlength="30"/); - assert.match(service, /feePayerPrivatePkcs8B64: keyBundle\.clientPair\.privatePkcs8B64/); + assert.match(service, /feePayerPrivatePkcs8B64: keyBundle\.blockchainPair\.privatePkcs8B64/); }); diff --git a/shine-solana/shine/Cargo.lock b/shine-solana/shine/Cargo.lock index 882e50de..e5801fd8 100644 --- a/shine-solana/shine/Cargo.lock +++ b/shine-solana/shine/Cargo.lock @@ -1222,7 +1222,7 @@ dependencies = [ [[package]] name = "shine_payments" -version = "0.2.0" +version = "1.0.0" dependencies = [ "anchor-lang", "pyth-solana-receiver-sdk", @@ -1231,7 +1231,7 @@ dependencies = [ [[package]] name = "shine_users" -version = "0.1.0" +version = "1.0.0" dependencies = [ "anchor-lang", "pyth-solana-receiver-sdk", diff --git a/shine-solana/shine/cleanup-shine-users/.gitignore b/shine-solana/shine/cleanup-shine-users/.gitignore new file mode 100644 index 00000000..8b9965dc --- /dev/null +++ b/shine-solana/shine/cleanup-shine-users/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/shine-solana/shine/cleanup-shine-users/Cargo.lock b/shine-solana/shine/cleanup-shine-users/Cargo.lock new file mode 100644 index 00000000..0c68196d --- /dev/null +++ b/shine-solana/shine/cleanup-shine-users/Cargo.lock @@ -0,0 +1,1919 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "arrayref" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "base64" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bitflags" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" + +[[package]] +name = "blake3" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3888aaa89e4b2a40fca9848e400f6a658a5a3978de7be858e209cafa8be9a4a0" +dependencies = [ + "arrayref", + "arrayvec", + "cc", + "cfg-if", + "constant_time_eq", + "digest 0.10.7", +] + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "borsh" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115e54d64eb62cdebad391c19efc9dce4981c690c85a33a12199d99bb9546fee" +dependencies = [ + "borsh-derive 0.10.4", + "hashbrown 0.13.2", +] + +[[package]] +name = "borsh" +version = "1.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad8646f98db542e39fc66e68a20b2144f6a732636df7c2354e74645faaa433ce" +dependencies = [ + "borsh-derive 1.5.7", + "cfg_aliases", +] + +[[package]] +name = "borsh-derive" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "831213f80d9423998dd696e2c5345aba6be7a0bd8cd19e31c5243e13df1cef89" +dependencies = [ + "borsh-derive-internal", + "borsh-schema-derive-internal", + "proc-macro-crate 0.1.5", + "proc-macro2", + "syn 1.0.109", +] + +[[package]] +name = "borsh-derive" +version = "1.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdd1d3c0c2f5833f22386f252fe8ed005c7f59fdcddeef025c01b4c3b9fd9ac3" +dependencies = [ + "once_cell", + "proc-macro-crate 3.3.0", + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "borsh-derive-internal" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65d6ba50644c98714aa2a70d13d7df3cd75cd2b523a2b452bf010443800976b3" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "borsh-schema-derive-internal" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "276691d96f063427be83e6692b86148e488ebba9f48f77788724ca027ba3b6d4" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "bs58" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "bumpalo" +version = "3.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" + +[[package]] +name = "bv" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8834bb1d8ee5dc048ee3124f2c7c1afcc6bc9aed03f11e9dfd8c69470a5db340" +dependencies = [ + "feature-probe", + "serde", +] + +[[package]] +name = "bytemuck" +version = "1.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9134a6ef01ce4b366b50689c94f82c14bc72bc5d0386829828a2e2752ef7958c" + +[[package]] +name = "bytemuck_derive" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fa76293b4f7bb636ab88fd78228235b5248b4d05cc589aed610f954af5d7c7a" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "cc" +version = "1.2.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f4ac86a9e5bc1e2b3449ab9d7d3a6a405e3d1bb28d7b9be8614f55846ae3766" +dependencies = [ + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "console_error_panic_hook" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" +dependencies = [ + "cfg-if", + "wasm-bindgen", +] + +[[package]] +name = "console_log" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89f72f65e8501878b8a004d5a1afb780987e2ce2b4532c562e367a72c57499f" +dependencies = [ + "log", + "web-sys", +] + +[[package]] +name = "constant_time_eq" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crunchy" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929" + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest 0.10.7", + "fiat-crypto", + "rand_core 0.6.4", + "rustc_version", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer 0.10.4", + "crypto-common", + "subtle", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "feature-probe" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da" + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + +[[package]] +name = "five8" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75b8549488b4715defcb0d8a8a1c1c76a80661b5fa106b4ca0e7fce59d7d875" +dependencies = [ + "five8_core", +] + +[[package]] +name = "five8_const" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26dec3da8bc3ef08f2c04f61eab298c3ab334523e55f076354d6d6f613799a7b" +dependencies = [ + "five8_core", +] + +[[package]] +name = "five8_core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2551bf44bc5f776c15044b9b94153a00198be06743e262afaaa61f11ac7523a5" + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", + "wasm-bindgen", +] + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" + +[[package]] +name = "indexmap" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" +dependencies = [ + "equivalent", + "hashbrown 0.15.2", +] + +[[package]] +name = "js-sys" +version = "0.3.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.172" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" + +[[package]] +name = "libsecp256k1" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9d220bc1feda2ac231cb78c3d26f27676b8cf82c96971f7aeef3d0cf2797c73" +dependencies = [ + "arrayref", + "base64 0.12.3", + "digest 0.9.0", + "libsecp256k1-core", + "libsecp256k1-gen-ecmult", + "libsecp256k1-gen-genmult", + "rand 0.7.3", + "serde", + "sha2 0.9.9", +] + +[[package]] +name = "libsecp256k1-core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0f6ab710cec28cef759c5f18671a27dae2a5f952cdaaee1d8e2908cb2478a80" +dependencies = [ + "crunchy", + "digest 0.9.0", + "subtle", +] + +[[package]] +name = "libsecp256k1-gen-ecmult" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccab96b584d38fac86a83f07e659f0deafd0253dc096dab5a36d53efe653c5c3" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "libsecp256k1-gen-genmult" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67abfe149395e3aa1c48a2beb32b068e2334402df8181f818d3aee2b304c4f5d" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + +[[package]] +name = "parking_lot" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro-crate" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +dependencies = [ + "toml", +] + +[[package]] +name = "proc-macro-crate" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edce586971a4dfaa28950c6f18ed55e0406c1ab88bbce2c6f6293a7aaba73d35" +dependencies = [ + "toml_edit", +] + +[[package]] +name = "proc-macro2" +version = "1.0.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "redox_syscall" +version = "0.5.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "928fca9cf2aa042393a8325b9ead81d2f0df4cb12e1e24cef072922ccd99c5af" +dependencies = [ + "bitflags", +] + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustversion" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "semver" +version = "1.0.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" + +[[package]] +name = "serde" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_bytes" +version = "0.11.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8437fd221bde2d4ca316d61b90e337e9e702b3820b87d63caa9ba6c02bd06d96" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest 0.10.7", + "keccak", +] + +[[package]] +name = "shine_users_cleanup" +version = "0.1.0" +dependencies = [ + "solana-program", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "smallvec" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" + +[[package]] +name = "solana-account" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f949fe4edaeaea78c844023bfc1c898e0b1f5a100f8a8d2d0f85d0a7b090258" +dependencies = [ + "solana-account-info", + "solana-clock", + "solana-instruction", + "solana-pubkey", + "solana-sdk-ids", +] + +[[package]] +name = "solana-account-info" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0c17d606a298a205fae325489fbed88ee6dc4463c111672172327e741c8905d" +dependencies = [ + "bincode", + "serde", + "solana-program-error", + "solana-program-memory", + "solana-pubkey", +] + +[[package]] +name = "solana-address-lookup-table-interface" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1673f67efe870b64a65cb39e6194be5b26527691ce5922909939961a6e6b395" +dependencies = [ + "bincode", + "bytemuck", + "serde", + "serde_derive", + "solana-clock", + "solana-instruction", + "solana-pubkey", + "solana-sdk-ids", + "solana-slot-hashes", +] + +[[package]] +name = "solana-atomic-u64" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52e52720efe60465b052b9e7445a01c17550666beec855cce66f44766697bc2" +dependencies = [ + "parking_lot", +] + +[[package]] +name = "solana-big-mod-exp" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75db7f2bbac3e62cfd139065d15bcda9e2428883ba61fc8d27ccb251081e7567" +dependencies = [ + "num-bigint", + "num-traits", + "solana-define-syscall", +] + +[[package]] +name = "solana-bincode" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19a3787b8cf9c9fe3dd360800e8b70982b9e5a8af9e11c354b6665dd4a003adc" +dependencies = [ + "bincode", + "serde", + "solana-instruction", +] + +[[package]] +name = "solana-blake3-hasher" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1a0801e25a1b31a14494fc80882a036be0ffd290efc4c2d640bfcca120a4672" +dependencies = [ + "blake3", + "solana-define-syscall", + "solana-hash", + "solana-sanitize", +] + +[[package]] +name = "solana-borsh" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "718333bcd0a1a7aed6655aa66bef8d7fb047944922b2d3a18f49cbc13e73d004" +dependencies = [ + "borsh 0.10.4", + "borsh 1.5.7", +] + +[[package]] +name = "solana-clock" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bb482ab70fced82ad3d7d3d87be33d466a3498eb8aa856434ff3c0dfc2e2e31" +dependencies = [ + "serde", + "serde_derive", + "solana-sdk-ids", + "solana-sdk-macro", + "solana-sysvar-id", +] + +[[package]] +name = "solana-cpi" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dc71126edddc2ba014622fc32d0f5e2e78ec6c5a1e0eb511b85618c09e9ea11" +dependencies = [ + "solana-account-info", + "solana-define-syscall", + "solana-instruction", + "solana-program-error", + "solana-pubkey", + "solana-stable-layout", +] + +[[package]] +name = "solana-decode-error" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c781686a18db2f942e70913f7ca15dc120ec38dcab42ff7557db2c70c625a35" +dependencies = [ + "num-traits", +] + +[[package]] +name = "solana-define-syscall" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ae3e2abcf541c8122eafe9a625d4d194b4023c20adde1e251f94e056bb1aee2" + +[[package]] +name = "solana-epoch-rewards" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b575d3dd323b9ea10bb6fe89bf6bf93e249b215ba8ed7f68f1a3633f384db7" +dependencies = [ + "serde", + "serde_derive", + "solana-hash", + "solana-sdk-ids", + "solana-sdk-macro", + "solana-sysvar-id", +] + +[[package]] +name = "solana-epoch-schedule" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fce071fbddecc55d727b1d7ed16a629afe4f6e4c217bc8d00af3b785f6f67ed" +dependencies = [ + "serde", + "serde_derive", + "solana-sdk-ids", + "solana-sdk-macro", + "solana-sysvar-id", +] + +[[package]] +name = "solana-example-mocks" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84461d56cbb8bb8d539347151e0525b53910102e4bced875d49d5139708e39d3" +dependencies = [ + "serde", + "serde_derive", + "solana-address-lookup-table-interface", + "solana-clock", + "solana-hash", + "solana-instruction", + "solana-keccak-hasher", + "solana-message", + "solana-nonce", + "solana-pubkey", + "solana-sdk-ids", + "solana-system-interface", + "thiserror", +] + +[[package]] +name = "solana-feature-gate-interface" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43f5c5382b449e8e4e3016fb05e418c53d57782d8b5c30aa372fc265654b956d" +dependencies = [ + "bincode", + "serde", + "serde_derive", + "solana-account", + "solana-account-info", + "solana-instruction", + "solana-program-error", + "solana-pubkey", + "solana-rent", + "solana-sdk-ids", + "solana-system-interface", +] + +[[package]] +name = "solana-fee-calculator" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89bc408da0fb3812bc3008189d148b4d3e08252c79ad810b245482a3f70cd8d" +dependencies = [ + "log", + "serde", + "serde_derive", +] + +[[package]] +name = "solana-hash" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b96e9f0300fa287b545613f007dfe20043d7812bee255f418c1eb649c93b63" +dependencies = [ + "borsh 1.5.7", + "bytemuck", + "bytemuck_derive", + "five8", + "js-sys", + "serde", + "serde_derive", + "solana-atomic-u64", + "solana-sanitize", + "wasm-bindgen", +] + +[[package]] +name = "solana-instruction" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47298e2ce82876b64f71e9d13a46bc4b9056194e7f9937ad3084385befa50885" +dependencies = [ + "bincode", + "borsh 1.5.7", + "getrandom 0.2.16", + "js-sys", + "num-traits", + "serde", + "serde_derive", + "solana-define-syscall", + "solana-pubkey", + "wasm-bindgen", +] + +[[package]] +name = "solana-instructions-sysvar" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0e85a6fad5c2d0c4f5b91d34b8ca47118fc593af706e523cdbedf846a954f57" +dependencies = [ + "bitflags", + "solana-account-info", + "solana-instruction", + "solana-program-error", + "solana-pubkey", + "solana-sanitize", + "solana-sdk-ids", + "solana-serialize-utils", + "solana-sysvar-id", +] + +[[package]] +name = "solana-keccak-hasher" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7aeb957fbd42a451b99235df4942d96db7ef678e8d5061ef34c9b34cae12f79" +dependencies = [ + "sha3", + "solana-define-syscall", + "solana-hash", + "solana-sanitize", +] + +[[package]] +name = "solana-last-restart-slot" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a6360ac2fdc72e7463565cd256eedcf10d7ef0c28a1249d261ec168c1b55cdd" +dependencies = [ + "serde", + "serde_derive", + "solana-sdk-ids", + "solana-sdk-macro", + "solana-sysvar-id", +] + +[[package]] +name = "solana-loader-v2-interface" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8ab08006dad78ae7cd30df8eea0539e207d08d91eaefb3e1d49a446e1c49654" +dependencies = [ + "serde", + "serde_bytes", + "serde_derive", + "solana-instruction", + "solana-pubkey", + "solana-sdk-ids", +] + +[[package]] +name = "solana-loader-v3-interface" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f7162a05b8b0773156b443bccd674ea78bb9aa406325b467ea78c06c99a63a2" +dependencies = [ + "serde", + "serde_bytes", + "serde_derive", + "solana-instruction", + "solana-pubkey", + "solana-sdk-ids", + "solana-system-interface", +] + +[[package]] +name = "solana-loader-v4-interface" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "706a777242f1f39a83e2a96a2a6cb034cb41169c6ecbee2cf09cb873d9659e7e" +dependencies = [ + "serde", + "serde_bytes", + "serde_derive", + "solana-instruction", + "solana-pubkey", + "solana-sdk-ids", + "solana-system-interface", +] + +[[package]] +name = "solana-message" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1796aabce376ff74bf89b78d268fa5e683d7d7a96a0a4e4813ec34de49d5314b" +dependencies = [ + "bincode", + "blake3", + "lazy_static", + "serde", + "serde_derive", + "solana-bincode", + "solana-hash", + "solana-instruction", + "solana-pubkey", + "solana-sanitize", + "solana-sdk-ids", + "solana-short-vec", + "solana-system-interface", + "solana-transaction-error", + "wasm-bindgen", +] + +[[package]] +name = "solana-msg" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f36a1a14399afaabc2781a1db09cb14ee4cc4ee5c7a5a3cfcc601811379a8092" +dependencies = [ + "solana-define-syscall", +] + +[[package]] +name = "solana-native-token" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "307fb2f78060995979e9b4f68f833623565ed4e55d3725f100454ce78a99a1a3" + +[[package]] +name = "solana-nonce" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "703e22eb185537e06204a5bd9d509b948f0066f2d1d814a6f475dafb3ddf1325" +dependencies = [ + "serde", + "serde_derive", + "solana-fee-calculator", + "solana-hash", + "solana-pubkey", + "solana-sha256-hasher", +] + +[[package]] +name = "solana-program" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98eca145bd3545e2fbb07166e895370576e47a00a7d824e325390d33bf467210" +dependencies = [ + "bincode", + "blake3", + "borsh 0.10.4", + "borsh 1.5.7", + "bs58", + "bytemuck", + "console_error_panic_hook", + "console_log", + "getrandom 0.2.16", + "lazy_static", + "log", + "memoffset", + "num-bigint", + "num-derive", + "num-traits", + "rand 0.8.5", + "serde", + "serde_bytes", + "serde_derive", + "solana-account-info", + "solana-address-lookup-table-interface", + "solana-atomic-u64", + "solana-big-mod-exp", + "solana-bincode", + "solana-blake3-hasher", + "solana-borsh", + "solana-clock", + "solana-cpi", + "solana-decode-error", + "solana-define-syscall", + "solana-epoch-rewards", + "solana-epoch-schedule", + "solana-example-mocks", + "solana-feature-gate-interface", + "solana-fee-calculator", + "solana-hash", + "solana-instruction", + "solana-instructions-sysvar", + "solana-keccak-hasher", + "solana-last-restart-slot", + "solana-loader-v2-interface", + "solana-loader-v3-interface", + "solana-loader-v4-interface", + "solana-message", + "solana-msg", + "solana-native-token", + "solana-nonce", + "solana-program-entrypoint", + "solana-program-error", + "solana-program-memory", + "solana-program-option", + "solana-program-pack", + "solana-pubkey", + "solana-rent", + "solana-sanitize", + "solana-sdk-ids", + "solana-sdk-macro", + "solana-secp256k1-recover", + "solana-serde-varint", + "solana-serialize-utils", + "solana-sha256-hasher", + "solana-short-vec", + "solana-slot-hashes", + "solana-slot-history", + "solana-stable-layout", + "solana-stake-interface", + "solana-system-interface", + "solana-sysvar", + "solana-sysvar-id", + "solana-vote-interface", + "thiserror", + "wasm-bindgen", +] + +[[package]] +name = "solana-program-entrypoint" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "473ffe73c68d93e9f2aa726ad2985fe52760052709aaab188100a42c618060ec" +dependencies = [ + "solana-account-info", + "solana-msg", + "solana-program-error", + "solana-pubkey", +] + +[[package]] +name = "solana-program-error" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ee2e0217d642e2ea4bee237f37bd61bb02aec60da3647c48ff88f6556ade775" +dependencies = [ + "borsh 1.5.7", + "num-traits", + "serde", + "serde_derive", + "solana-decode-error", + "solana-instruction", + "solana-msg", + "solana-pubkey", +] + +[[package]] +name = "solana-program-memory" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b0268f6c89825fb634a34bd0c3b8fdaeaecfc3728be1d622a8ee6dd577b60d4" +dependencies = [ + "num-traits", + "solana-define-syscall", +] + +[[package]] +name = "solana-program-option" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc677a2e9bc616eda6dbdab834d463372b92848b2bfe4a1ed4e4b4adba3397d0" + +[[package]] +name = "solana-program-pack" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "319f0ef15e6e12dc37c597faccb7d62525a509fec5f6975ecb9419efddeb277b" +dependencies = [ + "solana-program-error", +] + +[[package]] +name = "solana-pubkey" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b62adb9c3261a052ca1f999398c388f1daf558a1b492f60a6d9e64857db4ff1" +dependencies = [ + "borsh 0.10.4", + "borsh 1.5.7", + "bytemuck", + "bytemuck_derive", + "curve25519-dalek", + "five8", + "five8_const", + "getrandom 0.2.16", + "js-sys", + "num-traits", + "serde", + "serde_derive", + "solana-atomic-u64", + "solana-decode-error", + "solana-define-syscall", + "solana-sanitize", + "solana-sha256-hasher", + "wasm-bindgen", +] + +[[package]] +name = "solana-rent" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1aea8fdea9de98ca6e8c2da5827707fb3842833521b528a713810ca685d2480" +dependencies = [ + "serde", + "serde_derive", + "solana-sdk-ids", + "solana-sdk-macro", + "solana-sysvar-id", +] + +[[package]] +name = "solana-sanitize" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61f1bc1357b8188d9c4a3af3fc55276e56987265eb7ad073ae6f8180ee54cecf" + +[[package]] +name = "solana-sdk-ids" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5d8b9cc68d5c88b062a33e23a6466722467dde0035152d8fb1afbcdf350a5f" +dependencies = [ + "solana-pubkey", +] + +[[package]] +name = "solana-sdk-macro" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86280da8b99d03560f6ab5aca9de2e38805681df34e0bb8f238e69b29433b9df" +dependencies = [ + "bs58", + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "solana-secp256k1-recover" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baa3120b6cdaa270f39444f5093a90a7b03d296d362878f7a6991d6de3bbe496" +dependencies = [ + "libsecp256k1", + "solana-define-syscall", + "thiserror", +] + +[[package]] +name = "solana-serde-varint" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a7e155eba458ecfb0107b98236088c3764a09ddf0201ec29e52a0be40857113" +dependencies = [ + "serde", +] + +[[package]] +name = "solana-serialize-utils" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "817a284b63197d2b27afdba829c5ab34231da4a9b4e763466a003c40ca4f535e" +dependencies = [ + "solana-instruction", + "solana-pubkey", + "solana-sanitize", +] + +[[package]] +name = "solana-sha256-hasher" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0037386961c0d633421f53560ad7c80675c0447cba4d1bb66d60974dd486c7ea" +dependencies = [ + "sha2 0.10.9", + "solana-define-syscall", + "solana-hash", +] + +[[package]] +name = "solana-short-vec" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c54c66f19b9766a56fa0057d060de8378676cb64987533fa088861858fc5a69" +dependencies = [ + "serde", +] + +[[package]] +name = "solana-slot-hashes" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c8691982114513763e88d04094c9caa0376b867a29577939011331134c301ce" +dependencies = [ + "serde", + "serde_derive", + "solana-hash", + "solana-sdk-ids", + "solana-sysvar-id", +] + +[[package]] +name = "solana-slot-history" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97ccc1b2067ca22754d5283afb2b0126d61eae734fc616d23871b0943b0d935e" +dependencies = [ + "bv", + "serde", + "serde_derive", + "solana-sdk-ids", + "solana-sysvar-id", +] + +[[package]] +name = "solana-stable-layout" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f14f7d02af8f2bc1b5efeeae71bc1c2b7f0f65cd75bcc7d8180f2c762a57f54" +dependencies = [ + "solana-instruction", + "solana-pubkey", +] + +[[package]] +name = "solana-stake-interface" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5269e89fde216b4d7e1d1739cf5303f8398a1ff372a81232abbee80e554a838c" +dependencies = [ + "borsh 0.10.4", + "borsh 1.5.7", + "num-traits", + "serde", + "serde_derive", + "solana-clock", + "solana-cpi", + "solana-decode-error", + "solana-instruction", + "solana-program-error", + "solana-pubkey", + "solana-system-interface", + "solana-sysvar-id", +] + +[[package]] +name = "solana-system-interface" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94d7c18cb1a91c6be5f5a8ac9276a1d7c737e39a21beba9ea710ab4b9c63bc90" +dependencies = [ + "js-sys", + "num-traits", + "serde", + "serde_derive", + "solana-decode-error", + "solana-instruction", + "solana-pubkey", + "wasm-bindgen", +] + +[[package]] +name = "solana-sysvar" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d50c92bc019c590f5e42c61939676e18d14809ed00b2a59695dd5c67ae72c097" +dependencies = [ + "base64 0.22.1", + "bincode", + "bytemuck", + "bytemuck_derive", + "lazy_static", + "serde", + "serde_derive", + "solana-account-info", + "solana-clock", + "solana-define-syscall", + "solana-epoch-rewards", + "solana-epoch-schedule", + "solana-fee-calculator", + "solana-hash", + "solana-instruction", + "solana-instructions-sysvar", + "solana-last-restart-slot", + "solana-program-entrypoint", + "solana-program-error", + "solana-program-memory", + "solana-pubkey", + "solana-rent", + "solana-sanitize", + "solana-sdk-ids", + "solana-sdk-macro", + "solana-slot-hashes", + "solana-slot-history", + "solana-stake-interface", + "solana-sysvar-id", +] + +[[package]] +name = "solana-sysvar-id" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5762b273d3325b047cfda250787f8d796d781746860d5d0a746ee29f3e8812c1" +dependencies = [ + "solana-pubkey", + "solana-sdk-ids", +] + +[[package]] +name = "solana-transaction-error" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "222a9dc8fdb61c6088baab34fc3a8b8473a03a7a5fd404ed8dd502fa79b67cb1" +dependencies = [ + "solana-instruction", + "solana-sanitize", +] + +[[package]] +name = "solana-vote-interface" +version = "2.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef4f08746f154458f28b98330c0d55cb431e2de64ee4b8efc98dcbe292e0672b" +dependencies = [ + "bincode", + "num-derive", + "num-traits", + "serde", + "serde_derive", + "solana-clock", + "solana-decode-error", + "solana-hash", + "solana-instruction", + "solana-pubkey", + "solana-rent", + "solana-sdk-ids", + "solana-serde-varint", + "solana-serialize-utils", + "solana-short-vec", + "solana-system-interface", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "thiserror" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "tinyvec" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09b3661f17e86524eccd4371ab0429194e0d7c008abb45f7a7495b1719463c71" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_datetime" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3da5db5a963e24bc68be8b17b6fa82814bb22ee8660f192bb182771d498f09a3" + +[[package]] +name = "toml_edit" +version = "0.22.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "310068873db2c5b3e7659d2cc35d21855dbafa50d1ce336397c666e3cb08137e" +dependencies = [ + "indexmap", + "toml_datetime", + "winnow", +] + +[[package]] +name = "typenum" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" + +[[package]] +name = "unicode-ident" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" +dependencies = [ + "bumpalo", + "log", + "proc-macro2", + "quote", + "syn 2.0.117", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-sys" +version = "0.3.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06928c8748d81b05c9be96aad92e1b6ff01833332f281e8cfca3be4b35fc9ec" +dependencies = [ + "memchr", +] + +[[package]] +name = "zerocopy" +version = "0.8.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1702d9583232ddb9174e01bb7c15a2ab8fb1bc6f227aa1233858c351a3ba0cb" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/shine-solana/shine/cleanup-shine-users/Cargo.toml b/shine-solana/shine/cleanup-shine-users/Cargo.toml new file mode 100644 index 00000000..6f2b4123 --- /dev/null +++ b/shine-solana/shine/cleanup-shine-users/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "shine_users_cleanup" +version = "0.1.0" +edition = "2021" +publish = false + +[workspace] + +[lib] +name = "shine_users_cleanup" +crate-type = ["cdylib", "lib"] + +[dependencies] +solana-program = "2.1.21" + +[features] +custom-heap = [] +custom-panic = [] diff --git a/shine-solana/shine/cleanup-shine-users/README.md b/shine-solana/shine/cleanup-shine-users/README.md new file mode 100644 index 00000000..1ded4d1f --- /dev/null +++ b/shine-solana/shine/cleanup-shine-users/README.md @@ -0,0 +1,49 @@ +# Черновик разовой очистки `shine_users` в mainnet + +**Не развёрнут.** Исходник в этом каталоге собирается отдельно и предполагает +обновление существующего Program ID `SHiNEPr1APdAgNBteUyBXcNovaHctpSjUu8oH2ZJdN6`. +Он временно заменяет обычную бизнес-логику программы; пока он установлен, +регистрация, обновление пользователей и прочие штатные инструкции недоступны. + +## Контракт очистки + +- Единственная инструкция: один байт `01`. +- Ровно три аккаунта в порядке: подписант `SHiJ58…` (read-only signer), + удаляемый аккаунт (writable), получатель `SHiJ58…` (writable). +- Подписант и получатель обязаны совпадать с полным адресом + `SHiJ58FvbJQJnPEUa5mZNVpWd1ym9CkjjPgeHYzUJmh`. +- Аккаунт должен принадлежать `shine_users` и входить в зашитый список + 12 адресов, полученный через `getProgramAccounts` mainnet 03.12.2026. +- За один вызов удаляется только один аккаунт. Его данные уменьшаются до нуля, + все лампорты переводятся получателю. Повторный вызов для удалённого аккаунта + отклоняется, потому что он больше не принадлежит программе. +- Одиннадцать адресов — записи по 768 байт с префиксом `SHiNE`; + один адрес `GaR7jaae5EnxqWxEdXw1yAzgQ1F2teRaGQsi1XUSKi59` — economy config + размером 25 байт. Иных PDA инструкция не принимает. Перед деплоем нужно + повторно сверить полный список и балансы в сети. + +На момент снимка баланс 11 пользовательских записей суммарно 0.06859776 SOL, +economy config — 0.00106488 SOL; вместе **0.06966264 SOL** до комиссий. +Средства ProgramData `shine_users` этой инструкцией не возвращаются. + +## Подготовка и дальнейший порядок после отдельного одобрения + +1. Повторно запросить mainnet и убедиться, что список аккаунтов, owner, + Program ID, upgrade authority и адрес получателя совпадают с этим черновиком. +2. Собрать `cargo build-sbf --manifest-path cleanup-shine-users/Cargo.toml + --offline` и проверить размер `target/deploy/shine_users_cleanup.so`. +3. Протестировать локально отрицательные сценарии (чужой подписант, чужой + получатель, чужой аккаунт) и успешное закрытие на копиях данных. +4. Сохранить бинарник текущей mainnet-программы и подготовить путь возврата + штатной версии. Учесть, что пока установлен этот код, штатные операции + `shine_users` недоступны. На текущем ProgramData достаточно места для + этого маленького бинарника; для возврата более крупного бинарника может + потребоваться расширение. +5. Только после одобрения: обновить **`shine_users`**, а не закрытый + `shine_login_guard`; затем отправлять по одной инструкции и после каждой + сверять закрытие адреса, подпись транзакции и баланс получателя. +6. После очистки вернуть согласованную штатную версию `shine_users` и проверить + работоспособность. Если цель — удаление всех PDA, сначала убедиться, + что за время очистки не появились новые аккаунты вне зашитого списка. + +Деплой и очистка mainnet здесь не выполнялись. diff --git a/shine-solana/shine/cleanup-shine-users/src/lib.rs b/shine-solana/shine/cleanup-shine-users/src/lib.rs new file mode 100644 index 00000000..49c226ad --- /dev/null +++ b/shine-solana/shine/cleanup-shine-users/src/lib.rs @@ -0,0 +1,52 @@ +//! Одноразовая программа для очистки заранее перечисленных аккаунтов shine_users. +//! Сборку разрешено загружать только как обновление существующего Program ID. + +use solana_program::{ + account_info::{next_account_info, AccountInfo}, + entrypoint, + entrypoint::ProgramResult, + program_error::ProgramError, + pubkey::Pubkey, +}; + +solana_program::declare_id!("SHiNEPr1APdAgNBteUyBXcNovaHctpSjUu8oH2ZJdN6"); +const AUTHORITY: Pubkey = solana_program::pubkey!("SHiJ58FvbJQJnPEUa5mZNVpWd1ym9CkjjPgeHYzUJmh"); +const ACCOUNTS: [Pubkey; 12] = [ + solana_program::pubkey!("5V4Ddf39oybE8PtibzX5AKpUvsNALKq8BrQLdtdLGb2"), + solana_program::pubkey!("GFt3pGL1znNGcZD6nZbz3yth3ccg9pSaxr8JDVQm1sL"), + solana_program::pubkey!("TY5RoF5V6raCzGTwFR3xgg9c414grifQ4YYiP6i5A8V"), + solana_program::pubkey!("5RDLtsjEv6QoAjKkVtBm1vVCNJqKC9L7PaLtiHLX65Kw"), + solana_program::pubkey!("6BigHnyEyNZi7NbFtQztyky9tWkCJi6KRLt6F5XCNV4c"), + solana_program::pubkey!("6XRyMFSxUBYWLPsV5cLeLeopvMZp1JcPEvjiGnF5uz4k"), + solana_program::pubkey!("7uBwZAVXixYwqEny8mDzmCAZ2fSgrmUHdvM99Ks9VWNu"), + solana_program::pubkey!("8gLD1e5yx79cMs82b2s74NtmpuiHTCkdHgham17v2Lar"), + solana_program::pubkey!("8sbxncwuuoKt75K7f5NeVsH8vdxqRfxHu6fvGq6AkEak"), + solana_program::pubkey!("BVNdosfJEQp6uxCzK1eNCYLECzquHbmiGRf5tGWSAfmV"), + solana_program::pubkey!("H6hyJk4ox5EWPCYj1anbh1MRU82zLbJeHS9qxMphxZPX"), + solana_program::pubkey!("GaR7jaae5EnxqWxEdXw1yAzgQ1F2teRaGQsi1XUSKi59"), +]; + +entrypoint!(process_instruction); + +pub fn process_instruction(program_id: &Pubkey, accounts: &[AccountInfo], data: &[u8]) -> ProgramResult { + if program_id != &id() || data != [1] { + return Err(ProgramError::InvalidInstructionData); + } + let mut iter = accounts.iter(); + let signer = next_account_info(&mut iter)?; + let target = next_account_info(&mut iter)?; + let recipient = next_account_info(&mut iter)?; + if iter.next().is_some() || !signer.is_signer || signer.key != &AUTHORITY + || recipient.key != &AUTHORITY || target.key == recipient.key + || !target.is_writable || !recipient.is_writable || target.owner != program_id + || !ACCOUNTS.contains(target.key) + { + return Err(ProgramError::InvalidAccountData); + } + let amount = target.lamports(); + let new_balance = recipient.lamports().checked_add(amount).ok_or(ProgramError::ArithmeticOverflow)?; + target.realloc(0, false)?; + **target.try_borrow_mut_lamports()? = 0; + **recipient.try_borrow_mut_lamports()? = new_balance; + Ok(()) +} diff --git a/shine-solana/shine/doc/FUNDS_FLOW.md b/shine-solana/shine/doc/FUNDS_FLOW.md index f323cdd8..66fbbc82 100644 --- a/shine-solana/shine/doc/FUNDS_FLOW.md +++ b/shine-solana/shine/doc/FUNDS_FLOW.md @@ -24,7 +24,7 @@ ### Покупка (`buy_ticket`, `buy_ticket_usd`, `buy_ticket_sol`) 1. Плательщик: кошелек покупателя (`signer`). -2. Получатель: `dao_wallet` (казна DAO из `ConfigState`). +2. Получатель: `dao_treasury` (казна DAO из `ConfigState`). 3. В `inflow_vault` на этом шаге средства не зачисляются. ## 3) Шаг выплат (`shine_payments::step_payout`) @@ -38,7 +38,7 @@ При шаге выплаты: 1. Из `inflow_vault` переводится `ticket` получателю тикета. -2. Из `inflow_vault` переводится DAO-часть в `dao_wallet`. +2. Из `inflow_vault` переводится DAO-часть в `dao_treasury`. - для `Q1` это `1x payout_usd`; - для `Q2` это `2x payout_usd`; - для `Q3` это `3x payout_usd`; @@ -50,11 +50,13 @@ Подробно — `doc/programs/shine_payments.md`, §11. Если очереди пусты: -1. Весь доступный остаток `inflow_vault` переводится в `dao_wallet`. +1. Весь доступный остаток `inflow_vault` переводится в `dao_treasury`. ## 4) Какие адреса задаются настройками -1. `dao_wallet` — хранится в `ConfigState` (`shine_payments`), задается при `init`. +1. `dao_treasury` — хранится в `ConfigState` (`shine_payments`). Публичный `init` записывает + дефолт `AcJRevXj3Yux2ecxXromMwwxEpPBz6AN53hH6KdqWJ9A`; текущая upgrade authority + ProgramData может затем вызвать `update_dao_treasury` и задать native treasury данного кластера. 2. `inflow_vault` — PDA `shine_payments`, вычисляется по seed и program id. 3. Для `shine_users` получатель комиссии не настраивается отдельно: - всегда используется PDA `inflow_vault` программы `shine_payments`. diff --git a/shine-solana/shine/doc/programs/shine_payments.md b/shine-solana/shine/doc/programs/shine_payments.md index 79e0eb6c..06e06e84 100644 --- a/shine-solana/shine/doc/programs/shine_payments.md +++ b/shine-solana/shine/doc/programs/shine_payments.md @@ -24,9 +24,14 @@ - `SHiPmXbM9Fs9khzRUW3TGKsS2W84aqaXTxs3ZkajW9v` -Текущий зашитый административный кошелек: +Дефолтная казна для нового публичного `init`: -- `DAO_WALLET`: `aiShm43fZjm3YkMs22sYL1bpXaL3bVxv7SSraPHzVgq` +- `DEFAULT_DAO_TREASURY`: `AcJRevXj3Yux2ecxXromMwwxEpPBz6AN53hH6KdqWJ9A`. + +Это только начальное значение Config PDA. Реальную казну конкретного кластера +хранит `ConfigState.dao_treasury`; её меняет `update_dao_treasury`. Право менять +казну, коэффициент и менеджерские лимиты определяется текущей upgrade authority +ProgramData, а не адресом казны. ## 2. Основная модель @@ -87,7 +92,7 @@ Поля: - `version: u8` -- `dao_wallet: Pubkey` +- `dao_treasury: Pubkey` — получатель доходов DAO; не является административным signer; - `inflow_vault: Pubkey` ### 4.2. `CoefLimitState` @@ -196,7 +201,7 @@ ### Что записывается -- `dao_wallet` берётся из settings/deploy config; +- `dao_treasury` получает `DEFAULT_DAO_TREASURY`; - `inflow_vault` указывается как PDA самой программы; - коэффициенты и лимиты пишутся стартовыми значениями; - очереди стартуют с нулями. @@ -209,11 +214,16 @@ ### Авторизация -Только `dao_wallet` из `ConfigState`. +Только текущая upgrade authority из ProgramData этой программы. + +В accounts после `config_pda` и `coef_limit_pda` передаются сама исполняемая +программа `shine_payments` и её ProgramData. Программа проверяет связь Program → +ProgramData, owner Upgradeable Loader и `upgrade_authority == signer`. При +`upgrade_authority=None` инструкция недоступна. ### Проверки -- signer = `config.dao_wallet` +- signer совпадает с текущей `upgrade_authority` ProgramData; - `coef_ppm > 0` - `limit_usd_cents > 0` - `call_reward_lamports <= MAX_CALL_REWARD_LAMPORTS` @@ -226,15 +236,44 @@ ### Авторизация -Только DAO. +Только текущая upgrade authority ProgramData. Первый account — authority signer; +второй account — отдельный writable signer `rent_payer`. Далее передаются +`config_pda`, `manager_allowance_pda`, System Program, исполняемая программа +`shine_payments` и её ProgramData. ### Поведение - создаёт `manager_allowance_pda`, если её ещё нет; +- rent нового `manager_allowance_pda` оплачивает `rent_payer`, а не обязательно authority; - увеличивает доступные лимиты Q1/Q2/Q3 для указанного менеджера; - не добавляет тикеты сама. -## 9. Инструкции покупки тикета +## 9. Инструкция `update_dao_treasury` + +### Назначение + +Изменить только адрес, куда программа направляет DAO-доходы: покупки тикетов, +DAO-долю `step_payout` и доступный остаток inflow vault при пустых очередях. + +### Wire-формат и accounts + +```text +tag:u8 = 10 +new_treasury:[32] +``` + +Accounts в порядке: signer, writable `config_pda`, executable `shine_payments`, +readonly ProgramData `shine_payments`. + +### Авторизация и совместимость + +Авторизация совпадает с §7: signer должен быть текущей upgrade authority ProgramData. +Размер и положение поля Config PDA не менялись: существующий mainnet Config PDA +совместим, а инструкция переписывает его 32-байтный адрес казны. Для devnet/testnet +после публичного `init` необходимо до любых покупок тикетов и выплат вызвать эту +инструкцию с native treasury тестового DAO. + +## 10. Инструкции покупки тикета Есть три входных варианта: @@ -248,14 +287,14 @@ - создаётся ticket в очереди `Q1`; - обновляются агрегаты очереди `Q1`. -### 9.1. Общие правила +### 10.1. Общие правила - ticket создаётся только в `Q1`; - очередь `Q1` временно блокируется, если достигнут её суммарный лимит; - `payout_usd_cents = purchase_usd_cents * coef_ppm / COEF_SCALE_PPM`; - `recipient_wallet` записывается в ticket; -- `recipient_wallet` **не должен совпадать с адресом inflow-вольта** (см. §10.1); -- `recipient_wallet` не должен быть зарезервированным адресом (см. §10.2), иначе +- `recipient_wallet` **не должен совпадать с адресом inflow-вольта** (см. §11.1); +- `recipient_wallet` не должен быть зарезервированным адресом (см. §11.2), иначе `InvalidTicketRecipient` (19); - сумма, переводимая покупателем (`transfer_lamports`), не меньше `MIN_TICKET_PURCHASE_LAMPORTS` (0.1 SOL), иначе `TicketPurchaseTooSmall` (37). Правило @@ -264,12 +303,12 @@ долей тикета, и плодить мелкие тикеты ради награды невыгодно; а выплата по тикету заведомо выше rent-минимума, так что её примет и новый пустой кошелёк. -### 9.2. Важная деталь денежного потока +### 10.2. Важная деталь денежного потока В текущей реализации при покупке тикета лампорты переводятся: - не во inflow vault; -- а напрямую в `dao_wallet`. +- а напрямую в `dao_treasury` из Config PDA. То есть: @@ -278,7 +317,7 @@ Эта деталь обязательно должна быть осознана при переписи: либо её сохраняют как сознательную модель, либо отдельно меняют и тогда обновляют этот документ. -## 10. Инструкция `manager_add_ticket` +## 11. Инструкция `manager_add_ticket` ### Назначение @@ -292,8 +331,8 @@ Signer должен совпадать с `manager_wallet` в `manager_allowance - `queue_id` только `1`, `2` или `3`; - `payout_usd_cents > 0`; -- `recipient_wallet` не равен адресу inflow-вольта (см. §10.1); -- `recipient_wallet` не является зарезервированным адресом (см. §10.2); +- `recipient_wallet` не равен адресу inflow-вольта (см. §11.1); +- `recipient_wallet` не является зарезервированным адресом (см. §11.2); - доступный allowance по очереди не меньше суммы тикета; - ticket PDA ещё не существует. @@ -303,7 +342,7 @@ Signer должен совпадать с `manager_wallet` в `manager_allowance - allowance уменьшается; - агрегаты соответствующей очереди увеличиваются. -### 10.1. Запрет получателя, равного inflow-вольту (важно для безопасности) +### 11.1. Запрет получателя, равного inflow-вольту (важно для безопасности) `recipient_wallet` тикета не должен совпадать с адресом `inflow_vault` PDA. Причина: в `step_payout` выплата получателю исполняется прямой манипуляцией @@ -320,7 +359,7 @@ Signer должен совпадать с `manager_wallet` в `manager_allowance Для тикетов менеджера минимальной суммы нет: их размер задаёт allowance, выданный DAO. -### 10.2. Зарезервированные получатели +### 11.2. Зарезервированные получатели Нельзя указать получателем (`buy_ticket*`, `manager_add_ticket`, `change_ticket_recipient`; ошибка `InvalidTicketRecipient`, 19) адреса из `settings::RESERVED_RECIPIENTS` и саму @@ -341,9 +380,9 @@ Signer должен совпадать с `manager_wallet` в `manager_allowance аккаунты в транзакции понижает до read-only. Тикет с таким получателем невозможно оплатить, и раньше он навсегда останавливал очередь. Список отсекает известные адреса при вводе; всё, что он не покрывает (любая другая программа, недостижимый по rent адрес), ловит -автопропуск в `step_payout` (§11). +автопропуск в `step_payout` (§12). -## 11. Инструкция `step_payout` +## 12. Инструкция `step_payout` ### Назначение @@ -372,7 +411,7 @@ next_index = tickets_paid + 1 ### Проверки - `config_pda`, `coef_limit_pda`, `queues_pda`, `inflow_vault_pda` валидны; -- `dao_wallet` совпадает с `config.dao_wallet`; +- `dao_treasury` совпадает с `config.dao_treasury`; - `next_ticket_pda` совпадает с PDA следующего тикета; - тикет ещё не оплачен; - `ticket_recipient_wallet` совпадает с `ticket.recipient_wallet`; @@ -383,7 +422,7 @@ next_index = tickets_paid + 1 Перед переводами программа проверяет, сможет ли получатель принять `ticket_lamports`. Принять не сможет, если: -- аккаунт исполняемый (программа) или зарезервированный (§10.2); +- аккаунт исполняемый (программа) или зарезервированный (§11.2); - после зачисления его баланс остался бы ниже rent-минимума для его размера данных (`Rent::minimum_balance(data_len)`): runtime запрещает «создать» пустой адрес суммой ниже минимума и увеличивать баланс rent-paying аккаунта, не выводя его из ренты. @@ -433,9 +472,9 @@ next_index = tickets_paid + 1 Если все три очереди пусты: -- весь доступный остаток inflow vault переводится в DAO wallet. +- весь доступный остаток inflow vault переводится в `dao_treasury`. -## 12. Инструкция `change_ticket_recipient` +## 13. Инструкция `change_ticket_recipient` ### Назначение @@ -447,8 +486,8 @@ next_index = tickets_paid + 1 ### Ограничения -`new_recipient_wallet` не должен совпадать с адресом inflow-вольта (см. §10.1) и не должен -быть зарезервированным адресом (см. §10.2). +`new_recipient_wallet` не должен совпадать с адресом inflow-вольта (см. §11.1) и не должен +быть зарезервированным адресом (см. §11.2). Нельзя менять получателя у следующего тикета на выплату в активной очереди. @@ -459,7 +498,7 @@ next_index = tickets_paid + 1 - иначе следующий ticket берётся в `Q3`; - если текущий ticket и есть этот ближайший ticket, смена recipient запрещена. -## 13. Pyth oracle и конвертация +## 14. Pyth oracle и конвертация Программа использует Pyth SOL/USD. @@ -485,7 +524,7 @@ next_index = tickets_paid + 1 Это важно, чтобы не недоплачивать обязательства при payout. -## 14. Ошибки и классы отказа +## 15. Ошибки и классы отказа Программа должна различать как минимум: @@ -504,7 +543,7 @@ next_index = tickets_paid + 1 - oracle account/feed/price invalid; - slippage exceeded. -## 15. Что должно сохраниться при переписи без Anchor +## 16. Что должно сохраниться при переписи без Anchor Обязательно сохранить: diff --git a/shine-solana/shine/doc/programs/shine_users.md b/shine-solana/shine/doc/programs/shine_users.md index 00b9dc16..cb7d8864 100644 --- a/shine-solana/shine/doc/programs/shine_users.md +++ b/shine-solana/shine/doc/programs/shine_users.md @@ -1,8 +1,11 @@ # Программа `shine_users` -Актуальный пользовательский формат — `user_pda 1.3`; [нормативные изменения](../../../../docs/Solana/SHINE_USER_PDA_V13_ROOT_LIMITS.md). -Физический layout: `doc/formats/shine-user-pda-format-v.1.2.md` с изменениями 1.3. -Legacy 1.0 считается тестовым и не мигрируется. +Публичная версия программы — `1.0.0`. Поддерживается ровно один формат +пользовательской PDA: `SHiNE/1.0`; адрес выводится только из полного +`login@namespace`. Форматы 1.2/1.3 и переходные cleanup-инструкции удалены. + +Физический layout основан на последнем проверенном layout прежней 1.3, но его +единственная публичная версия теперь `1.0`. ## Что хранит программа @@ -99,21 +102,10 @@ Canonical hash = SHA256(unsigned PDA без 4 байт paid_limit_bytes кажд В V2 диспетчер не исполняет opcode 5. Новая регистрация не обращается в `shine_login_guard`, не использует promo seller и premium классы. Исторические standalone программы не удалялись. -### `6 close_legacy_pda` +### `6` — удалена -Временная cleanup-инструкция для тестовых PDA 1.0. - -```text -tag:u8 = 6 -login:string_u8 -``` - -Accounts: - -1. caller signer + writable; -2. legacy user PDA writable. - -Программа проверяет PDA seed/owner и `format=1.0`, переводит все lamports PDA вызывающему и обнуляет account data. PDA 1.2/1.3 этой инструкцией закрыть нельзя. +Opcode 6 не исполняется. Одноразовый opcode 11 существовал только в отдельном +промежуточном reset-релизе и отсутствует в публичной версии 1.0.0. ### `7 create_namespace` diff --git a/shine-solana/shine/doc/shine_payments_e2e_test_plan.md b/shine-solana/shine/doc/shine_payments_e2e_test_plan.md index 0ddc72e2..e4cea145 100644 --- a/shine-solana/shine/doc/shine_payments_e2e_test_plan.md +++ b/shine-solana/shine/doc/shine_payments_e2e_test_plan.md @@ -17,8 +17,10 @@ 2. Однократный `init` на пустых PDA. 3. Покупку билетов через `buy_ticket_usd` и `buy_ticket_sol`. 4. DAO-управление: + - `update_dao_treasury` с native treasury данного кластера; - `update_coef_limit` - `grant_manager_limits` + - отказ этих трёх инструкций для signer, не совпадающего с upgrade authority ProgramData. 5. Создание менеджерских тикетов во все три очереди: - `Q1` - `Q2` diff --git a/shine-solana/shine/package-lock.json b/shine-solana/shine/package-lock.json index b86a2553..cf705df2 100644 --- a/shine-solana/shine/package-lock.json +++ b/shine-solana/shine/package-lock.json @@ -4,7 +4,7 @@ "requires": true, "packages": { "": { - "license": "UNLICENSED", + "license": "AGPL-3.0-or-later", "dependencies": { "@coral-xyz/anchor": "^0.31.1", "@metaplex-foundation/mpl-token-metadata": "^3.4.0", diff --git a/shine-solana/shine/package.json b/shine-solana/shine/package.json index e3669c89..a7652a2f 100644 --- a/shine-solana/shine/package.json +++ b/shine-solana/shine/package.json @@ -1,6 +1,6 @@ { "private": true, - "license": "UNLICENSED", + "license": "AGPL-3.0-or-later", "scripts": { "lint:fix": "prettier */*.js \"*/**/*{.js,.ts}\" -w", "lint": "prettier */*.js \"*/**/*{.js,.ts}\" --check" diff --git a/shine-solana/shine/programs/shine_login_guard/Cargo.toml b/shine-solana/shine/programs/shine_login_guard/Cargo.toml index 2426b106..c32cb30d 100644 --- a/shine-solana/shine/programs/shine_login_guard/Cargo.toml +++ b/shine-solana/shine/programs/shine_login_guard/Cargo.toml @@ -3,6 +3,7 @@ name = "shine_login_guard" version = "0.1.0" description = "Premium login classification program" edition = "2021" +license = "AGPL-3.0-or-later" [lib] crate-type = ["cdylib", "lib"] diff --git a/shine-solana/shine/programs/shine_payments/Cargo.toml b/shine-solana/shine/programs/shine_payments/Cargo.toml index b0d438f6..dabf407a 100644 --- a/shine-solana/shine/programs/shine_payments/Cargo.toml +++ b/shine-solana/shine/programs/shine_payments/Cargo.toml @@ -1,8 +1,9 @@ [package] name = "shine_payments" -version = "0.2.0" -description = "Shine Payments v2 (очереди выплат)" +version = "1.0.0" +description = "Shine Payments 1.0 (очереди выплат)" edition = "2021" +license = "AGPL-3.0-or-later" [lib] crate-type = ["cdylib", "lib"] diff --git a/shine-solana/shine/programs/shine_payments/src/lib.rs b/shine-solana/shine/programs/shine_payments/src/lib.rs index 7e0c28e5..bd25c6ba 100644 --- a/shine-solana/shine/programs/shine_payments/src/lib.rs +++ b/shine-solana/shine/programs/shine_payments/src/lib.rs @@ -3,6 +3,7 @@ use pyth_solana_receiver_sdk::error::GetPriceError; use pyth_solana_receiver_sdk::price_update::{get_feed_id_from_hex, FeedId, PriceUpdateV2}; use solana_program::{ account_info::{next_account_info, AccountInfo}, + bpf_loader_upgradeable, clock::Clock, entrypoint, entrypoint::ProgramResult, @@ -30,6 +31,7 @@ const IX_BUY_TICKET_SOL: u8 = 6; const IX_MANAGER_ADD_TICKET: u8 = 7; const IX_STEP_PAYOUT: u8 = 8; const IX_CHANGE_TICKET_RECIPIENT: u8 = 9; +const IX_UPDATE_DAO_TREASURY: u8 = 10; /// Значение байта статуса тикета «закрыт пропуском без выплаты». const TICKET_STATUS_SKIPPED: u8 = 2; @@ -42,9 +44,9 @@ enum PaymentsError { InvalidPdaAddress = 3, EmptyState = 4, InvalidAccountData = 5, - InvalidSettingsWallet = 6, + InvalidSettingsTreasury = 6, InvalidInflowVault = 7, - InvalidDaoWallet = 8, + InvalidDaoTreasury = 8, UnauthorizedManager = 9, UnauthorizedDao = 10, InvalidCoefficient = 11, @@ -74,6 +76,7 @@ enum PaymentsError { InvalidSystemProgram = 35, PdaAlreadyExists = 36, TicketPurchaseTooSmall = 37, + InvalidUpgradeAuthority = 38, } impl From for ProgramError { @@ -145,10 +148,17 @@ pub struct ChangeTicketRecipientArgs { pub new_recipient_wallet: Pubkey, } +#[derive(Clone, Debug)] +pub struct UpdateDaoTreasuryArgs { + pub new_treasury: Pubkey, +} + #[derive(Clone, Debug)] pub struct ConfigState { pub version: u8, - pub dao_wallet: Pubkey, + /// Получатель доходов DAO. Это не административный signer: административные + /// инструкции проверяют текущую upgrade authority ProgramData. + pub dao_treasury: Pubkey, pub inflow_vault: Pubkey, } @@ -274,7 +284,7 @@ impl StateCodec for ConfigState { fn encode(&self) -> Vec { let mut out = Vec::with_capacity(65); out.push(self.version); - out.extend_from_slice(self.dao_wallet.as_ref()); + out.extend_from_slice(self.dao_treasury.as_ref()); out.extend_from_slice(self.inflow_vault.as_ref()); out } @@ -282,10 +292,10 @@ impl StateCodec for ConfigState { fn decode(data: &[u8]) -> Result { let mut reader = Reader::new(data, PaymentsError::InvalidAccountData.into()); let version = reader.read_u8()?; - let dao_wallet = reader.read_pubkey()?; + let dao_treasury = reader.read_pubkey()?; let inflow_vault = reader.read_pubkey()?; require!(reader.cursor == data.len(), PaymentsError::InvalidAccountData); - Ok(Self { version, dao_wallet, inflow_vault }) + Ok(Self { version, dao_treasury, inflow_vault }) } } @@ -452,6 +462,7 @@ enum Instruction { ManagerAddTicket(ManagerAddTicketArgs), StepPayout, ChangeTicketRecipient(ChangeTicketRecipientArgs), + UpdateDaoTreasury(UpdateDaoTreasuryArgs), } pub fn process_instruction( @@ -469,6 +480,7 @@ pub fn process_instruction( Instruction::ManagerAddTicket(args) => process_manager_add_ticket(program_id, accounts, args), Instruction::StepPayout => process_step_payout(program_id, accounts), Instruction::ChangeTicketRecipient(args) => process_change_ticket_recipient(program_id, accounts, args), + Instruction::UpdateDaoTreasury(args) => process_update_dao_treasury(program_id, accounts, args), } } @@ -513,6 +525,9 @@ fn parse_instruction(data: &[u8]) -> Result { IX_CHANGE_TICKET_RECIPIENT => Instruction::ChangeTicketRecipient(ChangeTicketRecipientArgs { new_recipient_wallet: reader.read_pubkey()?, }), + IX_UPDATE_DAO_TREASURY => Instruction::UpdateDaoTreasury(UpdateDaoTreasuryArgs { + new_treasury: reader.read_pubkey()?, + }), _ => return Err(ProgramError::InvalidInstructionData), }; reader.finish()?; @@ -535,12 +550,12 @@ fn process_init(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult require!(is_uninitialized_account(queues_pda), PaymentsError::SystemAlreadyInitialized); require!(is_uninitialized_account(inflow_vault_pda), PaymentsError::SystemAlreadyInitialized); - let dao_wallet = Pubkey::from_str(settings::DAO_WALLET) - .map_err(|_| ProgramError::from(PaymentsError::InvalidSettingsWallet))?; + let dao_treasury = Pubkey::from_str(settings::DEFAULT_DAO_TREASURY) + .map_err(|_| ProgramError::from(PaymentsError::InvalidSettingsTreasury))?; let config = ConfigState { version: 1, - dao_wallet, + dao_treasury, inflow_vault: *inflow_vault_pda.key, }; create_and_store_state( @@ -617,12 +632,13 @@ fn process_update_coef_limit( let signer = next_signer_account(account_iter)?; let config_pda = next_account_info(account_iter)?; let coef_limit_pda = next_account_info(account_iter)?; + let program_ai = next_account_info(account_iter)?; + let programdata_ai = next_account_info(account_iter)?; require!(account_iter.next().is_none(), PaymentsError::InvalidInstruction); + validate_upgrade_authority(program_id, signer, program_ai, programdata_ai)?; validate_singleton_state_pda(program_id, config_pda, settings::CONFIG_SEED)?; validate_singleton_state_pda(program_id, coef_limit_pda, settings::COEF_LIMIT_SEED)?; - let config = read_state::(config_pda)?; - require_keys_eq!(config.dao_wallet, *signer.key, PaymentsError::UnauthorizedDao); require!(args.coef_ppm > 0, PaymentsError::InvalidCoefficient); require!(args.limit_usd_cents > 0, PaymentsError::InvalidLimit); require!( @@ -643,16 +659,22 @@ fn process_grant_manager_limits( args: GrantManagerLimitsArgs, ) -> ProgramResult { let account_iter = &mut accounts.iter(); - let signer = next_signer_account(account_iter)?; + let authority = next_signer_account(account_iter)?; + // Authority и плательщик rent разделены: после передачи authority DAO + // governance PDA может авторизовать лимит, а обычный подписант оплатит + // создание нового manager_allowance PDA. + let rent_payer = next_signer_account(account_iter)?; let config_pda = next_account_info(account_iter)?; let manager_allowance_pda = next_account_info(account_iter)?; let system_program_ai = next_account_info(account_iter)?; + let program_ai = next_account_info(account_iter)?; + let programdata_ai = next_account_info(account_iter)?; require!(account_iter.next().is_none(), PaymentsError::InvalidInstruction); require_system_program(system_program_ai)?; + require!(rent_payer.is_writable, PaymentsError::InvalidSigner); + validate_upgrade_authority(program_id, authority, program_ai, programdata_ai)?; validate_singleton_state_pda(program_id, config_pda, settings::CONFIG_SEED)?; - let config = read_state::(config_pda)?; - require_keys_eq!(config.dao_wallet, *signer.key, PaymentsError::UnauthorizedDao); require!( args.add_q1_usd_cents > 0 || args.add_q2_usd_cents > 0 || args.add_q3_usd_cents > 0, PaymentsError::InvalidAmount @@ -671,7 +693,7 @@ fn process_grant_manager_limits( }; create_state_with_seeds( program_id, - signer, + rent_payer, system_program_ai, manager_allowance_pda, &[ @@ -694,6 +716,29 @@ fn process_grant_manager_limits( write_state(manager_allowance_pda, &state) } +/// Меняет только адрес, куда программа направляет DAO-доходы. Право берётся +/// из ProgramData, поэтому после передачи upgrade authority оно автоматически +/// переходит governance PDA DAO. +fn process_update_dao_treasury( + program_id: &Pubkey, + accounts: &[AccountInfo], + args: UpdateDaoTreasuryArgs, +) -> ProgramResult { + let account_iter = &mut accounts.iter(); + let signer = next_signer_account(account_iter)?; + let config_pda = next_account_info(account_iter)?; + let program_ai = next_account_info(account_iter)?; + let programdata_ai = next_account_info(account_iter)?; + require!(account_iter.next().is_none(), PaymentsError::InvalidInstruction); + + validate_upgrade_authority(program_id, signer, program_ai, programdata_ai)?; + validate_singleton_state_pda(program_id, config_pda, settings::CONFIG_SEED)?; + require!(config_pda.is_writable, PaymentsError::InvalidAccountData); + let mut config = read_state::(config_pda)?; + config.dao_treasury = args.new_treasury; + write_state(config_pda, &config) +} + fn process_buy_ticket( program_id: &Pubkey, accounts: &[AccountInfo], @@ -812,7 +857,7 @@ fn process_step_payout(program_id: &Pubkey, accounts: &[AccountInfo]) -> Program let inflow_vault_pda = next_account_info(account_iter)?; let next_ticket_pda = next_account_info(account_iter)?; let ticket_recipient_wallet = next_account_info(account_iter)?; - let dao_wallet = next_account_info(account_iter)?; + let dao_treasury = next_account_info(account_iter)?; let sol_usd_price_update = next_account_info(account_iter)?; require!(account_iter.next().is_none(), PaymentsError::InvalidInstruction); @@ -825,7 +870,7 @@ fn process_step_payout(program_id: &Pubkey, accounts: &[AccountInfo]) -> Program let mut queues = read_state::(queues_pda)?; let _vault_state = read_state::(inflow_vault_pda)?; - require_keys_eq!(*dao_wallet.key, config.dao_wallet, PaymentsError::InvalidDaoWallet); + require_keys_eq!(*dao_treasury.key, config.dao_treasury, PaymentsError::InvalidDaoTreasury); require_keys_eq!(*inflow_vault_pda.key, config.inflow_vault, PaymentsError::InvalidInflowVault); let q1_pending = checked_sub(queues.q1_tickets_total, queues.q1_tickets_paid)?; @@ -833,7 +878,7 @@ fn process_step_payout(program_id: &Pubkey, accounts: &[AccountInfo]) -> Program let q3_pending = checked_sub(queues.q3_tickets_total, queues.q3_tickets_paid)?; if q1_pending == 0 && q2_pending == 0 && q3_pending == 0 { - transfer_all_available_to_dao(inflow_vault_pda, dao_wallet)?; + transfer_all_available_to_dao(inflow_vault_pda, dao_treasury)?; return Ok(()); } @@ -882,7 +927,7 @@ fn process_step_payout(program_id: &Pubkey, accounts: &[AccountInfo]) -> Program require!(available_vault_lamports(inflow_vault_pda)? >= needed, PaymentsError::NotEnoughInflowForStep); transfer_from_vault(inflow_vault_pda, ticket_recipient_wallet, ticket_lamports)?; - transfer_from_vault(inflow_vault_pda, dao_wallet, dao_lamports)?; + transfer_from_vault(inflow_vault_pda, dao_treasury, dao_lamports)?; transfer_from_vault(inflow_vault_pda, signer, coef_limit.call_reward_lamports)?; ticket.is_paid = true; @@ -948,7 +993,7 @@ struct BuyTicketAccounts<'a, 'info> { coef_limit_pda: &'a AccountInfo<'info>, queues_pda: &'a AccountInfo<'info>, ticket_pda: &'a AccountInfo<'info>, - dao_wallet: &'a AccountInfo<'info>, + dao_treasury: &'a AccountInfo<'info>, sol_usd_price_update: &'a AccountInfo<'info>, system_program_ai: &'a AccountInfo<'info>, } @@ -961,7 +1006,7 @@ impl<'a, 'info> BuyTicketAccounts<'a, 'info> { let coef_limit_pda = next_account_info(account_iter)?; let queues_pda = next_account_info(account_iter)?; let ticket_pda = next_account_info(account_iter)?; - let dao_wallet = next_account_info(account_iter)?; + let dao_treasury = next_account_info(account_iter)?; let sol_usd_price_update = next_account_info(account_iter)?; let system_program_ai = next_account_info(account_iter)?; require!(account_iter.next().is_none(), PaymentsError::InvalidInstruction); @@ -972,7 +1017,7 @@ impl<'a, 'info> BuyTicketAccounts<'a, 'info> { coef_limit_pda, queues_pda, ticket_pda, - dao_wallet, + dao_treasury, sol_usd_price_update, system_program_ai, }) @@ -1008,6 +1053,46 @@ fn validate_singleton_state_pda( Ok(()) } +/// Проверяет не переданный клиентом адрес, а текущую upgrade authority ProgramData +/// именно этой программы. Layout соответствует UpgradeableLoaderState: +/// Program = [2:u32LE, programdata:32], ProgramData = +/// [3:u32LE, slot:u64LE, Option:1+32]. +fn validate_upgrade_authority( + program_id: &Pubkey, + signer: &AccountInfo, + program_ai: &AccountInfo, + programdata_ai: &AccountInfo, +) -> ProgramResult { + require!(signer.is_signer, PaymentsError::InvalidSigner); + require_keys_eq!(*program_ai.key, *program_id, PaymentsError::InvalidUpgradeAuthority); + require!( + program_ai.executable && *program_ai.owner == bpf_loader_upgradeable::id(), + PaymentsError::InvalidUpgradeAuthority + ); + let program_data = program_ai.try_borrow_data()?; + require!( + program_data.len() >= 36 && program_data[0..4] == 2u32.to_le_bytes(), + PaymentsError::InvalidUpgradeAuthority + ); + require!( + program_data[4..36] == programdata_ai.key.to_bytes(), + PaymentsError::InvalidUpgradeAuthority + ); + require!( + *programdata_ai.owner == bpf_loader_upgradeable::id(), + PaymentsError::InvalidUpgradeAuthority + ); + let programdata = programdata_ai.try_borrow_data()?; + require!( + programdata.len() >= 45 + && programdata[0..4] == 3u32.to_le_bytes() + && programdata[12] == 1 + && programdata[13..45] == signer.key.to_bytes(), + PaymentsError::InvalidUpgradeAuthority + ); + Ok(()) +} + fn find_single_pda(program_id: &Pubkey, seed: &[u8]) -> (Pubkey, u8) { Pubkey::find_program_address(&[seed], program_id) } @@ -1050,7 +1135,7 @@ fn buy_ticket_by_purchase_usd( let coef_limit = read_state::(ctx.coef_limit_pda)?; let mut queues = read_state::(ctx.queues_pda)?; - require_keys_eq!(*ctx.dao_wallet.key, config.dao_wallet, PaymentsError::InvalidDaoWallet); + require_keys_eq!(*ctx.dao_treasury.key, config.dao_treasury, PaymentsError::InvalidDaoTreasury); // Получатель тикета не должен совпадать с inflow-вольтом: иначе в step_payout // вольт окажется и источником, и получателем перевода (алиасинг одного аккаунта), // второй mutable-займ в transfer_from_vault упадёт, и такой тикет навсегда @@ -1074,7 +1159,7 @@ fn buy_ticket_by_purchase_usd( let payout_usd_cents = checked_mul(purchase_usd_cents, coef_limit.coef_ppm)? / settings::COEF_SCALE_PPM; require!(payout_usd_cents > 0, PaymentsError::InvalidPayoutAmount); - transfer_from_signer_to_target(ctx.signer, ctx.dao_wallet, ctx.system_program_ai, transfer_lamports)?; + transfer_from_signer_to_target(ctx.signer, ctx.dao_treasury, ctx.system_program_ai, transfer_lamports)?; let ticket = TicketState { version: 1, @@ -1348,9 +1433,9 @@ fn credit_leaves_rent_exempt(lamports: u64, amount: u64, min_balance: u64) -> bo lamports.saturating_add(amount) >= min_balance } -fn transfer_all_available_to_dao(vault: &AccountInfo, dao_wallet: &AccountInfo) -> ProgramResult { +fn transfer_all_available_to_dao(vault: &AccountInfo, dao_treasury: &AccountInfo) -> ProgramResult { let available = available_vault_lamports(vault)?; - transfer_from_vault(vault, dao_wallet, available) + transfer_from_vault(vault, dao_treasury, available) } fn next_signer_account<'a, 'info>( @@ -1553,4 +1638,86 @@ mod tests { // Награда за шаг выплаты — не больше 10% минимального тикета. assert!(settings::MAX_CALL_REWARD_LAMPORTS * 10 <= settings::MIN_TICKET_PURCHASE_LAMPORTS); } + + #[test] + fn config_treasury_keeps_existing_binary_layout() { + let config = ConfigState { + version: 1, + dao_treasury: Pubkey::new_from_array([4; 32]), + inflow_vault: Pubkey::new_from_array([5; 32]), + }; + let encoded = config.encode(); + assert_eq!(encoded.len(), ConfigState::encoded_len()); + assert_eq!(encoded[0], 1); + assert_eq!(&encoded[1..33], &[4; 32]); + assert_eq!(&encoded[33..65], &[5; 32]); + let decoded = ConfigState::decode(&encoded).unwrap(); + assert_eq!(decoded.dao_treasury, config.dao_treasury); + assert_eq!(decoded.inflow_vault, config.inflow_vault); + } + + #[test] + fn update_dao_treasury_instruction_is_parsed() { + let treasury = Pubkey::new_from_array([6; 32]); + let mut data = vec![IX_UPDATE_DAO_TREASURY]; + data.extend_from_slice(treasury.as_ref()); + match parse_instruction(&data).unwrap() { + Instruction::UpdateDaoTreasury(args) => assert_eq!(args.new_treasury, treasury), + _ => panic!("ожидалась инструкция update_dao_treasury"), + } + } + + #[test] + fn upgrade_authority_is_read_only_from_own_programdata() { + let signer_key = Pubkey::new_from_array([7; 32]); + let programdata_key = Pubkey::new_from_array([8; 32]); + let loader = bpf_loader_upgradeable::id(); + let system_owner = system_program::id(); + + let mut signer_lamports = 0; + let mut signer_data: [u8; 0] = []; + let signer = AccountInfo::new( + &signer_key, + true, + false, + &mut signer_lamports, + &mut signer_data, + &system_owner, + false, + 0, + ); + + let mut program_lamports = 0; + let mut program_data = vec![0; 36]; + program_data[..4].copy_from_slice(&2u32.to_le_bytes()); + program_data[4..36].copy_from_slice(programdata_key.as_ref()); + let program = AccountInfo::new( + &ID, + false, + false, + &mut program_lamports, + &mut program_data, + &loader, + true, + 0, + ); + + let mut programdata_lamports = 0; + let mut programdata_data = vec![0; 45]; + programdata_data[..4].copy_from_slice(&3u32.to_le_bytes()); + programdata_data[12] = 1; + programdata_data[13..45].copy_from_slice(signer_key.as_ref()); + let programdata = AccountInfo::new( + &programdata_key, + false, + false, + &mut programdata_lamports, + &mut programdata_data, + &loader, + false, + 0, + ); + + assert!(validate_upgrade_authority(&ID, &signer, &program, &programdata).is_ok()); + } } diff --git a/shine-solana/shine/programs/shine_payments/src/settings.rs b/shine-solana/shine/programs/shine_payments/src/settings.rs index c4bf6a95..6110a31f 100644 --- a/shine-solana/shine/programs/shine_payments/src/settings.rs +++ b/shine-solana/shine/programs/shine_payments/src/settings.rs @@ -112,5 +112,7 @@ pub const RESERVED_RECIPIENTS: &[Pubkey] = &[ pubkey!("SHiGxGsXGioQYCYhchQ5R7KWoxN5UjFAFsucPf6sfnh"), ]; -/// `DAO_WALLET` — адрес кошелька DAO-казны для `shine_payments`. -pub const DAO_WALLET: &str = "aiShm43fZjm3YkMs22sYL1bpXaL3bVxv7SSraPHzVgq"; +/// `DEFAULT_DAO_TREASURY` — адрес native treasury основного DAO. Он записывается +/// в новый Config PDA при публичном `init`; для каждого кластера его можно заменить +/// отдельной инструкцией, подписанной текущей upgrade authority программы. +pub const DEFAULT_DAO_TREASURY: &str = "AcJRevXj3Yux2ecxXromMwwxEpPBz6AN53hH6KdqWJ9A"; diff --git a/shine-solana/shine/programs/shine_payments/web/admin_tools.html b/shine-solana/shine/programs/shine_payments/web/admin_tools.html index adfbdee6..2ed6b3b1 100644 --- a/shine-solana/shine/programs/shine_payments/web/admin_tools.html +++ b/shine-solana/shine/programs/shine_payments/web/admin_tools.html @@ -59,7 +59,7 @@

Коэффициент, лимит и награда шага выплат

-
Право изменения: загрузка...
+
Право изменения: текущая upgrade authority загрузка...
@@ -71,6 +71,16 @@
+
+

Казна DAO

+
Получатель покупок тикетов, DAO-доли выплат и остатка inflow vault. Менять адрес может только текущая upgrade authority.
+
+ + +
+
+
+

Shine Users: экономические параметры

Право изменения: загрузка...
@@ -124,7 +134,7 @@ ticketQ2: "shine_payments_q2_ticket", ticketQ3: "shine_payments_q3_ticket", }; - const IX = { init: 1, updateCoefLimit: 2 }; + const IX = { init: 1, updateCoefLimit: 2, updateDaoTreasury: 10 }; const USERS_IX = { initUsersEconomyConfig: 1, updateUsersEconomyConfig: 2 }; const USERS_SEEDS = { economyConfig: "shine_users_v1_economy_config", @@ -175,10 +185,6 @@ function ixData(tag, ...parts) { return concat(new Uint8Array([tag]), ...parts); } - function isUnauthorizedDao(msg) { - const s = String(msg || "").toLowerCase(); - return s.includes("unauthorizeddao") || s.includes("0x1775"); - } function isUsersDaoUnauthorized(msg) { const s = String(msg || "").toLowerCase(); return s.includes("invalidsigner") || s.includes("0x3ed"); @@ -187,9 +193,9 @@ function parseConfig(data) { let o = 0; const version = data[o++]; - const dao = new solanaWeb3.PublicKey(data.slice(o, o + 32)); o += 32; + const daoTreasury = new solanaWeb3.PublicKey(data.slice(o, o + 32)); o += 32; const inflow = new solanaWeb3.PublicKey(data.slice(o, o + 32)); o += 32; - return { version, dao, inflow }; + return { version, daoTreasury, inflow }; } function parseCoef(data) { let o = 0; @@ -289,6 +295,22 @@ return pda; } + async function loadPaymentsProgramControl() { + const programAi = await connection.getAccountInfo(PROGRAM_ID, "confirmed"); + if (!programAi || !programAi.executable || programAi.data.length < 36) { + throw new Error("Не удалось прочитать ProgramData shine_payments"); + } + const programData = new solanaWeb3.PublicKey(programAi.data.slice(4, 36)); + const programDataAi = await connection.getAccountInfo(programData, "confirmed"); + if (!programDataAi || programDataAi.data.length < 45 || programDataAi.data[12] !== 1) { + throw new Error("У программы нет доступной upgrade authority"); + } + return { + programData, + upgradeAuthority: new solanaWeb3.PublicKey(programDataAi.data.slice(13, 45)), + }; + } + async function loadCore() { const pdas = derivePdas(); const [cfgAi, coefAi, qAi, inflowAi] = await Promise.all([ @@ -305,7 +327,7 @@ const coef = parseCoef(coefAi.data); const queues = parseQueues(qAi.data); const [daoBal, inflowRent] = await Promise.all([ - connection.getBalance(config.dao, "confirmed"), + connection.getBalance(config.daoTreasury, "confirmed"), connection.getMinimumBalanceForRentExemption(inflowAi.data.length, "confirmed"), ]); cache = { @@ -327,10 +349,12 @@ } const coefText = trimZeros((Number(core.coef.coefPpm) / 1_000_000).toFixed(6)); const limitRemain = core.coef.limitUsdCents > core.queues.q1SumTotal ? (core.coef.limitUsdCents - core.queues.q1SumTotal) : 0n; - document.getElementById("daoAllowed").textContent = core.config.dao.toBase58(); + const control = await loadPaymentsProgramControl(); + document.getElementById("upgradeAuthority").textContent = control.upgradeAuthority.toBase58(); + document.getElementById("daoTreasuryInput").value = core.config.daoTreasury.toBase58(); el.innerHTML = ` -
DAO: ${core.config.dao.toBase58()}
-
Сейчас это тестовый DAO-кошелек. В production здесь будет адрес реального DAO.
+
Казна DAO: ${core.config.daoTreasury.toBase58()}
+
Upgrade authority: ${control.upgradeAuthority.toBase58()}
Inflow vault: ${core.config.inflow.toBase58()}
Inflow vault — входящий PDA-кошелек выплат программы.
Награда за шаг: ${lamportsToSolStr(core.coef.reward)} SOL
@@ -345,7 +369,7 @@ `; } catch (e) { el.innerHTML = `${String(e.message || e)}`; - document.getElementById("daoAllowed").textContent = "не определен"; + document.getElementById("upgradeAuthority").textContent = "не определена"; } } @@ -419,23 +443,50 @@ if (rewardLamports > MAX_REWARD_LAMPORTS) throw new Error("Награда не должна быть больше 0.01 SOL"); const data = ixData(IX.updateCoefLimit, u64ToBytes(coefPpm), u64ToBytes(limitUsdCents), u64ToBytes(rewardLamports)); + const control = await loadPaymentsProgramControl(); const keys = [ { pubkey: walletPubkey, isSigner: true, isWritable: true }, - { pubkey: core.pdas.configPda, isSigner: false, isWritable: true }, + { pubkey: core.pdas.configPda, isSigner: false, isWritable: false }, { pubkey: core.pdas.coefPda, isSigner: false, isWritable: true }, + { pubkey: PROGRAM_ID, isSigner: false, isWritable: false }, + { pubkey: control.programData, isSigner: false, isWritable: false }, ]; const ix = new solanaWeb3.TransactionInstruction({ programId: PROGRAM_ID, keys, data }); const sig = await sendInstruction(ix); out.innerHTML = `Обновлено. Tx: ${sig}`; await refreshAll(); } catch (e) { - const raw = String(e.message || e); - if (isUnauthorizedDao(raw)) { - const dao = document.getElementById("daoAllowed").textContent; - out.innerHTML = `Вы подключены не под тем аккаунтом. Изменение доступно только DAO-кошельку: ${dao}.`; - return; - } - out.innerHTML = `${raw}`; + out.innerHTML = `${String(e.message || e)}`; + } + } + + async function updateDaoTreasury() { + const out = document.getElementById("updateTreasuryResult"); + out.textContent = ""; + try { + const provider = getProvider(); + if (!walletPubkey) await connectWallet(); + else if (!provider.isConnected) await provider.connect(); + const core = await loadCore(); + if (core.notInited) throw new Error("Сначала выполните init"); + const newTreasury = new solanaWeb3.PublicKey(document.getElementById("daoTreasuryInput").value.trim()); + const control = await loadPaymentsProgramControl(); + const keys = [ + { pubkey: walletPubkey, isSigner: true, isWritable: true }, + { pubkey: core.pdas.configPda, isSigner: false, isWritable: true }, + { pubkey: PROGRAM_ID, isSigner: false, isWritable: false }, + { pubkey: control.programData, isSigner: false, isWritable: false }, + ]; + const ix = new solanaWeb3.TransactionInstruction({ + programId: PROGRAM_ID, + keys, + data: ixData(IX.updateDaoTreasury, newTreasury.toBytes()), + }); + const sig = await sendInstruction(ix); + out.innerHTML = `Казна обновлена. Tx: ${sig}`; + await refreshAll(); + } catch (e) { + out.innerHTML = `${String(e.message || e)}`; } } @@ -569,6 +620,7 @@ document.getElementById("refreshBtn").addEventListener("click", refreshAll); document.getElementById("initBtn").addEventListener("click", runInit); document.getElementById("updateCoefBtn").addEventListener("click", updateCoefLimit); + document.getElementById("updateTreasuryBtn").addEventListener("click", updateDaoTreasury); document.getElementById("usersInitBtn").addEventListener("click", initUsersEconomy); document.getElementById("usersUpdateBtn").addEventListener("click", updateUsersEconomy); document.getElementById("loadQ1Btn").addEventListener("click", () => showQueue(1)); diff --git a/shine-solana/shine/programs/shine_payments/web/buy_ticket.html b/shine-solana/shine/programs/shine_payments/web/buy_ticket.html index 6683d7c0..642bc2f5 100644 --- a/shine-solana/shine/programs/shine_payments/web/buy_ticket.html +++ b/shine-solana/shine/programs/shine_payments/web/buy_ticket.html @@ -188,9 +188,9 @@ function parseConfig(data) { let o = 0; const version = data[o++]; - const dao = new solanaWeb3.PublicKey(data.slice(o, o + 32)).toBase58(); o += 32; + const daoTreasury = new solanaWeb3.PublicKey(data.slice(o, o + 32)).toBase58(); o += 32; const inflow = new solanaWeb3.PublicKey(data.slice(o, o + 32)).toBase58(); o += 32; - return { version, dao, inflow }; + return { version, daoTreasury, inflow }; } function parseCoef(data) { let o = 0; @@ -335,9 +335,9 @@ const remainingByTotal = coef.limitUsdCents > queues.q1SumTotal ? (coef.limitUsdCents - queues.q1SumTotal) : 0n; const paused = queues.q1SumTotal >= coef.limitUsdCents; el.innerHTML = ` -
DAO: ${config.dao}
+
Казна DAO: ${config.daoTreasury}
Inflow vault: ${config.inflow}
-
Тестовый DAO-кошелек. В production будет реальный адрес DAO.
+
Адрес берётся из Config PDA текущего кластера.
Курс SOL/USD (Pyth): ${trimZeros((Number(pyth.num) / Number(pyth.den) / 100).toFixed(6))}
Коэффициент: ${coefText}
Лимит очереди 1: ${centsToUsdStr(coef.limitUsdCents)} USD
@@ -382,7 +382,7 @@ { pubkey: pdas.coefPda, isSigner: false, isWritable: true }, { pubkey: pdas.queuesPda, isSigner: false, isWritable: true }, { pubkey: ticketPda, isSigner: false, isWritable: true }, - { pubkey: new solanaWeb3.PublicKey(config.dao), isSigner: false, isWritable: true }, + { pubkey: new solanaWeb3.PublicKey(config.daoTreasury), isSigner: false, isWritable: true }, { pubkey: ORACLE_ACCOUNT, isSigner: false, isWritable: false }, { pubkey: solanaWeb3.SystemProgram.programId, isSigner: false, isWritable: false }, ]; @@ -422,7 +422,7 @@ { pubkey: pdas.coefPda, isSigner: false, isWritable: true }, { pubkey: pdas.queuesPda, isSigner: false, isWritable: true }, { pubkey: ticketPda, isSigner: false, isWritable: true }, - { pubkey: new solanaWeb3.PublicKey(config.dao), isSigner: false, isWritable: true }, + { pubkey: new solanaWeb3.PublicKey(config.daoTreasury), isSigner: false, isWritable: true }, { pubkey: ORACLE_ACCOUNT, isSigner: false, isWritable: false }, { pubkey: solanaWeb3.SystemProgram.programId, isSigner: false, isWritable: false }, ]; diff --git a/shine-solana/shine/programs/shine_payments/web/dao_tools.html b/shine-solana/shine/programs/shine_payments/web/dao_tools.html index a2e0969b..7f35e87a 100644 --- a/shine-solana/shine/programs/shine_payments/web/dao_tools.html +++ b/shine-solana/shine/programs/shine_payments/web/dao_tools.html @@ -43,11 +43,7 @@
Программа:
-
- Пока реального DAO-голосования нет: роль DAO выполняет тестовый кошелек - aiShm43fZjm3YkMs22sYL1bpXaL3bVxv7SSraPHzVgq.
- Позже это заменяется на вызов из настоящего DAO-казначейства/голосования. -
+
Лимиты менеджеров выдаёт текущая upgrade authority программы. После передачи upgrade authority governance PDA это действие должно исполняться DAO proposal.
@@ -70,6 +66,7 @@
+
Текущий подключённый кошелёк оплачивает rent нового allowance PDA. При DAO proposal authority и rent payer могут быть разными signer-аккаунтами.
@@ -129,17 +126,12 @@ function ixData(tag, ...parts) { return concat(new Uint8Array([tag]), ...parts); } - function isUnauthorizedDao(msg) { - const s = String(msg || "").toLowerCase(); - return s.includes("unauthorizeddao"); - } - function parseConfig(data) { let o = 0; const version = data[o++]; - const dao = new solanaWeb3.PublicKey(data.slice(o, o + 32)); o += 32; + const daoTreasury = new solanaWeb3.PublicKey(data.slice(o, o + 32)); o += 32; const inflow = new solanaWeb3.PublicKey(data.slice(o, o + 32)); o += 32; - return { version, dao, inflow }; + return { version, daoTreasury, inflow }; } function parseManagerAllowance(data) { let o = 0; @@ -190,6 +182,22 @@ return pda; } + async function loadPaymentsProgramControl() { + const programAi = await connection.getAccountInfo(PROGRAM_ID, "confirmed"); + if (!programAi || !programAi.executable || programAi.data.length < 36) { + throw new Error("Не удалось прочитать ProgramData shine_payments"); + } + const programData = new solanaWeb3.PublicKey(programAi.data.slice(4, 36)); + const programDataAi = await connection.getAccountInfo(programData, "confirmed"); + if (!programDataAi || programDataAi.data.length < 45 || programDataAi.data[12] !== 1) { + throw new Error("У программы нет доступной upgrade authority"); + } + return { + programData, + upgradeAuthority: new solanaWeb3.PublicKey(programDataAi.data.slice(13, 45)), + }; + } + async function loadConfig() { const configPda = deriveConfigPda(); const ai = await connection.getAccountInfo(configPda, "confirmed"); @@ -201,10 +209,11 @@ async function refresh() { const el = document.getElementById("daoInfo"); try { - const { config } = await loadConfig(); + const [{ config }, control] = await Promise.all([loadConfig(), loadPaymentsProgramControl()]); el.innerHTML = ` -
DAO-кошелек: ${config.dao.toBase58()}
-
Выдавать лимиты может только этот кошелек.
+
Казна DAO: ${config.daoTreasury.toBase58()}
+
Upgrade authority: ${control.upgradeAuthority.toBase58()}
+
Выдавать лимиты может только upgrade authority через прямую подпись или DAO proposal.
`; } catch (e) { el.innerHTML = `${String(e.message || e)}`; @@ -228,23 +237,21 @@ const allowancePda = deriveManagerAllowancePda(manager); const data = ixData(IX.grantManagerLimits, manager.toBytes(), u64ToBytes(addQ1), u64ToBytes(addQ2), u64ToBytes(addQ3)); + const control = await loadPaymentsProgramControl(); const keys = [ { pubkey: walletPubkey, isSigner: true, isWritable: true }, - { pubkey: configPda, isSigner: false, isWritable: true }, + { pubkey: walletPubkey, isSigner: true, isWritable: true }, + { pubkey: configPda, isSigner: false, isWritable: false }, { pubkey: allowancePda, isSigner: false, isWritable: true }, { pubkey: solanaWeb3.SystemProgram.programId, isSigner: false, isWritable: false }, + { pubkey: PROGRAM_ID, isSigner: false, isWritable: false }, + { pubkey: control.programData, isSigner: false, isWritable: false }, ]; const ix = new solanaWeb3.TransactionInstruction({ programId: PROGRAM_ID, keys, data }); const sig = await sendInstruction(ix); out.innerHTML = `Лимиты выданы. Tx: ${sig}`; } catch (e) { - const raw = String(e.message || e); - if (isUnauthorizedDao(raw)) { - const dao = configCache?.config?.dao?.toBase58?.() || "не определен"; - out.innerHTML = `Вы подключены не под DAO-кошельком. Нужен: ${dao}.`; - return; - } - out.innerHTML = `${raw}`; + out.innerHTML = `${String(e.message || e)}`; } } diff --git a/shine-solana/shine/programs/shine_payments/web/track_ticket.html b/shine-solana/shine/programs/shine_payments/web/track_ticket.html index 31db5924..cd1d1498 100644 --- a/shine-solana/shine/programs/shine_payments/web/track_ticket.html +++ b/shine-solana/shine/programs/shine_payments/web/track_ticket.html @@ -165,9 +165,9 @@ function parseConfig(data) { let o = 0; const version = data[o++]; - const dao = new solanaWeb3.PublicKey(data.slice(o, o + 32)); o += 32; + const daoTreasury = new solanaWeb3.PublicKey(data.slice(o, o + 32)); o += 32; const inflow = new solanaWeb3.PublicKey(data.slice(o, o + 32)); o += 32; - return { version, dao, inflow }; + return { version, daoTreasury, inflow }; } function parseCoef(data) { let o = 0; @@ -298,8 +298,8 @@ if (queue === 0) { el.innerHTML = `
Курс SOL/USD (Pyth): ${trimZeros((Number(core.pyth.num) / Number(core.pyth.den) / 100).toFixed(6))}, возраст ${pythAge} сек
-
DAO: ${core.config.dao.toBase58()}
-
Сейчас это тестовый DAO-кошелек. В production здесь будет адрес реального DAO.
+
Казна DAO: ${core.config.daoTreasury.toBase58()}
+
Адрес берётся из Config PDA текущего кластера.
Все очереди пусты/полностью выплачены.
На inflow vault доступно (сверх ренты): ${lamportsToSolStr(core.available)} SOL
При шаге эта сумма уйдет в DAO, награда не начисляется.
@@ -321,8 +321,8 @@ const missing = core.available >= need ? 0n : (need - core.available); el.innerHTML = `
Курс SOL/USD (Pyth): ${trimZeros((Number(core.pyth.num) / Number(core.pyth.den) / 100).toFixed(6))}, возраст ${pythAge} сек
-
DAO: ${core.config.dao.toBase58()}
-
Сейчас это тестовый DAO-кошелек. В production здесь будет адрес реального DAO.
+
Казна DAO: ${core.config.daoTreasury.toBase58()}
+
Адрес берётся из Config PDA текущего кластера.
Следующий шаг выплат: очередь ${queue}
Следующий тикет: #${next.index.toString()}
Тикет: ${centsToUsdStr(next.payoutUsdCents)} USD (~${usdCentsToSolStr(next.payoutUsdCents, core.pyth)} SOL)
@@ -483,7 +483,7 @@ { pubkey: core.config.inflow, isSigner: false, isWritable: true }, { pubkey: nextTicketPda, isSigner: false, isWritable: true }, { pubkey: recipient, isSigner: false, isWritable: true }, - { pubkey: core.config.dao, isSigner: false, isWritable: true }, + { pubkey: core.config.daoTreasury, isSigner: false, isWritable: true }, { pubkey: ORACLE_ACCOUNT, isSigner: false, isWritable: false }, ]; const ix = new solanaWeb3.TransactionInstruction({ programId: PROGRAM_ID, keys, data }); diff --git a/shine-solana/shine/programs/shine_users/Cargo.toml b/shine-solana/shine/programs/shine_users/Cargo.toml index d4d8d2e6..e2edee3e 100644 --- a/shine-solana/shine/programs/shine_users/Cargo.toml +++ b/shine-solana/shine/programs/shine_users/Cargo.toml @@ -1,8 +1,9 @@ [package] name = "shine_users" -version = "0.1.0" +version = "1.0.0" description = "User registration smart contract" edition = "2021" +license = "AGPL-3.0-or-later" [lib] crate-type = ["cdylib", "lib"] diff --git a/shine-solana/shine/programs/shine_users/src/lib.rs b/shine-solana/shine/programs/shine_users/src/lib.rs index 92fbfc8b..a03f889a 100644 --- a/shine-solana/shine/programs/shine_users/src/lib.rs +++ b/shine-solana/shine/programs/shine_users/src/lib.rs @@ -25,9 +25,8 @@ entrypoint!(process_instruction); const MAGIC: &[u8; 5] = b"SHiNE"; const FORMAT_MAJOR: u8 = 1; -const FORMAT_MINOR: u8 = 3; -const PREVIOUS_FORMAT_MINOR: u8 = 2; -const LEGACY_FORMAT_MINOR: u8 = 0; +/// Публичный единственный формат user PDA. Его layout — бывший актуальный 1.3. +const FORMAT_MINOR: u8 = 0; const MAX_AUTO_REALLOC_INCREASE: usize = 10_000; const ZERO_HASH: [u8; 32] = [0; 32]; const BLOCK_TYPE_ROOT_KEY: u8 = 1; @@ -46,7 +45,6 @@ const IX_INIT_USERS_ECONOMY_CONFIG: u8 = 1; const IX_UPDATE_USERS_ECONOMY_CONFIG: u8 = 2; const IX_CREATE_USER_PDA: u8 = 3; const IX_UPDATE_USER_PDA: u8 = 4; -const IX_CLOSE_LEGACY_USER_PDA: u8 = 6; const IX_CREATE_NAMESPACE: u8 = 7; const IX_UPDATE_NAMESPACE_PRICE: u8 = 8; const IX_SUPPORT_USER: u8 = 9; @@ -223,11 +221,6 @@ pub struct UpdateUserPdaArgs { pub signature: [u8; 64], } -#[derive(Clone, Debug)] -pub struct CloseLegacyUserPdaArgs { - pub login: String, -} - #[derive(Clone, Debug)] pub struct UpdateUsersEconomyConfigArgs { pub update_fee_lamports: u64, @@ -342,7 +335,6 @@ fn process_instruction<'a>(program_id: &Pubkey, accounts: &'a [AccountInfo<'a>], r.finish()?; process_update_namespace_price(program_id, accounts, &namespace_name, currency_code, registration_fee) }, - IX_CLOSE_LEGACY_USER_PDA => dispatch_close_legacy_user_pda(program_id, accounts, r), _ => Err(ProgramError::from(ShineUsersError::InvalidInstruction)), } } @@ -463,11 +455,6 @@ fn parse_update_args(r: &mut Reader<'_>) -> Result) -> ProgramResult { - let args = CloseLegacyUserPdaArgs { login: r.read_string_u8()? }; - r.finish()?; - process_close_legacy_user_pda(program_id, accounts, args) -} fn process_init_users_economy_config(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult { let mut it = accounts.iter(); @@ -711,26 +698,19 @@ fn process_update_user_pda(program_id: &Pubkey, accounts: &[AccountInfo], args: require!(signer.is_signer, ShineUsersError::InvalidSigner); require_keys_eq!(*system_program_ai.key, system_program::id(), ShineUsersError::InvalidSystemProgram); - // Старые аккаунты без namespace сохраняют прежнюю возможность update. - // Новый create всегда требует полный login@namespace. - if args.login.contains('@') { validate_full_login(&args.login)?; } - else { validate_legacy_login(&args.login)?; } + validate_full_login(&args.login)?; validate_server_addresses(&args.server_addresses)?; validate_access_servers(&args.access_servers)?; validate_inflow_vault(inflow_vault)?; validate_users_economy_config_pda(program_id, users_economy_config_pda)?; let economy = read_users_economy_config(users_economy_config_pda)?; - let expected_pda = if args.login.contains('@') { - find_user_pda(program_id, &args.login).0 - } else { - find_legacy_user_pda(program_id, &args.login.to_ascii_lowercase()).0 - }; + let expected_pda = find_user_pda(program_id, &args.login).0; require_keys_eq!(expected_pda, *user_pda.key, ShineUsersError::InvalidPdaAddress); require!(user_pda.owner == program_id, ShineUsersError::InvalidPdaAddress); let raw = read_pda_all(user_pda)?; - require!(matches!(record_format_minor(&raw)?, FORMAT_MINOR | PREVIOUS_FORMAT_MINOR), ShineUsersError::InvalidRecordFormat); + require!(record_format_minor(&raw)? == FORMAT_MINOR, ShineUsersError::InvalidRecordFormat); let old_record = deserialize_record_v12_from_pda(&raw)?; require!(old_record.login == args.login, ShineUsersError::ImmutableFieldChanged); require!(args.updated_at_ms >= old_record.updated_at_ms, ShineUsersError::InvalidRecordData); @@ -763,13 +743,7 @@ fn process_update_user_pda(program_id: &Pubkey, accounts: &[AccountInfo], args: let old_record_len = u16::from_le_bytes([raw[7], raw[8]]) as usize; let old_unsigned = &raw[..old_record_len - 64]; - // Existing v1.2 links were hashed including limits. The first migration - // link commits to the exact old bytes; v1.3 links omit quota bytes. - let prev_hash = if raw[6] == PREVIOUS_FORMAT_MINOR { - hash(old_unsigned).to_bytes() - } else { - hash(&signed_bytes_without_limits(old_unsigned)?).to_bytes() - }; + let prev_hash = hash(&signed_bytes_without_limits(old_unsigned)?).to_bytes(); let mut new_record = UserRecordV12 { created_at_ms: old_record.created_at_ms, updated_at_ms: args.updated_at_ms, @@ -880,7 +854,7 @@ fn process_support_user(program_id: &Pubkey, accounts: &[AccountInfo], args: Sup require!(sender_pda.owner == program_id && recipient_pda.owner == program_id, ShineUsersError::InvalidAccountOwner); let sender_raw = read_pda_all(sender_pda)?; let recipient_raw = read_pda_all(recipient_pda)?; - require!(matches!(record_format_minor(&sender_raw)?, FORMAT_MINOR | PREVIOUS_FORMAT_MINOR) && matches!(record_format_minor(&recipient_raw)?, FORMAT_MINOR | PREVIOUS_FORMAT_MINOR), ShineUsersError::InvalidRecordFormat); + require!(record_format_minor(&sender_raw)? == FORMAT_MINOR && record_format_minor(&recipient_raw)? == FORMAT_MINOR, ShineUsersError::InvalidRecordFormat); let sender_record = deserialize_record_v12_from_pda(&sender_raw)?; let recipient_record = deserialize_record_v12_from_pda(&recipient_raw)?; require!(sender_record.login == args.sender_login && recipient_record.login == args.recipient_login, ShineUsersError::InvalidRecordData); @@ -932,7 +906,7 @@ fn process_support_dao(program_id: &Pubkey, accounts: &[AccountInfo], args: Supp require_keys_eq!(find_user_pda(program_id, &args.sender_login).0, *sender_pda.key, ShineUsersError::InvalidPdaAddress); require!(sender_pda.owner == program_id, ShineUsersError::InvalidAccountOwner); let raw = read_pda_all(sender_pda)?; - require!(matches!(record_format_minor(&raw)?, FORMAT_MINOR | PREVIOUS_FORMAT_MINOR), ShineUsersError::InvalidRecordFormat); + require!(record_format_minor(&raw)? == FORMAT_MINOR, ShineUsersError::InvalidRecordFormat); let record = deserialize_record_v12_from_pda(&raw)?; require!(record.login == args.sender_login, ShineUsersError::InvalidRecordData); require_keys_eq!(record.active_fork()?.blockchain_key, *sender.key, ShineUsersError::InvalidSigner); @@ -947,35 +921,6 @@ fn process_support_dao(program_id: &Pubkey, accounts: &[AccountInfo], args: Supp Ok(()) } -fn process_close_legacy_user_pda(program_id: &Pubkey, accounts: &[AccountInfo], args: CloseLegacyUserPdaArgs) -> ProgramResult { - let mut it = accounts.iter(); - let caller = next_account_info(&mut it)?; - let user_pda = next_account_info(&mut it)?; - require!(it.next().is_none(), ShineUsersError::InvalidInstruction); - require!(caller.is_signer, ShineUsersError::InvalidSigner); - require!(caller.is_writable, ShineUsersError::InvalidAccountData); - require!(user_pda.is_writable, ShineUsersError::InvalidAccountData); - - validate_legacy_login(&args.login)?; - require_keys_eq!(find_legacy_user_pda(program_id, &args.login.to_ascii_lowercase()).0, *user_pda.key, ShineUsersError::InvalidPdaAddress); - require!(user_pda.owner == program_id, ShineUsersError::InvalidPdaAddress); - - let raw = read_pda_all(user_pda)?; - require!(record_format_minor(&raw)? == LEGACY_FORMAT_MINOR, ShineUsersError::CannotCloseCurrentFormat); - - let lamports = user_pda.lamports(); - { - let mut caller_lamports = caller.try_borrow_mut_lamports().map_err(|_| ProgramError::from(ShineUsersError::InvalidAccountData))?; - **caller_lamports = (**caller_lamports).checked_add(lamports).ok_or(ProgramError::from(ShineUsersError::MathOverflow))?; - } - { - let mut pda_lamports = user_pda.try_borrow_mut_lamports().map_err(|_| ProgramError::from(ShineUsersError::InvalidAccountData))?; - **pda_lamports = 0; - } - user_pda.realloc(0, false)?; - Ok(()) -} - fn serialize_users_economy_config(state: &UsersEconomyConfigState) -> Vec { let mut out = Vec::with_capacity(1 + 8); out.push(state.version); @@ -1015,7 +960,7 @@ fn record_format_minor(raw: &[u8]) -> Result { fn deserialize_record_v12_from_pda(raw: &[u8]) -> Result { require!(raw.len() >= 9, ShineUsersError::InvalidRecordData); require!(sol_memcmp(&raw[0..5], MAGIC, 5) == 0, ShineUsersError::InvalidRecordMagic); - require!(raw[5] == FORMAT_MAJOR && matches!(raw[6], FORMAT_MINOR | PREVIOUS_FORMAT_MINOR), ShineUsersError::InvalidRecordFormat); + require!(raw[5] == FORMAT_MAJOR && raw[6] == FORMAT_MINOR, ShineUsersError::InvalidRecordFormat); let record_len = u16::from_le_bytes([raw[7], raw[8]]) as usize; require!(record_len >= 9 + 64, ShineUsersError::InvalidRecordLength); require!(record_len <= raw.len(), ShineUsersError::InvalidRecordLength); @@ -1195,7 +1140,7 @@ fn serialize_unsigned_record_v12(record: &UserRecordV12) -> Result, Prog Ok(out) } -/// Canonical signing bytes of a physical PDA 1.3 unsigned record: +/// Canonical signing bytes of a physical PDA 1.0 unsigned record: /// all original headers, lengths and blocks, EXCEPT four limit bytes per fork. /// Works over raw bytes to preserve unknown future variable blocks verbatim. fn signed_bytes_without_limits(unsigned: &[u8]) -> Result, ProgramError> { @@ -1258,10 +1203,6 @@ fn serialize_full_record_v12(record: &UserRecordV12) -> Result, ProgramE fn read_support_stats(raw: &[u8]) -> Result { require!(raw.len() >= 9, ShineUsersError::InvalidRecordData); let record_len = u16::from_le_bytes([raw[7], raw[8]]) as usize; - if record_len >= raw.len() || raw[record_len] == 0 { return Ok(SupportStats::default()); } - // Тестовый переход: прежние lamports-счётчики v1 намеренно забываются. - // При следующей записи PDA они заменяются нулевыми Stars v2. - if raw[record_len] == 1 { return Ok(SupportStats::default()); } require!(raw[record_len] == SUPPORT_STATS_VERSION, ShineUsersError::UnsupportedSupportStats); let end = record_len.checked_add(SUPPORT_STATS_LEN).ok_or(ProgramError::from(ShineUsersError::MathOverflow))?; require!(end <= raw.len(), ShineUsersError::InvalidRecordLength); @@ -1573,7 +1514,6 @@ fn ensure_pda_size_and_rent<'a>(pda: &AccountInfo<'a>, payer: &AccountInfo<'a>, } pub fn find_user_pda(program_id: &Pubkey, login: &str) -> (Pubkey, u8) { Pubkey::find_program_address(&[&user_pda_seed(login)], program_id) } -fn find_legacy_user_pda(program_id: &Pubkey, login: &str) -> (Pubkey, u8) { Pubkey::find_program_address(&[settings::USER_PDA_SEED_PREFIX.as_bytes(), login.as_bytes()], program_id) } pub fn find_namespace_pda(program_id: &Pubkey, name: &str) -> (Pubkey, u8) { let seed = hash(format!("{}{}", settings::NAMESPACE_PDA_SEED_PREFIX, name).as_bytes()).to_bytes(); Pubkey::find_program_address(&[&seed], program_id) @@ -1601,19 +1541,18 @@ mod support_stats_tests { use super::*; #[test] - fn legacy_support_stats_are_reset_and_v2_is_supported() { + fn only_current_support_stats_are_accepted() { let mut v0 = vec![0u8; 100]; v0[7..9].copy_from_slice(&80u16.to_le_bytes()); - assert_eq!(read_support_stats(&v0).unwrap(), SupportStats::default()); + assert!(read_support_stats(&v0).is_err()); let mut v1 = v0; v1[80] = 1; v1[81..89].copy_from_slice(&100u64.to_le_bytes()); v1[89..97].copy_from_slice(&90u64.to_le_bytes()); - // Статистика v1 игнорируется: это lamports, не Stars. - assert_eq!(read_support_stats(&v1).unwrap(), SupportStats::default()); + assert!(read_support_stats(&v1).is_err()); v1.resize(105, 0); v1[97..105].copy_from_slice(&7u64.to_le_bytes()); - assert_eq!(read_support_stats(&v1).unwrap(), SupportStats::default()); + assert!(read_support_stats(&v1).is_err()); v1[80] = 2; assert_eq!(read_support_stats(&v1).unwrap(), SupportStats { support_sent: 100, support_received: 90, dao_direct: 7 }); } diff --git a/shine-solana/shine/scripts/registration-v2/list-user-pdas-for-reset.mjs b/shine-solana/shine/scripts/registration-v2/list-user-pdas-for-reset.mjs new file mode 100644 index 00000000..44542794 --- /dev/null +++ b/shine-solana/shine/scripts/registration-v2/list-user-pdas-for-reset.mjs @@ -0,0 +1,65 @@ +#!/usr/bin/env node +/** + * Creates a reviewable inventory of every SHiNE user record PDA currently + * owned by shine_users. It never sends a transaction. + * + * node scripts/registration-v2/list-user-pdas-for-reset.mjs \ + * --rpc https://api.devnet.solana.com --output /tmp/shine-users-devnet.json + */ +import { writeFileSync } from 'node:fs'; +import { createRequire } from 'node:module'; +const require = createRequire(import.meta.url); +const { Connection, PublicKey } = require('@solana/web3.js'); + +const PROGRAM_ID = new PublicKey('SHiNEPr1APdAgNBteUyBXcNovaHctpSjUu8oH2ZJdN6'); +const MAGIC = Buffer.from('SHiNE'); + +function argsOf(argv) { + const out = {}; + for (let i = 0; i < argv.length; i++) { + const key = argv[i]; + if (!key.startsWith('--') || !argv[i + 1] || argv[i + 1].startsWith('--')) throw Error('Expected --rpc and --output'); + const name = key.slice(2); + if (out[name] !== undefined) throw Error('Repeated --' + name); + out[name] = argv[++i]; + } + return out; +} + +function readLogin(raw) { + // All historical user records that can be reset have this signed prefix: + // header(9), created(8), updated(8), number(4), previous hash(32), login. + const loginLengthOffset = 9 + 8 + 8 + 4 + 32; + if (raw.length <= loginLengthOffset) return null; + const length = raw[loginLengthOffset]; + const start = loginLengthOffset + 1; + const end = start + length; + if (end > raw.length || length === 0) return null; + const login = raw.subarray(start, end).toString('utf8'); + return Buffer.from(login, 'utf8').equals(raw.subarray(start, end)) ? login : null; +} + +async function main() { + const a = argsOf(process.argv.slice(2)); + if (!a.rpc || !a.output) throw Error('Specify --rpc and --output'); + const url = new URL(a.rpc); + if (!['http:', 'https:'].includes(url.protocol)) throw Error('RPC must use HTTP(S)'); + const conn = new Connection(a.rpc, 'confirmed'); + const accounts = await conn.getProgramAccounts(PROGRAM_ID, { commitment: 'confirmed' }); + const records = accounts + .filter(({ account }) => account.data.length >= 9 && account.data.subarray(0, 5).equals(MAGIC) && account.data[5] === 1) + .map(({ pubkey, account }) => ({ + pda: pubkey.toBase58(), + login: readLogin(account.data), + format: `${account.data[5]}.${account.data[6]}`, + lamports: account.lamports.toString(), + dataLength: account.data.length, + })) + .sort((a, b) => a.pda.localeCompare(b.pda)); + const unreadable = records.filter(({ login }) => login === null); + const output = { programId: PROGRAM_ID.toBase58(), generatedAt: new Date().toISOString(), records }; + writeFileSync(a.output, JSON.stringify(output, null, 2) + '\n', { encoding: 'utf8', flag: 'wx' }); + console.log(JSON.stringify({ output: a.output, candidates: records.length, unreadable: unreadable.length }, null, 2)); + if (unreadable.length) process.exitCode = 2; +} +main().catch((e) => { console.error('Error:', e.message); process.exitCode = 1; }); diff --git a/shine-solana/shine/scripts/registration-v2/reset-user-pdas.mjs b/shine-solana/shine/scripts/registration-v2/reset-user-pdas.mjs new file mode 100644 index 00000000..0eb90ddf --- /dev/null +++ b/shine-solana/shine/scripts/registration-v2/reset-user-pdas.mjs @@ -0,0 +1,103 @@ +#!/usr/bin/env node +/** + * Executes the one-time reset instruction from the intermediate shine_users + * release. Input must be an inventory reviewed by a human first. + * + * Dry run (default): + * node scripts/registration-v2/reset-user-pdas.mjs --rpc https://api.devnet.solana.com \ + * --keypair ~/.config/solana/id.json --input /tmp/shine-users-devnet.json + * + * Sending needs an explicit --send. Mainnet additionally needs --mainnet. + */ +import { readFileSync } from 'node:fs'; +import { createRequire } from 'node:module'; +const require = createRequire(import.meta.url); +const { Connection, PublicKey, Keypair, Transaction, TransactionInstruction, sendAndConfirmTransaction, SystemProgram } = require('@solana/web3.js'); +const { createHash } = require('node:crypto'); + +const PROGRAM_ID = new PublicKey('SHiNEPr1APdAgNBteUyBXcNovaHctpSjUu8oH2ZJdN6'); +const LOADER = new PublicKey('BPFLoaderUpgradeab1e11111111111111111111111'); +const MAGIC = Buffer.from('SHiNE'); +const IX_RESET_USER_PDA = 11; + +function argsOf(argv) { + const out = {}; + for (let i = 0; i < argv.length; i++) { + const item = argv[i]; + if (!item.startsWith('--')) throw Error('Unknown argument: ' + item); + const key = item.slice(2); + if (key === 'send' || key === 'mainnet') { if (out[key]) throw Error('Repeated --' + key); out[key] = true; continue; } + if (!argv[i + 1] || argv[i + 1].startsWith('--') || out[key] !== undefined) throw Error('Missing/repeated --' + key); + out[key] = argv[++i]; + } + return out; +} +function deriveUserPda(login) { + const normalized = login.toLowerCase(); + if (login.includes('@')) { + const seed = createHash('sha256').update('user_login=' + normalized, 'utf8').digest(); + return PublicKey.findProgramAddressSync([seed], PROGRAM_ID)[0]; + } + return PublicKey.findProgramAddressSync([Buffer.from('user_login='), Buffer.from(normalized)], PROGRAM_ID)[0]; +} +function resetData(login) { + const text = Buffer.from(login, 'utf8'); + if (text.length === 0 || text.length > 255) throw Error('Invalid login length: ' + login); + return Buffer.concat([Buffer.from([IX_RESET_USER_PDA, text.length]), text]); +} +function loadInventory(path) { + const parsed = JSON.parse(readFileSync(path, 'utf8')); + if (!parsed || parsed.programId !== PROGRAM_ID.toBase58() || !Array.isArray(parsed.records)) throw Error('Input is not a shine_users reset inventory'); + const seen = new Set(); + return parsed.records.map((entry) => { + if (!entry || typeof entry.login !== 'string' || typeof entry.pda !== 'string') throw Error('Every inventory record needs login and pda'); + const pda = new PublicKey(entry.pda); + if (!deriveUserPda(entry.login).equals(pda)) throw Error('PDA does not match login: ' + entry.login); + if (seen.has(pda.toBase58())) throw Error('Duplicate PDA: ' + pda.toBase58()); + seen.add(pda.toBase58()); + return { login: entry.login, pda }; + }); +} +async function currentProgramdata(conn, wallet) { + const executable = await conn.getAccountInfo(PROGRAM_ID, 'confirmed'); + if (!executable?.executable || !executable.owner.equals(LOADER) || executable.data.length < 36 || executable.data.readUInt32LE(0) !== 2) + throw Error('Program is not an upgradeable shine_users program'); + const programdata = new PublicKey(executable.data.subarray(4, 36)); + const pd = await conn.getAccountInfo(programdata, 'confirmed'); + if (!pd || !pd.owner.equals(LOADER) || pd.data.length < 45 || pd.data.readUInt32LE(0) !== 3 || pd.data[12] !== 1 || + !new PublicKey(pd.data.subarray(13, 45)).equals(wallet.publicKey)) throw Error('Wallet is not current shine_users upgrade authority'); + return programdata; +} +async function main() { + const a = argsOf(process.argv.slice(2)); + if (!a.rpc || !a.keypair || !a.input) throw Error('Specify --rpc, --keypair and --input'); + const url = new URL(a.rpc); + if (!['http:', 'https:'].includes(url.protocol)) throw Error('RPC must use HTTP(S)'); + const mainnet = url.hostname.includes('mainnet'); + if (a.send && mainnet && !a.mainnet) throw Error('Mainnet requires --mainnet in addition to --send'); + if (a.mainnet && !mainnet) throw Error('--mainnet is only valid for a mainnet RPC'); + const wallet = Keypair.fromSecretKey(Uint8Array.from(JSON.parse(readFileSync(a.keypair.replace(/^~\//, process.env.HOME + '/'), 'utf8')))); + const records = loadInventory(a.input); + const conn = new Connection(a.rpc, 'confirmed'); + const programdata = await currentProgramdata(conn, wallet); + console.log(JSON.stringify({ mode: a.send ? 'SEND' : 'DRY RUN', programId: PROGRAM_ID.toBase58(), authority: wallet.publicKey.toBase58(), records: records.length }, null, 2)); + for (const { login, pda } of records) { + const before = await conn.getAccountInfo(pda, 'confirmed'); + if (!before || !before.owner.equals(PROGRAM_ID) || before.data.length < 9 || !before.data.subarray(0, 5).equals(MAGIC) || before.data[5] !== 1) + throw Error('Not a resettable user PDA: ' + pda.toBase58()); + console.log(JSON.stringify({ login, pda: pda.toBase58(), format: `${before.data[5]}.${before.data[6]}`, refundLamports: before.lamports.toString() })); + if (!a.send) continue; + const ix = new TransactionInstruction({ programId: PROGRAM_ID, keys: [ + { pubkey: wallet.publicKey, isSigner: true, isWritable: true }, + { pubkey: pda, isSigner: false, isWritable: true }, + { pubkey: PROGRAM_ID, isSigner: false, isWritable: false }, + { pubkey: programdata, isSigner: false, isWritable: false }, + ], data: resetData(login) }); + const signature = await sendAndConfirmTransaction(conn, new Transaction().add(ix), [wallet], { commitment: 'confirmed' }); + const after = await conn.getAccountInfo(pda, 'confirmed'); + if (after && (!after.owner.equals(SystemProgram.programId) || after.lamports !== 0 || after.data.length !== 0)) + throw Error('Reset did not leave an empty system account: ' + pda.toBase58()); + console.log('Reset ' + login + ': ' + signature); + } +} +main().catch((e) => { console.error('Error:', e.message); process.exitCode = 1; }); diff --git a/shine-solana/shine/tests/pda-v1-2-codec.mjs b/shine-solana/shine/tests/pda-v1-2-codec.mjs index 5c98f509..c5524dd1 100644 --- a/shine-solana/shine/tests/pda-v1-2-codec.mjs +++ b/shine-solana/shine/tests/pda-v1-2-codec.mjs @@ -31,7 +31,7 @@ full.set(bytes(64, 200), unsigned.length); const parsed = parseShineUserPda(full); assert.equal(parsed.formatMajor, 1); -assert.equal(parsed.formatMinor, 3); +assert.equal(parsed.formatMinor, 0); assert.equal(parsed.isLegacy, false); assert.equal(parsed.recordNumber, 4); assert.equal(parsed.forks.length, 2); @@ -48,4 +48,4 @@ assert.notDeepEqual(unsigned, alternate, 'stored bytes must preserve actual quot assert.deepEqual(canonicalPdaSigningBytes(unsigned), canonicalPdaSigningBytes(alternate), 'changing only a system-owned limit must not affect root signature hash'); assert.equal(canonicalPdaSigningBytes(unsigned).length, unsigned.length - state.forks.length * 4); -console.log(`PDA 1.3 codec/canonical hash smoke test OK (${full.length} bytes)`); +console.log(`PDA 1.0 codec/canonical hash smoke test OK (${full.length} bytes)`); diff --git a/tools/test-publisher/protocol_tags.py b/tools/test-publisher/protocol_tags.py index 0f99f224..b3e1b00a 100644 --- a/tools/test-publisher/protocol_tags.py +++ b/tools/test-publisher/protocol_tags.py @@ -2,7 +2,7 @@ from pathlib import Path import re -NAMESPACE = 'test5595' +NAMESPACE = 'test5599' _UI_PROTOCOL_TAGS = Path(__file__).resolve().parents[2] / 'shine-UI' / 'js' / 'services' / 'protocol-tags.js' if _UI_PROTOCOL_TAGS.is_file(): match = re.search(r"SHINE_CORE_NAMESPACE\s*=\s*['\"]([^'\"]+)['\"]", _UI_PROTOCOL_TAGS.read_text(encoding='utf-8'))