npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

signalk-gnx-display-preset-plugin

v2.1.3

Published

Signal K plugin that automatically selects GNX display presets based on configurable Signal K path conditions

Downloads

356

Readme

signalk-gnx-display-preset-plugin

npm version

Signal K plugin that automatically switches Garmin GNX display presets based on configurable condition expressions evaluated against Signal K data paths.

Use case

When racing, different display layouts are useful at different times — a countdown timer during the start sequence, upwind instruments when beating, downwind instruments when running. This plugin monitors Signal K paths and sends NMEA 2000 commands to your GNX display to switch presets automatically.

Configuration

| Setting | Default | Description | |---|---|---| | Source Address | 0 | NMEA 2000 source address for preset commands (CAN gateway may override) | | Active Profile | default | Name of the profile to activate | | Debounce (ms) | 1000 | Delay before sending a command after conditions change | | Profiles | see below | Array of profile configurations |

Profiles and presets

Each profile contains exactly 4 presets (matching the 4 GNX display preset slots). Each preset has a name and a when expression. Presets are evaluated in order — the first match wins.

Condition expressions

Each preset's when field accepts a human-readable expression string:

navigation.racing.status == 'racing' AND environment.wind.angleTrueWater BETWEEN(-90deg, 90deg, 5deg)

Operators

| Operator | Example | Description | |---|---|---| | == | path == 'value' | Equals (string or number) | | != | path != 'value' | Not equals | | > | path > 10 | Greater than | | < | path < 10 | Less than | | >= | path >= 10 | Greater than or equal | | <= | path <= 10 | Less than or equal | | BETWEEN(min, max [, hysteresis]) | path BETWEEN(-90, 90, 5) | Value >= min and <= max (inclusive) | | OUTSIDE(min, max [, hysteresis]) | path OUTSIDE(-90, 90, 5) | Value < min or > max |

Hysteresis (optional)

BETWEEN and OUTSIDE accept an optional third argument — a non-negative deadband that widens the accepted range while the preset is already active. The entry threshold stays strict; the exit threshold becomes sticky. This prevents rapid flapping between presets when a value oscillates around a boundary.

Example — Upwind preset stays active until wind angle drifts past ±95° rather than flipping at exactly ±90°:

environment.wind.angleTrueWater BETWEEN(-90deg, 90deg, 5deg)

The deg suffix works for the hysteresis argument too, since the tokenizer converts degrees to radians uniformly.

Hysteresis is currently supported only on BETWEEN and OUTSIDE. Other comparison operators (>, <, >=, <=) do not accept a hysteresis argument.

Logic

| Keyword | Description | |---|---| | AND | Both sides must be true | | OR | Either side must be true | | NOT | Inverts the following expression | | ( ) | Group expressions to override precedence |

Precedence: NOT > AND > OR (standard boolean).

Units

Use true for a fallback preset that always matches, and false (or empty) for an unused preset slot.

Units

Append deg to any number to convert degrees to radians for comparison against Signal K values:

environment.wind.angleTrueWater BETWEEN(-90deg, 90deg)

Default profile

The plugin ships with a default racing profile:

| Preset | Name | Expression | |---|---|---| | 0 | Racing timer | navigation.racing.status == 'countdown' | | 1 | Upwind | navigation.racing.status == 'racing' AND environment.wind.angleTrueWater BETWEEN(-90deg, 90deg, 5deg) | | 2 | Downwind | navigation.racing.status == 'racing' AND environment.wind.angleTrueWater OUTSIDE(-90deg, 90deg, 5deg) | | 3 | Sailing | true |

Preset 0 takes priority: during countdown, the Racing timer display is always shown regardless of wind angle. Preset 3 uses true which always matches — since presets 0-2 are evaluated first, it acts as a general sailing fallback when no other preset applies (including when Signal K paths are missing).

REST API

The plugin exposes a single endpoint:

GET /plugins/signalk-gnx-display-preset/state

Returns:

{
  "activeProfile": "default",
  "activePreset": 1,
  "profiles": ["default"]
}

activePreset is null when no preset conditions are met.

How it works

  1. On start, the plugin parses all when expressions into an internal AST and subscribes to the Signal K paths they reference.
  2. When any subscribed path updates, evaluation is scheduled (debounced).
  3. Presets are evaluated in order (0-3). The first preset whose expression matches is selected.
  4. If the selected preset differs from the current one, the plugin emits a PGN 61184 (Garmin proprietary) NMEA 2000 command to switch the GNX display.

Expressions are parsed once at startup — at runtime the plugin only traverses a small cached AST. A full evaluation cycle across all 4 presets takes under 100 nanoseconds, adding negligible CPU load even at high Signal K data rates.

Disclaimer

This project is an independent demo and is not affiliated with, endorsed by, or connected to Garmin or its subsidiaries. "Garmin" and "GNX" are trademarks of Garmin. Use at your own risk. The authors assume no liability for any damage to equipment or loss of functionality resulting from the use of this software.

License

Apache-2.0