# PIPGEIG device applet

`app.js` is the readable Espruino source used by Demo 9.1;
`APPS/PIPGEIG.JS` is its stripped, deployable build. The app targets The Wand
Company Pip-Boy 3000's 480×320 indexed display and follows the RobCo app
lifecycle: anonymous non-invoked IIFE, `id`/`remove` return object, exclusive
knob listeners, and complete listener/timer cleanup.

## Controls

| Control | Monitor screens | Calibration |
| --- | --- | --- |
| Knob 1 turn | Select the active reading or trend window | Select a calibration row |
| Knob 1 press | Open calibration | Capture background / confirm / save |
| Knob 1 long-press | Return to RADS | Cancel without saving |
| Knob 2 turn | Switch RADS, TREND, and NAV | Adjust the selected value |

## Serial configuration

The detector link is 3.3 V UART at 115200 baud, 8 data bits, no parity, one
stop bit. The app deliberately ships without a pin assignment. Create
`USER/PIPGEIG.JSON` on the Pip-Boy SD card after verifying a genuinely free
USART pair on the exact hardware revision:

```json
{
  "rx": "A10",
  "tx": "A9",
  "background": 3,
  "factor": 5,
  "alarm": 100
}
```

`A10`/`A9` are examples, not a wiring recommendation. Confirm continuity,
firmware pin use, and `E.getConsole()` before connecting. The app refuses to
take Serial1 when the Espruino console is using it. Connect detector TX to the
verified Pip-Boy RX, detector RX to a verified Pip-Boy TX, and detector ground
to Pip-Boy ground. The Rev D board provides both 3.3 V electrical paths through
100-ohm series resistors, but the detector RX path does not provide command
support without corresponding GC1 firmware. Pip-Boy UART pin assignments remain
unverified. Never put 5 V UART on either device.

Calibration values mean:

- `background`: local background count rate in CPM.
- `factor`: tube sensitivity in CPM per µSv/h for the calibrated radiation
  field; the displayed dose is `(CPM - background) / factor` and remains an
  estimate, not a certified dosimetry result.
- `alarm`: field alert threshold in CPM.

Back up the SD card before installation. Install by copying the app and its
launcher metadata through a mounted microSD card or a USB-C Web Serial file
installer:

```text
APPS/PIPGEIG.JS               -> APPS/PIPGEIG.JS
APPINFO/PIPGEIG.info          -> APPINFO/PIPGEIG.info
```

The launcher manifest uses the device's shared `APPINFO/HOLO.IMG` icon. Reboot
after copying; the app appears under **ITEMS › MISC**. Do not flash firmware or
use the Espruino IDE's "Send to Espruino" button.

Regenerate the deployable file after changing `app.js`:

```sh
terser app.js -c negate_iife=false,side_effects=false,directives=false \
  -o APPS/PIPGEIG.JS
```

The build is deliberately not name-mangled because Espruino does not implement
standard block scoping for `let`/`const`.
