Auto Run
This commit is contained in:
@ -93,6 +93,7 @@ public class Commands {
|
|||||||
DECF (f, d);
|
DECF (f, d);
|
||||||
return;
|
return;
|
||||||
case 0b00101100000000:
|
case 0b00101100000000:
|
||||||
|
//1 bzw 2 Laufzeitpunkte
|
||||||
System.out.println("DECFSZ: " + f + " " + d);
|
System.out.println("DECFSZ: " + f + " " + d);
|
||||||
DECFSZ (f, d);
|
DECFSZ (f, d);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package fabrik.simulator.pic16f84;
|
|||||||
|
|
||||||
import com.gluonhq.charm.glisten.control.ToggleButtonGroup;
|
import com.gluonhq.charm.glisten.control.ToggleButtonGroup;
|
||||||
|
|
||||||
|
import javafx.application.Platform;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
@ -68,23 +69,39 @@ public class Controller_Frontend {
|
|||||||
@FXML
|
@FXML
|
||||||
private Button stepButton;
|
private Button stepButton;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private Button autoRunButton;
|
private Button autoRunGUI;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void autoRun(ActionEvent event) throws IOException {
|
private void autoRunGUI(ActionEvent event) {
|
||||||
while (DataRegister.getPC() < prog.length) {
|
Thread autoRunThread = new Thread(() -> {
|
||||||
stepintoButton(event);
|
|
||||||
try {
|
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) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
autoRunThread.setDaemon(true);
|
||||||
|
autoRunThread.start();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void stepintoButton(ActionEvent event) throws IOException {
|
private void stepintoButton(ActionEvent event) throws IOException {
|
||||||
@ -172,6 +189,9 @@ public class Controller_Frontend {
|
|||||||
// Aktuelle Zeile abrufen
|
// Aktuelle Zeile abrufen
|
||||||
int currentIndex = lstContentListView.getSelectionModel().getSelectedIndex();
|
int currentIndex = lstContentListView.getSelectionModel().getSelectedIndex();
|
||||||
|
|
||||||
|
|
||||||
|
// if (currentIndex == )
|
||||||
|
|
||||||
// Wenn keine Zeile ausgewählt ist, starte von der ersten Zeile
|
// Wenn keine Zeile ausgewählt ist, starte von der ersten Zeile
|
||||||
if (currentIndex == -1) {
|
if (currentIndex == -1) {
|
||||||
currentIndex = 1;
|
currentIndex = 1;
|
||||||
@ -188,6 +208,7 @@ public class Controller_Frontend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Zeile auswählen und anzeigen
|
// Zeile auswählen und anzeigen
|
||||||
|
lstContentListView.scrollTo(currentIndex);
|
||||||
lstContentListView.getSelectionModel().select(currentIndex + 1);
|
lstContentListView.getSelectionModel().select(currentIndex + 1);
|
||||||
lstContentListView.scrollTo(currentIndex + 1);
|
lstContentListView.scrollTo(currentIndex + 1);
|
||||||
}
|
}
|
||||||
@ -273,6 +294,7 @@ public class Controller_Frontend {
|
|||||||
lstContentListView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
|
lstContentListView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
|
||||||
|
|
||||||
lstContentListView.getStylesheets().add(Objects.requireNonNull(getClass().getResource("styles.css")).toExternalForm());
|
lstContentListView.getStylesheets().add(Objects.requireNonNull(getClass().getResource("styles.css")).toExternalForm());
|
||||||
|
autoRunGUI.setOnAction(this::autoRunGUI);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setTRISbuttons(ToggleButtonGroup[] allButtons) {
|
private static void setTRISbuttons(ToggleButtonGroup[] allButtons) {
|
||||||
|
|||||||
@ -21,12 +21,13 @@
|
|||||||
|
|
||||||
<?import javafx.scene.control.ListView?>
|
<?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">
|
<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>
|
<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" />
|
<!--RIchtiger AUtorun button für die Gui der funktioniert -->
|
||||||
<Button fx:id="autoRunButton" layoutX="182.0" layoutY="478.0" text="Auto Run" onAction="#autoRun"/>
|
<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">
|
<HBox layoutX="807.0" layoutY="134.0" prefHeight="293.0" prefWidth="701.0">
|
||||||
<children>
|
<children>
|
||||||
|
|||||||
Reference in New Issue
Block a user