• 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;
      
      jsvInit();
      

    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());

About

Avatar for JumJum @JumJum started