Switching BLE on/off and get additional 29KB into heap #7087
Replies: 1 comment
-
Posted at 2018-05-16 by @gfwilliams
Use a 'file' in
Then
I doubt it. If the flag has been set then people will know. I guess BLE functions may need a check & exception in there to ensure they can't be used if BLE hasn't been enabled?
Not easily. You could add a
http://www.espruino.com/Reference#l_ESP32_reboot ?
I'd say with BLE. We have the feature, so most people will want to be able to 'just use' it. Posted at 2018-05-17 by Wilberforce
That 'free' paritition is actually in use! Or it's labelled as such as it's in the flash available list... The wifi config is actually stored in esp-idf nvs (non-volatile-storage ) area. There is a partition set up for this (12K) . http://esp-idf.readthedocs.io/en/latest/api-reference/storage/nvs_flash.html?highlight=nvs So it would be easy to use this library to store blu config details. However, as @gfwilliams has said above - the Storage module might be better. @MaBecker has ported the ESP8266 to store the wifi details in the Storage module: So this might be the better way to go. I was considering porting the ESP32 wifi config to use this, as it we can extend the fuctionality to store multiple AP details etc. Gordon >Use a 'file' in require("Storage") - so use jsfFindFile. jsfReadFile would be perfect but One way of dealing with this would be that if this setting is changed, the board saves the setting. Then a reboot - is forced - so the system then starts with the new setting? The number of jsvars could be varied at this point.
Posted at 2018-05-17 by @gfwilliams
Yes, that sounds like a good plan.
I'm not sure how we'd do that without modifying the interpreter internals (especially the help message). It's also likely someone may have retained a reference to the function - eg
Totally - or even just display a message saying Just a quick gotcha here: Posted at 2018-05-18 by JumJum Worked a bit on a switch for BLE.
One more question could we do something like or with a new (empty) object called isDisabled Posted at 2018-05-18 by @gfwilliams Yes, you could calculate the vars - but as I said above it'll mess up saving/loading if there isn't a fixed number of vars.
This is what @wilberforce suggested. If you had saved code there are still ways to keep access to that object so it can be used - but I guess if you're destroying any saved code when you update it's ok. On boot you'd need to Personally I'd recommend modifying each function - that way the user actually gets a Posted at 2018-05-18 by JumJum Is there an (easy) way to calculate how many vars would be needed, based on saved ? Posted at 2018-05-18 by @gfwilliams You could copy jsfLoadStateFromFlash and then make it decompress all the code without writing it anywhere. Personally I'd say this is all getting a bit too complicated though - in a way it's nice just to have two clear numbers of vars available that you can tell people: It's X with, Y without. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2018-05-16 by JumJum
In a very early state I found a way to switch BLE on or off under testing.
Workflow right now is like this
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
Beta Was this translation helpful? Give feedback.
All reactions