diff --git a/docs/projects/SUMMARY.md b/docs/projects/SUMMARY.md index ce560a55..4a56be7a 100644 --- a/docs/projects/SUMMARY.md +++ b/docs/projects/SUMMARY.md @@ -76,6 +76,7 @@ * [Discover JavaScript Blocks](https://microbit.org/en/2017-03-07-javascript-block-resources/) * [Networking with the micro:bit](https://microbit.nominetresearch.uk/networking-book/) * [SparkFun Videos](https://youtu.be/kaNtg1HGXbY?list=PLBcrWxTa5CS0mWJrytvii8aG5KUqMXvSk) + * [Logic Lab](/courses/logic-lab) * [Blocks to JavaScript](/courses/blocks-to-javascript) * [SparkFun Inventor's Kit](https://learn.sparkfun.com/tutorials/sparkfun-inventors-kit-for-microbit-experiment-guide/introduction-to-the-sparkfun-inventors-kit-for-microbit) * [Kitronik Inventor Kit](https://www.kitronik.co.uk/blog/inventors-kit-experiment-1-help) diff --git a/libs/core/_locales/core-jsdoc-strings.json b/libs/core/_locales/core-jsdoc-strings.json index 1e635ab7..b0b76776 100644 --- a/libs/core/_locales/core-jsdoc-strings.json +++ b/libs/core/_locales/core-jsdoc-strings.json @@ -50,9 +50,11 @@ "Array.unshift": "Add one element to the beginning of an array and return the new length of the array.", "Array@type": "Add, remove, and replace items in lists.", "Boolean.toString": "Returns a string representation of an object.", + "Buffer.concat": "Return concatenation of current buffer and the given buffer", "Buffer.fill": "Fill (a fragment) of the buffer with given value.", "Buffer.getNumber": "Read a number in specified format from the buffer.", "Buffer.getUint8": "Reads an unsigned byte at a particular location", + "Buffer.indexOf": "Return position of other buffer in current buffer", "Buffer.length": "Returns the length of a Buffer object.", "Buffer.rotate": "Rotate buffer left in place.\n\n\n\nstart. eg: -1", "Buffer.rotate|param|length": "number of elements in buffer. If negative, length is set as the buffer length minus", @@ -197,6 +199,7 @@ "String.substr|param|length": "number of characters to extract", "String.substr|param|start": "first character index; can be negative from counting from the end, eg:0", "String@type": "Combine, split, and search text strings.", + "StringMap": "A dictionary from string key to string values", "basic": "Provides access to basic micro:bit functionality.", "basic.clearScreen": "Turn off all LEDs", "basic.forever": "Repeats the code forever in the background. On each iteration, allows other codes to run.", @@ -546,6 +549,8 @@ "serial.setRxBufferSize|param|size": "length of the rx buffer in bytes, eg: 32", "serial.setTxBufferSize": "Sets the size of the TX buffer in bytes", "serial.setTxBufferSize|param|size": "length of the tx buffer in bytes, eg: 32", + "serial.setWriteLinePadding": "Sets the padding length for lines sent with \"write line\".", + "serial.setWriteLinePadding|param|length": "the number of bytes alignment, eg: 0", "serial.writeBuffer": "Send a buffer through serial connection", "serial.writeLine": "Print a line of text to the serial port", "serial.writeNumber": "Print a numeric value to the serial port", diff --git a/libs/core/_locales/core-strings.json b/libs/core/_locales/core-strings.json index ee574669..6ef12a69 100644 --- a/libs/core/_locales/core-strings.json +++ b/libs/core/_locales/core-strings.json @@ -232,8 +232,11 @@ "String.charAt|block": "char from %this=text|at %pos", "String.compare|block": "compare %this=text| to %that", "String.fromCharCode|block": "text from char code %code", + "String.includes|block": "%this=text|includes %searchValue", + "String.indexOf|block": "%this=text|find index of %searchValue", "String.isEmpty|block": "%this=text| is empty", "String.length|block": "length of %VALUE", + "String.split|block": "split %this=text|at %separator", "String.substr|block": "substring of %this=text|from %start|of length %length", "String|block": "String", "basic.clearScreen|block": "clear screen", @@ -367,6 +370,7 @@ "serial.redirect|block": "serial|redirect to|TX %tx|RX %rx|at baud rate %rate", "serial.setRxBufferSize|block": "serial set rx buffer size to $size", "serial.setTxBufferSize|block": "serial set tx buffer size to $size", + "serial.setWriteLinePadding|block": "serial set write line padding to $length", "serial.writeBuffer|block": "serial|write buffer %buffer=serial_readbuffer", "serial.writeLine|block": "serial|write line %text", "serial.writeNumbers|block": "serial|write numbers %values", diff --git a/libs/core/images.cpp b/libs/core/images.cpp index e303e13c..941b9b05 100644 --- a/libs/core/images.cpp +++ b/libs/core/images.cpp @@ -1,6 +1,6 @@ #include "pxt.h" -PXT_VTABLE(RefMImage) +PXT_VTABLE(RefMImage, ValType::Object) RefMImage::RefMImage(ImageData *d) : PXT_VTABLE_INIT(RefMImage), img(d) { img->incr(); diff --git a/package.json b/package.json index 3d1ce576..121142da 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "@types/web-bluetooth": "0.0.4" }, "dependencies": { - "pxt-common-packages": "6.9.4", - "pxt-core": "5.15.12" + "pxt-common-packages": "6.13.7", + "pxt-core": "5.18.13" } } diff --git a/sim/state/buttonpairsim.ts b/sim/state/buttonpairsim.ts index 47f40284..a6db64b3 100644 --- a/sim/state/buttonpairsim.ts +++ b/sim/state/buttonpairsim.ts @@ -146,8 +146,9 @@ namespace pxsim.visuals { let btng = svg.elt("g"); let btn = svg.child(btng, "rect", { class: "sim-button-virtual", x: x, y: y, rx: corner, ry: corner, width: w, height: w}); let btnTxt = mkTxt(cx + txtXOff, cy + txtYOff, txtSize, 0, "A+B"); - svg.addClass(btnTxt, "sim-text") - svg.addClass(btnTxt, "sim-text-virtual"); + + U.addClass(btnTxt, "sim-text") + U.addClass(btnTxt, "sim-text-virtual"); btng.appendChild(btnTxt); return btng; @@ -157,7 +158,7 @@ namespace pxsim.visuals { this.abBtn.style.visibility = "hidden"; let el = svg.elt("g"); - svg.addClass(el, "sim-buttonpair") + U.addClass(el, "sim-buttonpair") el.appendChild(this.aBtn); el.appendChild(this.bBtn); el.appendChild(this.abBtn); diff --git a/sim/state/ledmatrix.ts b/sim/state/ledmatrix.ts index 31041d8d..7fa1eaa9 100644 --- a/sim/state/ledmatrix.ts +++ b/sim/state/ledmatrix.ts @@ -28,7 +28,7 @@ namespace pxsim { this.data = data; } public print() { - console.debug(`Image id:${this.id} refs:${this.refcnt} size:${this.width}x${Image.height}`) + console.debug(`Image id:${this.id} size:${this.width}x${Image.height}`) } public get(x: number, y: number): number { x = x >> 0; @@ -76,7 +76,6 @@ namespace pxsim { export function createInternalImage(width: number): Image { width = width >> 0; let img = createImage(width) - pxsim.runtime.unregisterLiveObject(img, true) return img } diff --git a/sim/visuals/microbit.ts b/sim/visuals/microbit.ts index 55a73fbc..ceecda9c 100644 --- a/sim/visuals/microbit.ts +++ b/sim/visuals/microbit.ts @@ -308,7 +308,7 @@ path.sim-board { this.recordPinCoords(); this.buildDom(); if (props && props.wireframe) - svg.addClass(this.element, "sim-wireframe"); + U.addClass(this.element, "sim-wireframe"); if (props && props.theme) this.updateTheme(); @@ -412,8 +412,8 @@ path.sim-board { this.updateButtonAB(); this.updateGestures(); - if (!runtime || runtime.dead) svg.addClass(this.element, "grayscale"); - else svg.removeClass(this.element, "grayscale"); + if (!runtime || runtime.dead) U.addClass(this.element, "grayscale"); + else U.removeClass(this.element, "grayscale"); } private updateGestures() { @@ -970,7 +970,7 @@ path.sim-board { let state = this.board; let pin = state.edgeConnectorState.pins[index]; let svgpin = this.pins[index]; - svg.addClass(svgpin, "touched"); + U.addClass(svgpin, "touched"); if (pin.mode & PinFlags.Input) { let cursor = svg.cursorPoint(pt, this.element, ev); let v = (400 - cursor.y) / 40 * 1023 @@ -983,7 +983,7 @@ path.sim-board { let state = this.board; let pin = state.edgeConnectorState.pins[index]; let svgpin = this.pins[index]; - svg.removeClass(svgpin, "touched"); + U.removeClass(svgpin, "touched"); this.updatePin(pin, index); return false; }, diff --git a/sim/visuals/neopixel.ts b/sim/visuals/neopixel.ts index 4b63387b..6e3ff3a2 100644 --- a/sim/visuals/neopixel.ts +++ b/sim/visuals/neopixel.ts @@ -132,7 +132,7 @@ namespace pxsim.visuals { } //show the canvas if it's hidden - svg.removeClass(this.background, "hidden"); + U.removeClass(this.background, "hidden"); //resize if necessary let [first, last] = [this.pixels[0], this.pixels[this.pixels.length - 1]]