Skip to content

Consolidate noise floor data into packetStore — remove split across two stores #46

Description

@zindello

Problem

Noise floor data currently lives in two stores:

  • systemStore.noiseFloorDbm — a computed that reads stats.noise_floor_dbm from the WebSocket stats payload. This is the live current reading.
  • packetStore.noiseFloorHistory / packetStore.currentNoiseFloor — historical readings fetched from the packets API on load, plus the zero-filtering / consecutive-bad-polls guard logic.

NoiseFloorSparkline has to stitch both together:

// live value from system store, filtered value from packet store
const currentValue = computed(() => systemStore.noiseFloorDbm || packetStore.currentNoiseFloor)

This split caused a bug (?? vs ||) because systemStore.noiseFloorDbm can be 0 (an invalid reading), bypassing the bad-poll guard that only lives in packetStore. It will keep being a source of confusion.

Where the data should live

packetStore is the right home. Noise floor is packet-layer RF data — it belongs alongside packet stats, not system/config stats. packetStore already owns the history, the dedup logic, the zero filter, and the bad-poll guard. It should own the live value too.

Proposed fix

  1. When the WebSocket stats payload includes noise_floor_dbm, the handler (currently in systemStore) should call packetStore.appendNoiseFloorReading(dbm) rather than writing to stats.noise_floor_dbm.
  2. Remove noiseFloorDbm from systemStore entirely.
  3. NoiseFloorSparkline reads only from packetStore.currentNoiseFloor — single source of truth, zero-filtering included.
  4. The watch(() => systemStore.noiseFloorDbm, ...) in NoiseFloorSparkline that feeds WS readings into the packet store can also be removed — the data service / WS handler does it directly.

Files to touch

  • src/stores/system.ts — remove noiseFloorDbm computed and the WS assignment
  • src/stores/dataService.ts (or wherever the WS stats handler lives) — call packetStore.appendNoiseFloorReading() on incoming noise floor readings
  • src/components/nav/NoiseFloorSparkline.vue — remove systemStore import and watch, simplify currentValue to packetStore.currentNoiseFloor

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions