Skip to content

Method LoadCalibrationAsync

Namespace: Belay.Core.Examples
Assembly: Belay.Core.dll

LoadCalibrationAsync()

Load calibration data and configure sensor parameters. This runs after hardware initialization.

csharp
[Setup(Order = 2)]
[PythonCode("\n        import json\n        \n        # Default calibration values\n        calibration = {\n            'temp_offset': 0.0,\n            'temp_scale': 1.0,\n            'light_scale': 1.0,\n            'humidity_offset': 0.0\n        }\n        \n        # Try to load saved calibration\n        try:\n            with open('calibration.json', 'r') as f:\n                saved_cal = json.loads(f.read())\n                calibration.update(saved_cal)\n            print('Calibration data loaded')\n        except:\n            print('Using default calibration values')\n        \n        # Store in global scope for use by other methods\n        globals()['sensor_calibration'] = calibration\n    ")]
Task LoadCalibrationAsync()

Returns

Task

Released under the Apache License 2.0.