Skip to content

Commit

Permalink
Merge pull request #296 from mygrexit/main
Browse files Browse the repository at this point in the history
make calibration optional
  • Loading branch information
aceisace authored Dec 15, 2023
2 parents 7cb3835 + b78a3f9 commit f749668
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions inkycal/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ def __init__(self, settings_path:str or None=None, render:bool=True):
except FileNotFoundError:
raise SettingsFileNotFoundError

self.disable_calibration = self.settings.get('disable_calibration', False)

if not os.path.exists(image_folder):
os.mkdir(image_folder)

Expand Down Expand Up @@ -541,11 +543,16 @@ def calibrate(self):

def _calibration_check(self):
"""Calibration scheduler
uses calibration hours from settings file to check if calibration is due"""
uses calibration hours from settings file to check if calibration is due.
If no calibration hours are set, calibration is skipped."""

# Check if calibration hours are not set or the list is empty
if not self._calibration_hours:
print("No calibration hours set. Skipping calibration.")
return

now = arrow.now()
# print('hour:', now.hour, 'hours:', self._calibration_hours)
# print('state:', self._calibration_state)
if now.hour in self._calibration_hours and self._calibration_state == False:
if now.hour in self._calibration_hours and not self._calibration_state:
self.calibrate()
self._calibration_state = True
else:
Expand Down

0 comments on commit f749668

Please sign in to comment.