Skip to main content

Tools Reference

Top level

ScriptPurpose
build.sh [clean] [--preset name] [--production]The build entry point; assembles configuration layers, supports custom CMake presets (ble, st7789), and enforces production preconditions
flash.sh [--preset name] [port]idf.py flash, default port /dev/ttyACM0
monitor.sh [--preset name] [port]Serial console with backtrace decoding

tools/

ScriptPurpose
prepare_sd_card_data.sh --check|--rename PATHValidate an SD card layout against the library rules; --rename fixes fixable names in place
import_quran_android_timings.pyConverts Quran Android SQLite timing databases (<reciter>.db) and JSONs to Safi's optimized .atb binary format and archives
download_reciter.shDownloads whole Quran recitations (EveryAyah or mp3quran) into sd_card_data/ with automatic .atb timing compilation
generate_https_certs.shDevelopment self-signed TLS certificate and key into littlefs_data/certs/ (10 years, CN safi.local)
generate_production_certs.shPer-device certificate and key, written outside the git tree (provisioning)
generate_lvgl_fonts.shRegenerates the merged Arabic+Latin LVGL fonts (the pipeline); output is committed C
nvs_mass_provisioning.pyCSV manifest to per-device NVS partition images (provisioning)
provision_device.shOne device end to end: flash, seed, verify
production_preflight.shRefuses production flashing unless the gates and key material check out
hil/run_device_tests.sh [port]Hardware-in-the-loop runner: on-target Unity suite, stdio gate, dev-firmware restore (testing)
font_converter.pyLegacy TTF-to-bitmap converter kept for the pre-LVGL display stack's history; superseded by generate_lvgl_fonts.sh

Hardware

Not build scripts, but the reproducible command lines behind the hardware chapters.

CommandPurpose
kicad-cli pcb export gerbers/drill ..., kicad-cli sch export pdf, kicad-cli ... export bomRegenerate the fabrication outputs (gerbers, drill, BOM, CPL, STEP, schematic PDF) into hardware/pcb/exports/; the exact invocations live in hardware/pcb/README.md
flatpak run --command=freecadcmd org.freecad.FreeCAD hardware/enclosure/safi_enclosure.pyHeadless FreeCAD run that rebuilds the printable enclosure STEP and STL from the parametric script

Documentation site

CommandPurpose
cd safi-docs && npm run startLive-reload docs authoring
npm run buildProduction build, both locales, broken links fatal
npm run diagramsRe-export draw.io sources to SVG via docker (style guide)
npm run write-translations -- --locale arRegenerate Arabic chrome translation JSON