Coder Social home page Coder Social logo

Comments (14)

MrYsLab avatar MrYsLab commented on August 30, 2024

Does lengthening the arduino_wait_time parameter help solve this issue for you?

from pymata-aio.

MrYsLab avatar MrYsLab commented on August 30, 2024

I am closing this issue. If you have any additional information or comments, you can add them here.

from pymata-aio.

VincentYZ avatar VincentYZ commented on August 30, 2024

Sorry for the late reply. I was trying to get different Arduino boards for more testing. For now, at least on this particular board I have, the problem seems to be with the get_analog_map function.

Even if I increase arduino_wait_time to 10, I'm still getting the same error. Increasing get_analog_map timeout threshold appears to be the only way to workaround it.

More hardware/software environment details:

Board Info:
BN: Arduino/Genuino Mega or Mega 2560
VID: 2341
PID: 0042
SN: 5543131323835151E012
Arduino Firmware ID: 2.4 StandardFirmata.ino

It's a knockoff Arduino, but appears to be identical to the genuine board in all aspects that matter.

PC:
Windows 10 running Python 3.6 and latest pymata-aio

I'm running a slightly modified version of your example code here:
https://gist.github.com/MrYsLab/0b9f125f04f171065af0

from pymata-aio.

MrYsLab avatar MrYsLab commented on August 30, 2024

I just tested the code at the link above on a SainSmart 2560 clone by flashing the latest version of
FirmataPlus (2.5.3) using the latest version of the Arduino software 1.8.5 and it starts without issue.
Please note that FiramataPlus is the sketch that is part of this repo and not StandardFirmataPlus.

If this is the only 2560 board you own, I would suggest that you just clone this repo and make the changes locally. There are no planned changes to this library so it is low risk.

I am very reluctant to make changes to the code, not because the change itself is difficult to do, but because of the time it will take to do regression testing and to redo the API documentation. I would need to make the change for the timeout configurable, with the default the current value, so as not to change anything for those with working applications.

Is this an acceptable solution?

from pymata-aio.

VincentYZ avatar VincentYZ commented on August 30, 2024

Thanks for looking into this. I too suspect this issue is specific to particular clone boards. Agree that this doesn't warrant the overheads to change the library since this problem seems rare. Let's consider the issue resolved.

from pymata-aio.

MrYsLab avatar MrYsLab commented on August 30, 2024

Thanks.

from pymata-aio.

chelsell avatar chelsell commented on August 30, 2024

@MrYsLab I'm experiencing what appears to be the very same problem, but it affects genuine Arduinos. In Windows 10, neither my Arduino Mega 2560 or Mega ADK can reliably connect due to the analog map retrieval timing out. I've never seen this problem in MacOS, and on Windows 10 my Arduino Uno works fine. I tried @VincentYZ's change and it works. I can clone the repo to keep this change, but I thought you might like to know that the same issue appears to affect genuine Arduinos.

EDIT: It's also worth mentioning that this problem is at least somewhat random--I can occasionally get the connection to work without changing the timeout threshold, but it's extremely unreliable and I haven't been able to link the successful attempts to something I'm doing differently.

from pymata-aio.

MrYsLab avatar MrYsLab commented on August 30, 2024

@chelsell On the boards that fail, if you first remove the USB, then plug it back in and wait for the tx/rx LEDS to stop flashing, and then start your program does it still fail?

Also, if you increase the timeout beyond 2 seconds, what value works reliably?

from pymata-aio.

chelsell avatar chelsell commented on August 30, 2024

@MrYsLab It sometimes works when I unplug it and plug it back in again (waiting until the lights stop blinking per your suggestion), but never consistently. With the timeout set to 4 seconds, I have yet to see the connection fail and I've tried around 10 times.

from pymata-aio.

MrYsLab avatar MrYsLab commented on August 30, 2024

@chelsell I am considering changing the code to accommodate the larger timeout, but since I am unable to reproduce the problem here, could you please provide some additional information:

  1. On your Windows 10 machine, are you running it natively or as a virtual machine (such as virtualbox)?
  2. What CPU does your computer have (for example, Intel Core i3, etc.)?

Thanks.

from pymata-aio.

chelsell avatar chelsell commented on August 30, 2024
  1. I am running natively.
  2. It's an Intel Core i7, 7700K 4.20GHz

from pymata-aio.

MrYsLab avatar MrYsLab commented on August 30, 2024

Ok, I will make the change in the next few days.

from pymata-aio.

MrYsLab avatar MrYsLab commented on August 30, 2024

@VincentYZ @chelsell I have increased the timeout to 4 seconds and published the change as version 2.21. It is available on pypi.

from pymata-aio.

chelsell avatar chelsell commented on August 30, 2024

Thanks for your prompt attention! Hopefully this will help someone in the future too.

from pymata-aio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.