diff --git a/package-lock.json b/package-lock.json
index 415071e5..44d1955f 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -123,11 +123,11 @@
}
},
"ajv": {
- "version": "6.10.2",
- "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz",
- "integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==",
+ "version": "6.11.0",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.11.0.tgz",
+ "integrity": "sha512-nCprB/0syFYy9fVYU1ox1l2KN8S9I+tziH8D4zdZuLT3N6RMlGSGt5FSTpAiHB/Whv8Qs1cWHma1aMKZyaHRKA==",
"requires": {
- "fast-deep-equal": "^2.0.1",
+ "fast-deep-equal": "^3.1.1",
"fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.2"
@@ -679,9 +679,9 @@
}
},
"caniuse-db": {
- "version": "1.0.30001019",
- "resolved": "https://registry.npmjs.org/caniuse-db/-/caniuse-db-1.0.30001019.tgz",
- "integrity": "sha512-AdQItnPLQ32qEWPAfp3lGIYXxjbHOtcabhmvqEv831kc8WyYdibpdnnUu+gQXxEwDf1Job597aCbqf+EYAnuTA=="
+ "version": "1.0.30001022",
+ "resolved": "https://registry.npmjs.org/caniuse-db/-/caniuse-db-1.0.30001022.tgz",
+ "integrity": "sha512-2RQQgO+yDEaqF4ltwrCja7oZst+FVnXHQLSJgZ678tausEljBq3/U20Fedvze+Hxqm8XLV+9OgGbtdgS7ksnRw=="
},
"caseless": {
"version": "0.12.0",
@@ -1237,9 +1237,9 @@
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
},
"electron-to-chromium": {
- "version": "1.3.328",
- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.328.tgz",
- "integrity": "sha512-x4XefnFxDxFwaQ01d/pppJP9meWhOIJ/gtI6/4jqkpsadq79uL7NYSaX64naLmJqvzUBjSrO3IM2+1b/W9KdPg=="
+ "version": "1.3.338",
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.338.tgz",
+ "integrity": "sha512-wlmfixuHEc9CkfOKgcqdtzBmRW4NStM9ptl5oPILY2UDyHuSXb3Yit+yLVyLObTgGuMMU36hhnfs2GDJId7ctA=="
},
"elliptic": {
"version": "6.5.2",
@@ -1419,9 +1419,9 @@
"integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU="
},
"fast-deep-equal": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz",
- "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk="
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz",
+ "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA=="
},
"fast-json-stable-stringify": {
"version": "2.1.0",
@@ -3518,9 +3518,9 @@
}
},
"pxt-core": {
- "version": "5.31.8",
- "resolved": "https://registry.npmjs.org/pxt-core/-/pxt-core-5.31.8.tgz",
- "integrity": "sha512-9+x7LGHER1C1X67G1F6VSSG1xpSDtuF5NoWVbel3zC7v/wzv2zHjn+CE4R2Mj4DM5fGp39vtfcTXKbPp/Kec8w==",
+ "version": "5.32.3",
+ "resolved": "https://registry.npmjs.org/pxt-core/-/pxt-core-5.32.3.tgz",
+ "integrity": "sha512-5HnyCbkEbhgj+/o8Bv6ib07dEquhMYmXGo/DaSFXM3ZCN1XBqCiqRXlDo2t/nxZiAxvSRIUBy8uOaQl/CafvqQ==",
"requires": {
"applicationinsights-js": "^1.0.20",
"bluebird": "3.5.1",
diff --git a/sim/state/edgeconnector.ts b/sim/state/edgeconnector.ts
index 80bf91e4..15a250b7 100644
--- a/sim/state/edgeconnector.ts
+++ b/sim/state/edgeconnector.ts
@@ -61,7 +61,7 @@ namespace pxsim.pins {
let pin = getPin(pinId);
if (!pin) return;
pin.mode = PinFlags.Analog | PinFlags.Output;
- pin.value = value ? 1 : 0;
+ pin.value = value ? value : 0;
runtime.queueDisplayUpdate();
}
diff --git a/sim/visuals/microbit.ts b/sim/visuals/microbit.ts
index 19e79fd5..e8c0032e 100644
--- a/sim/visuals/microbit.ts
+++ b/sim/visuals/microbit.ts
@@ -71,7 +71,7 @@ namespace pxsim.visuals {
.sim-text-pin {
font-family:"Lucida Console", Monaco, monospace;
font-size:20px;
- fill:#fff;
+ fill:#3cb5b5;
pointer-events: none;
}
@@ -244,130 +244,191 @@ namespace pxsim.visuals {
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
-
@@ -822,7 +883,7 @@ namespace pxsim.visuals {
private buttonsOuter: SVGElement[];
private pins: SVGElement[];
private pinGradients: SVGLinearGradientElement[];
- private pinTexts: SVGTextElement[];
+ private pinTexts:{ [key: number]: SVGTextElement };
private ledsOuter: SVGElement[];
private leds: SVGElement[];
private systemLed: SVGCircleElement;
@@ -1210,7 +1271,7 @@ namespace pxsim.visuals {
private updatePin(pin: Pin, index: number) {
if (!pin) return;
- let text = this.pinTexts[index];
+ let text = this.pinTexts[pin.id];
let v = "";
if (pin.mode & PinFlags.Analog) {
v = Math.floor(100 - (pin.value || 0) / 1023 * 100) + "%";
@@ -1222,10 +1283,10 @@ namespace pxsim.visuals {
}
else if (pin.mode & PinFlags.Touch) {
v = pin.touched ? "0%" : "100%";
- if (text) text.textContent = "";
+ if (text) text.textContent = "TOUCHED";
} else {
v = "100%";
- if (text) text.textContent = "";
+ if (text) text.textContent = "unused";
}
if (v) svg.setGradientValue(this.pinGradients[index], v);
}
@@ -1452,7 +1513,12 @@ namespace pxsim.visuals {
return lg;
})
- this.pinTexts = [67, 165, 275].map(x => svg.child(this.g, "text", { class: "sim-text-pin", x: x, y: 345 }));
+ this.pinTexts = {
+ [DigitalPin.P0]: svg.child(this.g, "text", { class: "sim-text-pin", x: -20, y: 340 }),
+ [DigitalPin.P1]: svg.child(this.g, "text", { class: "sim-text-pin", x: 50, y: 495 }),
+ [DigitalPin.P2]: svg.child(this.g, "text", { class: "sim-text-pin", x: 450, y: 495 }),
+ [DigitalPin.P3]: svg.child(this.g, "text", { class: "sim-text-pin", x: 500, y: 340 })
+ }
// BTN A, B
const btnids = ["BTN_A", "BTN_B"];
@@ -1593,7 +1659,7 @@ namespace pxsim.visuals {
return false;
});
})
- this.pins.slice(0, 3).forEach((btn, index) => {
+ this.pins.slice(0, 2).forEach((btn, index) => {
pointerEvents.down.forEach(evid => btn.addEventListener(evid, ev => {
let state = this.board;
state.edgeConnectorState.pins[index].touched = true;