Code Monkey home page Code Monkey logo

espruino's Issues

Better I2C error reporting

Also better error reporting generally, but I2C often gives 'INTERNAL' timeout errors if it doesn't get a response on a certain address.

Moving variables to front of Object

In functions and root scope - move a variable to the front when it is accessed - this should speed up accesses in things like loops quite a lot.

new ArrayBuffer(1) fails

I believe this is an ArrayBuffer iterator problem:

new ArrayBuffer(1)  ==> 'new ArrayBuffer([])' // bad
new ArrayBuffer(2)  ==> 'new ArrayBuffer([0,0])' // good

Serial + USB Wakeup in 'Deep' Sleep Mode

An important one - allow Espruino to be woken from deep sleep mode by Serial and USB. Currently not having this means that Deep sleep is disabled by default.

Broken on Olimexino STM32 board

When flashed onto Olimexino board it just lights up the green LED. This probably means that something bad happened during the hardware initialisation in jshInit

Overclocking/Underclocking

The STM32 chips can be overclocked - some people say by as much as 2x. It'd be fun to have a mode that allowed this :)

GDB-style built-in debugger

Firmly an 'enhancement', but it should be possible to modify the parser to have a built-in debugger that allows s/n/p/q type commands which can single-step through statements.

Ctrl-C could break into this and then Ctrl-C could break out of execution completely. It'd massively help with debugging.

Ability to Input/Output at high(er) speeds

A common way of sending an Array or ArrayBuffer using:

  • Digital outputs (>1 at a time)
  • DAC
  • PWM

Or receiving into an Array/ArrayBuffer:

  • Digital inputs (>1 at a time)
  • ADC

Faster than you could manage with setInterval, but:

  • at a user-defined speed
  • optional repetition
  • a callback on completion or for new buffers

IMO this doesn't need to be complicated with DMA, and we have UTIL_TIMER which we should be able to extend to handle this.

Technical IO have something called 'Signal' that might be able to be extended: http://hardwarejs.io/

Array.map method doesn't pass index and the array to the callback

Array.map must pass 3 arguments to the callback function: the current element, the current index and the array itself. But the current implementation passes only the first argument. Example:

var chars = ['a', 'b', 'c'];
chars.map(function( char, index, arr) {
 //do something
});

Fast String Appends

The first JSV_STRING in a chain could actually store only 8 characters (but a link to the last JSV_STRINGEXT in that chain). It'd allow us to do much faster appends which would help out in a number of areas.

'delete' keyword

Add the JavaScript delete keyword. Should be a lot easier now we have parentinfo

'short' toJSON mode

There should be a way of getting a 'shortened' JSON that can be used in the interactive console. For instance:

[0,1,2,3 ... 100,101,102]

and

function (a,b,c) { ... }

Software SPI implementation (shiftOut)

We should be able to do:

new SPI({mosi:A0,miso:A1,sck:A2})

And have Espruino treat it like normal SPI - but to instead just bit-bash the output. This would be way more useful than a shiftOut function.

It'd also be super-handy if it could take an argument called bits, as the hardware SPI implementation doesn't support 9 bit output and many devices (like LCDs) can work without a Data/Command (DC) pin.

Missing empty "gen" dir

Immediately after checkout:

$ make
...
Outputting decision tree
Traceback (most recent call last):
  File "scripts/build_jswrapper.py", line 135, in <module>
Traceback (most recent call last):
  File "scripts/build_platform_config.py", line 90, in <module>
    wrapperFile = open('gen/jswrapper.c', 'w')
    IOErrorheaderFile = open(headerFilename, 'w')
: [Errno 2] No such file or directory: 'gen/jswrapper.c'IOError
: [Errno 2] No such file or directory: 'gen/platform_config.h'
make: *** [gen/platform_config.h] Error 1
make: *** Waiting for unfinished jobs....
make: *** [gen/jswrapper.c] Error 1

That's because there's missing "gen" folder, which is becasue git doesn't store empty dirs, and way to work that round is to add ".empty" or similar file.

Compatibility with Tessel/Johnny-five etc

Tim from technical.io has come up with this proposal http://hardwarejs.io/ - but at the moment it's a big departure from Espruino's implementation (which already has a bunch of code written for it).

As a starting point (and to be compatible with J5-type arrangements where you can have more than one board) we'll want to have a 'hardware' object with all the existing API calls in. Hopefully this could be the root namespace, so you can still do digitalWrite(LED1,1) but also hardware.digitalWrite(hardware.LED1,1) in order to be compatible...

Integers as Strings in Arrays

a[5]===a["5"]
a[5]!=a["05"]

Espruino doesn't have this behaviour. Easy enough to fix but it's debatable if we want another check to slow down array access even more.

Array access speedup (2x speed)

While arrays are still linked lists, it's possible to speed access up by looking at the last element and working backwards if the index > last_element/2

Debounce in setWatch

It'd be nice if setWatch had some debounce capability. It'll be used quite a lot for interfacing switches, and it's quite a hurdle for beginners to implement debounce.

This could be handled quite easily by modifying the event in the event queue, but it would require that 'debounced' events weren't automatically pulled off of the event queue.

Rename numbered tests

The numbered tests are a pain - it'd help if each test was given a descriptive name, and then test fails could be seen easily.

Add Exceptions

Add JavaScript exceptions - we just need to find a nice way of doing this that doesn't slow us down when we're not using them.

jswHandleFunctionCall optimisations

This needs some experimentation to find a fast way of detecting built-in functions.

It seems like function names should be detected first, and the parent object should then be checked (rather than the other way around) but when I tried this it massively increased the code size.

Pin (and I2C) state to be saved to flash

This would save you having to write initialisation code into an onInit function...

I believe SPI already saves state, so it's just a matter of adding other peripherals - although we'd require a jshGetPinState added to jshardware.h

Remove JsParse pointer

We only need one JsParse active at a time - it'd be good to remove this, we could save some code space as well as a few bytes of stack.

Line wrap for toJSON

toJSON should be aware of line wrappings - it'd really help when dumping to the console

XON/XOFF flow control for Serial

There's the outline of some code for this in jsdevices.c/h already but it's not yet implemented. It'd be pretty handy when copy/pasting code over Bluetooth.

USB CDC bootloader required

We need a USB bootloader so that Espruino devices can be reflashed.

While we could use DFU, it makes a lot of sense to use a USB CDC (fake serial) bootloader implementing a protocol that's compatible with the built-in RS232 one. That way, Espruino can be reflashed from the Web IDE.

setTimeout must return positive id

setTimeout must return positive id. Currently it starts from 0. Zero (false) id usually is used to distinguish initialized and not initialized values.
Example:

if( timer)
 clearTimeout(timer);

timer = setTimeout(function(){}, 1000);

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.