Skip to content

Commit

Permalink
chore: updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Russell Green committed Jun 18, 2023
1 parent d2ac748 commit 059dd16
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"""
__author__ = "Russell Green"
__license__ = "MIT"
__version__ = "1.0.3"
__version__ = "1.0.4"
__maintainer__ = "Russell.Green"
__email__ = "me@rusty.green"
__status__ = "Production"
Expand Down Expand Up @@ -241,13 +241,21 @@ def set_get_pin_value(pin, value):


def get_pin_history(pin):
"""Gets pin history
Retrieves the pin history record if exists, otherwise creates a new one.
"""
if pin in gpio_pin_history:
return gpio_pin_history[pin]
else:
return {"lastValue": None}
return {"lastChange": None}


def set_pin_history(pin):
"""Sets pin history
Sets a pin history record for a given pin.
"""
history = {"lastChange": datetime.datetime.now()}
record = get_pin_history(pin)
record.update(history)
Expand Down

0 comments on commit 059dd16

Please sign in to comment.