|
|
@ -12,6 +12,8 @@ public class ResHeatingTubeRackSlotManager extends DiResourceManagerBase { |
|
|
|
private final List<ResHeatingTubeRackSlot> slots; |
|
|
|
// error slot index |
|
|
|
private Integer errorSlotIndex; |
|
|
|
// temperature refresh timer |
|
|
|
private Timer temperatureRefreshTimer; |
|
|
|
|
|
|
|
// constructor |
|
|
|
public ResHeatingTubeRackSlotManager() { |
|
|
@ -28,10 +30,12 @@ public class ResHeatingTubeRackSlotManager extends DiResourceManagerBase { |
|
|
|
this.errorSlotIndex = this.getDevice().getEnv().getProperty("app.errorSlotIndex",Integer.class); |
|
|
|
assert Objects.nonNull(this.errorSlotIndex); |
|
|
|
this.slots.get(this.errorSlotIndex).setupAsErrorSlot(); |
|
|
|
} |
|
|
|
|
|
|
|
// start a timer task to refresh slot temperature every 5 seconds |
|
|
|
var timer = new Timer(); |
|
|
|
timer.schedule(new TimerTask() { |
|
|
|
// start temperature refresh |
|
|
|
public void startTemperatureRefresh() { |
|
|
|
this.temperatureRefreshTimer = new Timer(); |
|
|
|
this.temperatureRefreshTimer.schedule(new TimerTask() { |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
ResHeatingTubeRackSlotManager.this.refreshSlotTemperature(); |
|
|
@ -39,6 +43,11 @@ public class ResHeatingTubeRackSlotManager extends DiResourceManagerBase { |
|
|
|
}, 0, 5000); |
|
|
|
} |
|
|
|
|
|
|
|
// stop temperature refresh |
|
|
|
public void stopTemperatureRefresh() { |
|
|
|
this.temperatureRefreshTimer.cancel(); |
|
|
|
} |
|
|
|
|
|
|
|
// refresh slot temperature |
|
|
|
public void refreshSlotTemperature() { |
|
|
|
var registers = this.getDevice().getRegisters(); |
|
|
|