Skip to content

Commit

Permalink
Merge pull request #79 from MrYsLab/dht_pin_dup
Browse files Browse the repository at this point in the history
Creating a second callback for a DHT sensor
  • Loading branch information
MrYsLab committed Mar 26, 2024
2 parents 908e44c + 37c6a06 commit 3e472bf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ find = {} # Scan the project directory with the default parameters

[project]
name = "telemetrix"
version = "1.38"
version = "1.39"
authors = [
{ name="Alan Yorinks", email="[email protected]" },
]
Expand Down
2 changes: 1 addition & 1 deletion telemetrix/private_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class PrivateConstants:
FEATURES = 20
DEBUG_PRINT = 99

TELEMETRIX_VERSION = "1.38"
TELEMETRIX_VERSION = "1.39"

# reporting control
REPORTING_DISABLE_ALL = 0
Expand Down
4 changes: 4 additions & 0 deletions telemetrix/telemetrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,10 @@ def set_pin_mode_dht(self, pin, callback=None, dht_type=22):
raise RuntimeError('set_pin_mode_dht: A Callback must be specified')

if self.dht_count < PrivateConstants.MAX_DHTS - 1:
if pin in self.dht_callbacks.keys():
if self.shutdown_on_exception:
self.shutdown()
raise RuntimeError(f'set_pin_mode_dht Pin {pin} already assigned')
self.dht_callbacks[pin] = callback
self.dht_count += 1

Expand Down

0 comments on commit 3e472bf

Please sign in to comment.