Compare commits

...

15 Commits

Author SHA1 Message Date
Peli de Halleux
fd73efa8a7 1.0.24 2018-04-16 07:13:02 -07:00
Peli de Halleux
374d9e9595 bumping pxt 2018-04-16 06:59:27 -07:00
Peli de Halleux
196ca79aa3 1.0.23 2018-04-04 08:59:37 -07:00
Peli de Halleux
d17dd09c59 updated pxt ref 2018-04-04 08:54:49 -07:00
Peli de Halleux
75dc59978e 1.0.22 2018-03-29 15:43:54 -07:00
Peli de Halleux
abe06d1594 adding locales 2018-03-29 15:43:44 -07:00
Peli de Halleux
72c6e7086e 1.0.21 2018-03-29 15:11:50 -07:00
Peli de Halleux
46951d44c8 updated package lock 2018-03-29 15:11:37 -07:00
Peli de Halleux
1339d3f579 updating pxt 2018-03-29 15:07:15 -07:00
Peli de Halleux
34af44d299 badge does not work 2017-12-15 14:54:29 -08:00
Peli de Halleux
1199845c52 added build status 2017-12-15 14:53:51 -08:00
Peli de Halleux
003150643d run latest bump build until live 2017-12-15 14:49:36 -08:00
Peli de Halleux
500de7fb13 1.0.20 2017-12-15 14:47:23 -08:00
Peli de Halleux
88934881f9 upgrading various simulator parts 2017-12-15 14:45:38 -08:00
Peli de Halleux
433e8c8805 adding neopixel/microturtle 2017-12-15 14:42:11 -08:00
10 changed files with 1226 additions and 1202 deletions

View File

@@ -1,7 +1,6 @@
# Calliope target for Microsoft MakeCode
This target is hosted at https://makecode.calliope.cc.
This target is hosted at https://makecode.calliope.cc.
## Hosted editor and build

View File

@@ -1,3 +1,3 @@
{
"appref": "v1.0.13"
"appref": "v"
}

View File

@@ -4,8 +4,12 @@
"AcceleratorRange.OneG": "The accelerator measures forces up to 1 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.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|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|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.",
@@ -14,6 +18,8 @@
"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|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.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.",
@@ -33,6 +39,8 @@
"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|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.splice": "Remove elements from an array.",
"Array.splice|param|deleteCount": "The number of elements to remove. eg: 0",

2303
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "pxt-calliope",
"version": "1.0.19",
"version": "1.0.24",
"description": "Calliope Mini editor for PXT",
"keywords": [
"JavaScript",
@@ -30,13 +30,13 @@
"typings": "built/pxtrequire.d.ts",
"devDependencies": {
"typescript": "^1.8.7",
"less": "^2.6.0",
"rtlcss": "^2.1.2",
"autoprefixer": "^6.7.6",
"semantic-ui-less": "^2.2.4"
"less": "2.7.3",
"semantic-ui-less": "2.2.14"
},
"dependencies": {
"pxt-core": "0.14.32"
"pxt-core": "0.18.3"
},
"scripts": {
"test": "node node_modules/pxt-core/built/pxt.js travis"

View File

@@ -1,5 +1,6 @@
{
"id": "calliopemini",
"aliases": ["calliope"],
"name": " calliope mini",
"nickname": "mini",
"title": "Calliope mini - Blocks / Javascript editor",
@@ -224,7 +225,11 @@
}
},
"docMenu": [],
"hasReferenceDocs": false
"hasReferenceDocs": false,
"availableLocales": [
"de",
"en"
]
},
"ignoreDocsErrors": true
}

View File

@@ -18,6 +18,9 @@ namespace pxsim {
speakerState: SpeakerState;
fileSystem: FileSystemState;
// visual
view: SVGElement;
constructor() {
super()
@@ -94,7 +97,7 @@ namespace pxsim {
break;
case "serial":
let data = (<SimulatorSerialMessage>msg).data || "";
this.serialState.recieveData(data);
this.serialState.receiveData(data);
break;
case "radiopacket":
let packet = <SimulatorRadioPacketMessage>msg;
@@ -121,16 +124,22 @@ namespace pxsim {
fnArgs: fnArgs,
maxWidth: "100%",
maxHeight: "100%",
highContrast: msg.highContrast
};
const viewHost = new visuals.BoardHost(pxsim.visuals.mkBoardView({
visual: boardDef.visual
visual: boardDef.visual,
highContrast: msg.highContrast
}), opts);
document.body.innerHTML = ""; // clear children
document.body.appendChild(viewHost.getView());
document.body.appendChild(this.view = viewHost.getView());
return Promise.resolve();
}
screenshot(): string {
return svg.toDataUri(new XMLSerializer().serializeToString(this.view));
}
}
export function initRuntimeWithDalBoard() {

View File

@@ -28,7 +28,7 @@ namespace pxsim {
this.data = data;
}
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 {
if (x < 0 || x >= this.width || y < 0 || y >= 5) return 0;
@@ -131,15 +131,33 @@ namespace pxsim.images {
namespace pxsim.ImageMethods {
export function showImage(leds: Image, offset: number, interval: number) {
pxtrt.nullCheck(leds)
leds.copyTo(offset, 5, board().ledMatrixState.image, 0)
runtime.queueDisplayUpdate()
basic.pause(interval);
let cb = getResume();
let first = true;
board().ledMatrixState.animationQ.enqueue({
interval,
frame: () => {
if (first) {
leds.copyTo(offset, 5, board().ledMatrixState.image, 0)
first = false;
return true;
}
return false;
},
whenDone: cb
})
}
export function plotImage(leds: Image, offset: number): void {
pxtrt.nullCheck(leds)
leds.copyTo(offset, 5, board().ledMatrixState.image, 0)
runtime.queueDisplayUpdate()
board().ledMatrixState.animationQ.enqueue({
interval: 0,
frame: () => {
leds.copyTo(offset, 5, board().ledMatrixState.image, 0)
return false;
}
})
}
export function height(leds: Image): number {
@@ -216,15 +234,16 @@ namespace pxsim.ImageMethods {
namespace pxsim.basic {
export function showNumber(x: number, interval: number) {
if (interval < 0) return;
if (interval <= 0)
interval = 1;
let leds = createImageFromString(x.toString());
if (x < 0 || x >= 10) ImageMethods.scrollImage(leds, 1, interval);
else showLeds(leds, interval * 5);
}
export function showString(s: string, interval: number) {
if (interval < 0) return;
if (interval <= 0)
interval = 1;
if (s.length == 0) {
clearScreen();
pause(interval * 5);
@@ -254,7 +273,16 @@ namespace pxsim.basic {
namespace pxsim.led {
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()
}
@@ -272,7 +300,7 @@ namespace pxsim.led {
}
export function setBrightness(value: number): void {
board().ledMatrixState.brigthness = value;
board().ledMatrixState.brigthness = Math.max(0, Math.min(255, value));
runtime.queueDisplayUpdate()
}
@@ -286,7 +314,7 @@ namespace pxsim.led {
runtime.queueDisplayUpdate()
}
export function displayMode() : DisplayMode {
export function displayMode(): DisplayMode {
return board().ledMatrixState.displayMode;
}

View File

@@ -1,8 +1,9 @@
namespace pxsim {
const SERIAL_BUFFER_LENGTH = 16;
export class SerialState {
serialIn: string[] = [];
public recieveData(data: string) {
public receiveData(data: string) {
this.serialIn.push();
}
@@ -13,18 +14,15 @@ namespace pxsim {
serialOutBuffer: string = "";
writeSerial(s: string) {
for (let i = 0; i < s.length; ++i) {
let c = s[i];
this.serialOutBuffer += c;
if (c == "\n") {
Runtime.postMessage(<SimulatorSerialMessage>{
type: "serial",
data: this.serialOutBuffer,
id: runtime.id
})
this.serialOutBuffer = ""
break;
}
this.serialOutBuffer += s;
if (/\n/.test(this.serialOutBuffer) || this.serialOutBuffer.length > SERIAL_BUFFER_LENGTH) {
Runtime.postMessage(<SimulatorSerialMessage>{
type: 'serial',
data: this.serialOutBuffer,
id: runtime.id,
sim: true
})
this.serialOutBuffer = '';
}
}
}
@@ -51,4 +49,8 @@ namespace pxsim.serial {
export function redirect(tx: number, rx: number, rate: number) {
// TODO?
}
export function redirectToUSB() {
// TODO
}
}

View File

@@ -11,6 +11,8 @@
"Tinkertanker/pxt-ssd1306-microbit"
],
"preferredRepos": [
"Microsoft/pxt-neopixel",
"Microsoft/pxt-microturtle",
"calliope-mini/pxt-calliope-modem",
"calliope-mini/pxt-calliope-bc95",
"calliope-mini/pxt-calliope-esp",