Skip to content
This repository has been archived by the owner on Oct 26, 2023. It is now read-only.

Commit

Permalink
Fix SCAN_TIMEOUT consts
Browse files Browse the repository at this point in the history
  • Loading branch information
zewelor committed Apr 16, 2019
1 parent d8b6736 commit 6561c2c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion workers/linakdesk.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def status_update(self):
return [MqttMessage(topic=self.format_topic('height/cm'), payload=self._get_height())]

def _get_height(self):
with timeout(SCAN_TIMEOUT, exception=TimeoutError('Retrieving the height from {} device {} timed out after {} seconds'.format(repr(self), self.mac, SCAN_TIMEOUT))):
with timeout(self.SCAN_TIMEOUT, exception=TimeoutError('Retrieving the height from {} device {} timed out after {} seconds'.format(repr(self), self.mac, self.SCAN_TIMEOUT))):
self.desk.read_dpg_data()
return self.desk.current_height_with_offset.cm

Expand Down
4 changes: 2 additions & 2 deletions workers/miscale.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ def _get_weight(self):

scan_processor = ScanProcessor(self.mac)
scanner = btle.Scanner().withDelegate(scan_processor)
scanner.scan(SCAN_TIMEOUT, passive=True)
scanner.scan(self.SCAN_TIMEOUT, passive=True)

with timeout(SCAN_TIMEOUT, exception=TimeoutError('Retrieving the weight from {} device {} timed out after {} seconds'.format(repr(self), self.mac, SCAN_TIMEOUT))):
with timeout(self.SCAN_TIMEOUT, exception=TimeoutError('Retrieving the weight from {} device {} timed out after {} seconds'.format(repr(self), self.mac, self.SCAN_TIMEOUT))):
while scan_processor.weight is None:
time.sleep(1)
return scan_processor.weight
Expand Down

0 comments on commit 6561c2c

Please sign in to comment.