-
-
Hello Gordon
I have 5x i2c rotary encoders wired, each on a diffenet i2c address:
https://www.tindie.com/products/jgilbert/makernet-knob/
I poll them every 250ms.
But it is not stable. From time to time, maybe after hours, i catch the following error:
"InternalError: InternalError: Timeout on I2C Write Transmit Mode 2"
It's repeating endless until i force to reset/restart the espruino using my own E.enableWatchdog(); function. Memory usage is stable.
I was not able to isolate the code. Here is a snip where i catch it.
try { I2C1.writeTo(...,....); d = I2C1.readFrom(...., 8); } catch(x) { log(x); // InternalError: InternalError: Timeout on I2C Write Transmit Mode 2 }
After a soft restart of the espruino using my own watchdog reset, everything is fine again. The encoders are not reseted or restarted. No powercycle was made for the encoders.
Is there a way to recover this i2c issue without a restart of the espruino ?
Thanks
Sacha
-
-
-
-
-
Corrected code. I used the same var for both setWatches.
Same output.pinMode(A1, "input_pulldown"); var a1=setWatch(function(e) { console.log('A1'); console.log(e); },A1, { repeat: true, edge: 'both', debounce: 200 } ); pinMode(A4, "input_pulldown"); var a4=setWatch(function(e) { console.log('A4'); console.log(e); },A4, { repeat: true, edge: 'both', debounce: 200 } );
-
-
Hello Gordon
On the EspruinoWifi. Two buttons connected:
3.3v -> A1
3.3v -> A4Code:
pinMode(A1, "input_pulldown"); var a1=setWatch(function(e) { console.log('A1'); console.log(e); },A1, { repeat: true, edge: 'both', debounce: 200 } ); pinMode(A4, "input_pulldown"); var a1=setWatch(function(e) { console.log('A4'); console.log(e); },A4, { repeat: true, edge: 'both', debounce: 200 } );
When i push the button on A4 or A1 i also get a callback on the other watch.
Output, pressed button connected on A4:
A1 { "state": false, "lastTime": 946685544.60812091827, "time": 946685548.80402851104 } A4 { "state": true, "lastTime": 946685544.78433227539, "time": 946685548.80407905578 }
I expected only receive a setWatch callback from A4.
Thanks
Sacha
-
-
-
Hi Gordon
Not that importand but i would like to let you know.
I logged in with google. It created user85862. When i click on "edit Profile" changing the username to "sacha" does not work.
Sacha