mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-11-19 18:40:17 +00:00
minor bugfix: simulation speed was not restored correctly
This commit is contained in:
parent
9cb2fd8465
commit
0b09084b92
@ -659,7 +659,10 @@ public class Simulation extends Observable implements Runnable {
|
||||
availableMoteTypes,
|
||||
moteTypeClassName
|
||||
);
|
||||
if (newClass != null && !newClass.equals(moteTypeClassName)) {
|
||||
if (newClass == null) {
|
||||
throw new MoteType.MoteTypeCreationException("No mote type class selected");
|
||||
}
|
||||
if (!newClass.equals(moteTypeClassName)) {
|
||||
logger.warn("Changing mote type class: " + moteTypeClassName + " -> " + newClass);
|
||||
moteTypeClassName = newClass;
|
||||
}
|
||||
@ -989,7 +992,7 @@ public class Simulation extends Observable implements Runnable {
|
||||
* @param newSpeedLimit
|
||||
*/
|
||||
public void setSpeedLimit(final Double newSpeedLimit) {
|
||||
invokeSimulationThread(new Runnable() {
|
||||
Runnable r = new Runnable() {
|
||||
public void run() {
|
||||
if (newSpeedLimit == null) {
|
||||
speedLimitNone = true;
|
||||
@ -1008,7 +1011,14 @@ public class Simulation extends Observable implements Runnable {
|
||||
Simulation.this.setChanged();
|
||||
Simulation.this.notifyObservers(this);
|
||||
}
|
||||
});
|
||||
};
|
||||
if (!isRunning()) {
|
||||
/* Simulation is stopped, change speed immediately */
|
||||
r.run();
|
||||
} else {
|
||||
/* Change speed from simulation thread */
|
||||
invokeSimulationThread(r);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user