Avatar for allObjects

allObjects

Member since Jul 2014 • Last active Apr 2017

Very excited about Espruino and even more so about Pico!

Most recent activity

  • in News
    Avatar for allObjects

    It is a challenging call to stay true to a creators long term goal, take into account 'the market', and the present imperfectnesses... The balance between driving a cause into new, expanded and next territories on an overall scale vs. just mending current 'pains' - 'needs' of users for a particular case - is a lot of 'thought works'. @Gordon, we all appreciate that you are living up to these task... and be so accessible in the forum - often very, very basic questions...

    • 4 comments
    • 159 views
  • in Puck.js
    Avatar for allObjects

    ...burn the excessive energy w/ turning on LED(s)... when voltage raises above a certain level...

    (That's what I do with my excessive solar pv power when battery bank is full: heating water with electricity - the most inefficient way to actually heat water. I divert to a water heater element instead of just short cutting / shunting the pv array and heating it up).

  • in Electronics
    Avatar for allObjects

    kickstarter.com/projects/835­264493/senstone-the-intelligent-wearable­-voice-recorder

    ...don't know about the processor, but could well be Espruino-able!

    (sorry, @Gordon, no competition in mind... on the other hand, puck needs also a fashionable - non-geek / non-engineer - casing...)

  • in Puck.js
    Avatar for allObjects

    My only wish is to have the area on the other side of the switch clear... which means relocate the resistor in the red ellipse... Operating the switch in open case with, for example, a tooth pick, or something similar, the resistor is in the direction of force and pushing any where else than in the direct line make the puck jumpy ;-)

  • in JavaScript
    Avatar for allObjects

    ...did you have a setWatch in root level?... 'never' put 'active/sensitive' things into the root level, 'always' put it into a startup function that is called in onInit() or with setTimeout() as last line in upload. With that you prevent getting your Espruino active before it has finished uploading.

  • in ESP8266
    Avatar for allObjects

    It's often not practical to make code that works both after direct upload and after save() and restart

    ...indeed... therefore, take a look at this tutorial about How to have ONE codebase that works after both direct upload and save() with power cycle (run in no-save AND save mode), even though there are also other ways to get specific code starting after save() and power cycle.

    In the above example, to start the code the application takes advantage of the built in Wifi event of having connected. Very often though, other initializations have to happen in controlled timing related to Wifi having connected. Luckily for code running on ESP8266 flavored boards, the Wifi connected event can be used to initialize things that have to happen after Wifi has connected. Wifi has a built in onPowerCycle to restart the connection with saved (Wifi save()) connection parameters and - on success - to emit this Wifi connected event.

  • in Tutorials
    Avatar for allObjects

    This tutorial was triggered by the forum post about code not running after save() and power cycle and related response, which states:

    It's often not practical to make code that works both after direct upload and after save() and restart

    Conclusion and recommendation: ...indeed... therefore, always choose the format that works for/after save()... to be on the safe side.

    But this is a bit cumbersome while developing, because you need to save the uploaded code every time and do a power-cycle - un-plug and re-plug - to get the code started. To get around this and speed up development, use this stream lined development process.

    • 1. Use function onInit() { ... } rather than E.on('init', function(){ ... });, and start your code after uploading by entering onInit() in the console / left hand pane of the Espruino Web IDE.

    Having to enter onInit() in the console every time after upload of the code to start it is still somewhat cumbersome, therefore

    • 2. Add - for development time - setTimeout(onInit,500); as last line in your code, which makes your overall code structure look like this:

    // ... your application code
    // ...
    // ...
    
    // initialization / start-up code
    function onInit() {
      // ...
    }
    
    // convenience line for dev phase; REMOVE for final save() and normal runtime
    setTimeout(onInit,500);
    

    This last line starts your code automatically after upload has completed in the same way as later on a power cycle will restart it on normal runtime after power cycle / reset. The timeout is added to allow - on the Espruino side - the upload process to complete and do so decoupled from your code start / execution.

    • 3. REMOVE this last line setTimeout(onInit,500); when entering the final development phase where you test save() and power-cycling.

    Bonus for using setTimeout(onInit, ...:

    You can pass development time parameters

    setTimeout(onInit, 500, true, "otherRuntimeParm_mode"); // enable debug, etc.
    

    that overwrite runtime parameters - for example for debugging w/ console output while developing - which automatically go away for the normal runtime. Your overall code may then look something like this complete code template good for code running after both direct upload AND save() :

    Code Template for development AND runtime:

    var dbg = false; // ***d***e***b***u***g*** of for normal runtime
    var mode = "normal"; // other runtime parameter
    // ...
    
    // your app code using global ```dbg``` and ```mode``` runtime vars to
    // control debug/normal runtime behavior, for ex. console output, etc.
    // ...
       if (dbg) console.log("....");
    // ...
    
    // initialization / start-up code
    function onInit(dbgParm, otherParm_mode, ...) {
    
      // accepting / overwriting operation parms while under development
      dbg = dbgParm;
      mode = (mode === undefined) ? mode : otherParm_mode;
    
      // other initialization / startup code
      // ...
    }
    
    // convenience line for dev phase; REMOVE for final save() and normal runtime
    setTimeout(onInit, 500, true, "otherRuntimeParm_mode"); // enable debug, etc.
    
  • in General
    Avatar for allObjects

    The original Espruino board has an SMD area where I put a FRAM / EEPROM on...

Actions