Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd73efa8a7 | ||
|
|
374d9e9595 | ||
|
|
196ca79aa3 | ||
|
|
d17dd09c59 | ||
|
|
75dc59978e | ||
|
|
abe06d1594 | ||
|
|
72c6e7086e | ||
|
|
46951d44c8 | ||
|
|
1339d3f579 | ||
|
|
34af44d299 | ||
|
|
1199845c52 | ||
|
|
003150643d | ||
|
|
500de7fb13 | ||
|
|
88934881f9 | ||
|
|
433e8c8805 |
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
This target is hosted at https://makecode.calliope.cc.
|
This target is hosted at https://makecode.calliope.cc.
|
||||||
|
|
||||||
|
|
||||||
## Hosted editor and build
|
## Hosted editor and build
|
||||||
|
|
||||||
Jenkins build: https://ci2.dot.net/job/Private/job/pxt_project_teal/job/master/
|
Jenkins build: https://ci2.dot.net/job/Private/job/pxt_project_teal/job/master/
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"appref": "v1.0.13"
|
"appref": "v"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,12 @@
|
|||||||
"AcceleratorRange.OneG": "The accelerator measures forces up to 1 gravity",
|
"AcceleratorRange.OneG": "The accelerator measures forces up to 1 gravity",
|
||||||
"AcceleratorRange.TwoG": "The accelerator measures forces up to 2 gravity",
|
"AcceleratorRange.TwoG": "The accelerator measures forces up to 2 gravity",
|
||||||
"Array": "Add, remove, and replace items in lists.\n\nAdd, remove, and replace items in lists.",
|
"Array": "Add, remove, and replace items in lists.\n\nAdd, remove, and replace items in lists.",
|
||||||
|
"Array.every": "Tests whether all elements in the array pass the test implemented by the provided function.",
|
||||||
|
"Array.every|param|callbackfn": "A function that accepts up to two arguments. The some method calls the callbackfn function one time for each element in the array.",
|
||||||
"Array.filter": "Return the elements of an array that meet the condition specified in a callback function.",
|
"Array.filter": "Return the elements of an array that meet the condition specified in a callback function.",
|
||||||
"Array.filter|param|callbackfn": "A function that accepts up to two arguments. The filter method calls the callbackfn function one time for each element in the array.",
|
"Array.filter|param|callbackfn": "A function that accepts up to two arguments. The filter method calls the callbackfn function one time for each element in the array.",
|
||||||
|
"Array.forEach": "Call a defined callback function on each element of an array.",
|
||||||
|
"Array.forEach|param|callbackfn": "A function that accepts up to two arguments. The forEach method calls the callbackfn function one time for each element in the array.",
|
||||||
"Array.get": "Get the value at a particular index.",
|
"Array.get": "Get the value at a particular index.",
|
||||||
"Array.get|param|index": "the zero-based position in the list of the item, eg: 0",
|
"Array.get|param|index": "the zero-based position in the list of the item, eg: 0",
|
||||||
"Array.indexOf": "Return the index of the first occurrence of a value in an array.",
|
"Array.indexOf": "Return the index of the first occurrence of a value in an array.",
|
||||||
@@ -14,6 +18,8 @@
|
|||||||
"Array.insertAt": "Insert the value at a particular index, increase the array length by 1.",
|
"Array.insertAt": "Insert the value at a particular index, increase the array length by 1.",
|
||||||
"Array.insertAt|param|index": "the zero-based position in the list to insert the value, eg: 0",
|
"Array.insertAt|param|index": "the zero-based position in the list to insert the value, eg: 0",
|
||||||
"Array.insertAt|param|value": "to insert, eg: 0",
|
"Array.insertAt|param|value": "to insert, eg: 0",
|
||||||
|
"Array.join": "joins all elements of an array into a string and returns this string.",
|
||||||
|
"Array.join|param|sep": "the string separator",
|
||||||
"Array.length": "Gets or sets the length of the array. This is a number one higher than the highest element defined in an array.",
|
"Array.length": "Gets or sets the length of the array. This is a number one higher than the highest element defined in an array.",
|
||||||
"Array.map": "Call a defined callback function on each element of an array, and return an array containing the results.",
|
"Array.map": "Call a defined callback function on each element of an array, and return an array containing the results.",
|
||||||
"Array.map|param|callbackfn": "A function that accepts up to two arguments. The map method calls the callbackfn function one time for each element in the array.",
|
"Array.map|param|callbackfn": "A function that accepts up to two arguments. The map method calls the callbackfn function one time for each element in the array.",
|
||||||
@@ -33,6 +39,8 @@
|
|||||||
"Array.slice": "Return a section of an array.",
|
"Array.slice": "Return a section of an array.",
|
||||||
"Array.slice|param|end": "The end of the specified portion of the array. eg: 0",
|
"Array.slice|param|end": "The end of the specified portion of the array. eg: 0",
|
||||||
"Array.slice|param|start": "The beginning of the specified portion of the array. eg: 0",
|
"Array.slice|param|start": "The beginning of the specified portion of the array. eg: 0",
|
||||||
|
"Array.some": "Tests whether at least one element in the array passes the test implemented by the provided function.",
|
||||||
|
"Array.some|param|callbackfn": "A function that accepts up to two arguments. The some method calls the callbackfn function one time for each element in the array.",
|
||||||
"Array.sort": "Sort the elements of an array in place and returns the array. The sort is not necessarily stable.",
|
"Array.sort": "Sort the elements of an array in place and returns the array. The sort is not necessarily stable.",
|
||||||
"Array.splice": "Remove elements from an array.",
|
"Array.splice": "Remove elements from an array.",
|
||||||
"Array.splice|param|deleteCount": "The number of elements to remove. eg: 0",
|
"Array.splice|param|deleteCount": "The number of elements to remove. eg: 0",
|
||||||
|
|||||||
2303
package-lock.json
generated
2303
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pxt-calliope",
|
"name": "pxt-calliope",
|
||||||
"version": "1.0.19",
|
"version": "1.0.24",
|
||||||
"description": "Calliope Mini editor for PXT",
|
"description": "Calliope Mini editor for PXT",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"JavaScript",
|
"JavaScript",
|
||||||
@@ -30,13 +30,13 @@
|
|||||||
"typings": "built/pxtrequire.d.ts",
|
"typings": "built/pxtrequire.d.ts",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"typescript": "^1.8.7",
|
"typescript": "^1.8.7",
|
||||||
"less": "^2.6.0",
|
|
||||||
"rtlcss": "^2.1.2",
|
"rtlcss": "^2.1.2",
|
||||||
"autoprefixer": "^6.7.6",
|
"autoprefixer": "^6.7.6",
|
||||||
"semantic-ui-less": "^2.2.4"
|
"less": "2.7.3",
|
||||||
|
"semantic-ui-less": "2.2.14"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"pxt-core": "0.14.32"
|
"pxt-core": "0.18.3"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "node node_modules/pxt-core/built/pxt.js travis"
|
"test": "node node_modules/pxt-core/built/pxt.js travis"
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"id": "calliopemini",
|
"id": "calliopemini",
|
||||||
|
"aliases": ["calliope"],
|
||||||
"name": " calliope mini",
|
"name": " calliope mini",
|
||||||
"nickname": "mini",
|
"nickname": "mini",
|
||||||
"title": "Calliope mini - Blocks / Javascript editor",
|
"title": "Calliope mini - Blocks / Javascript editor",
|
||||||
@@ -224,7 +225,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"docMenu": [],
|
"docMenu": [],
|
||||||
"hasReferenceDocs": false
|
"hasReferenceDocs": false,
|
||||||
|
"availableLocales": [
|
||||||
|
"de",
|
||||||
|
"en"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ignoreDocsErrors": true
|
"ignoreDocsErrors": true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ namespace pxsim {
|
|||||||
speakerState: SpeakerState;
|
speakerState: SpeakerState;
|
||||||
fileSystem: FileSystemState;
|
fileSystem: FileSystemState;
|
||||||
|
|
||||||
|
// visual
|
||||||
|
view: SVGElement;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super()
|
||||||
|
|
||||||
@@ -94,7 +97,7 @@ namespace pxsim {
|
|||||||
break;
|
break;
|
||||||
case "serial":
|
case "serial":
|
||||||
let data = (<SimulatorSerialMessage>msg).data || "";
|
let data = (<SimulatorSerialMessage>msg).data || "";
|
||||||
this.serialState.recieveData(data);
|
this.serialState.receiveData(data);
|
||||||
break;
|
break;
|
||||||
case "radiopacket":
|
case "radiopacket":
|
||||||
let packet = <SimulatorRadioPacketMessage>msg;
|
let packet = <SimulatorRadioPacketMessage>msg;
|
||||||
@@ -121,16 +124,22 @@ namespace pxsim {
|
|||||||
fnArgs: fnArgs,
|
fnArgs: fnArgs,
|
||||||
maxWidth: "100%",
|
maxWidth: "100%",
|
||||||
maxHeight: "100%",
|
maxHeight: "100%",
|
||||||
|
highContrast: msg.highContrast
|
||||||
};
|
};
|
||||||
const viewHost = new visuals.BoardHost(pxsim.visuals.mkBoardView({
|
const viewHost = new visuals.BoardHost(pxsim.visuals.mkBoardView({
|
||||||
visual: boardDef.visual
|
visual: boardDef.visual,
|
||||||
|
highContrast: msg.highContrast
|
||||||
}), opts);
|
}), opts);
|
||||||
|
|
||||||
document.body.innerHTML = ""; // clear children
|
document.body.innerHTML = ""; // clear children
|
||||||
document.body.appendChild(viewHost.getView());
|
document.body.appendChild(this.view = viewHost.getView());
|
||||||
|
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
screenshot(): string {
|
||||||
|
return svg.toDataUri(new XMLSerializer().serializeToString(this.view));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function initRuntimeWithDalBoard() {
|
export function initRuntimeWithDalBoard() {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace pxsim {
|
|||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
public print() {
|
public print() {
|
||||||
console.log(`Image id:${this.id} refs:${this.refcnt} size:${this.width}x${Image.height}`)
|
// console.debug(`Image id:${this.id} refs:${this.refcnt} size:${this.width}x${Image.height}`)
|
||||||
}
|
}
|
||||||
public get(x: number, y: number): number {
|
public get(x: number, y: number): number {
|
||||||
if (x < 0 || x >= this.width || y < 0 || y >= 5) return 0;
|
if (x < 0 || x >= this.width || y < 0 || y >= 5) return 0;
|
||||||
@@ -131,15 +131,33 @@ namespace pxsim.images {
|
|||||||
namespace pxsim.ImageMethods {
|
namespace pxsim.ImageMethods {
|
||||||
export function showImage(leds: Image, offset: number, interval: number) {
|
export function showImage(leds: Image, offset: number, interval: number) {
|
||||||
pxtrt.nullCheck(leds)
|
pxtrt.nullCheck(leds)
|
||||||
|
let cb = getResume();
|
||||||
|
let first = true;
|
||||||
|
|
||||||
|
board().ledMatrixState.animationQ.enqueue({
|
||||||
|
interval,
|
||||||
|
frame: () => {
|
||||||
|
if (first) {
|
||||||
leds.copyTo(offset, 5, board().ledMatrixState.image, 0)
|
leds.copyTo(offset, 5, board().ledMatrixState.image, 0)
|
||||||
runtime.queueDisplayUpdate()
|
first = false;
|
||||||
basic.pause(interval);
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
whenDone: cb
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function plotImage(leds: Image, offset: number): void {
|
export function plotImage(leds: Image, offset: number): void {
|
||||||
pxtrt.nullCheck(leds)
|
pxtrt.nullCheck(leds)
|
||||||
|
|
||||||
|
board().ledMatrixState.animationQ.enqueue({
|
||||||
|
interval: 0,
|
||||||
|
frame: () => {
|
||||||
leds.copyTo(offset, 5, board().ledMatrixState.image, 0)
|
leds.copyTo(offset, 5, board().ledMatrixState.image, 0)
|
||||||
runtime.queueDisplayUpdate()
|
return false;
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function height(leds: Image): number {
|
export function height(leds: Image): number {
|
||||||
@@ -216,15 +234,16 @@ namespace pxsim.ImageMethods {
|
|||||||
|
|
||||||
namespace pxsim.basic {
|
namespace pxsim.basic {
|
||||||
export function showNumber(x: number, interval: number) {
|
export function showNumber(x: number, interval: number) {
|
||||||
if (interval < 0) return;
|
if (interval <= 0)
|
||||||
|
interval = 1;
|
||||||
let leds = createImageFromString(x.toString());
|
let leds = createImageFromString(x.toString());
|
||||||
if (x < 0 || x >= 10) ImageMethods.scrollImage(leds, 1, interval);
|
if (x < 0 || x >= 10) ImageMethods.scrollImage(leds, 1, interval);
|
||||||
else showLeds(leds, interval * 5);
|
else showLeds(leds, interval * 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function showString(s: string, interval: number) {
|
export function showString(s: string, interval: number) {
|
||||||
if (interval < 0) return;
|
if (interval <= 0)
|
||||||
|
interval = 1;
|
||||||
if (s.length == 0) {
|
if (s.length == 0) {
|
||||||
clearScreen();
|
clearScreen();
|
||||||
pause(interval * 5);
|
pause(interval * 5);
|
||||||
@@ -254,7 +273,16 @@ namespace pxsim.basic {
|
|||||||
|
|
||||||
namespace pxsim.led {
|
namespace pxsim.led {
|
||||||
export function plot(x: number, y: number) {
|
export function plot(x: number, y: number) {
|
||||||
board().ledMatrixState.image.set(x, y, 255);
|
board().ledMatrixState.image.set(x, y, 0xff);
|
||||||
|
runtime.queueDisplayUpdate()
|
||||||
|
}
|
||||||
|
|
||||||
|
export function plotBrightness(x: number, y: number, brightness: number) {
|
||||||
|
const state = board().ledMatrixState;
|
||||||
|
brightness = Math.max(0, Math.min(0xff, brightness));
|
||||||
|
if (brightness != 0 && brightness != 0xff && state.displayMode != DisplayMode.greyscale)
|
||||||
|
state.displayMode = DisplayMode.greyscale;
|
||||||
|
state.image.set(x, y, brightness);
|
||||||
runtime.queueDisplayUpdate()
|
runtime.queueDisplayUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -272,7 +300,7 @@ namespace pxsim.led {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function setBrightness(value: number): void {
|
export function setBrightness(value: number): void {
|
||||||
board().ledMatrixState.brigthness = value;
|
board().ledMatrixState.brigthness = Math.max(0, Math.min(255, value));
|
||||||
runtime.queueDisplayUpdate()
|
runtime.queueDisplayUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -286,7 +314,7 @@ namespace pxsim.led {
|
|||||||
runtime.queueDisplayUpdate()
|
runtime.queueDisplayUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
export function displayMode() : DisplayMode {
|
export function displayMode(): DisplayMode {
|
||||||
return board().ledMatrixState.displayMode;
|
return board().ledMatrixState.displayMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
namespace pxsim {
|
namespace pxsim {
|
||||||
|
const SERIAL_BUFFER_LENGTH = 16;
|
||||||
export class SerialState {
|
export class SerialState {
|
||||||
serialIn: string[] = [];
|
serialIn: string[] = [];
|
||||||
|
|
||||||
public recieveData(data: string) {
|
public receiveData(data: string) {
|
||||||
this.serialIn.push();
|
this.serialIn.push();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -13,18 +14,15 @@ namespace pxsim {
|
|||||||
|
|
||||||
serialOutBuffer: string = "";
|
serialOutBuffer: string = "";
|
||||||
writeSerial(s: string) {
|
writeSerial(s: string) {
|
||||||
for (let i = 0; i < s.length; ++i) {
|
this.serialOutBuffer += s;
|
||||||
let c = s[i];
|
if (/\n/.test(this.serialOutBuffer) || this.serialOutBuffer.length > SERIAL_BUFFER_LENGTH) {
|
||||||
this.serialOutBuffer += c;
|
|
||||||
if (c == "\n") {
|
|
||||||
Runtime.postMessage(<SimulatorSerialMessage>{
|
Runtime.postMessage(<SimulatorSerialMessage>{
|
||||||
type: "serial",
|
type: 'serial',
|
||||||
data: this.serialOutBuffer,
|
data: this.serialOutBuffer,
|
||||||
id: runtime.id
|
id: runtime.id,
|
||||||
|
sim: true
|
||||||
})
|
})
|
||||||
this.serialOutBuffer = ""
|
this.serialOutBuffer = '';
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -51,4 +49,8 @@ namespace pxsim.serial {
|
|||||||
export function redirect(tx: number, rx: number, rate: number) {
|
export function redirect(tx: number, rx: number, rate: number) {
|
||||||
// TODO?
|
// TODO?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function redirectToUSB() {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -11,6 +11,8 @@
|
|||||||
"Tinkertanker/pxt-ssd1306-microbit"
|
"Tinkertanker/pxt-ssd1306-microbit"
|
||||||
],
|
],
|
||||||
"preferredRepos": [
|
"preferredRepos": [
|
||||||
|
"Microsoft/pxt-neopixel",
|
||||||
|
"Microsoft/pxt-microturtle",
|
||||||
"calliope-mini/pxt-calliope-modem",
|
"calliope-mini/pxt-calliope-modem",
|
||||||
"calliope-mini/pxt-calliope-bc95",
|
"calliope-mini/pxt-calliope-bc95",
|
||||||
"calliope-mini/pxt-calliope-esp",
|
"calliope-mini/pxt-calliope-esp",
|
||||||
|
|||||||
Reference in New Issue
Block a user