-
-
-
@Gordon, Mouser specs:
http://no.mouser.com/ProductDetail/STMicroelectronics/STM32F103RFT6/?qs=2ulep4BJ1ieqSd6x3%252bh%252bmg==http://no.mouser.com/ProductDetail/STMicroelectronics/STM32F103RGT6/?qs=9CYplWqnH7H2%252bxyt3bktHg==
and the espruino one:
http://no.mouser.com/ProductDetail/STMicroelectronics/STM32F103RCT6/?qs=%252bB84zevwoRA6TYzZIgOIoA==EDIT: sorry, must be wrong on the mouser site, the datasheets on there say its 72Mhz as well. Nevermind my comment.
-
-
-
-
There are multiple ways to work around this issue of course. I thought it would be great if all the functions in "normal" javascript would be supported on the espruino to make porting code much easier. I could put a few dozen lines of code at the top of my program to create shift() replace() and object.create() but ideally I shouldn't have to if they are normal javascript functions.
All of these functions caused runtime errors when porting running code from node and chrome to the espruino so I figured I'd mention it :).
-
Hi all,
It seems there is no implementation for Object.create().
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create
I couldn't find this discussed anywhere, is this on the roadmap or is there a technical reason why this isn't implemented?
Regards,
Alex
-
Hi All,
I noticed the Array.shift() is missing. It is easily replaced by Array.splice(0,1) but in order for code to work on the espruino exactly as it does on node or chome, it would be a useful addition.
ref: http://www.w3schools.com/jsref/jsref_shift.asp
Regards,
Alex
-
-
Hi,
there is a broken link in motion sensing lights tutorial: http://www.espruino.com/Motion+Sensing+Lights
its the second reference to the pyroelectric sensor:
"Connect the Pyroelectic sensor as follows:" -
First of all, I couldn't agree more with the first two comments. Secondly, I just wanted to clarify something. The RAM contains your variables, since functions and prototypes and objects are variables too, so is all code on the espruino on the RAM? Then when you type save() it saves all those to the flash and loads it back into RAM when called with the onInit()? For my project we won't be using very large arrays of data but we do have a lot of code to run. What exactly is on the flash and what can be stored on the SD card?
-
-
-
Since you fixed the bug, the hasOwnProperty does not work correctly.
agents =
"0":{ "RPCfunctions":{}, "init":function () { console.log(this.agentName + " added"); }, "add":.............................. }
message =
{ "address":"0", "origin":"0", "UID":"4n22krpnok2", "content":{ "method":"add", "params":{"a":71,"b":12}, "id":"2180qsewake8" } }
agent.hasOwnProperty(message.address) == false
-
-
-
that callbacks length is part of the
this.topics[topic] = {agents: { agentId : { callbacks:[]}}, subscriberCount:0};
So that's just an array. I realize codestructure is a bit sloppy, I'm still prototyping ;). I'll try to download the fix you mentioned in the other thread and see if I can get it to run again.
EDIT: ahh you mean the typo.. I tend to mix those up.. let me kick my IDE (not webIDE) :)
-
This is a really strange one.. It may not be related to call or apply at all. I have added a new file on my git, named espruinoMinimized:
https://github.com/AlexDM0/espruinoEVE/blob/master/espruinoMinimized.jsThis is the espruinoCall file but stripped function by function untill the problem is gone. In the espruinoMinimized file, the problem is still present and it can be solved by:
removing:
Eve.prototype.sendOverTransports = function(message) { this.receiveMessage(message); };
and changing 57:
this.sendOverTransports(JSON.stringify(message));
tothis.receiveMessage(JSON.stringify(message));
effectively cutting out the sendOverTransports function.OR:
you can clear lines 124,130,133,134,135:Eve.prototype.alreadyHandledMessage = function(UID) { return this.receivedMessages.indexOf(UID) != -1; };
and the single call to this function on 124.
The functions that are removed HAVE to be used. Functions that are not used do not affect this.
It is funny to note that this only happens when used with the setTimeout().
It looks like after a certain execution time threshold, the setTimeout schedules the next time further away. I tried allocating 250 ms for each function call in the set timeout, ie:
setTimeout(function() { me.sendMessage.apply(me); }, 250); setTimeout(function() { me.sendMessage.apply(me); }, 500); setTimeout(function() { me.sendMessage.apply(me); }, 750); setTimeout(function() { me.sendMessage.apply(me); }, 1000); setTimeout(function() { me.sendMessage.apply(me); }, 1250);
but that doesn't fix the problem... Does that shed any light on the issue?
EDIT: naturally, removing the call I mentioned in the OP and the apply mentioned after that also fix the problem. They are on lines 28 and 153.
-
-
Hi all,
I have encountered a strange problem regarding indices. I have a small snippet of example code that shows this problem:
var a = {}; var c = {}; var b = "0"; a[b] = "hello world"; c["0"] = "hello moon"; console.log(a[b],a[0],a["0"]); // output: hello world undefined undefined console.log(c[b],c[0],c["0"]); // output: undefined hello moon hello moon function foo(id) { console.log(id,a[id], c[id]); } foo(b); // output: 0 hello world undefined foo("0"); // output: 0 hello world undefined
I would expect that a[b] and a["0"] would give the same result?
Thanks for all the help so far!
-
If I upload the code of espruinoCall.js to the espruino, it takes about 15 seconds for all the console.log messages to show up on the webIDE. If I remove the call, it takes less than a second. I also tried to remove the apply's on other places (like 288, apply) and also seems to fix the problem.. Since I'm doing apply on apply on apply, could that run into a recursion problem? I'll try to put this in a small example to see if that could be it.
Also, thank you for the answer on the minify topic ;)
EDIT: throttle did not make a difference. I also don't use minification here.
-
Hi Gordon,
If the callback is unchanged, there the difference in performance between .call/.apply and directly calling (). In this case the callback is still being sent in both versions and it is also being executed succesfully.I will try to create a small example that reproduces the problem. Thank you for your patience, I guess I was hoping you had some sort of hardware profiling/debugging tool that could explain why the method of calling a function makes such a difference.
-
I tried this and it says =undefined after uploading it so I assume it was succesful.
More verbose check: