# LocalPulse user guide

## Product screens

Production uses one fixed repeating sequence. The portal's Screen rotation is
the default duration, and any screen can optionally override it independently:

1. **World Time** — Local City plus the next two configured cities. Each
   column shows city-local time, P2 temperature, and `DD MMM`. Short city
   labels are centered; long labels make one pass and then hold their readable
   beginning within the column margin.
2. **Local Weather** — current conditions for Local City.

   If precipitation is measured at the current observation, this screen says
   `RAIN NOW` or `SNOW NOW`; a current thunderstorm displays `STORM NOW` even
   when its provider observation has no precipitation amount. Otherwise `RAIN` is the provider's current
   probability and `+1 HR` is the next complete hourly forecast interval.
3. **Outdoors** — Local City weather guidance.
4. **Forecast** — Local City's next 12 hours. It always appears: it shows a
   rain/snow/storm/heat event when present, or a clear-period outlook when dry.
   A provider WMO 95–99 thunderstorm code qualifies as a storm forecast even
   if its hourly amount is absent.
5. **Sky Events** — Local City Sun/Moon events, calculated on-device. Its
   header pairs the city with the local date in `DDD   MM/DD` form; the
   weekday and numeric date are separated by three pixels. It shows Sun rise,
   set, daylight duration; and Moon rise, set, illumination, and waxing/waning
   state.
6. **Moon** — standard phase at the header, a rotating set of the nearest two
   or three locally eligible astronomy events, and Full/New Moon countdowns.
   The left column advances every three seconds through eligible eclipses,
   supermoons, micromoons, Blue Moons, meteor peaks, planetary oppositions,
   Venus maximum elongation, equinoxes, solstices, and catalogued occultations.
   Each left-column line is limited to ten characters so it does not overlap
   the Full/New labels; planetary events use compact wording such as `SATURN`
   and `BEST xD` rather than `SATURN OPPOSITION`.
   The same event type never appears twice in a row. Cultural/tithi events
   appear only in the lower CULTURAL ticker, which scrolls
   up to four upcoming events in chronological order.
   These labels are calculated on-device from the lunar phase and do not need
   an API key or internet calendar service. The astronomy event list uses an
   embedded free NASA/IMO/USNO-derived catalog plus on-device Moon calculations and is cached
   persistently for the Local City for up to 12 months; changing the Local City
   or its time-zone offset invalidates and rebuilds the cache.
7. **Quake** — the only earthquake screen. It shows the current Quake record,
   including the colored USGS Alert flag and Tsunami status (`No` for `0`).

World Time receives weather for its three displayed cities. The other city
screens use Local City only. There is no configurable screen playlist, hazard
monitoring screen, Volcano screen, page scope, or hazard-radius control.

## Portal

Connect to `LocalPulse-Setup` and open `http://192.168.4.1/` when setting up a
new board or recovering Wi-Fi. The setup portal is open on the trusted local
network without a browser login dialog. Connect to `LocalPulse-Setup` using
WPA2 when recovery mode is active. Mutating
requests still require the portal's short-lived CSRF token. Send `ACCESS`
followed by Enter over USB to print the recovery AP key when needed.

Use the portal to configure Wi-Fi, an optional fallback Wi-Fi network, up to
five cities, Local City, the global screen duration, optional screen-specific
duration overrides, and Production
or Development mode. Choose **Global default** on an individual screen to
inherit the shared duration; for example, global 8 seconds with Quake at 10
seconds changes only Quake. Development can preview
only World Time, Local Weather, Outdoors, Forecast, Sky Events, Moon, and Quake. Recovery mode
keeps the setup portal available while normal display/provider work is paused.

City search can fill the name and coordinates automatically; latitude and
longitude can also be entered manually. Stored Wi-Fi passwords are never
displayed. A standard Wi-Fi QR payload may be pasted or scanned:

```text
WIFI:T:WPA;S:NetworkName;P:NetworkPassword;;
```

Open-Meteo is the primary weather provider. The optional **Tomorrow.io API key**
is a weather fallback, used only if the primary weather request fails. The
portal key is stored locally and takes precedence over
`LOCALPULSE_TOMORROW_API_KEY` in the ignored local `secrets.h`. Neither form of
the key is displayed, exported, or written to serial logs.

Use the physical **UP** and **DOWN** buttons on the MatrixPortal S3 to raise or
lower brightness in 10% increments. The setting is saved locally. Factory
reset returns brightness to 30% and clears portal-stored provider keys.

After the first two full dashboard rotations following boot, LocalPulse shows
an 8-second **Portal Setup** card with a scannable QR code and the live portal
address. It appears again no more often than every five minutes. Double-click
the physical **UP** button to show it immediately; a single UP press still
raises brightness.

## Diagnostics and recovery

While connected, the serial log prints a Wi-Fi heartbeat every five minutes
with the active network (primary or fallback) and the dashboard
URL, for example `dashboard=http://10.0.0.198/`.

The portal provides connectivity status, reset/heap diagnostics, non-secret
configuration backup and restore, and factory reset. Factory reset requires
typing `RESET`. It restores compiled defaults and restarts the device.

After three consecutive panic/watchdog boots, the firmware enters portal-only
recovery mode. The crash streak is cleared after two minutes of stable operation.
Once the device remains stable in recovery mode for three minutes total, it
automatically restarts into normal operation. You can also manually escape
recovery mode at any time by pressing **Escape Recovery Mode** on the recovery
portal page, which restarts immediately. OTA images are not confirmed immediately:
the device must keep the display, network, portal, and worker loop healthy for a
15-second soak or the bootloader rolls the image back at the 180-second deadline.

Synthetic quake/fire serial injection is disabled in production firmware. It is
available only in an explicitly compiled development test build with
`LOCALPULSE_ENABLE_HAZARD_TESTS=1`.

For the data model and provider field reference, see
[`HAZARD_ARCHITECTURE.html`](HAZARD_ARCHITECTURE.html). The authoritative
screen contract is [`PRODUCT_FLOW.md`](PRODUCT_FLOW.md).
