-
Just tested mem release function for BLE and got about 30k back.
Will do some more testing, but looks like we will get up to 2000 vars back :)BTW, after some chatting with Gordon, I'll try to come closer to already existing Bluetooth in Espruino (for Puck.js). World is different between nrf and esp-idf, so this will take some time.
-
Actual status of my work for Bluetooth is here https://github.com/espruino/Espruino/tree/ESP32/targets/esp32/docs/Bluetooth_first_attempt
@wilberforce, tried to contact you on gitter, without success. -
-
I would like to call a javascript function from c and use the return value.
In first test:/*JSON{ "type" : "function", "name" : "ExecJS", "generate" : "jswrap_ExecJS", "params" : [ ["function","JsVar","A Function or String to be executed"] ], "return" : ["JsVar","can be used for everything"] } */ JsVar *jswrap_ExecJS(JsVar *func){ JsVar x = *jspExecuteFunction(func, 0,0,0); jsWarn("na sowas: %d\n",x); jsvUnLock(&x); jsWarn("done\n"); }
got this error, after ExecJS(function(){return 99;}); whats wrong ?
WARNING: na sowas: 99
WARNING: done
=ASSERT(v->flags == JSV_UNUSED) FAILED AT src/jsvar.c:399
#1[r1,l2] Object {#2[r1,l2] Name String [1 blocks] "\xFF" #3[r1,l2] Object { #6[r1,l2] Name String [2 blocks] "timers" #8[r2,l1] Array(0) [ ] #9[r1,l2] Name String [2 blocks] "watches" #11[r2,l1] Array(0) [ ] #13[r1,l2] Name String [1 blocks] "net" #14[r1,l2] String [1 blocks] "\x05\x00\x00\x00\x00\xFF\xFF\xFF" #15[r1,l2] Name String [2 blocks] "history" #25[r1,l1] Array(2) [ #26[r1,l2] Name Integer 0 #19[r1,l1] String [5 blocks] "console.log(\"<\",\"<<\",JSON.stringify(process.env),\">>\",\">\")" #224[r1,l2] Name Integer 1 #213[r1,l1] String [3 blocks] "ExecJS(function(){return 99;});" ] } #17[r1,l2] Name String [2 blocks] "console" #18[r1,l1] NativeFunction 0x40123264 (1) { } #28[r1,l2] Name String [1 blocks] "JSON" #27[r1,l1] NativeFunction 0x401232ac (1) { } #33[r1,l2] Name String [2 blocks] "process" #32[r1,l1] NativeFunction 0x40123210 (1) { }
}
HALTING. -
I spend lot of days to get Bluetooth up and running in a very first simple step
So is time to give a first status.
To be open, I'm not sure, we will ever get it running in a nice way.
Memory consumption in binary file and in RAM is huuuugeThis is what I did in some short steps:
- got the example from esp-idf for UART-Server running
- got connected from my mobile, using nRF Toolbox
- rebuilt source and added to Espruino/targets/ESP32
- got huge binary, up to 1400KB
- created a new partition table to support this big application size
- flashed and got "no heap" and reset, reset, ....
- changed config and removed classic Bluetooth and some other memory eater
- tons of problems, sometimes even without any error message
- had to reduce jsvars from 5000 down to 2000 and now its working
There is still no functionality available in Javascript, and UART is receiving data only.
Question is, should I spend more time on this, or wait for availibility of breadboards with ESP32 wrover which has additional PSRAM. - got the example from esp-idf for UART-Server running
-
-
Looks like Espruino becomes a brand
https://www.cnx-software.com/2017/09/11/getting-started-with-espruino-javascript-on-esp32-with-espino32-board/ -
Shame on me, I didn't even know anything about this debugger.
Anyway, its working on ESP32, what a crazy world ;-)>hello() 1 3 ...r b='World';console.log(1);debugger;console.log(2),foo(bar(a... ^ debug>info locals Locals: -------------------------------- a : "Hello" b : "World" Execution Interrupted at line 3 col 44 ...r b='World';console.log(1);debugger;console.log(2),foo(bar(a... ^ in function "hello" called from line 1 col 7 hello() ^ >
-
-
-
During debugging for software PWM some jsWarn (in jstimer, function jstPinPWM) have been used.
Looks to me, that 2nd var of same type is always shown as zero.
See attached code, where only sequence of 2 vars is changed:jsWarn("duty:%f,period:%d,pulse:%d \n",dutyCycle,period,pulseLength); jsWarn("duty:%f,pulse:%d,period:%d \n",dutyCycle,pulseLength,period);
Result in debug window is:
WARNING: duty:0.5,period:100000,pulse:0
WARNING: duty:0.5,pulse:50000,period:0Or is %d the wrong format ?
-
-
-
Oh, hopefully, your kids will recognize that old man at the door ;-)
Being serious now, what was strange in my code, which took away your time ?Thanks for your feedback. I will do as suggested.
One thing I don't understand, there is an res.end in function uploadStd and another one in function uploadPipe. Are they never called, wrong location, or ??BTW, do you know about any guideline about setting up a VM for Espruino on Windows 10.
-
-
Hopefully this helps (and there is no typo in text :-) ).
First see attached files.
- copy testPipe.html to sd
- connect sd to your board
- copy tesppipeJS.txt to webIDE
- change ssid/passwd and pins to your board
- send to your board
- open http://nameOfServerOnYourBoard/testPipe.html
- fill textarea with a lot of chars, more than 1000
- click Upload piped
- check file on sd in webide console.log(require("fs").readFile("uploaded.html"). In my case only a few lines, up to 25, are found )
- drop file on sd require("fs").unlink("uploaded.html")
- click Upload eventdriven
- do same check as before. In my case the file now holds everything
BTW, looks like different sd cards result in different size for Upload piped
- copy testPipe.html to sd
-
Project is to support uploading of files and save on SD.
It is tested on ESP32, I don't have hardware to compare with espruino board.
If this is a ESP32 problem only, please move it to ESP32 forum.
Doing the job with piping does not save full upload, some data at the end is missingfunction postUpload(req,res){ var a = url.parse(req.url,true); //there is a parameter given for location of new file on SD var f = E.openFile(a.query.pathname,"w"); req.pipe(f,{chunkSize:32, end:false, complete:function(){ f.close(); res.end(); } }); }
Doing same without piping works fine
function postUpload(req,res){ var a = url.parse(req.url,true); var f = E.openFile(a.query.pathname,"w"); req.on("data",function(data){f.write(data);}); req.on("close",function(){ f.close(); res.end(); }); }
-
-
-
-
-
Attached code runs fine, but after moving everything into an object, by removing comments, fails with this error.
*Uncaught Error: Function "listen" not found!
at line 13 col 10}).listen(8080);*
Got this problem on ESP32, could not test on other board. @Gordon, if this is an ESP32 only problem, please move it to that category :-)
Tested this 10 times with both options and always got same result.var wifi = require("Wifi");var http = require("http"); var ssid = "xxxxxxx"; var password = "yyyyyyyyyyyy"; //function httpSrv(){ function init(){ var x; wifi.connect(ssid, {password: password}, function(dt) { http.createServer(function(req,res){ res.writeHead(200); res.end("Hello World"); }).listen(8080); }); } init(); //} //var s = new httpSrv();
-
-
After taking a closer look to latest changes in lib for bluetooth I have some questions.
I will start with setScan. As far as I can see, I have to create an event with a JsVar for adv. This is taken in callback and converted to a BluetothDevice object.
setScan is defined as nrf.setScan. This is the way how all the descriptions are done. IMHO it would be a kind of confusing for users of other boards to use a nrf command. I could imagine to add one more wrapper which connects the same function to Bluetooth Object. Same for setServices etc.
BluetoothUtils holds a lot of helpful functions, which could be used for other boards as well. As far as I understand, there are also some nrf only functions in.