ms-iot/remote-wiring

Digital pin updated REAL slow to report?

JAgostoni opened this issue · 3 comments

I've been trying to figure out what it the issue here but haven't be able to nail it down.

Symptom:
Waiting for digital pin update event is talking a long time or queuing up several updates before it finally bursts through all the pin updates that had happened.

Setup:

  • Arduino UNO (also tried on a YUN) attached via USB, with StandardFirmata 2.5.2, tried with 2.4 as well
  • Windows 10 running on my 64-bit laptop
  • Button hooked up to a digital pin (5 in my test case)

Repo Steps:
In any Win 10 sample app (even the Remote Experience sample) set a pin to INPUT (or PULLUP if you use my fork -- see my PR --).

Capture the DigitalPinUpdated event.

Wire a button (or even a jumper cable straight to 5v [input mode] or GND [pullup mode]) as appropriate for the pin mode.

Run the app, hit the button/jumper one time, verified the Tx light lit-up on my UNO when the state transitioned. I see no output from the DigitalPinUpdated event.

Wait for a while, nothing seems to come through.

Hit the button/jumper a bunch of times and eventually I get a burst of updates from the event.

What I tried/looked at:

  1. First, I verified this exact scenario works fine using an equivalent Johnny-Five program.
  2. I put breakpoints within RemoteDevice's OnDigitalReport() and it is getting called in the same manner as above
  3. Walking back to Firmata I can see that processInput is properly looping
  4. Started looking into UsbSerial but not familiar enough with the code [read() method] to determine a cause
  5. Tried compiling in x86 or x64 ... just in case ;) Same issue.

Ok. I think I figured something out. It is an issue with the SerialDevice class in that the ReadTimeout somehow affects the rate of the serial device. This is an issue in the Maker.Serial repo so I'll fork and submit a PR back over there. I'll add a reference to that issue here for tracking.

Ok. Here is a link to the PR I submitted on the serial-wiring repo: serial-wiring PR 16

Looks like the PR was merged into serial-wiring on the develop branch. Thanks!