Simulator refactoring to support better resizing of modules and controls

This commit is contained in:
Sam El-Husseini
2017-12-22 14:00:23 -08:00
parent 300a2c1476
commit 180f32f25c
23 changed files with 408 additions and 301 deletions

View File

@ -20,7 +20,7 @@ namespace pxsim {
export class ColorSensorNode extends UartSensorNode {
id = NodeType.ColorSensor;
private color: number;
private color: number = 50;
constructor(port: number) {
super(port);
@ -31,10 +31,8 @@ namespace pxsim {
}
setColor(color: number) {
if (this.color != color) {
this.color = color;
this.setChangedState();
}
this.color = color;
this.setChangedState();
}
getValue() {

View File

@ -48,6 +48,7 @@ namespace pxsim {
stop() {
// TODO: implement
this.setSpeed(0);
}
start() {

View File

@ -88,7 +88,7 @@ namespace pxsim {
const inputNodes = ev3board().getInputNodes();
for (let port = 0; port < DAL.NUM_INPUTS; port++) {
const node = inputNodes[port];
if (node) {
if (node && node.isUart()) {
// Actual
const index = 0; //UartOff.Actual + port * 2;
util.map16Bit(data, UartOff.Raw + DAL.MAX_DEVICE_DATALENGTH * 300 * port + DAL.MAX_DEVICE_DATALENGTH * index, Math.floor(node.getValue()))