ModelComponentTestbench works again
authorDaniel Kirschten <daniel.kirschten@gmx.de>
Mon, 6 Jan 2020 22:32:08 +0000 (23:32 +0100)
committerDaniel Kirschten <daniel.kirschten@gmx.de>
Mon, 6 Jan 2020 22:32:08 +0000 (23:32 +0100)
plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/LogicExecuter.java
plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/SimpleLogicUIStandalone.java

index 52adeba..a7f8c83 100644 (file)
@@ -67,7 +67,7 @@ public class LogicExecuter
                                                }
                                        }
                                        catch (@SuppressWarnings("unused") InterruptedException e)
-                                       {// do nothing; it is normal execution flow to be interrupted
+                                       { // do nothing; it is normal execution flow to be interrupted
                                        }
                                }
                        }
@@ -83,8 +83,11 @@ public class LogicExecuter
                timeline.addEventAddedListener(event ->
                {
                        if (isRunningLive.get())
-                               if (Timeline.timeCmp(event.getTiming(), nextExecSimulTime.get()) < 0)
+                       {
+                               long nextExecSimulTime = this.nextExecSimulTime.get();
+                               if (nextExecSimulTime == -1 || Timeline.timeCmp(event.getTiming(), nextExecSimulTime) < 0)
                                        simulationThread.interrupt();
+                       }
                });
                // not optimal; but we don't expect this to happen very often
                tf.addSimulTimeToRealTimeFactorChangedListener(d -> simulationThread.interrupt());
index 48f5cf5..b84877e 100644 (file)
@@ -46,6 +46,7 @@ public class SimpleLogicUIStandalone
                        beforeRun.accept(new VisualisationObjects(logicModel, timeline, ui, exec));
 
                // run it
+               exec.setSpeedFactor(1);
                exec.startLiveExecution();
                ui.run();
                exec.stopLiveExecution();