-
Exactly.
Also it may be a good idea to specifically say that it happens ONLY when there is a USB cable connected to a PC which is not listening (i.e. not when running on batteries or mains). It really looks bad otherwise, like you couldn't use espruino in standalone mode.
EDIT: never mind, it's already there :)
-
-
Got it from this site http://www.espruino.com/Serial+Bootloader
Is it different instructions for other boards (I have HY-Mini too) or does it need to be updated to include-k
? -
-
-
Success! After countless tries, fiddling with cables, changing ports, pushing espruino buttons in frustration etc finally it went through with no errors. After that every consecutive try so far works fine.
I don't have a clue what was the problem as I'm still using the same cable and USB port. But I guess if you get the same problem then just keep trying, it will come back to life :)
-
@Sacha thanks...
-
Did anyone else have troubles with updating to 1v62? It failed quite badly in my case http://forum.espruino.com/conversations/1250/#comment19230
-
Hi,
I was trying to flash a new version to my 1.3b board but that failed and now I don't really know what to do with my Espruino board as it's kind of bricked - when I plug it in to my linux box it's not recognized at all and blue and red lights are lit very dimly. All I can do is switch into bootloader mode (blue light is pulsing) at which point device pops up in the system as /dev/ttyACM0
When I try to flash with python script then I get this:
python stm32loader.py -p /dev/ttyACM0 -evw ~/Downloads/espruino_1v61/espruino_1v61_espruino_1r3.bin Reading data from /home/graf/Downloads/espruino_1v61/espruino_1v61_espruino_1r3.bin Bootloader version 0x30 Chip id 0x430, STM32F1, performance, XL-density Global mass erase; this may take a while Writing 214728 bytes to start address 0x8000000 Write 256 bytes at 0x8000000 WRITE FAIL - try and recover WRITE FAIL - wait WRITE FAIL - retry WRITE FAIL - try and recover WRITE FAIL - wait
and so on for ever (well I gave up after ~15 minutes). During this time the green light is blinking from time to time.
When I try to flash with WebIDE then it's a bit different. After download is complete green and red LEDs are blinking very quickly for a couple of minutes. Then only the red LED is lit for about a minute and then I get this error message:
Can't find STM32 bootloader. Make sure the chip is reset into bootloader mode by holding down BTN1 while pressing RST
I was flashing without problems with the previous versions and also Espruino was working fine before that failed attempt to update today. Now I can't even flash 1v61.
Any ideas, please?? -
@mgg1010 that's assuming you always have a working internet connection at startup and you want to expose your device to the internet. Both assumptions are not an option if you ask me, but I guess that depends on the project. Thanks for the module BTW :)
-
-
Surely you're just dumping the memory usage before you remove the timer?
Ahhh good catch, thanks! But it was also before I add another timer..
EDIT: That's it! On the first console.log the memory usage was lower because timer was not even set at this point. Then on the second console.log the timer was finally set and memory usage was higher. Thanks for helping me understand this :)
Now it's only the ID numbering that puzzles me.
-
-
One more question because this is driving me nuts and I can't find the reason why
ledTimer
gets incremented at all.What happens when I
clearTimeout(ledTimer)
? Is it set to an empty function so that when it comes to the given time it does nothing, or is it really removed?Also when I add
console.log(process.memory());
at the beginning of watch function then it shows memory usage goes up quite a lot when I press the button before the timeout passed.The output now looks like that:
{"free":1722,"usage":78,"total":1800,"history":44,"stackEndAddress":536909512,"flash_start":134217728,"flash_binary_end":134432224,"flash_code_start":134443008,"flash_length":262144} before: null after: 2 {"free":1695,"usage":105,"total":1800,"history":44,"stackEndAddress":536909512,"flash_start":134217728,"flash_binary_end":134432224,"flash_code_start":134443008,"flash_length":262144} before: null after: 4 {"free":1695,"usage":105,"total":1800,"history":44,"stackEndAddress":536909512,"flash_start":134217728,"flash_binary_end":134432224,"flash_code_start":134443008,"flash_length":262144} before: null after: 6 >
-
-
Turns out
setWatch
andsetTimeout
IDs are shared so that's where value 2 is coming from (watch ID is 1).If I add another watch for
btnPin
(falling) then the timeout ID has value 3 and it's growing +3 every time. That means the ID's value can grow very fast if I have a bunch of timers/watches that I want to add or remove dynamically.And that's just the ID's value growing, the number of timers is the same as far as I understand.
-
It's awesome to have such an easy-to-use tool and to have results in minutes.
Yeah second that. Probably it's just the nature of the forum that you hear mostly about problems - and that's the purpose of this thread :) - but some praise can't be bad. For example I was playing with switches recently and was blown away by
setWatch()
. On Arduino doing timers and debouncing never felt intuitive to me, but on Espruino it's a pleasure. Thanks! -
-
Could someone please explain me how are the IDs allocated? Or even better why it's not like I thought? :)
In this code below I would expect the
ledTimer
to get the same value (ID) over and over again but that doesn't happen.var btnPin = BTN; var ledPin = LED1; var ledTimer = null; digitalWrite(ledPin, 0); var btnWatcher = setWatch(function () { if (ledTimer) { clearTimeout(ledTimer); ledTimer = null; } digitalWrite(ledPin, 1); console.log("before: " + ledTimer); ledTimer = setTimeout(function () { digitalWrite(ledPin, 0); ledTimer = null; }, 4000); console.log("after: " + ledTimer); }, btnPin, {repeat: true, edge: "rising", debounce: 70});
Now when I press the button every 5 seconds I get what I expected:
before: null after: 2 before: null after: 2 ...and so on
But when I press the button every 3 seconds then it's not what I expected:
before: null after: 2 before: null after: 4 ...and +2 every time
-
@mgg1010 Thanks! If it was up to me I would get rid of all the print statements, personally I find them a bit annoying (and cryptic) and it takes up memory too :)
-
-
@gadicc Any thoughts on meteor+espruino over the serial connection (i.e. no wifi)?
Edit:
To be more specific. I'm thinking about data logger where data is continually collected by sensors connected to Espruino and sent to Meteor. All the data would be stored and presented by Meteor. -
-
@possmann sorry I got distracted by other things and never finished this module properly, but as Gordon said it shouldn't be too difficult now - unless you want to handle alarms as events, in which case I'm not able to help :)
As a side note - if you don't need alarms and don't mind hacky solutions then you can use write/read scratchpad functions to persistently store your data in these unused registers.