Remove td, remove field matrix, update radio blocks. Revert image literal changes.
This commit is contained in:
parent
dc5ec79708
commit
8957bf0647
@ -406,16 +406,6 @@ namespace pxt.editor {
|
||||
"main.blocks": data.source
|
||||
}, name: data.meta.name
|
||||
})
|
||||
}, {
|
||||
id: "td",
|
||||
canImport: data => data.meta.cloudId == "microbit.co.uk" && data.meta.editor == "touchdevelop",
|
||||
importAsync: (project, data) =>
|
||||
project.createProjectAsync({
|
||||
filesOverride: { "main.blocks": "", "main.ts": " " },
|
||||
name: data.meta.name
|
||||
})
|
||||
.then(() => project.convertTouchDevelopToTypeScriptAsync(data.source))
|
||||
.then(text => project.overrideTypescriptFile(text))
|
||||
}]
|
||||
};
|
||||
|
||||
|
@ -1,14 +1,10 @@
|
||||
/// <reference path="../node_modules/pxt-core/built/pxteditor.d.ts"/>
|
||||
/// <reference path="../node_modules/pxt-core/built/pxtsim.d.ts"/>
|
||||
import { FieldMatrix } from "./fieldMatrix";
|
||||
|
||||
pxt.editor.initFieldExtensionsAsync = function (opts: pxt.editor.FieldExtensionOptions): Promise<pxt.editor.FieldExtensionResult> {
|
||||
pxt.debug('loading pxt-microbit field editors...')
|
||||
const res: pxt.editor.FieldExtensionResult = {
|
||||
fieldEditors: [{
|
||||
selector: "matrix",
|
||||
editor: FieldMatrix
|
||||
}]
|
||||
fieldEditors: []
|
||||
};
|
||||
return Promise.resolve<pxt.editor.FieldExtensionResult>(res);
|
||||
}
|
@ -1,225 +0,0 @@
|
||||
/// <reference path="../node_modules/pxt-core/localtypings/blockly.d.ts" />
|
||||
/// <reference path="../node_modules/pxt-core/built/pxtsim.d.ts"/>
|
||||
|
||||
const rowRegex = /^.*[\.#].*$/;
|
||||
|
||||
enum LabelMode {
|
||||
None,
|
||||
Number,
|
||||
Letter
|
||||
}
|
||||
|
||||
export class FieldMatrix extends Blockly.Field implements Blockly.FieldCustom {
|
||||
private static CELL_WIDTH = 23;
|
||||
private static CELL_HORIZONTAL_MARGIN = 7;
|
||||
private static CELL_VERTICAL_MARGIN = 5;
|
||||
private static CELL_CORNER_RADIUS = 5;
|
||||
private static BOTTOM_MARGIN = 9;
|
||||
private static Y_AXIS_WIDTH = 9;
|
||||
private static X_AXIS_HEIGHT = 10;
|
||||
private static TAB = " ";
|
||||
|
||||
public isFieldCustom_ = true;
|
||||
|
||||
private params: any;
|
||||
private onColor = "#e2484a";
|
||||
private offColor = "white";
|
||||
|
||||
// The number of columns
|
||||
private matrixWidth: number = 5;
|
||||
|
||||
// The number of rows
|
||||
private matrixHeight: number = 5;
|
||||
|
||||
private yAxisLabel: LabelMode = LabelMode.None;
|
||||
private xAxisLabel: LabelMode = LabelMode.None;
|
||||
|
||||
private cellState: boolean[][] = [];
|
||||
private elt: SVGSVGElement;
|
||||
|
||||
constructor(text: string, params: any, validator?: Function) {
|
||||
super(text, validator);
|
||||
this.params = params;
|
||||
|
||||
if (this.params.rows !== undefined) {
|
||||
let val = parseInt(this.params.rows);
|
||||
if (!isNaN(val)) {
|
||||
this.matrixHeight = val;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.params.columns !== undefined) {
|
||||
let val = parseInt(this.params.columns);
|
||||
if (!isNaN(val)) {
|
||||
this.matrixWidth = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the inline free-text editor on top of the text.
|
||||
* @private
|
||||
*/
|
||||
showEditor_() {
|
||||
// Intentionally left empty
|
||||
}
|
||||
|
||||
private initMatrix() {
|
||||
this.elt = pxsim.svg.parseString(`<svg xmlns="http://www.w3.org/2000/svg" id="field-matrix" />`);
|
||||
|
||||
// Initialize the matrix that holds the state
|
||||
for (let i = 0; i < this.matrixHeight; i++) {
|
||||
this.cellState.push([])
|
||||
for (let j = 0; j < this.matrixWidth; j++) {
|
||||
this.cellState[i].push(false);
|
||||
}
|
||||
}
|
||||
|
||||
this.restoreStateFromString();
|
||||
this.updateValue()
|
||||
|
||||
// Create the cells of the matrix that is displayed
|
||||
for (let i = 0; i < this.matrixWidth; i++) {
|
||||
for (let j = 0; j < this.matrixHeight; j++) {
|
||||
this.createCell(i, j);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.xAxisLabel !== LabelMode.None) {
|
||||
const y = this.matrixHeight * (FieldMatrix.CELL_WIDTH + FieldMatrix.CELL_VERTICAL_MARGIN) + FieldMatrix.CELL_VERTICAL_MARGIN * 2 + FieldMatrix.BOTTOM_MARGIN
|
||||
const xAxis = pxsim.svg.child(this.elt, "g", { transform: `translate(${0} ${y})` });
|
||||
for (let i = 0; i < this.matrixWidth; i++) {
|
||||
const x = this.getYAxisWidth() + i * (FieldMatrix.CELL_WIDTH + FieldMatrix.CELL_HORIZONTAL_MARGIN) + FieldMatrix.CELL_WIDTH / 2 + FieldMatrix.CELL_HORIZONTAL_MARGIN / 2;
|
||||
const lbl = pxsim.svg.child(xAxis, "text", { x, class: "blocklyText" })
|
||||
lbl.textContent = this.getLabel(i, this.xAxisLabel);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.yAxisLabel !== LabelMode.None) {
|
||||
const yAxis = pxsim.svg.child(this.elt, "g", {});
|
||||
for (let i = 0; i < this.matrixHeight; i++) {
|
||||
const y = i * (FieldMatrix.CELL_WIDTH + FieldMatrix.CELL_VERTICAL_MARGIN) + FieldMatrix.CELL_WIDTH / 2 + FieldMatrix.CELL_VERTICAL_MARGIN * 2;
|
||||
const lbl = pxsim.svg.child(yAxis, "text", { x: 0, y, class: "blocklyText" })
|
||||
lbl.textContent = this.getLabel(i, this.yAxisLabel);
|
||||
}
|
||||
}
|
||||
|
||||
this.fieldGroup_.appendChild(this.elt);
|
||||
}
|
||||
|
||||
private getLabel(index: number, mode: LabelMode) {
|
||||
switch (mode) {
|
||||
case LabelMode.Letter:
|
||||
return String.fromCharCode(index + /*char code for A*/ 65);
|
||||
default:
|
||||
return (index + 1).toString();
|
||||
}
|
||||
}
|
||||
|
||||
private createCell(x: number, y: number) {
|
||||
const tx = x * (FieldMatrix.CELL_WIDTH + FieldMatrix.CELL_HORIZONTAL_MARGIN) + FieldMatrix.CELL_HORIZONTAL_MARGIN + this.getYAxisWidth();
|
||||
const ty = y * (FieldMatrix.CELL_WIDTH + FieldMatrix.CELL_VERTICAL_MARGIN) + FieldMatrix.CELL_VERTICAL_MARGIN;
|
||||
|
||||
const cellG = pxsim.svg.child(this.elt, "g", { transform: `translate(${tx} ${ty})` }) as SVGGElement;
|
||||
const cellRect = pxsim.svg.child(cellG, "rect", { width: FieldMatrix.CELL_WIDTH, height: FieldMatrix.CELL_WIDTH, fill: this.getColor(x, y), rx: FieldMatrix.CELL_CORNER_RADIUS }) as SVGRectElement;
|
||||
|
||||
pxsim.svg.onClick(cellRect, () => {
|
||||
this.cellState[x][y] = !this.cellState[x][y];
|
||||
cellRect.setAttribute("fill", this.getColor(x, y));
|
||||
this.updateValue()
|
||||
});
|
||||
}
|
||||
|
||||
private getColor(x: number, y: number) {
|
||||
return this.cellState[x][y] ? this.onColor : this.offColor;
|
||||
}
|
||||
|
||||
render_() {
|
||||
if (!this.visible_) {
|
||||
this.size_.width = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.elt) {
|
||||
this.initMatrix();
|
||||
}
|
||||
|
||||
|
||||
// The height and width must be set by the render function
|
||||
this.size_.height = Number(this.matrixHeight) * (FieldMatrix.CELL_WIDTH + FieldMatrix.CELL_VERTICAL_MARGIN) + FieldMatrix.CELL_VERTICAL_MARGIN * 2 + FieldMatrix.BOTTOM_MARGIN + this.getXAxisHeight()
|
||||
this.size_.width = Number(this.matrixWidth) * (FieldMatrix.CELL_WIDTH + FieldMatrix.CELL_HORIZONTAL_MARGIN) + this.getYAxisWidth();
|
||||
}
|
||||
|
||||
// The return value of this function is inserted in the code
|
||||
getValue() {
|
||||
// getText() returns the value that is set by calls to setValue()
|
||||
let text = removeQuotes(this.getText());
|
||||
return `\`\n${FieldMatrix.TAB}${text}\n${FieldMatrix.TAB}\``;
|
||||
}
|
||||
|
||||
// Restores the block state from the text value of the field
|
||||
private restoreStateFromString() {
|
||||
let r = this.getText();
|
||||
if (r) {
|
||||
const rows = r.split("\n").filter(r => rowRegex.test(r));
|
||||
|
||||
for (let y = 0; y < rows.length && y < this.matrixHeight; y++) {
|
||||
let x = 0;
|
||||
const row = rows[y];
|
||||
|
||||
for (let j = 0; j < row.length && x < this.matrixWidth; j++) {
|
||||
if (isNegativeCharacter(row[j])) {
|
||||
this.cellState[x][y] = false;
|
||||
x++;
|
||||
}
|
||||
else if (isPositiveCharacter(row[j])) {
|
||||
this.cellState[x][y] = true;
|
||||
x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Composes the state into a string an updates the field's state
|
||||
private updateValue() {
|
||||
let res = "";
|
||||
for (let y = 0; y < this.matrixHeight; y++) {
|
||||
for (let x = 0; x < this.matrixWidth; x++) {
|
||||
res += (this.cellState[x][y] ? "#" : ".") + " "
|
||||
}
|
||||
res += "\n" + FieldMatrix.TAB
|
||||
}
|
||||
|
||||
// Blockly stores the state of the field as a string
|
||||
this.setValue(res);
|
||||
}
|
||||
|
||||
private getYAxisWidth() {
|
||||
return this.yAxisLabel === LabelMode.None ? 0 : FieldMatrix.Y_AXIS_WIDTH;
|
||||
}
|
||||
|
||||
private getXAxisHeight() {
|
||||
return this.xAxisLabel === LabelMode.None ? 0 : FieldMatrix.X_AXIS_HEIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
function isPositiveCharacter(c: string) {
|
||||
return c === "#" || c === "*" || c === "1";
|
||||
}
|
||||
|
||||
function isNegativeCharacter(c: string) {
|
||||
return c === "." || c === "_" || c === "0";
|
||||
}
|
||||
|
||||
|
||||
const allQuotes = ["'", '"', "`"];
|
||||
|
||||
function removeQuotes(str: string) {
|
||||
str = str.trim();
|
||||
const start = str.charAt(0);
|
||||
if (start === str.charAt(str.length - 1) && allQuotes.indexOf(start) !== -1) {
|
||||
return str.substr(1, str.length - 2).trim();
|
||||
}
|
||||
return str;
|
||||
}
|
@ -230,7 +230,7 @@
|
||||
"basic.pause|block": "pause (ms) %pause",
|
||||
"basic.showArrow|block": "show arrow %i=device_arrow",
|
||||
"basic.showIcon|block": "show icon %i",
|
||||
"basic.showLeds|block": "show leds| %leds",
|
||||
"basic.showLeds|block": "show leds",
|
||||
"basic.showNumber|block": "show|number %number",
|
||||
"basic.showString|block": "show|string %text",
|
||||
"basic|block": "basic",
|
||||
@ -266,8 +266,8 @@
|
||||
"game|block": "game",
|
||||
"images.arrowImage|block": "arrow image %i=device_arrow",
|
||||
"images.arrowNumber|block": "%arrow",
|
||||
"images.createBigImage|block": "create big image| %leds",
|
||||
"images.createImage|block": "create image| %leds",
|
||||
"images.createBigImage|block": "create big image",
|
||||
"images.createImage|block": "create image",
|
||||
"images.iconImage|block": "icon image %i",
|
||||
"images|block": "images",
|
||||
"input.acceleration|block": "acceleration (mg)|%NAME",
|
||||
|
@ -34,13 +34,10 @@ namespace basic {
|
||||
*/
|
||||
//% help=basic/show-leds
|
||||
//% weight=95 blockGap=8
|
||||
//% imageLiteral=0 async
|
||||
//% leds.fieldEditor="matrix"
|
||||
//% leds.fieldOptions.onParentBlock=true
|
||||
//% leds.fieldOptions.decompileLiterals=true
|
||||
//% imageLiteral=1 async
|
||||
//% blockId=device_show_leds
|
||||
//% block="show leds| %leds" icon="\uf00a"
|
||||
//% parts="ledmatrix" blockExternalInputs=1
|
||||
//% block="show leds" icon="\uf00a"
|
||||
//% parts="ledmatrix"
|
||||
void showLeds(ImageLiteral leds, int interval = 400) {
|
||||
uBit.display.print(MicroBitImage(imageBytes(leds)), 0, 0, 0, interval);
|
||||
}
|
||||
@ -87,10 +84,7 @@ namespace basic {
|
||||
* @param leds pattern of LEDs to turn on/off
|
||||
* @param interval time in milliseconds between each redraw
|
||||
*/
|
||||
//% help=basic/show-animation imageLiteral=0 async
|
||||
//% leds.fieldEditor="matrix"
|
||||
//% leds.fieldOptions.onParentBlock=true
|
||||
//% leds.fieldOptions.decompileLiterals=true
|
||||
//% help=basic/show-animation imageLiteral=1 async
|
||||
//% parts="ledmatrix"
|
||||
void showAnimation(ImageLiteral leds, int interval = 400) {
|
||||
uBit.display.animate(MicroBitImage(imageBytes(leds)), interval, 5, 0, 0);
|
||||
@ -137,4 +131,4 @@ namespace basic {
|
||||
void pause(int ms) {
|
||||
fiber_sleep(ms);
|
||||
}
|
||||
}
|
||||
}
|
@ -10,11 +10,8 @@ namespace images {
|
||||
* Creates an image that fits on the LED screen.
|
||||
*/
|
||||
//% weight=75 help=images/create-image
|
||||
//% blockId=device_build_image block="create image| %leds"
|
||||
//% leds.fieldEditor="matrix"
|
||||
//% leds.fieldOptions.onParentBlock=true
|
||||
//% leds.fieldOptions.decompileLiterals=true
|
||||
//% parts="ledmatrix" imageLiteral=0 blockExternalInput=1
|
||||
//% blockId=device_build_image block="create image"
|
||||
//% parts="ledmatrix"
|
||||
Image createImage(ImageLiteral leds) {
|
||||
return MicroBitImage(imageBytes(leds)).clone().leakData();
|
||||
}
|
||||
@ -23,11 +20,7 @@ namespace images {
|
||||
* Creates an image with 2 frames.
|
||||
*/
|
||||
//% weight=74 help=images/create-big-image
|
||||
//% leds.fieldEditor="matrix"
|
||||
//% leds.fieldOptions.onParentBlock=true
|
||||
//% leds.fieldOptions.decompileLiterals=true
|
||||
//% blockId=device_build_big_image block="create big image| %leds"
|
||||
//% imageLiteral=0 blockExternalInput=1
|
||||
//% blockId=device_build_big_image block="create big image" imageLiteral=2
|
||||
//% parts="ledmatrix"
|
||||
Image createBigImage(ImageLiteral leds) {
|
||||
return createImage(leds);
|
||||
@ -160,4 +153,4 @@ namespace ImageMethods {
|
||||
void showFrame(Image i, int frame, int interval = 400) {
|
||||
showImage(i, frame * 5, interval);
|
||||
}
|
||||
}
|
||||
}
|
27
libs/core/shims.d.ts
vendored
27
libs/core/shims.d.ts
vendored
@ -12,22 +12,15 @@ declare namespace images {
|
||||
* Creates an image that fits on the LED screen.
|
||||
*/
|
||||
//% weight=75 help=images/create-image
|
||||
//% blockId=device_build_image block="create image| %leds"
|
||||
//% leds.fieldEditor="matrix"
|
||||
//% leds.fieldOptions.onParentBlock=true
|
||||
//% leds.fieldOptions.decompileLiterals=true
|
||||
//% parts="ledmatrix" imageLiteral=0 blockExternalInput=1 shim=images::createImage
|
||||
//% blockId=device_build_image block="create image"
|
||||
//% parts="ledmatrix" imageLiteral=1 shim=images::createImage
|
||||
function createImage(leds: string): Image;
|
||||
|
||||
/**
|
||||
* Creates an image with 2 frames.
|
||||
*/
|
||||
//% weight=74 help=images/create-big-image
|
||||
//% leds.fieldEditor="matrix"
|
||||
//% leds.fieldOptions.onParentBlock=true
|
||||
//% leds.fieldOptions.decompileLiterals=true
|
||||
//% blockId=device_build_big_image block="create big image| %leds"
|
||||
//% imageLiteral=0 blockExternalInput=1
|
||||
//% blockId=device_build_big_image block="create big image" imageLiteral=2
|
||||
//% parts="ledmatrix" shim=images::createBigImage
|
||||
function createBigImage(leds: string): Image;
|
||||
}
|
||||
@ -154,13 +147,10 @@ declare namespace basic {
|
||||
*/
|
||||
//% help=basic/show-leds
|
||||
//% weight=95 blockGap=8
|
||||
//% imageLiteral=0 async
|
||||
//% leds.fieldEditor="matrix"
|
||||
//% leds.fieldOptions.onParentBlock=true
|
||||
//% leds.fieldOptions.decompileLiterals=true
|
||||
//% imageLiteral=1 async
|
||||
//% blockId=device_show_leds
|
||||
//% block="show leds| %leds" icon="\uf00a"
|
||||
//% parts="ledmatrix" blockExternalInputs=1 interval.defl=400 shim=basic::showLeds
|
||||
//% block="show leds" icon="\uf00a"
|
||||
//% parts="ledmatrix" interval.defl=400 shim=basic::showLeds
|
||||
function showLeds(leds: string, interval?: int32): void;
|
||||
|
||||
/**
|
||||
@ -190,10 +180,7 @@ declare namespace basic {
|
||||
* @param leds pattern of LEDs to turn on/off
|
||||
* @param interval time in milliseconds between each redraw
|
||||
*/
|
||||
//% help=basic/show-animation imageLiteral=0 async
|
||||
//% leds.fieldEditor="matrix"
|
||||
//% leds.fieldOptions.onParentBlock=true
|
||||
//% leds.fieldOptions.decompileLiterals=true
|
||||
//% help=basic/show-animation imageLiteral=1 async
|
||||
//% parts="ledmatrix" interval.defl=400 shim=basic::showAnimation
|
||||
function showAnimation(leds: string, interval?: int32): void;
|
||||
|
||||
|
@ -6,7 +6,9 @@
|
||||
"radio.Packet.serial": "The serial number of the sender of the packet or 0 if the sender did not sent their serial number.",
|
||||
"radio.Packet.signal": "The received signal strength indicator (RSSI) of the packet.",
|
||||
"radio.Packet.time": "The system time of the sender of the packet at the time the packet was sent.",
|
||||
"radio.onDataPacketReceived": "Registers code to run when the radio receives a packet. Also takes the\nreceived packet from the radio queue.",
|
||||
"radio.onReceivedNumber": "Registers code to run when the radio receives a packet. Also takes the\nreceived packet from the radio queue.",
|
||||
"radio.onReceivedString": "Registers code to run when the radio receives a packet. Also takes the\nreceived packet from the radio queue.",
|
||||
"radio.onReceivedValue": "Registers code to run when the radio receives a packet. Also takes the\nreceived packet from the radio queue.",
|
||||
"radio.receivedBuffer": "Returns the buffer payload from the last packet taken from the radio queue\n(via ``receiveNumber``, ``receiveString``, etc) or the empty string if that\npacket did not contain a string.",
|
||||
"radio.receivedNumber": "Returns the number payload from the last packet taken from the radio queue\n(via ``receiveNumber``, ``receiveString``, etc) or 0 if that packet did not\ncontain a number.",
|
||||
"radio.receivedSerial": "Returns the serial number of the sender micro:bit from the last packet taken\nfrom the radio queue (via ``receiveNumber``, ``receiveString``, etc) or 0 if\nthat packet did not send a serial number.",
|
||||
|
@ -1,5 +1,7 @@
|
||||
{
|
||||
"radio.onDataPacketReceived|block": "on radio received",
|
||||
"radio.onReceivedNumber|block": "on radio received number",
|
||||
"radio.onReceivedString|block": "on radio received string",
|
||||
"radio.onReceivedValue|block": "on radio received",
|
||||
"radio.sendNumber|block": "radio send number %value",
|
||||
"radio.sendString|block": "radio send string %msg",
|
||||
"radio.sendValue|block": "radio send|value %name|= %value",
|
||||
|
@ -37,7 +37,7 @@ namespace radio {
|
||||
* Registers code to run when the radio receives a packet. Also takes the
|
||||
* received packet from the radio queue.
|
||||
*/
|
||||
//% help=radio/on-data-packet-received
|
||||
//% help=radio/on-data-packet-received deprecated=true
|
||||
//% mutate=objectdestructuring
|
||||
//% mutateText=Packet
|
||||
//% mutateDefaults="receivedNumber;receivedString:name,receivedNumber:value;receivedString"
|
||||
@ -55,4 +55,60 @@ namespace radio {
|
||||
cb(packet)
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers code to run when the radio receives a packet. Also takes the
|
||||
* received packet from the radio queue.
|
||||
*/
|
||||
//% help=radio/on-radio-received-number
|
||||
//% blockId=radio_on_number block="on radio received number" blockGap=8
|
||||
export function onReceivedNumber(cb: (num: number, time?: number, serial?: number, signal?: number) => void) {
|
||||
onDataReceived(() => {
|
||||
receiveNumber();
|
||||
const packet = new Packet();
|
||||
packet.receivedNumber = receivedNumber();
|
||||
packet.time = receivedTime();
|
||||
packet.serial = receivedSerial();
|
||||
packet.signal = receivedSignalStrength();
|
||||
cb(packet.receivedNumber, packet.time, packet.serial, packet.signal);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers code to run when the radio receives a packet. Also takes the
|
||||
* received packet from the radio queue.
|
||||
*/
|
||||
//% help=radio/on-radio-received-string
|
||||
//% blockId=radio_on_string block="on radio received string" blockGap=8
|
||||
export function onReceivedString(cb: (received: string, time?: number, serial?: number, signal?: number) => void) {
|
||||
onDataReceived(() => {
|
||||
receiveNumber();
|
||||
const packet = new Packet();
|
||||
packet.time = receivedTime();
|
||||
packet.serial = receivedSerial();
|
||||
packet.signal = receivedSignalStrength();
|
||||
packet.receivedString = receivedString();
|
||||
cb(packet.receivedString, packet.time, packet.serial, packet.signal);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers code to run when the radio receives a packet. Also takes the
|
||||
* received packet from the radio queue.
|
||||
*/
|
||||
//% help=radio/on-radio-received-value
|
||||
//% blockId=radio_on_value block="on radio received" blockGap=8
|
||||
export function onReceivedValue(cb: (packet: Packet) => void) {
|
||||
onDataReceived(() => {
|
||||
receiveNumber();
|
||||
const packet = new Packet();
|
||||
packet.receivedNumber = receivedNumber();
|
||||
packet.time = receivedTime();
|
||||
packet.serial = receivedSerial();
|
||||
packet.signal = receivedSignalStrength();
|
||||
packet.receivedString = receivedString();
|
||||
cb(packet)
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
130
package-lock.json
generated
130
package-lock.json
generated
@ -1903,6 +1903,16 @@
|
||||
"verror": "1.10.0"
|
||||
}
|
||||
},
|
||||
"keytar": {
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmjs.org/keytar/-/keytar-4.2.1.tgz",
|
||||
"integrity": "sha1-igamV3/fY3PgqmsRInfmPex3/RI=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"nan": "2.8.0",
|
||||
"prebuild-install": "2.5.0"
|
||||
}
|
||||
},
|
||||
"kind-of": {
|
||||
"version": "3.2.2",
|
||||
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
|
||||
@ -2306,6 +2316,12 @@
|
||||
"resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz",
|
||||
"integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s="
|
||||
},
|
||||
"nan": {
|
||||
"version": "2.8.0",
|
||||
"resolved": "https://registry.npmjs.org/nan/-/nan-2.8.0.tgz",
|
||||
"integrity": "sha1-7XFfP+neArV6XmJS2QqWZ14fCFo=",
|
||||
"optional": true
|
||||
},
|
||||
"node-abi": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.2.0.tgz",
|
||||
@ -3483,9 +3499,9 @@
|
||||
"integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4="
|
||||
},
|
||||
"pxt-core": {
|
||||
"version": "3.10.9",
|
||||
"resolved": "https://registry.npmjs.org/pxt-core/-/pxt-core-3.10.9.tgz",
|
||||
"integrity": "sha512-uZb0GkpIlF3BSZC7sR0XU6XPZhcin31639sCgn3dIjKzMPq31jt0mHR1dj/1j6cTMIM/NyYAUiTSiL/ZwQaKPg==",
|
||||
"version": "3.10.16",
|
||||
"resolved": "https://registry.npmjs.org/pxt-core/-/pxt-core-3.10.16.tgz",
|
||||
"integrity": "sha512-QsvI6Q68Pfn99/yoQDKpOLvG0/Ldb+f1MQoTpQ3JyNGC1vuqLI1WA8sbrxT2SGbtreEGV71DHL4Lws++QEdI1Q==",
|
||||
"requires": {
|
||||
"bluebird": "3.5.1",
|
||||
"browserify": "13.3.0",
|
||||
@ -3504,69 +3520,6 @@
|
||||
"rtlcss": "2.2.0",
|
||||
"serialport": "6.2.0",
|
||||
"uglify-js": "3.3.21"
|
||||
},
|
||||
"dependencies": {
|
||||
"commander": {
|
||||
"version": "2.15.1",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz",
|
||||
"integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==",
|
||||
"optional": true
|
||||
},
|
||||
"debug": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
|
||||
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"keytar": {
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmjs.org/keytar/-/keytar-4.2.1.tgz",
|
||||
"integrity": "sha1-igamV3/fY3PgqmsRInfmPex3/RI=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"nan": "2.8.0",
|
||||
"prebuild-install": "2.5.0"
|
||||
}
|
||||
},
|
||||
"nan": {
|
||||
"version": "2.8.0",
|
||||
"resolved": "https://registry.npmjs.org/nan/-/nan-2.8.0.tgz",
|
||||
"integrity": "sha1-7XFfP+neArV6XmJS2QqWZ14fCFo=",
|
||||
"optional": true
|
||||
},
|
||||
"serialport": {
|
||||
"version": "6.2.0",
|
||||
"resolved": "https://registry.npmjs.org/serialport/-/serialport-6.2.0.tgz",
|
||||
"integrity": "sha512-y6Bdr+1kazPIMlZQYB1nQhiSbC8xEL8cyuSd79nJ29JwTh7NR0SUxjseoY8DcLRGuta5sifqQhP4CGcI3S/V4Q==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"bindings": "1.3.0",
|
||||
"commander": "2.15.1",
|
||||
"debug": "3.1.0",
|
||||
"nan": "2.10.0",
|
||||
"parser-byte-length": "1.0.2",
|
||||
"parser-cctalk": "1.0.2",
|
||||
"parser-delimiter": "1.0.2",
|
||||
"parser-readline": "1.0.2",
|
||||
"parser-ready": "1.0.2",
|
||||
"parser-regex": "1.0.2",
|
||||
"prebuild-install": "2.5.0",
|
||||
"promirepl": "1.0.1",
|
||||
"prompt-list": "3.1.2",
|
||||
"safe-buffer": "5.1.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"nan": {
|
||||
"version": "2.10.0",
|
||||
"resolved": "https://registry.npmjs.org/nan/-/nan-2.10.0.tgz",
|
||||
"integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==",
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"q": {
|
||||
@ -3838,6 +3791,51 @@
|
||||
"integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==",
|
||||
"optional": true
|
||||
},
|
||||
"serialport": {
|
||||
"version": "6.2.0",
|
||||
"resolved": "https://registry.npmjs.org/serialport/-/serialport-6.2.0.tgz",
|
||||
"integrity": "sha512-y6Bdr+1kazPIMlZQYB1nQhiSbC8xEL8cyuSd79nJ29JwTh7NR0SUxjseoY8DcLRGuta5sifqQhP4CGcI3S/V4Q==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"bindings": "1.3.0",
|
||||
"commander": "2.15.1",
|
||||
"debug": "3.1.0",
|
||||
"nan": "2.10.0",
|
||||
"parser-byte-length": "1.0.2",
|
||||
"parser-cctalk": "1.0.2",
|
||||
"parser-delimiter": "1.0.2",
|
||||
"parser-readline": "1.0.2",
|
||||
"parser-ready": "1.0.2",
|
||||
"parser-regex": "1.0.2",
|
||||
"prebuild-install": "2.5.0",
|
||||
"promirepl": "1.0.1",
|
||||
"prompt-list": "3.1.2",
|
||||
"safe-buffer": "5.1.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"commander": {
|
||||
"version": "2.15.1",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz",
|
||||
"integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==",
|
||||
"optional": true
|
||||
},
|
||||
"debug": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
|
||||
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"nan": {
|
||||
"version": "2.10.0",
|
||||
"resolved": "https://registry.npmjs.org/nan/-/nan-2.10.0.tgz",
|
||||
"integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==",
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"set-blocking": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
|
||||
|
@ -66,7 +66,7 @@ namespace pxsim {
|
||||
|
||||
export function createInternalImage(width: number): Image {
|
||||
let img = createImage(width)
|
||||
//pxsim.runtime.unregisterLiveObject(img, true)
|
||||
pxsim.runtime.unregisterLiveObject(img, true)
|
||||
return img
|
||||
}
|
||||
|
||||
|
@ -74,9 +74,9 @@
|
||||
--------------------*/
|
||||
|
||||
@flyoutLabelColor: white;
|
||||
@blocklyFlyoutColor: #3B3C3D;
|
||||
@blocklyFlyoutColor: #4b4949;
|
||||
@blocklyFlyoutColorOpacity: 1.0;
|
||||
@monacoFlyoutColor: rgba(59, 60, 61, 1.0);
|
||||
@monacoFlyoutColor: @blocklyFlyoutColor;
|
||||
|
||||
/*-------------------
|
||||
Serial
|
||||
|
@ -54,16 +54,6 @@
|
||||
background: transparent !important;
|
||||
}
|
||||
|
||||
/*******************************
|
||||
Monaco
|
||||
*******************************/
|
||||
|
||||
.monacoDraggableBlock {
|
||||
background: #ecf0f1;
|
||||
border: solid 3px #ecf0f1;
|
||||
}
|
||||
|
||||
|
||||
/* Mobile */
|
||||
@media only screen and (max-width: @largestMobileScreen) {
|
||||
#filelist {
|
||||
|
Loading…
Reference in New Issue
Block a user