• Never mind, there is a bug in the DHT22 library code. PR on it's way :)

    Hi, this will be strange, but feels like Espruino just forgot about pin-change watches set up with setWatch after some time.

    The setup:
    Pixl.js + CCS811 air quality sensor + DHT22.

    • Reading data from the DHT22 every two seconds (setInterval)
    • The CCS811 pulls it's interrupt pin when it has new data. ~every second (setWatch)
    • And refresh the screen every second (setInterval)

    But after a couple of minutes, no data coming from the CCS811. No crash, no restart, plenty of memory. DHT22 still refreshes (so the interval for reading the DHT and refreshing the screen is working) and can still query the CCS811, but the Pixl.JS does not respond to pin changes.

    Also set up watches on BNT 1 - 3, and that too stopped working. BTN 1 and 2 not doing anything useful atm, but the BTN3 setWatch looks like this:

      setWatch(function(e) {
        LED1.toggle();
      }, BTN3, { repeat: true, edge: 'rising' });
    

    The CCS811 js module stores it's watch id, and in my case that was "4". Makes sense, set up 3 buttons, and the CCS811 was the 4th.
    But calling clearWatch(1) (or 2, 3, 4) throws an error: Uncaught Error: Unknown Watch. All pin watches gone!

    I do not use clearWatch anywhere in my code.

    Tested with 2v02 and 2v01, same behavior.
    Any idea what might cause this?

    Edit: already tried just setWatch on BTN3 + pressing it like an idiot, but that worked without issues.

  • One more thing:
    Setting the watches again, numbering starts from 1 again. And both the button and CCS811 works just fine. For a minute or two. Kind of random.

    And all watches disappear at the same time. Stops responding to button presses, and no more data thru CCS811 interrupts.

    E.getErrorFlags returns empty array :/

  • Never mind, there is a bug in the DHT22 library code. PR on it's way :)

  • Thanks!

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Never mind, there is a bug in the DHT22 library code. PR on it's way :)

Posted by Avatar for AkosLukacs @AkosLukacs

Actions