# Development Manual [简体中文](../development-manual.md) Built specifically for the Switch version of `Tomodachi Life`. Updated: 2026-05-22 Status: active development ## 0. Local Verification Snapshot, 2026-05-22 This verification pass covered the desktop app, the web flasher, and ESP32 firmware compilation in the current repository: - `npm run ci:local:quick`: passed, including desktop type-checking, `94` desktop tests, flasher type-checking, `8` flasher tests, and the flasher web build - `npm run build`: passed, including root TypeScript compilation and static asset copying - `~/.platformio/penv/bin/pio run -d firmware/esp32 -e esp32dev_wireless`: passed - `~/.platformio/penv/bin/pio run -d firmware/esp32 -e esp32dev_wireless_switch2`: passed - `~/.platformio/penv/bin/pio run -d firmware/esp32 -e esp32dev_wireless_switch_lite`: passed - `npm run build --prefix site/flasher`: passed and produced the web flasher release output - `npm run verify:pages --prefix site/flasher`: passed Notes: - On this machine, `python3 -m platformio` is not available, but `~/.platformio/penv/bin/pio` is available; firmware compilation was verified through the full `pio` path documented for repo-based usage - These results only cover automated tests, builds, and firmware compilation; real flashing, Bluetooth pairing, timing tuning, and drawing still need device-by-device validation through the quick-start flow ## Author notes - Original source author: Xiaohongshu creator `惜羽拓麻镇` - The repository currently uses the `GPL-3.0-or-later` license - If you publicly repost, mirror, or redistribute this project, it is recommended that you credit `惜羽拓麻镇` - If you publicly repost, mirror, or redistribute this project, it is also recommended that you include the original publication link ## 1. Current objective The current objective is not to complete fully automatic, high-fidelity multicolor drawing for arbitrary images in one step. The current objective is to make this real-world usage chain stable first: `Packaged desktop app / repo-based workflow -> Firmware Flash -> Controller Test -> Timing Tune / Benchmark -> Script Studio -> serial ACK execution -> ESP32 Bluetooth controller output -> stable reproduction on the Switch drawing canvas` Current priorities: 1. stable Bluetooth connection and long-duration execution 2. stable mono, official-palette, and custom-multicolor drawing 3. keep calibrating color sources and offset assumptions 4. only then move on to more ambitious automation ## 2. Current runtime shape The project currently has two real entry routes: - `Packaged desktop app`: for `macOS` and `Windows x64` - `Repo-based workflow`: for development, debugging, and protocol validation In the current implementation: - `apps/desktop/src/electron/main.ts` is responsible for the desktop shell, runtime path selection, local web-server startup, and main-window lifecycle - `package.json` already contains scripts such as `electron:dev`, `dist:mac`, and `dist:win:x64` - packaged builds do not run firmware directly from a read-only resource directory; they first copy `firmware/esp32` into a writable location before handing it to `PlatformIO` - the `Windows` package includes `drivers/windows` resources so the desktop UI can expose driver-helper entry points - `apps/desktop/src/web/recoverySessions.ts` is responsible for recovery-session persistence, reload, cleanup, and state conversion - recovery sessions are currently stored under the user's documents directory in `FriendMaker/recovery-sessions` - `apps/desktop/src/drawingTemplates.ts` owns drawing-template definitions, and template masks / previews are loaded from static assets So the real development shape is no longer just "CLI + webpage". It is: `Electron desktop app + embedded local web workspace + TypeScript development toolchain` ## 3. Stable capabilities right now As of the current version, these parts are already verified or basically usable: - packaged desktop build scripts and a desktop entry already exist for `macOS` and `Windows x64` - the web UI already covers `Script Studio / Firmware Flash / Controller Test / Timing Tune / Benchmark` - the page can directly invoke `PlatformIO` to compile and flash firmware - the page can directly run controller connection, Bluetooth reset, and button / D-pad / stick tests - the page can directly tune `inputDelay / buttonPressDuration` and run loopback timing tests - a `256x256` script-coordinate canvas - the public UI currently exposes six square-pixel brush sizes: `1 / 3 / 7 / 13 / 19 / 27` - round pixel brushes are still reserved / guarded, and the main generation and execution path does not depend on them - drawing starts from the center of the canvas after entering the drawing page - after recovery, re-entering the drawing page is still modeled as starting again from the center - `A` is used for drawing / confirming a stroke - the D-pad is used for one-cell movement - the page can import images, generate previews, inspect statistics, and execute commands - the mono drawing path is already working - the official-palette drawing path is already integrated through `image-q` - the custom-multicolor path is already integrated as a formal feature and can write batches into the `9` custom color slots - official colors are quantized into the `7 x 12` / `84`-color base palette and then mapped into the game's right-side `9` palette slots - the drawing-template system already supports categories, previews, masks, and command-time cropping - automatic background removal, preview guides, and official-palette previews are already integrated - the image import path currently supports `PNG / JPG / WEBP / SVG` - execution logs, flash logs, and test logs are all observable in the page - `inputDelay` currently behaves more like a stability knob, while `buttonPressDuration` behaves more like an input-strength knob - recovery tasks are persisted after pause, stop, or abnormal exit; if the app exits while paused, that task is converted into a recoverable task on the next launch - packaged desktop builds include firmware resources, app icons, and bundled `Windows` driver resources - ESP32 already supports the base serial protocol - ESP32 already supports the ACK execution path required by formal drawing - ESP32 already supports test commands such as `TAP