This commit is contained in:
2024-05-06 15:35:51 +02:00
parent 07c9279ad3
commit 0db7c7d840
3 changed files with 34 additions and 10 deletions

View File

@ -93,6 +93,7 @@ public class Commands {
DECF (f, d);
return;
case 0b00101100000000:
//1 bzw 2 Laufzeitpunkte
System.out.println("DECFSZ: " + f + " " + d);
DECFSZ (f, d);
return;

View File

@ -2,6 +2,7 @@ package fabrik.simulator.pic16f84;
import com.gluonhq.charm.glisten.control.ToggleButtonGroup;
import javafx.application.Platform;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
@ -68,24 +69,40 @@ public class Controller_Frontend {
@FXML
private Button stepButton;
@FXML
private Button autoRunButton;
private Button autoRunGUI;
@FXML
private void autoRun(ActionEvent event) throws IOException {
while (DataRegister.getPC() < prog.length) {
stepintoButton(event);
private void autoRunGUI(ActionEvent event) {
Thread autoRunThread = new Thread(() -> {
try {
Thread.sleep(500); // Millisekunden
while (DataRegister.getPC() < prog.length) {
Platform.runLater(() -> {
try {
stepintoButton(null);
} catch (IOException e) {
e.printStackTrace();
}
});
Thread.sleep(200); // Millisekunden
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
});
autoRunThread.setDaemon(true);
autoRunThread.start();
}
@FXML
private void stepintoButton(ActionEvent event) throws IOException {
if (lstContentListView.getItems().isEmpty()) {
@ -172,6 +189,9 @@ public class Controller_Frontend {
// Aktuelle Zeile abrufen
int currentIndex = lstContentListView.getSelectionModel().getSelectedIndex();
// if (currentIndex == )
// Wenn keine Zeile ausgewählt ist, starte von der ersten Zeile
if (currentIndex == -1) {
currentIndex = 1;
@ -188,6 +208,7 @@ public class Controller_Frontend {
}
// Zeile auswählen und anzeigen
lstContentListView.scrollTo(currentIndex);
lstContentListView.getSelectionModel().select(currentIndex + 1);
lstContentListView.scrollTo(currentIndex + 1);
}
@ -273,6 +294,7 @@ public class Controller_Frontend {
lstContentListView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
lstContentListView.getStylesheets().add(Objects.requireNonNull(getClass().getResource("styles.css")).toExternalForm());
autoRunGUI.setOnAction(this::autoRunGUI);
}
private static void setTRISbuttons(ToggleButtonGroup[] allButtons) {

View File

@ -21,12 +21,13 @@
<?import javafx.scene.control.ListView?>
<AnchorPane xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="fabrik.simulator.pic16f84.Controller_Frontend" stylesheets="styles.css">
<ListView fx:id="lstContentListView" prefHeight="400.0" prefWidth="600.0" />
<children>
<ListView fx:id="lstContentListView" prefHeight="400.0" prefWidth="600.0" />
<Button fx:id="stepintoButton" layoutX="42.0" layoutY="400.0" mnemonicParsing="false" onAction="#stepintoButton" text="Step IN" />
<Button fx:id="stepintoButton" layoutX="42.0" layoutY="478.0" mnemonicParsing="false" onAction="#stepintoButton" text="Step IN" />
<Button fx:id="autoRunButton" layoutX="182.0" layoutY="478.0" text="Auto Run" onAction="#autoRun"/>
<!--RIchtiger AUtorun button für die Gui der funktioniert -->
<Button fx:id="autoRunGUI" layoutX="182.0" layoutY="400.0" text="Auto Run" onAction="#autoRunGUI"/>
<HBox layoutX="807.0" layoutY="134.0" prefHeight="293.0" prefWidth="701.0">
<children>