validity-sensors-initializer: Use calibration file if any is available
Otherwise save generated one in temporary path
This commit is contained in:
parent
a6ca2cbc56
commit
b211d0e92b
1 changed files with 12 additions and 2 deletions
|
|
@ -168,8 +168,18 @@ class VFSInitializer():
|
||||||
self.sleep()
|
self.sleep()
|
||||||
self.restart()
|
self.restart()
|
||||||
|
|
||||||
print('Calibrating...')
|
print('Calibrating, re-using calib-data.bin if any...')
|
||||||
calibrate()
|
if os.path.exists('calib-data.bin'):
|
||||||
|
calibrate(calib_data_path='calib-data.bin')
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
calib_data = os.path.join(tempfile.mkdtemp(), 'calib-data.bin')
|
||||||
|
calibrate(calib_data_path=calib_data)
|
||||||
|
print('Calibration data saved at {}'.format(calib_data))
|
||||||
|
except Exception as e:
|
||||||
|
print('Calibration failed using device data ({}), ' \
|
||||||
|
'You can try loading a local `calib-data.bin` blob, ' \
|
||||||
|
'the device should work anyway, so skipping...'.format(e))
|
||||||
|
|
||||||
print('Init database...')
|
print('Init database...')
|
||||||
init_db()
|
init_db()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue