Compare commits

...

24 Commits

Author SHA1 Message Date
2336521df1 0.2.86 2016-04-22 13:38:45 -07:00
2ce72aeb28 Bump pxt-core to 0.2.93 2016-04-22 13:38:43 -07:00
e746c13212 don't filter or throttle serial, let the user deal with it. 2016-04-22 13:12:43 -07:00
9e073aee36 fixing doc links. fix for #49 2016-04-22 12:37:47 -07:00
3906f06a2f 0.2.85 2016-04-22 00:15:11 -07:00
d89747fa46 typo in default value 2016-04-22 00:14:57 -07:00
c4e6618baa 0.2.84 2016-04-22 00:07:31 -07:00
5232be58ce auto adjusting bar graph + debouncing sending data over serial 2016-04-21 23:44:22 -07:00
5a75483811 updated target definition 2016-04-21 22:46:40 -07:00
4b40585690 0.2.83 2016-04-21 14:26:36 -07:00
dd65efaab6 Bump pxt-core to 0.2.92 2016-04-21 14:26:34 -07:00
890c2566af 0.2.82 2016-04-20 07:13:06 -07:00
cd71fc5d13 Bump pxt-core to 0.2.89 2016-04-20 07:13:04 -07:00
f626dd4bbb 0.2.81 2016-04-19 20:52:09 -07:00
956992e9ab Bump pxt-core to 0.2.88 2016-04-19 20:52:08 -07:00
91ddcef6ce 0.2.80 2016-04-19 16:30:49 -07:00
49fa42473f Bump pxt-core to 0.2.86 2016-04-19 16:30:47 -07:00
564de8863a fix scrollbar 2016-04-19 13:26:00 -07:00
1dd70100d6 Merge branch 'master' of https://github.com/Microsoft/pxt-microbit 2016-04-19 13:25:46 -07:00
a38ff18eaf 0.2.79 2016-04-19 12:58:18 -07:00
d46ef1efca Bump pxt-core to 0.2.83 2016-04-19 12:58:16 -07:00
c54cd21efa Don't go through uBit object if not needed 2016-04-19 11:52:44 -07:00
94f18340ec prevent elastic scroll in simulator 2016-04-19 10:06:36 -07:00
13bdcf762d updated dal definition 2016-04-19 09:43:23 -07:00
15 changed files with 81 additions and 34 deletions

View File

@ -11,9 +11,13 @@
"dependencies": {
"microbit": "file:../microbit"
},
"microbit": {
"yotta": {
"config": {
"MICROBIT_BLE_ENABLED": "1"
"microbit-dal": {
"bluetooth": {
"enabled": 1
}
}
}
},
"installedVersion": "zakvul"

View File

@ -12,10 +12,14 @@
"dependencies": {
"microbit": "file:../microbit"
},
"microbit": {
"yotta": {
"config": {
"MICROBIT_BLE_ENABLED": "0"
"microbit-dal": {
"bluetooth": {
"enabled": 0
}
}
}
},
"installedVersion": "rlfgis"
}
}

View File

@ -58,7 +58,7 @@ namespace basic {
int l = s.length();
if (l == 0) {
uBit.display.clear();
uBit.sleep(interval * 5);
fiber_sleep(interval * 5);
} else if (l > 1) {
uBit.display.scroll(s, interval);
} else {
@ -98,7 +98,7 @@ namespace basic {
void forever_stub(void *a) {
while (true) {
runAction0((Action)a);
uBit.sleep(20);
fiber_sleep(20);
}
}
@ -123,6 +123,6 @@ namespace basic {
//% async block="pause (ms) %pause"
//% blockId=device_pause icon="\uf110"
void pause(int ms) {
uBit.sleep(ms);
fiber_sleep(ms);
}
}

View File

@ -132,7 +132,7 @@ namespace control {
//% weight=30 async help=control/reset
//% blockId="control_reset" block="reset"
void reset() {
uBit.reset();
microbit_reset();
}
/**

View File

@ -1,6 +1,7 @@
#include "ksbit.h"
#include <limits.h>
namespace String_ {
//%
StringData *charAt(StringData *s, int pos) {
@ -127,13 +128,13 @@ namespace Math_ {
//%
int random(int max) {
if (max == INT_MIN)
return -uBit.random(INT_MAX);
return -microbit_random(INT_MAX);
else if (max < 0)
return -uBit.random(-max);
return -microbit_random(-max);
else if (max == 0)
return 0;
else
return uBit.random(max);
return microbit_random(max);
}
//%
@ -298,6 +299,6 @@ namespace pxtrt {
//%
void panic(int code)
{
uBit.panic(code);
microbit_panic(code);
}
}

View File

@ -2,7 +2,9 @@
declare const enum DAL {
// built/yt/yotta_modules/microbit-dal/inc//bluetooth/ExternalEvents.h
MICROBIT_ID_BLE = 1000,
MICROBIT_ID_BLE_UART = 1001,
MICROBIT_ID_BLE_UART = 1200,
MICROBIT_BLE_EVT_CONNECTED = 1,
MICROBIT_BLE_EVT_DISCONNECTED = 2,
// built/yt/yotta_modules/microbit-dal/inc//bluetooth/MESEvents.h
MES_REMOTE_CONTROL_ID = 1001,
MES_REMOTE_CONTROL_EVT_PLAY = 1,
@ -294,6 +296,7 @@ declare const enum DAL {
// built/yt/yotta_modules/microbit-dal/inc//drivers/MicroBitDisplay.h
MICROBIT_DISPLAY_EVT_ANIMATION_COMPLETE = 1,
MICROBIT_DISPLAY_EVT_LIGHT_SENSE = 2,
MICROBIT_DISPLAY_DEFAULT_AUTOCLEAR = 1,
MICROBIT_DISPLAY_SPACING = 1,
MICROBIT_DISPLAY_GREYSCALE_BIT_DEPTH = 8,
MICROBIT_DISPLAY_ANIMATE_DEFAULT_POS = -255,
@ -303,7 +306,8 @@ declare const enum DAL {
ANIMATION_MODE_PRINT_TEXT = 3,
ANIMATION_MODE_SCROLL_IMAGE = 4,
ANIMATION_MODE_ANIMATE_IMAGE = 5,
ANIMATION_MODE_PRINT_CHARACTER = 6,
ANIMATION_MODE_ANIMATE_IMAGE_WITH_CLEAR = 6,
ANIMATION_MODE_PRINT_CHARACTER = 7,
DISPLAY_MODE_BLACK_AND_WHITE = 0,
DISPLAY_MODE_GREYSCALE = 1,
DISPLAY_MODE_BLACK_AND_WHITE_LIGHT_SENSE = 2,
@ -384,6 +388,7 @@ declare const enum DAL {
MICROBIT_THERMOMETER_PERIOD = 1000,
MICROBIT_THERMOMETER_EVT_UPDATE = 1,
MICROBIT_THERMOMETER_ADDED_TO_IDLE = 2,
// built/yt/yotta_modules/microbit-dal/inc//platform/yotta_cfg_mappings.h
// built/yt/yotta_modules/microbit-dal/inc//types/ManagedString.h
// built/yt/yotta_modules/microbit-dal/inc//types/ManagedType.h
// built/yt/yotta_modules/microbit-dal/inc//types/Matrix4.h

View File

@ -247,7 +247,7 @@ namespace input {
//% help=input/running-time weight=50
//% blockId=device_get_running_time block="running time (ms)" icon="\uf017"
int runningTime() {
return uBit.systemTime();
return system_timer_current_time();
}
/**

View File

@ -4,18 +4,33 @@
//% color=3 weight=35
namespace led {
// what's the current high value
let barGraphHigh = 0;
// when was the current high value recorded
let barGraphHighLast = 0;
/**
* Displays a vertical bar graph based on the ``value`` and ``high`` value.
* Displays a vertical bar graph based on the `value` and `high` value.
* If `high` is 0, the chart gets adjusted automatically.
* @param value current value to plot
* @param high maximum value, eg: 1023, 255
* @param high maximum value. If 0, maximum value adjusted automatically, eg: 0
*/
//% help=/led/plot-bar-graph weight=20
//% blockId=device_plot_bar_graph block="plot bar graph of %value |up to %high" icon="\uf080" blockExternalInputs=true
export function plotBarGraph(value: number, high: number): void {
export function plotBarGraph(value: number, high: number): void {
let now = input.runningTime();
serial.writeString(value.toString() + "\r\n");
value = Math.abs(value);
let v = Math.abs((value * 15) / high);
if (high != 0) barGraphHigh = high;
else if (value > barGraphHigh || now - barGraphHighLast > 5000) {
barGraphHigh = value;
barGraphHighLast = now;
}
barGraphHigh = Math.max(barGraphHigh, 16);
let v = (value * 15) / barGraphHigh;
let k = 0;
for(let y = 4; y >= 0; --y) {
for (let x = 0; x < 3; ++x) {

View File

@ -180,8 +180,9 @@ namespace pins {
}
if (ms > 0) {
uBit.sleep(ms);
fiber_sleep(ms);
pitchPin->setAnalogValue(0);
// TODO why do we use wait_ms() here? it's a busy wait I think
wait_ms(5);
}
}

View File

@ -31,9 +31,13 @@
],
"public": true,
"dependencies": {},
"microbit": {
"yotta": {
"config": {
"MESSAGE_BUS_LISTENER_DEFAULT_FLAGS": "MESSAGE_BUS_LISTENER_QUEUE_IF_BUSY"
"microbit-dal": {
"bluetooth": {
"enabled": 0
}
}
}
}
}

View File

@ -7,7 +7,7 @@ namespace serial {
* Prints a line of text to the serial
* @param value to send over serial
*/
//% help=/serial/write-line
//% help=serial/write-line
//% blockId=serial_writeline block="serial|write %text"
export function writeLine(text: string): void {
writeString(text);
@ -27,7 +27,7 @@ namespace serial {
* @param value to write
*/
//% weight=80
//% help=/serial/write-value
//% help=serial/write-value
//% blockId=serial_writevalue block="serial|write %name|= %value"
export function writeValue(name: string, value: number): void {
writeString(name);

View File

@ -1,6 +1,6 @@
{
"name": "pxt-microbit",
"version": "0.2.78",
"version": "0.2.86",
"description": "BBC micro:bit target for PXT",
"keywords": [
"JavaScript",
@ -29,6 +29,6 @@
"typescript": "^1.8.7"
},
"dependencies": {
"pxt-core": "0.2.82"
"pxt-core": "0.2.93"
}
}

View File

@ -56,11 +56,14 @@
"hasHex": true,
"deployDrives": "^MICROBIT"
},
"runtime": {
"mathBlocks": true
},
"simulator": {
"autoRun": true
},
"compileService": {
"gittag": "v0.1.7",
"gittag": "v0.1.8",
"serviceId": "ws"
},
"serial": {

View File

@ -5,10 +5,20 @@
<meta charset="utf-8">
<title>microbit simulator</title>
<style>
body {
background: transparent;
overflow: hidden;
}
html {
height: 100%;
width: 100%;
overflow: hidden;
}
body {
height: 100%;
padding: 0;
overflow: hidden;
margin: 0;
-webkit-overflow-scrolling: touch;
overflow-scrolling: touch;
}
</style>
<script src="/cdn/bluebird.min.js"></script>
<script src="/cdn/pxtsim.js"></script>

View File

@ -219,7 +219,7 @@ namespace pxsim.micro_bit {
rx:5, ry:5,
fill:`url(#${gid})`
});
this.thermometerText = Svg.child(this.g, "text", { class:'sim-text', x:60, y:130}) as SVGTextElement;
this.thermometerText = Svg.child(this.g, "text", { class:'sim-text', x:58, y:130}) as SVGTextElement;
this.updateTheme();
let pt = this.element.createSVGPoint();