Breakpoint visible

This commit is contained in:
2024-06-02 23:14:27 +02:00
parent 7440329d91
commit 0b163589db
2 changed files with 20 additions and 17 deletions

View File

@ -1 +1,3 @@
{"0":255} {
}

View File

@ -147,8 +147,7 @@ public class Controller_Frontend {
@FXML @FXML
public void autoRunGUI(ActionEvent event) { public void autoRunGUI(ActionEvent event) {
if (!isAutoRunActive) { if (!isAutoRunActive) {
isAutoRunActive = true; isAutoRunActive = true;
initializeBreakpoints();
} }
Thread autoRunThread = new Thread(() -> { Thread autoRunThread = new Thread(() -> {
@ -217,18 +216,18 @@ public class Controller_Frontend {
// Überprüfung ob ein Breakpoint gesetzt ist testte // Überprüfung ob ein Breakpoint gesetzt ist testte
if (breakpoints.contains(currentIndex)) { if (breakpoints.contains(currentIndex)) {
if (breakpoints.contains(currentIndex) && !continueExecutionAfterBreakpoint){ if (!continueExecutionAfterBreakpoint){
isBreakpointReached = true; isBreakpointReached = true;
stopAutoRun(null); stopAutoRun(null);
System.out.println("Breakpoint erreicht bei Zeile: " + currentIndex); System.out.println("Breakpoint erreicht bei Zeile: " + currentIndex);
continueExecutionAfterBreakpoint = true; continueExecutionAfterBreakpoint = true;
return; return;
} }
} }
else {
initializeBreakpoints(); isBreakpointReached = false;
continueExecutionAfterBreakpoint = false;
}
// Scrollen zur ausgewählten Zeile // Scrollen zur ausgewählten Zeile
lstContentListView.scrollTo(currentIndex -2); lstContentListView.scrollTo(currentIndex -2);
@ -245,15 +244,12 @@ public class Controller_Frontend {
markSelectedRow(currentIndex, selectedRowStyle); markSelectedRow(currentIndex, selectedRowStyle);
if (!isSleeping) { if (!isSleeping) {
Commands.decode(prog[DataRegister.getPC()]); Commands.decode(prog[DataRegister.getPC()]);
DataRegister.increasePC(); DataRegister.increasePC();
} }
else { else {
Commands.decode(0); Commands.decode(0);
} }
WatchdogTimer.testAndTrigger(); WatchdogTimer.testAndTrigger();
Table.refresh(); Table.refresh();
@ -277,11 +273,21 @@ public class Controller_Frontend {
} else { } else {
setStyle(""); setStyle("");
} }
CheckBox breakpointCheckBox = new CheckBox();
breakpointCheckBox.setOnAction(event -> {
int index = getIndex();
if (breakpointCheckBox.isSelected()) {
breakpoints.add(index);
} else {
breakpoints.remove(index);
}
});
breakpointCheckBox.setSelected(breakpoints.contains(getIndex()));
setGraphic(breakpointCheckBox);
} }
}); });
} }
//////////////testeteet
private Set<Integer> breakpoints = new HashSet<>(); private Set<Integer> breakpoints = new HashSet<>();
@ -294,7 +300,6 @@ public class Controller_Frontend {
String fileAddress = selectedFile.getAbsolutePath(); String fileAddress = selectedFile.getAbsolutePath();
DataRegister.initDataRegister(); DataRegister.initDataRegister();
DataRegister.resetPC(); DataRegister.resetPC();
initialize();
toggleLEDs(null); toggleLEDs(null);
IOPorts.reset(); IOPorts.reset();
@ -305,7 +310,6 @@ public class Controller_Frontend {
IOPorts.setPORTfromUI(toggleButtonGroup); IOPorts.setPORTfromUI(toggleButtonGroup);
} catch (NullPointerException ignored) {} } catch (NullPointerException ignored) {}
} }
initializeBreakpoints();
breakpoints.clear(); breakpoints.clear();
IOPorts.refreshUI(getTRISbuttons(), getPORTbuttons()); IOPorts.refreshUI(getTRISbuttons(), getPORTbuttons());
Commands.resetTotalExecutionTime(); Commands.resetTotalExecutionTime();
@ -349,7 +353,6 @@ public class Controller_Frontend {
private Callback<ListView<String>, ListCell<String>> createBreakpointCell() { private Callback<ListView<String>, ListCell<String>> createBreakpointCell() {
return listView -> new ListCell<String>() { return listView -> new ListCell<String>() {
private final CheckBox breakpointCheckBox = new CheckBox(); private final CheckBox breakpointCheckBox = new CheckBox();
{ {
breakpointCheckBox.setOnAction(event -> { breakpointCheckBox.setOnAction(event -> {
int index = getIndex(); int index = getIndex();
@ -500,8 +503,6 @@ public class Controller_Frontend {
executionTimeComboBox.setItems(FXCollections.observableArrayList("8 MHZ", "4 MHZ", "1 MHZ", "500 HZ", "100 HZ", "32 HZ")); executionTimeComboBox.setItems(FXCollections.observableArrayList("8 MHZ", "4 MHZ", "1 MHZ", "500 HZ", "100 HZ", "32 HZ"));
executionTimeComboBox.setValue("4 MHZ"); executionTimeComboBox.setValue("4 MHZ");
executionTimeComboBox.setOnAction(event -> updateExecutionTimeMultiplier()); executionTimeComboBox.setOnAction(event -> updateExecutionTimeMultiplier());
lstContentListView.setCellFactory(createBreakpointCell());
} }