Skip to content

Commit

Permalink
skip initial measurements to have settled sensor data
Browse files Browse the repository at this point in the history
  • Loading branch information
wuan committed Jan 28, 2024
1 parent b0fc22b commit bf54b35
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion klimalogger/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,16 @@ def __init__(self, measurement_dispatcher: MeasurementDispatcher,
def measure_and_store_periodically(self, period=15):
log.info("measure_and_store_periodically(%d)", period)
last_measurement = time.time() - period
skip_initial = 2
while True:
timestamp = time.time()
if last_measurement < timestamp - period:
self.measure_and_store()
if skip_initial == 0:
self.measure_and_store()
else:
log.info("skipping initial measurement(%d)", skip_initial)
self.measure()
skip_initial -= 1
last_measurement += period
else:
self.measure()
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "klimalogger"
version = "0.7.13"
version = "0.7.14"
authors = [
{ name = "Andreas Würl", email = "andi@tryb.de" },
]
Expand Down

0 comments on commit bf54b35

Please sign in to comment.