Closed ValdasRK closed 11 years ago
not that I think increasing this size would cause any harm on a reasonable sized machine, I'm curious what usecase you have that benefits from that amount to be read at once given that firmata-messages are 64 bytes only (and the usb-buffers on Arduino are not bigger than that either)?
I'm using Arduino Due. In my project I frequently reading inputs. When I read in once only 512 bytes, then I not getting all data. May be size of 1024 will be OK?
I think you should also make shure FirmataPlattform->poll() is called more frequently. Assuming you are running the serial-line at standard 57600 baud poll it's sufficient to call poll 12times/sec to read all data from the serial interface (with a 512 bytes readcount). You should find out why the callbacks that are called by PerlFirmata take to long to execute (or maybe to much other stuff is done in between). The increase in readsize is just a workaround, the fact the polling-frquency is to low indicates you might have to reconsider your application design. Maybe your application might benefit from multithreadding. While perl-firmata is not designed to be threadsafe (you cannot share the Platform-object amongst threads using it concurrently), you should be able to have 1 thread that handles the interface, receives the callbacks and distributes the actual work to a pool of worker-threads.
increased amount of readining data from 512 to 2048 bytes.