-
• #2
Tue 2019.07.30
Is it possible that a hard reset is being performed instead of just inserting the battery?
'The green LED will blink on success'
'In a few weeks, The old battery has suddenly lost all its power'
Am I to understand this means a few weeks ago, or does it mean a new battery only lasted a few weeks? Please elaborate.
-
• #3
a few weeks ago, the battery lost all its power from ~90% to ~20% then i changed it today and impossible to scan the puck button.
After changing the battery , the green led flash started sometimes when i click the button .I have hard reseted but the problem persist.
-
• #4
The green led will flash 5 times if you pressed the button when you applied power to the battery. It's the self-test as Robin points out.
If you hard-reset according to http://www.espruino.com/Puck.js#hard-reset then the Puck's Red LED should flash 5 times and all code will be wiped, so you should be back to normal.
Please can you try to update your firmware as described in http://www.espruino.com/Puck.js#firmware-updates ? That would be the first place to debug power usage issues.
I notice that the code itself that you uploaded seems broken (for instance
notify
is not a function so would create an error on just the third line), so if you uploaded you wouldn't expect that to work.Also, if you uploaded 'direct to flash' then the
save()
you added at the end would actually cause a reboot loop that'd stop the device working until you cleared out saved code. I guess that could be an issue? -
• #5
Ok thank you, i'll remove "notify(0)" and will try to update firmware .
I upload the script with noble in node.js program, i'm not using the WEB IDE or Espruino program,
i thought the function to save the script to ram was "save()" .
I want to keep the script after reboot. -
• #6
Tue 2019.07.30
'function to save the script to ram was "save()"' ( sic - save script to flash ROM )
You are correct.
However, . . . placing
save()
in the code itself will have a different effect than typing in on the Left-Hand console side of the WebIDE after upload, as Gordon points out in #4.Please verfiy your setting before upload at:
WebIDE >> Settings >> Communications >> Save On Send
I am not familiar with the process using Noble
-
• #7
Ok, thanks for the clarification - that explains the
echo(0)
. If that's the case then what you're doing is fine.Are you definitely sending newline characters after each line? I notice there's an explicit
\n
at the end - and if that's the only newline then you might be overflowing Espruino's available memory (or not actually executingecho(0)
until after the code has already been uploaded).Please could you try connecting and uploading with the Web IDE and see if that makes any difference? It could well be that there's an issue with your code upload from Noble, and using tools that we know work would help to narrow down where that problem is.
-
• #8
@Christof550, other option with your uploading approach is:
- put your active code - lines 17..93 - into the
onInit()
function - send the
reset(1)
command separately as pre-amble (the true-thy arg clears saved code) - drop the
notify(0); clearInterval(); clearWatch();
-reset()
already took care of this; - send the code (lines 6..93 with active code in
onInit()
function) - send the
save()
command separately as post-amble - it will save the code and invokeonInit()
and get's 'you' going
Any restart of the code / power cycle will then just do fine... (load/execute the - initialization and defining the onInit() - code in to ram and then invoke the
onInit();
). - put your active code - lines 17..93 - into the
-
• #9
Thanks all of you, i 'll try your advice soon.
-
• #11
Thr 2019.08.01
re: 'yes it's the only new line \n'
@Christof550 please re-read @Gordon's 2nd pp in #7 above.
If there is one and only one new line entry, then it is quite possible an attempt is being made to upload one ginormous line of characters. Each code line requires a line terminator, one is not enough.
Was the leading and trailing single grave accent char in L1 and L94 from code block in #1 there as part of the code, or there to make the outlining in the code block stand out and be more presentable?
-
• #12
haa ok ! I'll add a line terminator for each line of codes.
Yes, it's because . i create a string variable in my program for the entire puck JS script to upload.Thanks.
Hi,
My puck.js not advertising anymore, i have changed the battery then the green led flash 5 times sometimes when i click the button.
In a few weeks, The old battery has suddenly lost all its power from ~90% to ~20%.
When the battery has died, i changed it with a the same new then impossible to scan it and these flashes started..
What's the meaning of green led flashing ?
Thanks!
here the script uploaded :