mirror of
https://github.com/oliverschmidt/contiki.git
synced 2025-01-12 10:30:09 +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,
|
availableMoteTypes,
|
||||||
moteTypeClassName
|
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);
|
logger.warn("Changing mote type class: " + moteTypeClassName + " -> " + newClass);
|
||||||
moteTypeClassName = newClass;
|
moteTypeClassName = newClass;
|
||||||
}
|
}
|
||||||
@ -989,7 +992,7 @@ public class Simulation extends Observable implements Runnable {
|
|||||||
* @param newSpeedLimit
|
* @param newSpeedLimit
|
||||||
*/
|
*/
|
||||||
public void setSpeedLimit(final Double newSpeedLimit) {
|
public void setSpeedLimit(final Double newSpeedLimit) {
|
||||||
invokeSimulationThread(new Runnable() {
|
Runnable r = new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (newSpeedLimit == null) {
|
if (newSpeedLimit == null) {
|
||||||
speedLimitNone = true;
|
speedLimitNone = true;
|
||||||
@ -1008,7 +1011,14 @@ public class Simulation extends Observable implements Runnable {
|
|||||||
Simulation.this.setChanged();
|
Simulation.this.setChanged();
|
||||||
Simulation.this.notifyObservers(this);
|
Simulation.this.notifyObservers(this);
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
if (!isRunning()) {
|
||||||
|
/* Simulation is stopped, change speed immediately */
|
||||||
|
r.run();
|
||||||
|
} else {
|
||||||
|
/* Change speed from simulation thread */
|
||||||
|
invokeSimulationThread(r);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user