Skip to content

[Enhancemant 585] Split out Distance, Temperature and Pressure in to three individually configurable settings#624

Merged
accius merged 5 commits intoaccius:Stagingfrom
alanhargreaves:distinct-units
Feb 28, 2026
Merged

[Enhancemant 585] Split out Distance, Temperature and Pressure in to three individually configurable settings#624
accius merged 5 commits intoaccius:Stagingfrom
alanhargreaves:distinct-units

Conversation

@alanhargreaves
Copy link
Copy Markdown
Collaborator

@alanhargreaves alanhargreaves commented Feb 26, 2026

What does this PR do?

There are some out there who like to mix up using imperial and metric for different things. This change is to help these folks out, by splitting distance, temperature and pressure in to three individually configurable settings.

The .env file now accepts the following variables (defaults listed)

# Seperated Units ('imperial' or 'metric')
# DISTUNITS - Distance units
DISTUNITS=imperial
# TEMPUNITS - Temperature Units
TEMPUNITS=imperial
# PRESSUNITS - Pressure Units
PRESSUNITS=imperial

Similarly config.json can use:

"allUnits": {
    "dist": "imperial",
    "temp": "imperial",
    "press": "imperial"
  },

The older units has been deprecated. The only place it will be used now is as a default (if set) for three new variables the first time a version of Open Ham Clock is run with them.

The Settings panel has had the old UNITS configuration replaced with buttons for each of the new units. Clicking the button toggles between 'metric' and 'imperial'.

Type of change

  • Bug fix
  • New feature
  • Performance improvement
  • Refactor / code cleanup
  • Documentation
  • Translation
  • Map layer plugin

How to test

  1. Bring up the Settings panel and select Station
  2. Scroll down until you find UNITS
  3. Toggle one of them and save your settings
  4. Go to a panel which uses those units and verify that they are now displayed indoor current selection of imperial vs metric

Checklist

  • App loads without console errors
  • Tested in Dark, Light, and Retro themes
  • Responsive at different screen sizes (desktop + mobile)
  • If touching server.js: caches have TTLs and size caps (we serve 2,000+ concurrent users) - not relevant for this change
  • If adding an API route: includes caching and error handling
  • If adding a panel: wired into Modern, Classic, and Dockable layouts
  • No hardcoded colors — uses CSS variables (var(--accent-cyan), etc.)
  • No .bak, .old, console.log debug lines, or test scripts included

Screenshots (if visual change)

Settings before
image
Settings After
image

… configurable settings.

There are some out there who like to mix up using imperial and metric for different things. This change is to help these folks out, by splitting distance, temperature and pressure in to three individually configurable settings.

The `.env` file now accepts the following variables (defaults listed)

```
# Seperated Units ('imperial' or 'metric')
# DISTUNITS - Distance units
DISTUNITS=imperial
# TEMPUNITS - Temperature Units
TEMPUNITS=imperial
# PRESSUNITS - Pressure Units
PRESSUNITS=imperial
```
Similarly config.json can use:
```
"allUnits": {
    "dist": "imperial",
    "temp": "imperial",
    "press": "imperial"
  },
```
The older `units` has been deprecated. The only place it will be used now is as a default (if set) for three new variables the first time a version of Open Ham Clock is run with them.

The `Settings` panel has had the old `UNITS` configuration replaced with buttons for each of the new units. Clicking the button toggles between 'metric' and 'imperial'.
@accius
Copy link
Copy Markdown
Owner

accius commented Feb 28, 2026

Merging this — nice work splitting units into per-category settings. The architecture is clean and the migration path from the old units field is handled well. Coverage across all three layouts, weather consumers, and plugin layers is thorough.
I'm making a couple of quick edits on merge to fix two crashes:

  1. config.Units typo in DockableApp.jsx — the "bars" PropagationPanel gets allUnits={config.Units} (capital U) instead of config.allUnits. Every allUnits.dist access inside PropagationPanel will throw a TypeError since config.Units is undefined. The other three PropagationPanel instances are correct, just this one.
  2. Press undefined variable in useAmbientWeather.js — convPressure references Press instead of isMetricPress. ReferenceError as soon as Ambient Weather tries to display pressure data.
    Also removing the console.log(CONFIG.allUnits) debug line left in server.js.
    A few minor things I'm not going to hold this up for, but worth cleaning up in a follow-up:

== instead of === in CallsignWeatherOverlay and SettingsPanel (toggleUnitType, unitString) — rest of codebase uses strict equality
WorldMap DX marker popup still shows pressure as hardcoded hPa — should respect allUnits.press
README table has stray periods in the default column and an unclosed backtick in the DISTUNITS description that will break table rendering
"Seperated" → "Separated" in .env.example
// units, commented-out line in SettingsPanel save object — can just delete
Duplicate setPropMode call at lines 149-150 in SettingsPanel useEffect (pre-existing, but the diff touched that block)

Thanks for the contribution! 73

Copy link
Copy Markdown
Owner

@accius accius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made some changes, hoping I am right.... pushing this to staging.

@accius accius merged commit c0df0ce into accius:Staging Feb 28, 2026
@alanhargreaves alanhargreaves deleted the distinct-units branch February 28, 2026 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants