Avatar for JumJum


Member since Oct 2013 • Last active May 2018
  • 107 conversations

Most recent activity

  • in ESP32
    Avatar for JumJum

    Is there an (easy) way to calculate how many vars would be needed, based on saved ?

  • in ESP32
    Avatar for JumJum

    Worked a bit on a switch for BLE.
    To be prepared for surprises, the idea is to calculate available jsVars.
    Assumptions are:

    • heap of 50000 bytes is sufficient
    • use steps of 100
    • maximum no. of JsVars is 20000
      Do you guys agree ?

    int heapVars;
    heapVars = (esp_get_free_heap_size() - 50000) / 16;
    heapVars = heapVars - heapVars % 100;
    if(heapVars > 20000) heapVars = 20000;
    jsVarsSize = heapVars;

    One more question could we do something like
    Bluetooth = nothing;
    NRF = nothing;

    or with a new (empty) object called isDisabled
    Bluetooth = new(isDisabled());
    NRF = new(isDisabled());

  • in ESP32
    Avatar for JumJum

    In a very early state I found a way to switch BLE on or off under testing.
    Workflow right now is like this

    • added an ESP32 specific command (ESP32enableBLE(mode);)
    • this functions stores a flag in Flash (in the moment partition free)
    • HWreset the board
    • during startup, read the flag from Flash, and according to that init BLE, or not
      Results in my test environment is heap of 103388 to 74252.
      This would be around 2000 additional jsVars, if BLE is not used

    Before making this nicer, better tested etc, I've some questions

    1. Should we use partition free, or is there a better place ?
    2. Do we need a message during startup, that BLE is disabled ?
    3. Is there a way to make NRF, Bluetooth and others inactive, so they cannot be called by accident ?
    4. Is there an option to use of HWReset ?
    5. some other questions, not comin to my mind right now ;-)
    6. what should be default setting, with or without BLE ?
  • in Porting to new Devices
    Avatar for JumJum

    @Wilberforce, thats correct, first of all I've to pair in Admin screen. Same as with Puck.
    With actual version this step works fine, I see connected.
    If devicename is like PUCK* or Espruino now, the board is shown in Select list of WebIDE
    After click on connect, connection starts. on ESP32 I see the connected event
    Next, after a second or two, an MTU event appears which gives size of MTU (AFAIK) only
    And then, 3 more seconds later we get a disconnect event.

    Does windows expect something, that ESP32 does not deliver or ????

  • in Porting to new Devices
    Avatar for JumJum

    Problem was missing SetDeviceInitialised for Serial1.
    Now LoopbackA.setConsole() and Serial1.setConsole() works fine.

    BTW, looks to me, like LOOPbackA and LoopbackB are not initialised, at least flag is not set.

    One more success, Bluetooth.setConsole works fine, and next Serial1.setConsole from my Android with nRf UART V2.0 returns control to webIDE.
    Life can be so beautiful.

    Now I've to figure out, why Windows10 does not like my ESP32, .......

  • in Porting to new Devices
    Avatar for JumJum

    Oh, LoopbackA.setConsole(), and I get an illegal instruction panic
    If I call Serial1.setConsole() without LoobackA.setConsole before, everything looks fine.
    Now have to do some work to check stack and see how panic happens.

    Problem starts in jshUSARTSetup, have to dig deeper.

    Oh, this problem is fixed, default in switch for serial ports was wrong.
    But now the problem is the same as before with Bluetooth.
    Console does not come back.

    One more chance for me to dig deeper, .....

  • in Porting to new Devices
    Avatar for JumJum

    Now that Bluetooth.print works fine, next step is to test Bluetooth as console.
    First step is to write a simple function, which

    1. set a timeout
    2. in this, timeout set bluetooth to console
      2.1. set one more timeout
    3. in this timeout set Console back to Serial1
      Some prints are added to each step.

    Expectation for this function is,

    • after 1 sec console is switched to Bluetooth, which happens
    • 5secs later console is switched back to Serial1, which never happens

    Hopefully the following description is not too confusing

    function testConsole(){
        setTimeout(function()  {
          //Bluetooth.print("BT \n");     Serial1.print("Ser BT \n");
          //Bluetooth.print("SER set\n"); Serial1.print("Ser SER set\n");
        //Bluetooth.print("BT set\n");    Serial1.print("Ser BT set\n");

    Testing itself is

    • upload the function
    • start uart service in WebIDE
    • connect from my android to uart service with nRF UART v2.0
    • call the function TestConsole in WebIDE

    On WebIDE I see

    testConsole() // start of function(see function above)**
    -> Bluetooth // Message from firmware
    Ser BT set // Bluetooth is set to console
    Ser BT // before setting Serial to be console

                                   // message missing from firmware, that Serial1 is switched back from BT
                                  // message missing from 2nd setTimeout, that serial is set to console

    In nRF Uart everything looks like expected

    RX: <- Serial1 //message from firmware, console switched from Serial1 to BT
    BT set // Bluetooth is set to Console
    BT // before switching back to Serial

    [J->Serial1 // message from firmware, console switched to Serial
    RX: Ser set // message from 2nd setTimeout, console is switched back to Serial1