Code Monkey home page Code Monkey logo

pxt-brainpad's Introduction

GHI Electronics Brain Pad target for MakeCode

Build Status Community Discord

Local Dev setup

These instructions assume familiarity with dev tools and languages.

In a common folder,

npm install
jake
  • go to pxt-common-packages and run
npm install
npm link ../pxt
  • go to pxt-brainpad and run
npm install
npm link ../pxt
npm link ../pxt-common-packages

to run the local server

From root github folder,

cd pxt-brainpad
pxt serve --cloud

If you are editing C++, install [docker.com] and make sure your drive is shared.

pxt serve

to build and deploy a single package via command line

cd libs/core
pxt deploy

Updating CODAL dependency

pxt clean
  • build again
pxt buildtarget

Releasing the editor

The version served under / is controlled by /docs/index-ref.json. Change the version in that file and push to immediately update the version.

Each time you bump (using pxt bump) and the build passes, the /beta will point to that release. /beta can be used to test new features before pushing down the release to all users. The update is handled automatically by MakeCode afterwards.

Be careful when updating the version number of the editor, as MakeCode follows semver. In particular, do not change the major version unless you are releasing a completely new and incompatible editor.

  • run pxt udpdate to pick any updates to the PXT engine
  • run pxt bump to create a new release (say vX.Y.Z)
  • wait for build to finish, typically 10 minutes
  • test new build in /beta. You can check the version number in the bottom of the home screen is vX.Y.Z. Remember that it will update the background and load after a dozen of seconds or so.
  • when ready and tested, run pxt tag index vX.Y.Z, and commit /docs/index-ref.json if successfull. This command does some routine checks to make sure everything is ok.

License

MIT

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

pxt-brainpad's People

Contributors

greg-norris avatar guillaumejenkins avatar jwunderl avatar microsoft-github-policy-service[bot] avatar mmoskal avatar palomino34 avatar pelikhan avatar riknoll avatar robobyt avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pxt-brainpad's Issues

C++ build fails

r/pxtapp/base/pxt.cpp.obj -MF CMakeFiles\BRAINPAD.dir\pxtapp\base\pxt.cpp.obj.d -o CMakeFiles/BRAINPAD.dir/pxtapp/base/pxt.cpp.obj -c ../pxtapp/base/pxt.cpp
../pxtapp/base/pxt.cpp:184:1: error: 'ramint_t' does not name a type
 ramint_t Segment::growthFactor(ramint_t size) {
 ^
../pxtapp/base/pxt.cpp:201:25: error: variable or field 'growByMin' declared void
 void Segment::growByMin(ramint_t minSize) {
                         ^
../pxtapp/base/pxt.cpp:201:25: error: 'ramint_t' was not declared in this scope
../pxtapp/base/pxt.cpp:205:22: error: variable or field 'growBy' declared void
 void Segment::growBy(ramint_t newSize) {
                      ^
../pxtapp/base/pxt.cpp:205:22: error: 'ramint_t' was not declared in this scope
../pxtapp/base/pxt.cpp:579:1: error: expected '}' at end of input
 } // namespace pxt
 ^
[6/89] Building CXX object CMakeFiles/BRAINPAD.dir/pxtapp/core/dmac.cpp.obj
ninja: build stopped: subcommand failed.

***
*** Build failed: target build failed: Exit code: 1 from cd built/codal; python build.py
Error: Exit code: 1 from cd built/codal; python build.py
    at ChildProcess.<anonymous> (C:\gh\pxt\built\nodeutil.js:86:24)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
***

avatar.svg and loader.svg sizes need to be reduced

12:42:25 Skipped data-uri embedding of ../docs/static/avatar.svg because its size (107806 characters) exceeds IE8-safe 32768 characters!
12:42:25 Skipped data-uri embedding of ../docs/static/loader.svg because its size (190347 characters) exceeds IE8-safe 32768 characters!

codal build broken

pxt buildtarget
...
ER -MMD -MT CMakeFiles/BRAINPAD.dir/pxtapp/base/pxt.cpp.obj -MF CMakeFiles\BRAINPAD.dir\pxtapp\base\pxt.cpp.obj.d -o CMakeFiles/BRAINPAD.dir/pxtapp/base/pxt.cpp.obj -c ../pxtapp/base/pxt.cpp
../pxtapp/base/pxt.cpp:184:1: error: 'ramint_t' does not name a type
 ramint_t Segment::growthFactor(ramint_t size) {
 ^
../pxtapp/base/pxt.cpp:201:25: error: variable or field 'growByMin' declared void
 void Segment::growByMin(ramint_t minSize) {
                         ^
../pxtapp/base/pxt.cpp:201:25: error: 'ramint_t' was not declared in this scope
../pxtapp/base/pxt.cpp:205:22: error: variable or field 'growBy' declared void
 void Segment::growBy(ramint_t newSize) {
                      ^
../pxtapp/base/pxt.cpp:205:22: error: 'ramint_t' was not declared in this scope
../pxtapp/base/pxt.cpp:579:1: error: expected '}' at end of input
 } // namespace pxt
 ^
[6/94] Building CXX object CMakeFiles/BRAINPAD.dir/pxtapp/core/i2c.cpp.obj
ninja: build stopped: subcommand failed.
INTERNAL ERROR: Error: Exit code: 1 from cd built/codal; python build.py
    at ChildProcess.<anonymous> (C:\gh\pxt\built\nodeutil.js:86:24)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)

last pull

sorry, I had to use PR request instead of master branch.

Accelerometer support

  • support in CODAL for sensor
  • test and validate reading ranges, axis orientation (C++ CODAL)
  • test gesture recognition (C++ CODAL)
  • integrate changes in pxt-brainpad
  • test simulator support
  • test hardware support (MakeCode)

Bootloader interaction

Follow up from the call: It's important to make the bootloader interactions as simple as possible. This is what happens with Adafruit:

  • when a MakeCode program is flashed, a particular flash location is set so that the bootloader knows that it is in "MakeCode" mode
  • in MakeCode mode, pressing reset once flips between bootloader and user mode when connected to USB
  • when not connected to USB (i.e., it fails to connect to the computer in 2 seconds or so), it flips back to user mode, which effectively turns it into a reset button
  • when connecting the device to USB, it automatically goes into bootloader mode.
  • the green LED glows (in case that matters).

Downloading project twice

After clicking download, the download complete window appears with the instructions on how to load the project to the BrainPad, there is another button on that window clicking on it downloads the file a second time. Do we need the download button again since it's already downloaded on the first click? Everyone that has tested so far ends up downloading the project twice.

downloadwindow

Light sensor

  • write CODAL sample that validates light sensor values (C++)
  • integrate CODAL modification to MakeCode package
  • test simulator: validate light sensor range (0..255) (MakeCode)
  • test simulator: validate that light sensor events trigger (MakeCode)
  • test hardware: validate light sensor range (0..255) (MakeCode)
  • test hardware: validate that light sensor events trigger (MakeCode)

Loader svg

We need a monochromatic logo (svg) to be used for the loading dialogs. This is the waiting loading dialog that shows up when you create a new project etc...
Just attach the file here.

test screen

I somehow managed to loose my brainpad board. Please try out the screen rendering on the latest build.

let y = 0
let x = 0
forever(function () {
    x = Math.randomRange(0, screen.width - 1)
    y = Math.randomRange(0, screen.height - 1)
    screen.fillRect(x, y, 4, 4, 1)
})

use new pixel format

The new pixel format in images should be now exactly what you guys expect. I think you just need to do the following, but please test.

CC @pelikhan

diff --git a/source/BrainPadDisplay.cpp b/source/BrainPadDisplay.cpp
index ea28e88..c8fb835 100644
--- a/source/BrainPadDisplay.cpp
+++ b/source/BrainPadDisplay.cpp
@@ -69,14 +69,6 @@ void BrainPadDisplay::flush() {
 }

 void BrainPadDisplay::writeScreenBuffer(uint8_t* buffer) {
-    for (int x = 0; x < 128; x++) {
-        for (int y = 0; y < 64; y++) {
-            int offset = y * 16 + x / 8;
-            int mask = 0x80 >> (x & 7);
-
-            drawNativePixel(x, y, (buffer[offset] & mask) > 0);
-        }
-    }
-
+    memcpy(vram + 1, buffer, vramSize - 1);
     flush();
 }

lightbulb.setColor() function is different between Blocks and JavaScript.

When dragging the "set light bulb to" block into the staging area, it works fine when switching between Blocks and Javascript. After dragging "setColor()" on the JavaScript side, I get an error when trying to switch back into the Block editor.

The block code side creates this function when switching to Javascript
lightbulb.setColor(0xFF0000)

The Javascript side creates this function when dragging in.
lightbulb.setColor(Colors.Red)

Neither of these functions seem to work correctly when trying to use them inline in Markdown examples.

Testing components on simulator & Brainpad.

Tested components on simulator:

  • accelerometer
  • temperature sensor
  • light sensor
  • buttons
  • display
  • servo motors
  • light bulb
  • Buzzer

Tested components on physical BrainPad:

  • accelerometer
  • temperature sensor
  • light sensor
  • buttons
  • display
  • servo motors
  • light bulb
  • Buzzer

'button is pressed' parameter, not working in Sim.

When running this code, it doesn't work in the Simulator, but does work when deployed to the BrainPad.

forever(function () {
    if (input.buttonU.isPressed()) {
        lightbulb.setColor(0xff0000)
    } else {
        lightbulb.setColor(0x00ff00)
    }
})
``

I2C issue updated?

Has the I2C issue been resolved concerning the screen? I would like to work on a Display tutorial, but we would also like to get the BrainPad to a known state? Our engineers don't want to flood the site with issues from our end with things that are only temporarily down or changing.

255 vs 100%?

There are several places where users can enter parameters. Such as the "set brightness" block, and the "Colors: red, green, and blue parameter" block. Are the we going to be using the values of '0 - 255' or '0 - 100%' going forward?

We ask this question for two reasons, we want to get our supplemental documentation correct, and we've come across this issue several times in the past. We've had this issue when trying to explain to students, that are new to programming, what these values actually mean. In particular when we refer to things like 'set brightness'. They always assume 0 - 100%. We've found 255 means nothing to new programmers and often can be confusing to them.

Remove screenshots of blocks

You should really try to avoid any kind of block screenshot as they are not localiable and tend to grow stale.
This commit added a bunch of them.
090df8c

Avoid large .gifs

The gif images are too large. You should try to crop and shrink the gifs to the absolute minimum and under 1Mb. Also, all documentations assets should go under /docs/static/... , nothing should go under /sim.

image

Hero image needed

We need the hero image for the editor. It goes here:
image
You can just attach it to this issue. We'll take it from here.

Displaying predefined images or Show String in OnStart Loop

Predefined images added to the on start block don't show in the simulator, even when adding a pause. If I also add an image to the forever loop, then I briefly see the first image in the on start block. Show string block also only visible in the forever block.

Bootloader experience

  • turn LED to green when bootloader mode
  • press reset once goes to bootloader mode when connected to computer
  • go to bootloader mode automatically when connected to computer
  • auto-restart once flashing is done.

Avatar svg

We need a cute avatar svg that will be used in the tutorial bubble. .If you try the Adafruit step by step tutorials, you can see the avatar in the instructions.
image

Build failure - assembly error

Building failing due to assembly error

Build:
https://ci2.dot.net/job/Private/job/pxt_project_blue/job/master/job/pxt-brainpad_Push/6/console

Error:
12:35:10 main.ts(1,1): error TS9200: -> Line 65 (' bl pxtrt::getGlobalsPtr’), error: assembly error
12:35:10 Maybe: bl LABEL (jump out of range at ‘pxtrt::getGlobalsPtr’)
12:35:10 Maybe: bls LABEL (opcode name doesn’t match at ‘’)

getGlobalsPtr is implemented in pxt-common-packages/base, and base is inherited in full in pxt-brainpad

New BrainPad SVG

Here is the a newest version of the BrainPad.svg. This is the our newest BrainPad, with the larger boot-loader button and our newest surface mounted display. (New display works exactly the same as older version)

BrainPadSVG.zip

Local server fails

Clone repo, npm install, pxt serve.

Uncaught TypeError: Cannot read property 'pxtCrowdinBranch' of undefined
    at http://localhost:3232/blb/main.js:2215:123
    at <anonymous>
From previous event:
    at HTMLDocument.<anonymous> (http://localhost:3232/blb/main.

Download section images.

connect
reset
transfer

Here are 3 images for the download section. Also the verbage should read something similar to this.

  1. Take the USB cable you connected to your computer. Plug it into your BrainPad.

  2. Press and HOLD the RESET button until the LIGHTBULB turns GREEN. This will open a new folder.

  3. Click and drag the file you downloaded into the newly opened BrainPad folder.

Screen

  • CODAL driver for screen. Needed an API that takes bitmap buffer.
  • C++ sample and test
  • wrap bitmap buffer in MakeCode API
  • simulator support
  • test hardware support from MakeCode with predefined images.

Servo images?

@pelikhan Are we going to need to create something similar to this in SVG for the servos? Or is there something already built in? If we are making, do we make it as a stand alone image (servos alone) or do we attach it to the BrainPad SVG as one image. All parts ID properly of course.

servomotor

Bootloader issues

I'm trying the latest board that came up via Fedex this morning (Thanks!)

  • no drive showing up when I connect and/or press reset button. Tested on Windows 10.
  • screen display garbage image

image

Temperature sensor

  • refactor temperature singleton to support custom
  • Add support for temperature sensor in codal-brainpad
  • calibrate and test sensor in CODAL C++ sample
  • integrate modifications in pxt-braindpad
  • test simulator support (MakeCode)
  • test hardware support from MakeCode

Pin definition

Now buttons don't work. I try to figure it out and understand the structure of environment in whole.

  1. Have I change something in pxt-common-packages\libs\core\pins.h? (It looks like, \pxt-brainpad\libs\core\dal.d.ts generated from pins.h) It is incorrect defined buttons.
  2. In pxt-brainpad\libs\brainpad\device.d.ts correct pin definition. I guess it is an autogenerated file. Where is it from?

Tutorials

A set of step-by-step tutorials that enumerate each sensor. For each tutorial, a markdown page + image for the gallery

  • light sensor
  • temperature sensor
  • accelerometer
  • servo
  • screen

Incorrect pins for sensors

After deploying firmware light and temperature sensors don't' respond. At the same time when I use Pins function "analog read pin" I get properly values. In config.ts PIN_LIGHT = DAL.PB_1; - is correct. In lightsensore.cpp function sensor(*LOOKUP_PIN(LIGHT), DEVICE_ID_LIGHT_SENSOR) use correct definition? Or the problem in another place? What is the best way fix it up?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.