Skip to content

Commit

Permalink
Set iSpindel interval dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
lbussy committed Apr 17, 2021
1 parent ba59f56 commit 3a43cb9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions brewpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -1232,12 +1232,18 @@ def loop(): # Main program loop
else:
_temp = bc.convert(
api['temperature'], 'F', 'C')

# Clamp and round temp values
_temp = clamp(round(_temp, 2), Decimal(config['clampTempLower']), Decimal(config['clampTempUpper']))

# Clamp and round gravity values
_gravity = clamp(api['gravity'], Decimal(config['clampSGLower']), Decimal(config['clampSGUpper']))

# Capture interval to set timeout
timeoutiSpindel = api['interval'] * 2.5
# Set time of last update
lastiSpindel = timestamp = time.time()

# Update prevTempJson if keys exist
if checkKey(prevTempJson, 'battery'):
prevTempJson['spinBatt'] = api['battery']
Expand All @@ -1252,9 +1258,6 @@ def loop(): # Main program loop
'spinTemp': _temp
})

# Set time of last update
lastiSpindel = timestamp = time.time()

elif not ispindel:
logError('iSpindel packet received but no iSpindel configuration exists in {0}settings/config.cfg'.format(
util.addSlash(sys.path[0])))
Expand Down

0 comments on commit 3a43cb9

Please sign in to comment.