From 143bbdfea18b281a75adcf1b5b6caf3867d801ae Mon Sep 17 00:00:00 2001 From: jaknapper Date: Tue, 17 Feb 2026 13:42:11 +0000 Subject: [PATCH] Add URL to wiki if firmware out of date --- src/openflexure_microscope_server/things/stage/sangaboard.py | 5 +++-- tests/unit_tests/test_sangaboard.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/openflexure_microscope_server/things/stage/sangaboard.py b/src/openflexure_microscope_server/things/stage/sangaboard.py index 7429aea3..ba09f8a1 100644 --- a/src/openflexure_microscope_server/things/stage/sangaboard.py +++ b/src/openflexure_microscope_server/things/stage/sangaboard.py @@ -17,6 +17,7 @@ from . import BaseStage REQUIRED_VERSION = semver.Version.parse("1.0.0") RECOMMENDED_VERSION = semver.Version.parse("1.0.4") +WIKI_URL = "https://openflexure.miraheze.org/wiki/Sangaboard" class SangaboardThing(BaseStage): @@ -108,14 +109,14 @@ class SangaboardThing(BaseStage): if version < REQUIRED_VERSION: raise RuntimeError( f"Sangaboard firmware version {version} is below the required " - f"{REQUIRED_VERSION}." + f"{REQUIRED_VERSION}. Visit {WIKI_URL} for instructions on updating." ) # Warn if version is below recommended if version < RECOMMENDED_VERSION: self.logger.warning( f"Sangaboard firmware version {version} is below the recommended " - f"{RECOMMENDED_VERSION}." + f"{RECOMMENDED_VERSION}. Visit {WIKI_URL} for instructions on updating." ) def _hardware_move_relative( diff --git a/tests/unit_tests/test_sangaboard.py b/tests/unit_tests/test_sangaboard.py index b22ef1af..1be144d9 100644 --- a/tests/unit_tests/test_sangaboard.py +++ b/tests/unit_tests/test_sangaboard.py @@ -9,6 +9,7 @@ from labthings_fastapi.testing import create_thing_without_server from openflexure_microscope_server.things.stage.sangaboard import ( RECOMMENDED_VERSION, REQUIRED_VERSION, + WIKI_URL, SangaboardThing, ) @@ -39,7 +40,7 @@ def test_firmware_before_recommended(mock_sanga_thing, caplog): assert len(caplog.records) == 1 msg = ( f"Sangaboard firmware version {REQUIRED_VERSION} is below the recommended " - f"{RECOMMENDED_VERSION}." + f"{RECOMMENDED_VERSION}. Visit {WIKI_URL} for instructions on updating." ) assert caplog.records[0].message == msg @@ -56,7 +57,7 @@ def test_dev_is_before_recommended(mock_sanga_thing, caplog): assert len(caplog.records) == 1 msg = ( f"Sangaboard firmware version {dev_version} is below the recommended " - f"{RECOMMENDED_VERSION}." + f"{RECOMMENDED_VERSION}. Visit {WIKI_URL} for instructions on updating." ) assert caplog.records[0].message == msg