-
@Gordon I've attached the partial output from a trace() after the error occurred. This time it manifested itself in some debug code. Basically a i++ became i,+ but again in the same function.
(just noticed i<a.length also became k<a.length)The error is on line 917 of the file. I did a trace before the error occurred and the code was correct (I thought Closure may be corrupting something but that doesn't seem to be the case.)
I have no issues giving you the code but it would take a lot of setup to get it running (you would need an ILI9341 with touch & wiz5500io). Maybe there is something else I could try before that?
I'm unsure about the trace command - would it be worth doing a trace immediately before the error, then immediately after and doing a diff on them to see if there are more corruptions?
(I copied the trace output from the console, is there a better way - maybe a simple dos command to redirect the output from a com port to a file after ECHO trace() > COM5 ?)
I can reproduce the error in about 5 seconds of loading the program - basically a few clicks of the buttons on my ILI9341.
I tried to reproduce the error with less code but haven't managed to yet.
Hopefully i haven't done anything stupid since I don't want to waste your time!
EDIT: Just ran it again - this time:
Uncaught Error: Field or method does not already exist, and can't create it on undefined at line 1 col 48 ...i=0;i<a.length;i++)console.lpg(a.charCodeAt(i));return{x:a.c... ^
log became lpg. The error always seems to be 1 character out.
-
I've tried the latest 1v72 but identical error.I can consistently reproduce the error even after a reset & reload and after adding debug code, its always in the same block of code but it is slightly different each time. I honestly cant see anything wrong with the code (but I've been confident about that before yet wrong!!)
I'll try to investigate a bit more tonight.
-
Hi
All of a sudden I'm getting random code corruption/errors such as this:
Uncaught Error: Field or method does not already exist, and can't create it on undefined at line 1 col 64 ...deAt(1)+a.charCodeAt(2),w:a.charCodeBt(3),h:a.charCodeAt(4),..
As can be seen one of the charCodeAt statements has become charCodeBt !!!
Another example:
at line 1 col 26 {return{x:a.charCodeAt(0+,y:a.charCodeAt(1)+a.charCodeAt(2),...
The closing bracket has become a + symbol.
Maybe its just how the error is being displayed but I don't think so.
I happen to remember someone else having similar issues - was there ever a solution?
-
I thought it would be fine since the pump is only 100W but I hadn't really considered the impact of an inductive load. The specs for the relay are:
General purpose 2 A, 240 VAC
Tungsten 1 A, 240 VAC
Motor 1.60 FLA/8.60 LRA, 240 VACI don't understand the FLA/LRA bit at all (I'm sure google knows!)
Maybe I should consider standard relays - I actually thought solid state would be better since the motor may produce arching at the contacts - I'm not sure if standard circulating pumps have snubbers (if that is the correct term).
The idea of using 5v is appreciated - I didn't know that could be done.
I could obviously just try things out and see how it works out but the last thing I want to do is fire up the boiler with no water circulating (I was considering putting a flow switch in so that the boiler would only turn on if water was circulating) but they are difficult to come across/expensive:
http://uk.farnell.com/gentech-international/fs-05/flow-switch-brass-ac-10bar/dp/1006768
EDIT: Just wondering - has anyone bought from China, I've been a bit dubious but are the sellers usually reliable (even if delivery is a bit slow)?
-
@Gordon I'm also pleased with the speed (I'm getting 130ms from my work office).
As for the temperature - you may have noticed that the readings are within 0.5 deg range - thats because all 5 sensors are on the breadboard at present. The breadboard is in my "workshop" which is a converted garage and doesn't hold the heat very well (hence the 13 deg!).
I have another 5 sensors attached to a length of ethernet cable (I live in a bungalow so its easy to run the cable in the loft & have a small hole in the ceiling to run a short wire into each room.) I will use these these sensors when I go "live".
Wireless would be good but don't suggest things like that - I'm hopeless with scope-creep as it is :)
Those valves look excellent - hopefully you get them working. I currently only have 2 zones (heat & water) but intended to add a few more zone valves - these may provide a simpler solution requiring less plumbing (most of my rads have thermostatic valve heads).
Thanks for the CORS info - I thought it would be more difficult but seems simple enough, especially for GETS. The JSONP is working really well & I like the way integrates so as you suggested I will keep that approach.
One quick question - I'm planning to use this relay module for the boiler & pump (since I already have one):
http://www.amazon.co.uk/gp/product/B007F6Q5QU
How far do you think this could be from espruino if the GPIO's were connected to it using CAT6 cable? I would like to get about 10m if possible. Maybe I should just try it ...
-
@allObjects Thanks for your feedback - really appreciated.
You are correct about tabLinks & tabContents - not sure how that slipped through the code review process;)
Could you explain the 'bootstrapping shell' idea please - is it basically a redirect from espruino to x10host?
I've taken note of your comment on AMD/requireJS And am reading http://requirejs.org/docs/whyamd.html#amd
Your ui controls look excellent - I don't know how I missed that post - is the code available? Is it memory intensive?
As for the forum messages - I hadn't been checking but will do.
-
@Gordon I have been away with work for most of the week so didn't get a chance to fully test the problems described above. The wiznet device & Espruino seem to be working perfectly so long as I don't reset too frequently.
I left my central heating httpserver application running all week and it was still running when I got home.
I have added a new post to the Projects folder and there is a link in that post to a web application currently communicating with Espruino using a Rest interface in real time.
Hopefully I can get more done over the weekend.
EDIT: Hope @Gordon doesn't mind me using his header background image - I'm not the best at web design!
-
I have been working on an Espruino project to control my heating system. Its far from complete but I thought what I have done so far would be worth sharing:
I have created the temperature measurement module (based on DS18B20), a bespoke scheduler module and a "ButtonSet" module to help with a touch-screen user interface (ILI9341).
More interesting is the HttpServer module (wiz550io) which implements a REST web service.
I put together a browser application which communicates with my Espruino using RESTful calls and in future this will allow me to control my home heating system remotely. It currently only performs read operations so I decided to make it available for demonstration of what can be done with espruino.
The server has been running all week without any glitches (or memory leaks). It can be found at:
http://heating.x10host.com/main.html
Please try it out but no denial of service attacks :)
(if it is unavailable I am probably working at it so please try again later)
NOTE: Don't use IE - there is an unresolved issue but Chrome, Safari, Opera & Firefox seem fine also be sure to read "The Software" tab in the application for an explanation of how it works.
EDIT: It's not always so cold - I've been away most of week!
It's now working with IE - it turns out function.name is not available in IE yet.
-
-
Some additional info - the log on my router has numerous errors from this morning when I was having issues:
09:15:51, 30 Nov. OUT: BLOCK [65] First packet is Invalid (TCP 192.168.1.65:50027-?>74.125.195.95:443 on ppp3)
09:15:39, 30 Nov. BLOCKED 1 more packets (because of First packet is Invalid)
09:15:39, 30 Nov. OUT: BLOCK [65] First packet is Invalid (TCP 192.168.1.65:50024-?>74.125.230.230:443 on ppp3)
09:15:38, 30 Nov. ( 1938.530000) Lease for IP 192.168.1.70 renewed by host WIZ550IO (MAC 00:08:dc:1e:00:2f). Lease duration: 1440 min
09:15:38, 30 Nov. ( 1938.530000) Device connected: Hostname: WIZ550IO IP: 192.168.1.70 MAC: 00:08:dc:1e:00:2f Lease time: 1440 min. Link rate: 100.0 Mbps
09:15:38, 30 Nov. ( 1938.460000) Lease requested
09:15:38, 30 Nov. ( 1938.380000) Wire Lan Port 2 up
09:15:32, 30 Nov. ( 1932.080000) Device disconnected: Hostname: WIZ550IO IP: 192.168.1.70 MAC: 00:08:dc:1e:00:2f
09:15:32, 30 Nov. ( 1932.080000) Wire Lan Port 2 down -
This is a bit of an essay but my help others!!
I was getting on great with my wiz550io until I encountered this error today. From browsing the forum it seems like others have also had this but there is no definite reason/solution.
For me it occurs when calling http.get() - there is no response for about 30 seconds then the dreaded "Socket error -7 while sending" is thrown. Once the error occurs it is really difficult to clear. A soft reset, hard reset and even power off/on has no effect - all future http.gets() respond in this way. (I even tried rebooting my PC!!)
In complete frustration I restarted my broadband router (BT Home Hub 5); the error was cleared and everything worked fine for a while only to re-occur about an hour later. Again a reboot of my router was the only way to clear it.
Through further investigation I identified that the error only occurs after a hard reset of Espruino (or power off/on) - not every time but after 2 or 3 resets.
It also appears that the error is cleared if the wiznet device is disconnected from the network for about 10 minutes (or Espruino left powered off). It does not clear if left connected/powered.
I can also clear the error by using the BT Home Hub manager (http://bthomehub.home/) to disconnect then re-connect to the internet which is much faster than a restart.
All this makes me think that the issue may be with the wiznet device, not Espruino.
I am unsure if what I described is how others are getting this error - is it?
I think getting good robust internet connectivity is vital for espruino - after all we are talking the "Internet of Things"!
Now that I know what causes the error & how to resolve it if it happens I should be able to make some progress.
-
-
I've received my wiz550io so decided to install the latest wiznet espruino binary:
http://www.espruino.com/binaries/espruino_1v71_espruino_1r3_wiznet.bin
After installing my board is no-longer recognised as a USB device!
I've gone back to the latest standard binary and all is fine but I would like to get going with working on an http server!
Any ideas?
-
I missed the FedEx delivery this afternoon but have just picked up my delivery from the depot - the first thing I did was look at the F401 version - like you it's the C-01. Hopefully we can make use of them!
I am also from a software background and have little hardware experience. I have been using one of Gordon's boards for a few weeks and have really enjoyed it.
It's a long wait until April for your picos - maybe you should get an official board - if you do just make sure it is a 1v4. I ended up with a 1v3 from digital means but it's fine - very robust & has endured my clumsy soldering!
-
-
-
@Gordon : That worked out perfectly, just what I needed: A couple of extra lines of code saved me about 100 variable blocks!! AND i can use long/descriptive variable & function names since the minifier is now free to do its magic!!
Anyone having "out of memory" issues should try this pattern:
var onInit = function(){ var aaa, bbb, ccc; function one(){ } function two(){ } function three(){ } //all your normal onInit code here one(); delete onInit; //This is the key to saving memory //onInit = unassigned; //also works } onInit();
I am now going to try it on a few of my modules to see if it helps there too.
-
-
I have been really pleased with how much code I can load/run within 48K ram. My current project is getting quite large yet when using minification I still have room for 700 variables.
I would still like to ensure I use as little memory as possible (just in case I hit the limit).
Minification works really well but for those variables that the minifier cannot rename i.e. those that interface with the object (at root level) what length should I try to keep variable names to?
i.e. what are "Short" variable names - I saw this mentioned somewhere but can't find it again?
If I have a module defining an object/class of which there will only ever be one instance, is there any benefit (or overhead!) in having all functions against the objects prototype?
I also tried placing all my main code within onInit(). i.e. instead of:
var aaa, bbb, ccc; function one(){ } function two(){ } function three(){ } onInit(){ one(); }
I used:
onInit(){ var aaa, bbb, ccc; function one(){ } function two(){ } function three(){ } one(); }
This allowed the minifier to rename most of my variables/functions but resulted in more memory being used - why did this happen?
I have read http://www.espruino.com/Internals but not 100% sure about the best approach.
Any other ideas on how to minimise memory usage yet keep my code readable/maintainable would be appreciated.
-
I really want to get going with this but have been put off getting a wiznet device because of the delivery cost to UK.
I'm planning to wait until I have a few items to order and get them all at once from Mouser (delivered from US).
Does anyone know of a better source (hopefully within UK, free delivery?)
-
I came across the following link about speeding up SPI and was wondering if something similar could be implemented in Espruino (maybe it already is - write vs send?).
http://developer.mbed.org/users/Sissors/code/BurstSPI/
I thought it could speed up writing large amounts of data to the ILI9341 but not too sure if it is relevant?
-
-
@Gordon - Further to my reply above I have noticed an issue with 1v72 (it may also happen with 1v71, I haven't had a chance to try). Its regarding the RTC after a hard reset.
Power up Espruino and try this code (it should take 3 and a bit seconds):
function test(){ for (var i=0;i<10000;i++){ var j = new Array(10000); j.fill(0xFF); } } var t = getTime(); test(); console.log(getTime()-t);
Now disconnect IDE, hard reset & run again - zero duration!
(I hope the code above has no syntax errors, I cant run it just at present)
-
@Gordon I tested 1v72 - it seems fine, I tried a few projects and did not get any errors.
Both issues appear to be fixed and it performs better than 1v71 but still slightly slower than 1v70 (by about 10% as you said earlier).
I really appreciate how quickly you managed to sort these issues out.
I've a 2nd wiznet so as a start I will swap them tonight, I'll also remove the solid state relay unit (which was switching a 240v 40w bulb but is not connected to the power supply at present). I've got a display without touch so could also swap that in.
One odd observation - I added some extra code last night to try and move the offending function into a different memory location but the error still occurs in the same place yet the code its now about 100 lines further down the trace. I thought the error may have occurred somewhere else.