Improving the boiler with an antifreeze check
Now that the forecast fetching is up and running, we can proceed with implementing the antifreeze feature. To achieve the interaction and the logic previously discussed, we should:
Enhance the
Preset
class storing the user's antifreeze setpoint. In this class, we should provide two utilities to disable the antifreeze check and to find out whether the feature is enabled or not.Handle the antifreeze feature in the
Overview
activity, updating the user interface when a setpoint is selected.Update the boiler logic in the
SensorThread
class so it takes into account the antifreeze check when it's enabled.
We begin our work by changing the Preset
class with the following steps:
At the top of the class, add the highlighted declarations:
private static final String CURRENT_LOCATION = "__LOCATION__"; private static final String CURRENT_ANTIFREEZE = "__ANTIFREEZE__"; private static final float ANTIFREEZE_DISABLED = -Float.MAX_VALUE
We use the
ANTIFREEZE_DISABLED...