Working Component Management

This commit is contained in:
2025-04-14 15:12:02 +02:00
parent 133ee646d1
commit ca36cffd47
20 changed files with 138 additions and 170 deletions

View File

@ -2,29 +2,14 @@ package fabrik.simulator.pic16f84;
import fabrik.simulator.pic16f84.interfaces.*;
public class WatchdogTimer implements WatchdogTimerInterface {
public class WatchdogTimer extends PICComponent implements WatchdogTimerInterface {
private long watchdogTime;
private double lastReset = 0;
private boolean enabled = false;
private long rawtimer = 0;
private long realtimer = 0;
private final DataRegisterInterface dataRegister;
private final ProgramStackInterface programStack;
private final FrontendControllerInterface frontendController;
private final PreScaler preScaler;
private final CommandInterface command;
public WatchdogTimer( DataRegisterInterface dataRegister, ProgramStackInterface programStack, FrontendControllerInterface frontendController,PreScaler preScaler, CommandInterface command){
this.dataRegister = dataRegister;
this.programStack = programStack;
this.preScaler = preScaler;
this.command = command;
this.frontendController = frontendController;
public WatchdogTimer(){
}
private long getTimeFromRegister() {
@ -36,7 +21,7 @@ public class WatchdogTimer implements WatchdogTimerInterface {
if (enabled) {
if (realtimer >= (watchdogTime + lastReset - 1)) {
dataRegister.clearBit(3, 4);
lastReset = command.getTotalExecutionTime();
lastReset = commands.getTotalExecutionTime();
frontendController.stopRunFromBackend("Watchdog Timer");
}
else {
@ -47,7 +32,7 @@ public class WatchdogTimer implements WatchdogTimerInterface {
}
public void reset (){
lastReset = command.getTotalExecutionTime();
lastReset = commands.getTotalExecutionTime();
rawtimer = 0;
realtimer = 0;
preScaler.reset();
@ -69,6 +54,6 @@ public class WatchdogTimer implements WatchdogTimerInterface {
@Override
public void initialize(PICComponents picComponents) {
super.initialize(picComponents);
}
}