Skip to content

Commit

Permalink
Cal on startup if calibration is expired.
Browse files Browse the repository at this point in the history
  • Loading branch information
dboulware committed Mar 14, 2024
1 parent 75e64c8 commit 33f8200
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion env.template
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ADMIN_PASSWORD=password

# set to CERT to enable scos-sensor certificate authentication
AUTHENTICATION=TOKEN

CALIBRATION_EXPIRATION_LIMIT=360
# Default callback api/results
# Set to CERT for certificate authentication
CALLBACK_AUTHENTICATION=TOKEN
Expand Down
2 changes: 1 addition & 1 deletion src/initialization/sensor_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def load_sensor(sensor_capabilities: dict, sensor_actions: dict) -> Sensor:
# Now run the calibration action defined in the environment
# This will create an onboard_cal file if needed, and set it
# as the sensor's sensor_calibration.
if settings.CALIBRATE_ON_STARTUP or sensor.sensor_calibration is None:
if sensor.sensor_calibration is None or sensor.sensor_calibration.expired():
if settings.STARTUP_CALIBRATION_ACTION is None:
logger.error("No STARTUP_CALIBRATION_ACTION set.")
else:
Expand Down
2 changes: 1 addition & 1 deletion src/sensor/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,5 +450,5 @@
MAX_FAILURES = env("MAX_FAILURES", default=2)
os.environ["RUNNING_TESTS"] = str(RUNNING_TESTS)
USB_DEVICE = env("USB_DEVICE", default=None)
CALIBRATE_ON_STARTUP = env.bool("CALIBRATE_ON_STARTUP", default=False)
CALIBRATION_EXPIRATION_LIMIT = env("CALIBRATION_EXPIRATION_LIMIT", default=None)
STARTUP_CALIBRATION_ACTION = env("CALIBRATE_ON_STARTUP", default=None)

0 comments on commit 33f8200

Please sign in to comment.