Simplified redundant code

This commit is contained in:
Snorre Selmer 2022-10-23 13:05:50 +02:00
parent ab9bb4d391
commit 59a479670c

View File

@ -32,25 +32,22 @@ start:
yield yield
# establish min- and max-temps to registry # establish min- and max-temps to registry
l Variance TempVariance Setting l Variance TempVariance Setting
l MinTemp Thermostat Setting
sub MinTemp MinTemp Variance
l MaxTemp Thermostat Setting
add MaxTemp MaxTemp Variance
l TargetTemp Thermostat Setting l TargetTemp Thermostat Setting
sub MinTemp TargetTemp Variance
add MaxTemp TargetTemp Variance
# get current temperature # get current temperature
jal temp_read jal temp_read
# update display # update display
brdns TempDisplay 2 bdseal TempDisplay display
jal display
# compare current temp to max/min temp and # compare current temp to max/min temp and
# initiate cooling or heating if needed # initiate cooling or heating if needed
bgt CurrentTemp MaxTemp cooling bgt CurrentTemp MaxTemp cooling
blt CurrentTemp MinTemp heating blt CurrentTemp MinTemp heating
# Ensure coolers and heaters are off when not needed
sb Cooler On CoolingActive sb Cooler On CoolingActive
sb Heater On HeatingActive sb Heater On HeatingActive
@ -72,8 +69,8 @@ jal temp_read
# test if coolers need to be on or not # test if coolers need to be on or not
sgt CoolingActive CurrentTemp TargetTemp sgt CoolingActive CurrentTemp TargetTemp
brdns TempDisplay 2 # update display
jal display bdseal TempDisplay display
# send state to coolers # send state to coolers
sb Cooler On CoolingActive sb Cooler On CoolingActive
@ -88,8 +85,8 @@ jal temp_read
# test if heaters need to be on or not # test if heaters need to be on or not
slt HeatingActive CurrentTemp TargetTemp slt HeatingActive CurrentTemp TargetTemp
brdns TempDisplay 2 # update display
jal display bdseal TempDisplay display
# send state to heaters # send state to heaters
sb Heater On HeatingActive sb Heater On HeatingActive