-
• #2
Hi,
I think the issue you're seeing is that some stuff (the SSD1306 and NFC) will need initialising at power on.
What happens when you type
save()
is it saves the current state of the interpreter, but that doesn't include the external hardware.There's more in-depth info on this here: http://www.espruino.com/Saving
But either you could add the lines:
function onInit() { // remove stuff if setup() was called previously clearInterval(); clearWatch(); // start up properly setup(); }
and save as you were doing, or you could use "save on send" which does what I think you're expecting happens now - which is basically to run all your code at boot time as if it were uploaded fresh each time.
The downside of the second option is you can't fiddle with the code while it's running and then re-save it, but you may not want to do that anyway.
-
• #3
Gordon! Thank you so much for your detailed advice. The path with using "save on send" unfortunately did not work, but setting up the
onInit()
function like you suggested worked like a charm! And thanks for including the resource on Saving, I had not seen that yet. Very helpful. -
• #4
Hi everyone! I fired up an older project today that had been working perfectly, and then (maybe after a firmware update?) I received a similar error. Can anyone please help me understand what I am looking at here?
Here's the first part of my .BOOTCDE:
Modules.addCached("MPR121",function(){exports.connect=function(a,g,d){d=d||{};let b=d.address||90,f={read:c=>a.readFrom(b,c),write:c=>a.writeTo(b,c),touched:function(){a.writeTo(b,0);var c=a.readFrom(b,2);return c[1]<<8||c[0]},setThresholds:function(c,h){for(var e=0;24>e;e+=2)a.writeTo(b,65+e,c),a.writeTo(b,66+e,h)}};a.writeTo(b,[94,0]);a.writeTo(b,[43,1]);a.writeTo(b,[44,1]);a.writeTo(b,[45,0]);a.writeTo(b,[46,0]);a.writeTo(b,[47,1]);a.writeTo(b,[48,1]);a.writeTo(b,[49,255]);a.writeTo(b,[50,2]);f.setThresholds(15,
8);a.writeTo(b,[92,d.config1||32]);a.writeTo(b,[93,d.config2||32]);a.writeTo(b,[94,143]);g&&g(f);return f}});And here's my error message (screenshot):
Any help is greatly appreciated! :)
1 Attachment
-
• #5
Sorry for the delay.
Timeout on I2C Write
is usually when an I2C device isn't responding.Could it be that one of the wires to the I2C device you're trying to connect to has become disconnected/loose?
-
• #6
The chain is as strong as the weakest link. Espruino can save a state, but if you have a peripheral (link) in it that cannot save its state (or configuration) non-volatile, this great Espruino feature fails. This is typical for a lot of products that introduce a great (enhancement) feature to their detriment:
The user blames Espruino not working when in real it is all the stuff around it that is inferior to support the same level of features. Espruino is taken down by its own strength.
Therefore, any feature with such a potential should not be implemented - EXCEPT - where a significant number of use cases that benefit from the feature AND a clear NOTE / DISCLAIMER goes with the documentation about the feature's constraints and the overall context - exquisite to Espruino .
Even with all precautions taken, a feature may open pandora's box because users may not be aware of the ramifications of the constraints in their project. I experienced first hand what it means to withdraw a feature that jeopardizes the reputation of a product. Luckily it is not that serious with the 'save()' feature of Espruino. The repeated occurrence over time though shows that Espruino has reached a level of complexity where for some 'issues' there are no simple answers anymore.
Nevertheless, a loose (breadboard) wire connection can still be the cause, as simple as that.
Hello,
When I have my Wifi plugged in with USB and I load the code through the IDE, everything works fine. The moment I
save()
it breaks and I get the I2C error above. Where should I begin to hunt down what's causing the issue?Full code
Excerpt of code that is raising an error
Full Error Message:
I have also attached an image of the NFC chip I'm using. It is wired as follows:
I have looked at some of the Troubleshooting guides and they suggest:
console.log
/print
statements. I think I have done so.USB.setConsole()
duringonInit()
. That changed nothing.Any pointers would be greatly appreciated, I'm very new to all of this. Thanks in advance!
1 Attachment