Skip to content

Build and test ​

Build ​

js
import { build } from '@emdzej/navx-sdk';
import { checkNoMulDiv, uiBuild } from '@emdzej/navx-sdk/ui';

const ui = uiBuild('dist/gen/myapp');
const sources = ['myapp.c', ...ui.sources];
checkNoMulDiv(sources, ui.includes, 'dist/gen/myapp', 'myapp');
const { module } = build(sources, { name: 'myapp', cflags: ['-Os', '-Werror', ...ui.includes.map((i) => `-I${i}`)] });

Check module.bytes before you write it anywhere: parity, CRC, and a size that's a multiple of 4.

The emulated unit ​

The NAVX emulator (@emdzej/navx-emu) runs the unit's own software from a flash copy of your own, with the NavX firmware on top. A test or a screenshot tool:

  1. Boot with NAVX_FLASH=/path/flash. Put the launcher in pstartup.
  2. Put your module on a disc: APPS/MYAPP and APPS/APPS.TXT (My app|/dvd/APPS/MYAPP||ui runs it inside the shell).
  3. Drive the knob with BMBT frames:
    js
    m.ibus.receive(ibusFrame(0xf0, 0x3b, [0x49, 0x80 | 1])); // one step right
    m.ibus.receive(ibusFrame(0xf0, 0xff, [0x48, 0x05]));     // press …
    m.ibus.receive(ibusFrame(0xf0, 0xff, [0x48, 0x85]));     // … release
  4. Put made-up car traffic into the I-Bus ring, give the GPS a fix (new Machine({ gps: { lat, lon, speedKmh, heading } })), and take shots with m.video.snapshot().

Every screenshot on this site was made this way, with made-up data.

Check ​

  • Look at the shots against the UI guidelines.
  • After any colour change, run node ui/tools/contrast.mjs: every text colour must be at 4.5:1 or more on the car's LCD.
  • Keep vitest to 2 workers. Emulator runs are heavy.

The NavX SDK is private for now; these docs are public.