Skip to content

[WIP] Gaia charts#362

Open
mrosseel wants to merge 286 commits into
brickbots:mainfrom
mrosseel:deepchart
Open

[WIP] Gaia charts#362
mrosseel wants to merge 286 commits into
brickbots:mainfrom
mrosseel:deepchart

Conversation

@mrosseel

@mrosseel mrosseel commented Nov 23, 2025

Copy link
Copy Markdown
Collaborator

Add a gaia achart view to all objects, down to mag 17 but with an auto limiting magnitude taking into account SQM and equipment. This auto limit is overridable.

TODO:

  • further performance optimisations
  • fix missing tile bug
  • get the data < 1Gb
  • choose how to get this data to the users
  • 90 degree rotation bug?

@mrosseel mrosseel changed the base branch from release to main November 23, 2025 22:49
mrosseel and others added 29 commits February 9, 2026 15:51
NetworkManager fix-paths.patch embeds openconnect binary path.
Override with a dummy script to avoid pulling openconnect -> stoken -> GTK 427MB.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
MM is a build-time dependency of NM, not just runtime.
Reverts to working 376MB state.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
iwd is ~10x lighter than NetworkManager for WiFi-only use.
- Removes modemmanager, VPN plugins, glib/polkit bloat
- Uses systemd-networkd for DHCP
- iwctl CLI available for managing networks

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
profiles/base.nix (imported by sd-image) adds w3m which pulls perl (150MB).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
nixos-container pulls perl for container management.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add pinctrl to PWM overlay to route PWM0_1 to GPIO 13
- Change boot-splash to static mode (no animation)
- Fix boot-splash color from blue to red (RGB565)
- Fix NFS deploy script /etc symlinks for PAM

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Primary build on self-hosted aarch64 (Pi5) - fast native
- Fallback to ubuntu-latest with QEMU if Pi5 unavailable
- Also trigger on nixos branch pushes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
pifinder-dev doesn't exist, use pifinder-netboot

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The closure's /etc is a symlink, so direct paths don't work.
Use /etc/static which resolves through the NixOS etc derivation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Type=idle waits for ALL other services to finish before starting,
causing ~2 minute delay. Type=simple starts immediately.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
ln -sfT can't overwrite a directory, need rm -rf first

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Update bootstrap.nix to fetch from correct repo/branch
- Update NIXOS_STATUS.md: WiFi warning is cosmetic, not a real issue

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add pifinder.repoUrl module option to both services.nix and bootstrap.nix
so switching between mrosseel (testing) and brickbots (production) repos
requires only changing the default value in one place.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Builds bootstrap SD image on Pi5 self-hosted runner, extracts boot/rootfs
partitions, and creates tarball for RPi OS -> NixOS migration.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds push trigger for nixos branch when bootstrap.nix, flake.nix, or
the workflow itself changes. Uses VERSION env var for flexibility.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add -type f to find command to match actual image files inside
the sd-image subdirectory.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The rootfs contains root-owned files and lost+found directories that
require elevated permissions to access.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove any existing tarball, staging dir, and mount points before
starting to avoid permission issues from previous failed runs.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Port manifest/channel infrastructure from migration branch:
- _parse_version with pre-release support
- _fetch_manifest / _fetch_version_txt with fallback
- _filter_upgrades, _available_channels
- Multi-phase menu: channel → version → action
- UIReleaseNotes with _strip_markdown
- Full test suite for version parsing, filtering, markdown

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
shell.nix provides Python 3.9 + native build deps (linuxHeaders,
gcc, SDL2, etc.) with LD_LIBRARY_PATH for scipy/numpy.
.envrc auto-creates venv and installs requirements via direnv.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace runtime camera selection (config.txt dtoverlay) with
build-time device tree overlays and NixOS specialisations.
All three camera variants (imx462, imx296, imx477) are pre-built;
switching is instant via `switch-to-configuration boot` + reboot.

- Remove runtimeCameraSelection option, always bake overlay into DT
- Change default camera from imx296 to imx462
- Add specialisations to SD image (imx296, imx477) and netboot (imx296, imx462)
- Add pifinder-switch-camera wrapper script and sudoers entry
- Preserve camera choice across upgrades via /var/lib/pifinder/camera-type
- Delete Debian sys_utils.py, rename sys_utils_nixos.py to sys_utils.py
- Simplify utils.py get_sys_utils() (no more /etc/NIXOS check)
- Delegate callbacks.py get_camera_type() to sys_utils
- Deploy script: use FDTDIR in extlinux.conf, remove dtoverlay from config.txt

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The pifinder systemd service has a restricted PATH that doesn't
include sudo. Use /run/current-system/sw/bin/sudo for all calls.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
These commands are called outside of sudo (which has secure_path),
so they need full paths in the restricted pifinder service PATH.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Bump nixpkgs input to nixos-25.11
- Update Python 3.12 → 3.13 across all references
- Switch simplejpeg wheel to cp313
- Add explicit pyproject/build-system to 13 packages (required by 25.11)
- Add dontCheckRuntimeDeps for packages with env-level deps
- Rename hardware.pulseaudio → services.pulseaudio

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- u-boot SD image: use custom ubootSD with CONFIG_CMD_SYSBOOT,
  hardcoded load address, correct partition (0:2)
- RPi.GPIO: patch cpuinfo.c for aarch64 where /proc/cpuinfo lacks
  Hardware line and u-boot replaces firmware DTB
- I2C1: add overlay to fdtoverlay chain (nixos-hardware was bypassed)
- sudo: substituteInPlace pifinder-src to use /run/wrappers/bin/sudo
- polkit: add reboot/shutdown D-Bus rules for pifinder user
- /boot: mount firmware at /boot/firmware so extlinux.conf works

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- u-boot: disable PCI/USB/NET probing (CONFIG_PREBOOT="", CONFIG_PCI=n,
  CONFIG_USB=n, etc.) — eliminates ~3-4s of unnecessary hardware scanning
- boot-splash: move earlier with DefaultDependencies=false, poll for SPI
  device instead of relying on systemd restart
- Disable NetworkManager-wait-online (7.1s savings, NM still works async)
- pwm-permissions: no longer blocks pifinder startup (runs in parallel)
- pifinder-src: pre-compile .pyc bytecode at build time

Net result: splash ~7s (was 21s), menu ~45s (was 65s).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add bashInteractive to systemPackages (mkForce strips default bash)
- Add download-buffer-size 512MB for large PiFinder repo tarball
- Fix migration_progress OLED binary args to match expected format
  (<percent> <stage_num> <stage_total> <stage_name>)
- Fix nixos-rebuild progress: count copying/building lines instead of
  parsing non-existent (N/M) format

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
mrosseel added 12 commits July 4, 2026 13:25
…ery-hold hints on failure screens (ADR 0005/0006)
…6 dev boxes

python-libinput/rpi-gpio/rpi-hardware-pwm/python-prctl/dbus-python/picamera2/
spidev/pygobject/pyhotkey/pynput are aarch64-only: on dev machines they either
can't build (evdev kernel headers, imp removal, cairo/dbus C deps) or are
meaningless off-device (dev uses sys_utils_fake and the pygame keyboard).
The device env (uv2nix, aarch64) is unchanged. Dev flow: uv sync -> pytest
(CI marker set passes 735/735 under 3.13).
…rop the baked-target existence condition (ADR 0003)
mrosseel and others added 3 commits July 5, 2026 23:49
The repeated block in UBX-NAV-SVINFO is chn, svid, flags, quality,
cno, elev, azim — but the parser started reading at chn, so every
field was shifted one byte: satellite IDs were channel numbers, the
used flag was svid bit 0, and the C/N0 was the 0-7 quality indicator.

Because "cno" was really the quality indicator (>=1 even for idle
SBAS/QZSS channels still searching), the sats-seen count was inflated
to near the full channel count, and the per-satellite used flags were
random — which is why uSat was previously treated as stale and
ignored.

With the offsets fixed:
- nSat only counts satellites with an actual signal (cno > 0)
- uSat from SVINFO is valid, so report it as the used count instead
  of relying solely on NAV-SOL
- elevation/azimuth are decoded as signed values per the spec

Also update the used count from NAV-PVT numSV, which was parsed but
never surfaced — on protVer >= 15 receivers gpsd enables NAV-PVT
instead of NAV-SOL, so the used count stayed 0 forever despite a
valid fix. And actually set got_sat_update when NAV-SAT arrives so
the SVINFO fallback defers to it as intended.

Verified against a live MAX-M8 (PROTVER 14) stream: SVINFO uSat now
matches NAV-SOL numSV, and IDs/C-N0 match gpsd's own SKY decode.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NrdGJ1s3jmA9qzV8HAsdZs
Newer u-blox receivers (later M8 firmware, M9, M10) get NAV-PVT +
NAV-SAT from gpsd instead of NAV-SOL + NAV-SVINFO, so this path is
what recent PiFinder GPS units actually exercise.

- take "used" from the dedicated svUsed flag (bit 3) instead of
  inferring it from the quality indicator
- only count satellites with an actual signal: NAV-SAT lists every
  known satellite, so nSat was inflated by idle entries
- decode elevation/azimuth as signed values

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NrdGJ1s3jmA9qzV8HAsdZs
During cold start the receiver reports an estimated C/N0 for
almanac-predicted satellites it is still trying to confirm, so a
cno > 0 filter makes the seen count start around 20+ and sink to the
real value as candidates fail to confirm. Gate on the quality
indicator instead: only code-locked signals (quality >= 4) count as
seen, in both NAV-SVINFO and NAV-SAT.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NrdGJ1s3jmA9qzV8HAsdZs
@mrosseel mrosseel force-pushed the deepchart branch 4 times, most recently from 4d66ac2 to 9268b3a Compare July 6, 2026 14:14
mrosseel and others added 3 commits July 6, 2026 16:24
Gating the seen count on quality >= 4 (code locked) made the display
flap to zero during marginal re-acquisition — walking out to sky view
showed 0-3 satellites bouncing instead of the steady climb to a lock.
Satellites at quality 2-3 (signal acquired) have a real signal and
belong in the count; only quality-1 search candidates, whose C/N0 is
an estimate, still don't. Same threshold for NAV-SVINFO and NAV-SAT.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NrdGJ1s3jmA9qzV8HAsdZs
Re-applied the deepchart feature (Gaia star charts) as a clean delta on top
of current nixos, replacing the cat_images image backend with the new
object_images package (POSS images + generated Gaia charts via
chart_provider / poss_provider / gaia_chart / star_catalog). Adds the
limiting-magnitude entry UI (ui/lm_entry.py) and the Obj Chart / Set LM menus.

Merge decisions (theirs=deepchart, ours=nixos):
- object_details.py: object_images.get_display_image replaces
  cat_images.get_display_image; nixos Contrast Reserve, telemetry and the
  DM_CONTRAST page preserved; deepchart chart-generator and progressive-image
  handling integrated.
- menu_structure.py: keep both UITelemetryList and UILMEntry imports; union
  the nixos Image menu with deepchart Obj Chart / Set LM menus.
- log / solver / main / camera_debug / sqm conflicts resolved to nixos
  (deepchart changes there were dead code, disabled test hacks, or already
  upstream).
- cat_images.py removed (object_images fully replaces it); obsolete
  test_cat_images.py removed and test_equipment.py decoupled from it.

Carried nixos NSEW-label / object-size-box overlays onto the object_images
backend: ported the cardinal/size/vertex geometry helpers and an
add_orientation_overlays() into object_images/image_utils.py, called from
poss_provider so the image_nsew / image_bbox settings work again.

Replaced the obsolete star_catalog tests (which targeted the removed
_read_binary_index API) with real coverage of the v3 CompressedIndex reader:
header/tile-count parsing, cumulative per-run tile offsets, second-run
offset_base, missing-tile lookups (before/after/gap/past-run-length),
single-run, and version validation. Made CompressedIndex.close() idempotent
to fix a double-close ValueError the new tests exposed. The healpy-dependent
_parse_records / _apply_proper_motion paths still need on-device coverage.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Gaia deep charts load from utils.data_dir/gaia_stars at runtime, but nothing
provisioned it. Add a fixed-output derivation that fetches the ~454 MB catalog
tarball and symlink it into PiFinder_data from the activation script, mirroring
the pifinder-src / astro_data pattern so both fresh flashes and in-place
upgrades deliver it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mrosseel mrosseel force-pushed the deepchart branch 2 times, most recently from 084fa98 to 4087364 Compare July 8, 2026 22:09
star_catalog.py needs healpy for query_disc tile selection, but it was
neither declared in pyproject.toml nor imported unconditionally. The uv2nix
env shipped without it, and a try/except import guard (_HEALPY_AVAILABLE)
degraded silently: every render logged an error and returned zero tiles, so
the deep chart showed no stars and the SQUARE view drew blank instead of
failing at startup.

- Declare healpy in pyproject.toml and relock (prebuilt aarch64 wheel; pulls astropy).
- Drop the _HEALPY_AVAILABLE guard: import healpy plainly and remove the six
  silent-degradation branches. A missing mandatory dep now fails loudly at import.
- Fix pre-existing DTZ lint in the proper-motion epoch calc: use timez.utc_now()
  instead of naive datetime.now(), and snapshot it once (the old code called
  now() twice, risking a year/day-of-year straddle across a year boundary).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testable Ready for testing via PiFinder software update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant