Simulator refactoring to support better resizing of modules and controls
This commit is contained in:
@ -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() {
|
||||
|
@ -48,6 +48,7 @@ namespace pxsim {
|
||||
|
||||
stop() {
|
||||
// TODO: implement
|
||||
this.setSpeed(0);
|
||||
}
|
||||
|
||||
start() {
|
||||
|
@ -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()))
|
||||
|
Reference in New Issue
Block a user