### Start self-hosted KOReader sync server with Docker Compose Source: https://github.com/0x1abin/crossmux/blob/main/USER_GUIDE.md Creates a compose.yaml for the koreader/kosync image, exposing ports 7200 and 17200, and starts it with Docker or Podman. ENABLE_USER_REGISTRATION=true is convenient for first setup; set to false after creating users to avoid unexpected registrations. ```bash mkdir -p kosync-quickstart cd kosync-quickstart cat > compose.yaml <<'YAML' services: kosync: image: koreader/kosync:latest ports: - "7200:7200" - "17200:17200" volumes: - ./data/redis:/var/lib/redis environment: - ENABLE_USER_REGISTRATION=true restart: unless-stopped YAML # Docker docker compose up -d # Podman (alternative) podman compose up -d ``` -------------------------------- ### Set up pioarduino core in local virtual environment Source: https://github.com/0x1abin/crossmux/blob/main/docs/contributing/getting-started.md Create a Python virtual environment and install the pinned pioarduino core (6.2.0) along with the platform preparation script. Use on Linux or macOS; Windows uses a different activation path. ```sh python3 -m venv .venv . .venv/bin/activate python -m pip install pioarduino==6.2.0 python scripts/patch_pioarduino_cache.py --prepare-platform pio --version ``` -------------------------------- ### Pin nested core environment for custom_sdkconfig profiles Source: https://github.com/0x1abin/crossmux/blob/main/docs/contributing/getting-started.md For profiles with custom_sdkconfig (default, sticky), install uv and pin the nested core environment before the first build. Replace 'default' with the selected profile; adjust the Python path on Windows. ```sh python -m pip install uv pio pkg install -e default uv pip install --python ~/.platformio/penv/bin/python 'pioarduino==6.2.0' ``` -------------------------------- ### Verify clang-format version Source: https://github.com/0x1abin/crossmux/blob/main/docs/contributing/getting-started.md Check that the installed clang-format major version is 21 or newer. ```sh clang-format-21 --version ``` -------------------------------- ### Build default profile with pio run Source: https://github.com/0x1abin/crossmux/blob/main/docs/contributing/getting-started.md Build the default Xteink X3/X4 firmware profile. Use an existing board environment in platformio.ini for other devices. ```sh pio run -e default ``` -------------------------------- ### YAML File Format Example (spanish.yaml) Source: https://github.com/0x1abin/crossmux/blob/main/docs/i18n.md Example of a language YAML file with metadata keys (_language_name, _language_code, _order, _bcp47) and translation entries. Metadata keys are prefixed with underscore; keys must be valid C++ identifiers starting with STR_. ```yaml _language_name: "Español" _language_code: "ES" _order: "1" _bcp47: "es" STR_CROSSPOINT: "CrossPoint" STR_BOOTING: "BOOTING" STR_BROWSE_FILES: "Buscar archivos" ``` -------------------------------- ### Flash firmware to device Source: https://github.com/0x1abin/crossmux/blob/main/docs/contributing/getting-started.md Upload the built firmware to the connected device using the default upload target. ```sh pio run --target upload ``` -------------------------------- ### Install clang-format 21 on Debian/Ubuntu and macOS Source: https://github.com/0x1abin/crossmux/blob/main/docs/contributing/getting-started.md Install clang-format 21 to satisfy the CI requirement. On Debian/Ubuntu, try the apt package first; if unavailable, add the LLVM apt repo and retry. On macOS, use Homebrew. ```sh # Debian/Ubuntu (try this first) sudo apt-get update && sudo apt-get install -y clang-format-21 # If the package is unavailable, add LLVM apt repo and retry wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh sudo ./llvm.sh 21 sudo apt-get update sudo apt-get install -y clang-format-21 # macOS (Homebrew) brew install clang-format ``` -------------------------------- ### Install font conversion dependencies Source: https://github.com/0x1abin/crossmux/blob/main/docs/sd-card-fonts.md Install the required Python packages for converting TrueType/OpenType fonts to .cpfont files. ```bash pip install freetype-py fonttools ``` -------------------------------- ### Install pioarduino and prepare PlatformIO platform Source: https://github.com/0x1abin/crossmux/blob/main/docs/engineering/build-system.md Run from the repository root before building with a new PlatformIO tool directory. The platform's IDF installer otherwise replaces the Core's running SCons package, causing missing Python modules during a clean build. Preparation removes SCons from that installer's tool list; Core still supplies it. ```bash python -m pip install pioarduino==6.2.0 python scripts/patch_pioarduino_cache.py --prepare-platform ``` -------------------------------- ### WebSocket Upload - Example session Source: https://github.com/0x1abin/crossmux/blob/main/docs/webserver-endpoints.md Example WebSocket session showing the protocol: client sends START, server replies READY, client sends binary chunks, server sends PROGRESS every 64 KB or at completion, then DONE or ERROR. ```text Client -> START:mybook.epub:1234567:/Books Server -> READY Client -> [binary chunk] Server -> PROGRESS:65536:1234567 ... Server -> DONE ``` -------------------------------- ### Font Usage Example Source: https://github.com/0x1abin/crossmux/blob/main/docs/engineering/architecture-and-patterns.md Shows how to include font IDs and insert a font into the renderer, then draw text with it. ```cpp #include "fontIds.h" renderer.insertFont(FONT_UI_MEDIUM, ui12FontFamily); renderer.drawText(FONT_UI_MEDIUM, x, y, "Hello", true); ``` -------------------------------- ### Enable repository-managed Git hooks Source: https://github.com/0x1abin/crossmux/blob/main/docs/contributing/getting-started.md Configure Git to use the repository's hooks directory and make the pre-commit hook executable. Required once per clone. ```sh git config core.hooksPath .githooks chmod +x .githooks/pre-commit ``` -------------------------------- ### Clone CrossMux repository with submodules Source: https://github.com/0x1abin/crossmux/blob/main/docs/contributing/getting-started.md Clone the repository recursively to include submodules. If already cloned without submodules, initialize and update them. ```sh git clone --recursive https://github.com/0x1abin/crossmux.git cd crossmux ``` ```sh git submodule update --init --recursive ``` -------------------------------- ### Build for Read Pico Source: https://github.com/0x1abin/crossmux/blob/main/README.md Builds the Read Pico (小纸 Pico) firmware. The binary is `.pio/build/readpico/firmware.bin`. First installation requires a full-table flash after a verified full-chip backup because the repository partition table and the board's factory `partitions_16M.csv` disagree. ```bash pio run -e readpico ``` -------------------------------- ### GET /api/plugins Source: https://github.com/0x1abin/crossmux/blob/main/docs/webserver-endpoints.md Lists installed plugins that ship a plugin.js. Returns an array of plugin objects with name, directory, title, and mount information. ```APIDOC ## GET /api/plugins ### Description Lists installed plugins that ship a plugin.js. Returns an array of plugin objects with name, directory, title, and mount information. ### Method GET ### Endpoint /api/plugins ### Response #### Success Response (200) - **array** - Array of plugin objects: `[{"name":"","dir":"/","title":"","mount":"settings"}, ...]` - **name** (string) - Plugin folder name - **dir** (string) - Installation directory - **title** (string) - Plugin title from manifest.json - **mount** (string) - Mount point: "settings" or "files" ``` -------------------------------- ### Full CJK font regeneration workflow Source: https://github.com/0x1abin/crossmux/blob/main/docs/engineering/chinese-build.md One-time setup installs build deps into a venv, places the official Noto Sans CJK SC Regular OTF, optionally regenerates character lists, generates the six per-size CJK headers, and builds the unified C3 firmware. The character list step writes both cn_common_chars.txt and cn_i18n_chars.txt; the latter drives the 14/16/18pt subset. ```bash # 1. (One-time) install build deps into a venv python3 -m venv /tmp/cn_font_venv /tmp/cn_font_venv/bin/pip install -r lib/EpdFont/scripts/requirements.txt # 2. Place the official Noto Sans CJK SC Regular OTF into the source dir # (gitignored) under the filename expected by the script. # Source: # https://github.com/notofonts/noto-cjk/blob/main/Sans/OTF/SimplifiedChinese/NotoSansCJKsc-Regular.otf cp /path/to/NotoSansSC-Regular.otf lib/EpdFont/builtinFonts/source/NotoSansSC/ # 3. (Optional) regenerate the character lists. build-cn-builtin-fonts.sh # calls this for you in Step 0 unless SKIP_CHARSET=1 is set. # Writes BOTH cn_common_chars.txt (top-N + require-from) and # cn_i18n_chars.txt (require-from only — drives the 14/16/18pt subset). PYTHON=/tmp/cn_font_venv/bin/python3 \ python3 lib/EpdFont/scripts/build_cn_charset.py \ --require-from lib/I18n/translations/chinese.yaml # 4. Generate the 6 per-size CJK headers PYTHON=/tmp/cn_font_venv/bin/python3 \ bash lib/EpdFont/scripts/build-cn-builtin-fonts.sh # 5. Build the unified C3 firmware pio run -e gh_release ``` -------------------------------- ### CMake build configuration for UserGuideTest and EPUB generation Source: https://github.com/0x1abin/crossmux/blob/main/test/user_guide/CMakeLists.txt Configures a custom command to generate UserGuide.generated.h from the user guide XHTML files using generate_userguide_epub.py, then builds UserGuideTest linking against crosspoint_test_common and GTest. Registers the test with gtest_discover_tests and adds a separate UserGuideEpub test running test_userguide_epub.py. ```cmake find_package(Python3 REQUIRED COMPONENTS Interpreter) set(GUIDE_HEADER ${REPO_ROOT}/src/util/UserGuide.generated.h) add_custom_command(OUTPUT ${GUIDE_HEADER} COMMAND ${Python3_EXECUTABLE} ${REPO_ROOT}/scripts/generate_userguide_epub.py --bundled DEPENDS ${REPO_ROOT}/scripts/generate_userguide_epub.py ${REPO_ROOT}/docs/user-guide/en.xhtml ${REPO_ROOT}/docs/user-guide/zh-CN.xhtml ${REPO_ROOT}/docs/user-guide/style.css ) add_executable(UserGuideTest UserGuideTest.cpp ${REPO_ROOT}/src/util/UserGuide.cpp ${GUIDE_HEADER}) target_include_directories(UserGuideTest BEFORE PRIVATE stubs ${REPO_ROOT}/src/util) target_link_libraries(UserGuideTest PRIVATE crosspoint_test_common GTest::gtest_main) gtest_discover_tests(UserGuideTest) add_test(NAME UserGuideEpub COMMAND ${Python3_EXECUTABLE} ${REPO_ROOT}/scripts/tests/test_userguide_epub.py) ``` -------------------------------- ### Install and run enhanced debug monitor Source: https://github.com/0x1abin/crossmux/blob/main/docs/contributing/testing-debugging.md Installs required Python packages and runs the enhanced debugging monitor script. ```sh python3 -m pip install pyserial colorama matplotlib python3 scripts/debugging_monitor.py ``` -------------------------------- ### Run CI checks before opening a PR Source: https://github.com/0x1abin/crossmux/blob/main/docs/contributing/getting-started.md Execute the repository's CI check script to validate changes before submitting a pull request. ```sh ./bin/ci-check ``` -------------------------------- ### Run simulator and UI regression tests Source: https://github.com/0x1abin/crossmux/blob/main/docs/engineering/high-dpi-ui-profile.md Commands to launch the simulator and run UI regression and font fallback tests for the high-DPI profile review. Screenshots are from the SDL simulator's unscaled pixels using an isolated sample SD card without installed fonts. ```bash pio run -e simulator_readpico -t run_simulator python3 scripts/tests/test_reading_ui_regressions.py python3 scripts/tests/test_ui_font_fallback.py ``` -------------------------------- ### Replace Navigation Functions with ActivityManager Methods Source: https://github.com/0x1abin/crossmux/blob/main/docs/activity-manager.md Shows the before and after for replacing exitActivity() and enterNewActivity() with ActivityManager methods. The after example uses activityManager.goToSettings() or activityManager.replaceActivityWith<MyActivity>() for arbitrary navigation. ```cpp // BEFORE (in main.cpp or via stored callbacks) exitActivity(); enterNewActivity(new SettingsActivity(renderer, mappedInput, onGoHome)); // AFTER (from any Activity method) activityManager.goToSettings(); // or for arbitrary navigation: activityManager.replaceActivityWith<MyActivity>(); ``` -------------------------------- ### GET / Source: https://github.com/0x1abin/crossmux/blob/main/docs/webserver-endpoints.md Returns the home/status page of the device. ```APIDOC ## GET / ### Description Returns the home/status page of the device. ### Method GET ### Endpoint / ``` -------------------------------- ### GET /plugins Source: https://github.com/0x1abin/crossmux/blob/main/docs/webserver-endpoints.md Returns the plugins page (web settings of SD-card plugins). ```APIDOC ## GET /plugins ### Description Returns the plugins page (web settings of SD-card plugins). ### Method GET ### Endpoint /plugins ``` -------------------------------- ### GET /settings Source: https://github.com/0x1abin/crossmux/blob/main/docs/webserver-endpoints.md Returns the web settings page. ```APIDOC ## GET /settings ### Description Returns the web settings page. ### Method GET ### Endpoint /settings ``` -------------------------------- ### Using Translations in C++ Code Source: https://github.com/0x1abin/crossmux/blob/main/docs/i18n.md Shows how to use the tr() macro (recommended) and I18N.get() directly. Requires including CrossPointSettings.h, I18n.h, and Logging.h. ```cpp #include <CrossPointSettings.h> #include <I18n.h> #include <Logging.h> // Using the tr() macro (recommended) renderer.drawText(font, x, y, tr(STR_MY_NEW_STRING)); // Using I18N.get() directly const char* text = I18N.get(StrId::STR_MY_NEW_STRING); ``` -------------------------------- ### GET /plugins-run Source: https://github.com/0x1abin/crossmux/blob/main/docs/sd-plugins.md Headless page that loads every plugin (UI hidden) and executes jobs while open. Used as a runner for external automation. ```APIDOC ## GET /plugins-run ### Description Headless page that loads every plugin (UI hidden) and executes jobs while open. Used as a runner for external automation. ### Method GET ### Endpoint /plugins-run ### Response #### Success Response (200) - HTML page that loads plugins and executes jobs ### Response Example (No example provided in source) ``` -------------------------------- ### Run desktop simulator for multiple devices Source: https://github.com/0x1abin/crossmux/blob/main/README.md Runs the desktop simulator for X4, X3, eego A4, Murphy M4, and Read Pico. Requires SDL2 and curl (plus OpenSSL dev headers on Linux) and EPUBs in `fs_/books/`. The simulator previews UI and input flows but does not validate display waveforms, power consumption, or physical timing. ```bash pio run -e simulator -t run_simulator # X4 pio run -e simulator_x3 -t run_simulator # X3 pio run -e simulator_eego_a4 -t run_simulator # eego A4 pio run -e simulator_murphy_m4 -t run_simulator # Murphy M4 pio run -e simulator_readpico -t run_simulator # Read Pico, 684x1216 portrait ``` -------------------------------- ### GET /js/epub-optimizer.js Source: https://github.com/0x1abin/crossmux/blob/main/docs/webserver-endpoints.md Returns the file manager EPUB optimizer, loaded with JSZip only when needed. ```APIDOC ## GET /js/epub-optimizer.js ### Description Returns the file manager EPUB optimizer, loaded with JSZip only when needed. ### Method GET ### Endpoint /js/epub-optimizer.js ``` -------------------------------- ### Run desktop simulator targets Source: https://github.com/0x1abin/crossmux/blob/main/docs/engineering/build-system.md Install SDL2 and curl (plus OpenSSL development headers on Linux), place EPUB files under fs_/books/, then run these simulator targets. The simulator implementation and launcher come from the pinned 0x1abin/crosspoint-simulator fork; the exact revision is recorded in platformio.ini. ```bash pio run -e simulator -t run_simulator pio run -e simulator_x3 -t run_simulator pio run -e simulator_eego_a4 -t run_simulator pio run -e simulator_murphy_m4 -t run_simulator pio run -e simulator_readpico -t run_simulator ``` -------------------------------- ### Get specific settings with ?keys= filter Source: https://github.com/0x1abin/crossmux/blob/main/docs/webserver-endpoints.md Use ?keys= with a comma-separated list (no spaces) to return only those settings in the same array format and in settings-list order. Unknown keys are ignored. ```bash curl 'http://crosspoint.local/api/settings?keys=koServerUrl,dictionaryName' ``` -------------------------------- ### Example settings item (JSON) Source: https://github.com/0x1abin/crossmux/blob/main/docs/webserver-endpoints.md Shows the common fields for a settings item. For enum type, value is an index into options; for toggle it is 0 or 1; for numeric value it is an integer and may be negative. ```json { "key": "fontSize", "name": "Reader Font Size", "category": "Reader", "type": "enum", "value": 1, "options": ["12 pt", "14 pt", "16 pt", "18 pt"] } ``` -------------------------------- ### BoardReadPico::begin() Source: https://github.com/0x1abin/crossmux/blob/main/docs/engineering/read-pico.md Initializes the board support: shared I2C, FCA9555 self-test and Port-0 configuration, touch reset pulse, PMU init and identity, accelerometer identity probe, and buzzer pin idle LOW. ```APIDOC ## BoardReadPico::begin() ### Description Initializes the board support: shared I2C, FCA9555 self-test and Port-0 configuration, touch reset pulse, PMU init and identity, accelerometer identity probe, and buzzer pin idle LOW. ### Method begin ### Parameters None ### Response - **bool** - True on success, false on failure. ``` -------------------------------- ### Build, upload, and run murphy_m4 with PlatformIO Source: https://github.com/0x1abin/crossmux/blob/main/docs/engineering/murphy-m4.md Build, upload, and run the simulator for the murphy_m4 target using PlatformIO. The first command compiles the firmware, the second uploads it to the device, and the third runs the desktop simulator. ```bash pio run -e murphy_m4 pio run -e murphy_m4 -t upload pio run -e simulator_murphy_m4 -t run_simulator ``` -------------------------------- ### GET /api/wifi - Response JSON Source: https://github.com/0x1abin/crossmux/blob/main/docs/webserver-endpoints.md Example response from GET /api/wifi. Contains index, ssid, hasPassword, and isLastConnected fields. ```json [ { "index": 0, "ssid": "HomeWiFi", "hasPassword": true, "isLastConnected": true } ] ``` -------------------------------- ### GET /plugins-run Source: https://github.com/0x1abin/crossmux/blob/main/docs/webserver-endpoints.md Headless executor page that loads every plugin with its UI hidden so registered actions run. Keep it open while jobs are queued. ```APIDOC ## GET /plugins-run ### Description Headless executor page that loads every plugin with its UI hidden so registered actions run. Keep it open while jobs are queued. ### Method GET ### Endpoint /plugins-run ### Response #### Success Response (200) - The page loads all plugins and executes registered actions. ``` -------------------------------- ### Adding a New Language (italian.yaml) Source: https://github.com/0x1abin/crossmux/blob/main/docs/i18n.md Create a new YAML file for a language, e.g., italian.yaml. Only include strings you have translations for; missing keys fall back to English automatically. ```yaml _language_name: "Italiano" _language_code: "IT" _order: "7" _bcp47: "it" STR_CROSSPOINT: "CrossPoint" STR_BOOTING: "AVVIO" ``` -------------------------------- ### I18n::operator[](StrId id) Source: https://github.com/0x1abin/crossmux/blob/main/docs/i18n.md Operator overload to get a translated string by its StrId identifier. Provides an alternative syntax to the get() method. ```APIDOC ### Description Operator overload to get a translated string by its StrId identifier. Provides an alternative syntax to the get() method. ### Method Operator Overload ### Parameters - **id** (StrId) - Required - The string identifier ### Returns - **const char*** - The translated string ### Example ```cpp const char* text = I18N[StrId::STR_SETTINGS_TITLE]; ``` ``` -------------------------------- ### FreeInkLgfxEpd::setup() updated for 16-bit bus Source: https://github.com/0x1abin/crossmux/blob/main/docs/engineering/read-pico.md Copies the first 8 data pins as before, then copies high pins only when busWidth is 16, and sets bc.bus_width accordingly. Keeps existing boards byte-identical. ```cpp for (int i = 0; i < 8; ++i) bc.pin_data[i] = c.dataPins[i]; for (int i = 8; i < c.busWidth && i < 16; ++i) bc.pin_data[i] = c.dataPinsHigh[i - 8]; bc.bus_width = c.busWidth; ``` -------------------------------- ### BoardReadPico::ready() Source: https://github.com/0x1abin/crossmux/blob/main/docs/engineering/read-pico.md Returns true when I2C and FCA9555 have come up successfully. ```APIDOC ## BoardReadPico::ready() ### Description Returns true when I2C and FCA9555 have come up successfully. ### Method ready ### Parameters None ### Response - **bool** - True if I2C and FCA9555 are ready. ``` -------------------------------- ### I18n::getLanguage() Source: https://github.com/0x1abin/crossmux/blob/main/docs/i18n.md Gets the current runtime language of the application. ```APIDOC ### Description Gets the current runtime language of the application. ### Method Method ### Returns - **Language** - The current language ### Example ```cpp Language lang = I18N.getLanguage(); ``` ``` -------------------------------- ### Download file with GET /download Source: https://github.com/0x1abin/crossmux/blob/main/docs/webserver-endpoints.md Downloads a file from the SD card. The `path` query parameter is required. Protected dotfiles, `System Volume Information`, `XTCache`, and credential stores cannot be downloaded. EPUB files are served as `application/epub+zip`; other files use `application/octet-stream`. ```bash curl -OJ "http://crosspoint.local/download?path=/Books/MyBook.epub" ``` -------------------------------- ### I18N API reference Source: https://github.com/0x1abin/crossmux/blob/main/docs/i18n.md Covers convenience macros (tr, I18N) and full API methods for getting translated strings, setting/getting language, getting character sets, and persisting language choice. ```cpp // === Convenience Macros (Recommended) === // tr(id) - Get translated string without StrId:: prefix const char* text = tr(STR_SETTINGS_TITLE); renderer.drawText(font, x, y, tr(STR_BROWSE_FILES)); LOG_INF("I18N", "Status: %s", tr(STR_CONNECTED)); // I18N - Shorthand for I18n::getInstance() I18N.setLanguage(Language::ES); Language lang = I18N.getLanguage(); // === Full API === // Get the singleton instance I18n& instance = I18n::getInstance(); // Get translated string (three equivalent ways) const char* text = tr(STR_SETTINGS_TITLE); // Macro (recommended) const char* text = I18N.get(StrId::STR_SETTINGS_TITLE); // Direct call const char* text = I18N[StrId::STR_SETTINGS_TITLE]; // Operator overload // Set runtime language I18N.setLanguage(Language::ES); // Get current language Language lang = I18N.getLanguage(); // Get character set for font subsetting (static method) const char* chars = I18n::getCharacterSet(Language::FR); // Persist a user language choice SETTINGS.language = static_cast<uint8_t>(Language::ES); SETTINGS.saveToFile(); ``` -------------------------------- ### Build firmware via PlatformIO CLI Source: https://github.com/0x1abin/crossmux/blob/main/docs/engineering/testing-and-debugging.md Build the default environment, upload to device, build a specific environment, run native simulators, or clean build artifacts. Use `pio run -e gh_release` for a specific environment and `-t run_simulator` for simulator targets. ```bash # Build firmware (default environment) pio run # Build and upload to device pio run -t upload # Build specific environment pio run -e gh_release # Build and run a native device simulator pio run -e simulator -t run_simulator pio run -e simulator_x3 -t run_simulator pio run -e simulator_eego_a4 -t run_simulator pio run -e simulator_murphy_m4 -t run_simulator # Clean build artifacts pio run -t clean ``` -------------------------------- ### GET /plugin?name=<plugin>&file=<file> Source: https://github.com/0x1abin/crossmux/blob/main/docs/webserver-endpoints.md Serves a single file from a plugin's folder. Both parameters must be single path components; returns 404 if plugin, file, or directory not found, 500 if file cannot be read. ```APIDOC ## GET /plugin?name=<plugin>&file=<file> ### Description Serves a single file from a plugin's folder. Both parameters must be single path components; returns 404 if plugin, file, or directory not found, 500 if file cannot be read. ### Method GET ### Endpoint /plugin?name=<plugin>&file=<file> ### Parameters #### Query Parameters - **name** (string) - Required - Plugin name (single path component) - **file** (string) - Required - File name (single path component) ### Response #### Success Response (200) - **body** - File contents - **ETag** (string) - MD5 of file contents - **Cache-Control** (string) - `no-cache` #### Success Response (304) - **body** - Empty, when If-None-Match matches #### Error Response (404) - **body** - Not found #### Error Response (500) - **body** - Cannot read file ``` -------------------------------- ### Clone and build for X3/X4 with PlatformIO Source: https://github.com/0x1abin/crossmux/blob/main/README.md Clones the repository with submodules and runs PlatformIO builds for X3/X4. Use `pio run -e default` for development, `pio run -e gh_release` for a stable build, and add `-t upload` to flash the image. The binary is `.pio/build/<environment>/firmware.bin`. ```bash git clone --recursive https://github.com/0x1abin/crossmux.git cd crossmux # If submodules were not initialized: git submodule update --init --recursive # X3/X4 development build pio run -e default # X3/X4 unified-language stable build pio run -e gh_release # Build and flash that image to a connected X3/X4 pio run -e gh_release -t upload ``` -------------------------------- ### GET /api/fonts Source: https://github.com/0x1abin/crossmux/blob/main/docs/webserver-endpoints.md Lists installed SD-card font families. On devices that load TTF/OTF/TTC files, these families appear with sizes: [0]. ```APIDOC ## GET /api/fonts ### Description Lists installed SD-card font families. On devices that load TTF/OTF/TTC files, these families appear with `sizes: [0]`. The `0` means that the font file has no fixed point size; the reader offers 12, 14, 16, and 18 pt. ### Method GET ### Endpoint /api/fonts ### Response #### Success Response (200) - **maxFamilies** (number) - Maximum number of font families. - **vectorFonts** (boolean) - Indicates if vector fonts are supported. - **families** (array) - List of font families. - **name** (string) - Font family name. - **sizes** (array) - Available point sizes. - **files** (array) - List of font files. - **name** (string) - File name. - **size** (number) - File size in bytes. ### Request Example ```bash curl http://crosspoint.local/api/fonts ``` #### Response Example ```json { "maxFamilies": 128, "vectorFonts": false, "families": [ { "name": "Literata", "sizes": [12, 14, 16, 18], "files": [ {"name": "Literata_12.cpfont", "size": 123456} ] } ] } ``` ``` -------------------------------- ### I18n::getInstance() Source: https://github.com/0x1abin/crossmux/blob/main/docs/i18n.md Static method to get the singleton instance of the I18n class. Use this for direct access when not using the I18N macro. ```APIDOC ### Description Static method to get the singleton instance of the I18n class. Use this for direct access when not using the I18N macro. ### Method Static Method ### Returns - **I18n&** - The singleton instance ### Example ```cpp I18n& instance = I18n::getInstance(); ``` ``` -------------------------------- ### Create folder with POST /mkdir Source: https://github.com/0x1abin/crossmux/blob/main/docs/webserver-endpoints.md Creates a folder. The `name` form parameter is required; `path` defaults to `/`. ```bash curl -X POST -d "name=NewFolder&path=/" http://crosspoint.local/mkdir ``` -------------------------------- ### api.fetchToSd(url, dest, headers, {method, body}) Source: https://github.com/0x1abin/crossmux/blob/main/docs/sd-plugins.md Downloads a URL directly to the SD card. Options are optional; with a method other than GET or a non-empty body, the request is sent once, and on failure the thrown error carries the /api/fetch result in err.result. ```APIDOC ## api.fetchToSd(url, dest, headers, {method, body}) ### Description Downloads a URL directly to the SD card. Options are optional; with a method other than GET or a non-empty body, the request is sent once, and on failure the thrown error carries the /api/fetch result in err.result. ### Method N/A (JavaScript API) ### Endpoint N/A ### Parameters - **url** (string) - Required - URL to download - **dest** (string) - Required - Destination path on SD - **headers** (object) - Required - Request headers - **options** (object) - Optional - {method, body} ### Response On failure, the thrown error carries the /api/fetch result in err.result, including the start of the server's answer in err.result.body when there is one. ``` -------------------------------- ### I18n::get(StrId id) Source: https://github.com/0x1abin/crossmux/blob/main/docs/i18n.md Direct method to get a translated string by its StrId identifier. Equivalent to the tr() macro and the operator[] overload. ```APIDOC ### Description Direct method to get a translated string by its StrId identifier. Equivalent to the tr() macro and the operator[] overload. ### Method Method ### Parameters - **id** (StrId) - Required - The string identifier ### Returns - **const char*** - The translated string ### Example ```cpp const char* text = I18N.get(StrId::STR_SETTINGS_TITLE); ``` ``` -------------------------------- ### POST /mkdir Source: https://github.com/0x1abin/crossmux/blob/main/docs/sd-plugins.md Creates a directory on the SD card. ```APIDOC ## POST /mkdir ### Description Creates a directory on the SD card. ### Method POST ### Endpoint /mkdir ### Parameters #### Request Body - **path** (string) - Required - Path of the directory to create ### Response No specific response documented. ``` -------------------------------- ### I18n::getCharacterSet(Language lang) Source: https://github.com/0x1abin/crossmux/blob/main/docs/i18n.md Static method to get the character set for font subsetting for a given language. Useful for rendering text with the correct glyphs. ```APIDOC ### Description Static method to get the character set for font subsetting for a given language. Useful for rendering text with the correct glyphs. ### Method Static Method ### Parameters - **lang** (Language) - Required - The language to get the character set for (e.g., Language::FR) ### Returns - **const char*** - The character set string ### Example ```cpp const char* chars = I18n::getCharacterSet(Language::FR); ``` ``` -------------------------------- ### tr(id) - Get translated string Source: https://github.com/0x1abin/crossmux/blob/main/docs/i18n.md Macro to retrieve a translated string by its StrId identifier without needing the StrId:: prefix. Recommended for most use cases. ```APIDOC ### Description Macro to retrieve a translated string by its StrId identifier without needing the StrId:: prefix. Recommended for most use cases. ### Method Macro ### Parameters - **id** (StrId) - Required - The string identifier (e.g., STR_SETTINGS_TITLE) ### Returns - **const char*** - The translated string ### Example ```cpp const char* text = tr(STR_SETTINGS_TITLE); renderer.drawText(font, x, y, tr(STR_BROWSE_FILES)); LOG_INF("I18N", "Status: %s", tr(STR_CONNECTED)); ``` ``` -------------------------------- ### Core PlatformIO and utility commands Source: https://github.com/0x1abin/crossmux/blob/main/AGENTS.md Common build, flash, static analysis, formatting, and monitoring commands for the CrossMux project. Includes default env build, unified-language X3/X4 release, desktop simulator, CI checks, clang-format, and enhanced serial monitor. ```bash pio run # Build (default env) pio run -t upload # Build + flash pio run -e gh_release # Unified-language X3/X4 stable firmware pio run -e simulator -t run_simulator # Desktop X4 simulator (SDL2 + curl) pio check # Static analysis (cppcheck) ./bin/ci-check # Full code-change checks (see contributor workflow) ./bin/clang-format-fix # Format (CI uses clang-format 21+) python3 scripts/debugging_monitor.py # Enhanced serial monitor ``` -------------------------------- ### Build all six unified ESP32-S3 device binaries Source: https://github.com/0x1abin/crossmux/blob/main/docs/engineering/chinese-build.md Builds the six unified ESP32-S3 device binaries for the hardware targets sticky, x4pro, papermono, eego_a4, murphy_m4, and waveshare_epaper_397. ```bash # Build all six unified ESP32-S3 device binaries pio run -e sticky -e x4pro -e papermono -e eego_a4 \ -e murphy_m4 -e waveshare_epaper_397 ``` -------------------------------- ### GET /api/status JSON response Source: https://github.com/0x1abin/crossmux/blob/main/docs/webserver-endpoints.md Example response from the /api/status endpoint. Fields include firmware version, plugin API level, IP address, Wi-Fi mode, RSSI, free heap, uptime, and hardware detection. ```json { "version": "1.0.0", "firmwareFamily": "crosspoint", "pluginApi": 1, "pluginCapabilities": "catalog.lists,catalog.notices,catalog.bundle_install,catalog.version_tracking,catalog.compatibility,catalog.item_details,catalog.encoded_item_fields,catalog.list_index_mapping", "ip": "192.168.1.100", "mode": "STA", "rssi": -45, "freeHeap": 123456, "uptime": 3600, "device": "X4" } ``` -------------------------------- ### POST /mkdir Source: https://github.com/0x1abin/crossmux/blob/main/docs/webserver-endpoints.md Creates a folder. ```APIDOC ## POST /mkdir ### Description Creates a folder. ### Method POST ### Endpoint /mkdir ### Parameters #### Form Parameters - **name** (string) - Required - New folder name - **path** (string) - Optional - Parent folder (default: `/`) ### Request Example ```bash curl -X POST -d "name=NewFolder&path=/" http://crosspoint.local/mkdir ``` ``` -------------------------------- ### GET /api/fonts - List font families Source: https://github.com/0x1abin/crossmux/blob/main/docs/webserver-endpoints.md Lists installed SD-card font families. On devices that load TTF/OTF/TTC files, families appear with sizes: [0], meaning no fixed point size; the reader offers 12, 14, 16, and 18 pt. ```bash curl http://crosspoint.local/api/fonts ``` ```json { "maxFamilies": 128, "vectorFonts": false, "families": [ { "name": "Literata", "sizes": [12, 14, 16, 18], "files": [ {"name": "Literata_12.cpfont", "size": 123456} ] } ] } ``` -------------------------------- ### Build and test commands for metalio_eink4_plus Source: https://github.com/0x1abin/crossmux/blob/main/docs/engineering/metalio-eink4-plus.md Run these commands to initialize submodules, build the S31 target with PlatformIO, and run the unit tests. Requires PlatformIO Core 6.2+ and pioarduino 61.04.00-RC1. The build uses a separate Core directory and build directory. ```sh git submodule update --init --recursive PLATFORMIO_CORE_DIR=/tmp/crossmux-plus-beta-pio PLATFORMIO_BUILD_DIR=.pio/build-s31 pio run -e metalio_eink4_plus python3 -m unittest discover -s scripts/tests -p test_metalio_eink4_plus.py ``` -------------------------------- ### GET / Source: https://github.com/0x1abin/crossmux/blob/main/docs/webserver-endpoints.md WebDAV-compatible handler for file manager clients. Supports GET method. ```APIDOC ## [GET] / ### Description WebDAV-compatible handler for file manager clients. Supports GET method. ### Method GET ### Endpoint / ``` -------------------------------- ### Run ReaderFontPreview and SdCardFontPreflight tests Source: https://github.com/0x1abin/crossmux/blob/main/docs/engineering/sd-card-font-cache.md Build ReaderFontPreviewTest and SdCardFontPreflightTest, then run this ctest command to verify preview decisions and read-only preflight boundaries. Use --output-on-failure to see failures. ```sh ctest --test-dir build/test -R "ReaderFontPreview|SdCardFontPreflight|FontPreloadFlow" --output-on-failure ``` -------------------------------- ### GET / (Captive Portal Redirect) Source: https://github.com/0x1abin/crossmux/blob/main/docs/webserver-endpoints.md In AP mode, any GET or HEAD request with a Host header that is not an IP address, a .local name, or a single-label name such as 'crosspoint' gets a 302 redirect to the AP IP. ```APIDOC ## [GET] / (Captive Portal Redirect) ### Description In AP mode, any GET or HEAD request with a Host header that is not an IP address, a .local name, or a single-label name such as 'crosspoint' gets a 302 redirect to the AP IP. ### Method GET ### Endpoint / ### Response #### Success Response (302) - **Location** (string) - http://<AP IP>/ ``` -------------------------------- ### Create Folder via POST /mkdir Source: https://github.com/0x1abin/crossmux/blob/main/src/network/html/en/FilesPage.html Handles folder creation by sending a POST request to /mkdir with FormData containing name and path. On success reloads the page; on failure shows an alert with the server response or a network error. ```javascript or ..'); return; } const formData = new FormData(); formData.append('name', folderName); formData.append('path', currentPath); const xhr = new XMLHttpRequest(); xhr.open('POST', '/mkdir', true); xhr.onload = function() { if (xhr.status === 200) { window.location.reload(); } else { showWebAlert('Failed to create folder: ' + xhr.responseText); } }; xhr.onerror = function() { showWebAlert('Failed to create folder - network error'); }; xhr.send(formData); } ``` -------------------------------- ### Build for X4 Pro and Metalio E-Ink 4 Source: https://github.com/0x1abin/crossmux/blob/main/README.md Runs PlatformIO builds for X4 Pro and Metalio E-Ink 4 in Dev, Stable, and Nightly variants. The Stable ZIPs are `crossmux-<version>-x4pro.zip` and `crossmux-<version>-metalio-eink4.zip`. First installation requires the matching bootloader and partition layout. ```bash # X4 Pro: Dev / Stable / Nightly pio run -e x4pro pio run -e x4pro-gh_release pio run -e x4pro_nightly # Metalio E-Ink 4: Dev / Stable / Nightly pio run -e metalio_eink4 pio run -e metalio_eink4-gh_release pio run -e metalio_eink4_nightly ``` -------------------------------- ### Get all settings with curl Source: https://github.com/0x1abin/crossmux/blob/main/docs/webserver-endpoints.md Returns a streamed JSON array of editable settings. Use without query parameters to get the full list. ```bash curl http://crosspoint.local/api/settings ``` -------------------------------- ### Recursive checkout and validation commands for Read Pico Source: https://github.com/0x1abin/crossmux/blob/main/docs/engineering/read-pico.md Run after merging SDK PR #36 to initialize submodules and build the readpico and gh_release environments, then execute host and UI tests. Requires the pinned SDK commit fe12c72f9ca7dc72929c3203e204e700986f8d97. ```bash git submodule update --init --recursive pio run -e readpico -e gh_release python3 freeink-sdk/libs/display/EpdiyLcd/test/host/test_transactions.py python3 scripts/tests/test_ui_font_fallback.py ``` -------------------------------- ### HEAD / (Captive Portal Redirect) Source: https://github.com/0x1abin/crossmux/blob/main/docs/webserver-endpoints.md In AP mode, any GET or HEAD request with a Host header that is not an IP address, a .local name, or a single-label name such as 'crosspoint' gets a 302 redirect to the AP IP. ```APIDOC ## [HEAD] / (Captive Portal Redirect) ### Description In AP mode, any GET or HEAD request with a Host header that is not an IP address, a .local name, or a single-label name such as 'crosspoint' gets a 302 redirect to the AP IP. ### Method HEAD ### Endpoint / ### Response #### Success Response (302) - **Location** (string) - http://<AP IP>/ ``` -------------------------------- ### App directory structure for a new app Source: https://github.com/0x1abin/crossmux/blob/main/src/activities/apps/README.md Required layout for a new app: MyAppActivity.{h,cpp} extending Activity, plus optional game-specific files. ```text apps/<myapp>/ MyAppActivity.{h,cpp} # required — extends Activity ... # game-specific board / store / generator as needed ``` -------------------------------- ### BoardReadPico::epdPrepare() Source: https://github.com/0x1abin/crossmux/blob/main/docs/engineering/read-pico.md One of the three freeink::LgfxEpdPowerHooks bodies. Prepares the EPD for power-on. ```APIDOC ## BoardReadPico::epdPrepare() ### Description One of the three freeink::LgfxEpdPowerHooks bodies. Prepares the EPD for power-on. ### Method epdPrepare ### Parameters None ### Response - **bool** - True on success, false on failure. ``` -------------------------------- ### Run debugging monitor script Source: https://github.com/0x1abin/crossmux/blob/main/USER_GUIDE.md Run the custom debugging monitor script to capture detailed logs. Requires Python 3 with pyserial, colorama, and matplotlib (install via pip3 install pyserial colorama matplotlib). The script auto-detects the serial port. ```bash python3 scripts/debugging_monitor.py ``` -------------------------------- ### Build and test BLE firmware with cmake, ctest, and pio Source: https://github.com/0x1abin/crossmux/blob/main/docs/engineering/c3-bluetooth.md Runs host checks for BLE lifecycle, startup failure/retry, input isolation, CPU protection, profile/link isolation, paged/resident lookup agreement, non-BMP and page boundaries, corrupt files, allocation failures, short-read retry, and Flash fallback. Host checks do not model the actual controller or prove radio timing. ```bash cmake -S test -B build/test cmake --build build/test --target ble_input_internal_tests ble_input_psram_tests \ ble_input_unavailable_tests ble_overlay_tests ble_ipc_stack_tests ble_key_mapping_tests \ SdCardFontMemoryTest SdCardFontPagedTest sd_card_font_cache_format_test FontCacheManagerTest \ ChapterHtmlSlimParserTest ctest --test-dir build/test --output-on-failure \ -R 'Ble|Nimble|internal\.|psram\.|unavailable\.|SdCardFont|FontCacheManager|ChapterHtmlSlimParser|Section' pio run -e default -e gh_release -e gh_release_rc \ -e sticky-gh_release -e x4pro-gh_release -e x4c -e papermono-gh_release ``` -------------------------------- ### GET /files Source: https://github.com/0x1abin/crossmux/blob/main/docs/webserver-endpoints.md Returns the file manager page. ```APIDOC ## GET /files ### Description Returns the file manager page. ### Method GET ### Endpoint /files ``` -------------------------------- ### List available Unicode interval presets Source: https://github.com/0x1abin/crossmux/blob/main/docs/sd-card-fonts.md Display all preset Unicode intervals with their codepoint counts. ```bash python3 lib/EpdFont/scripts/fontconvert_sdcard.py --list-presets ``` -------------------------------- ### GET /api/files Source: https://github.com/0x1abin/crossmux/blob/main/docs/sd-plugins.md Lists files on the SD card (same-origin endpoint). ```APIDOC ## GET /api/files ### Description Lists files on the SD card (same-origin endpoint). ### Method GET ### Endpoint /api/files ### Parameters None documented ### Response Returns a list of files. ``` -------------------------------- ### GET /fonts Source: https://github.com/0x1abin/crossmux/blob/main/docs/webserver-endpoints.md Returns the SD-card font manager page. ```APIDOC ## GET /fonts ### Description Returns the SD-card font manager page. ### Method GET ### Endpoint /fonts ``` -------------------------------- ### BoardReadPico library directory structure Source: https://github.com/0x1abin/crossmux/blob/main/docs/engineering/read-pico.md Directory layout for the new freeink-sdk library 'BoardReadPico' under libs/hardware/. Contains library.json (name 'BoardReadPico', deps BoardConfig + EInkDisplay), include/BoardReadPico.h, include/BoardReadPicoPins.h, src/BoardReadPico.cpp, and src/ReadPicoLgfxConfig.cpp. ```text freeink-sdk/libs/hardware/BoardReadPico/ library.json // name "BoardReadPico", deps BoardConfig + EInkDisplay include/BoardReadPico.h include/BoardReadPicoPins.h src/BoardReadPico.cpp src/ReadPicoLgfxConfig.cpp ``` -------------------------------- ### GET /js/jszip.min.js Source: https://github.com/0x1abin/crossmux/blob/main/docs/webserver-endpoints.md Returns the JavaScript asset used by the file manager. ```APIDOC ## GET /js/jszip.min.js ### Description Returns the JavaScript asset used by the file manager. ### Method GET ### Endpoint /js/jszip.min.js ``` -------------------------------- ### GET /api/settings?keys=a,b Source: https://github.com/0x1abin/crossmux/blob/main/docs/sd-plugins.md Reads a few reader settings. Returns only the settings you ask for. ```APIDOC ## GET /api/settings?keys=a,b ### Description Reads a few reader settings. Returns only the settings you ask for. ### Method GET ### Endpoint /api/settings ### Parameters #### Query Parameters - **keys** (string) - Required - Comma-separated list of setting keys to retrieve ### Response Returns the requested settings. ``` -------------------------------- ### GET /api/wifi - List saved Wi-Fi networks Source: https://github.com/0x1abin/crossmux/blob/main/docs/webserver-endpoints.md Lists saved Wi-Fi networks. Passwords are never returned. ```bash curl http://crosspoint.local/api/wifi ```