bengtmartensson / AGirs

A Girs infrared server for the Arduino
http://www.harctoolbox.org/Girs.html
GNU General Public License v2.0
55 stars 13 forks source link

issuing a "send" immediately after a "receive" requires waiting for the receive to complete or time out #38

Closed ebukh closed 6 years ago

ebukh commented 6 years ago

If I issue a send command after a receive command to GirsLite, I end up waiting for the receive to either get a signal, or to time out (default is 10 seconds) before my send command is executed. I would like to have a way to interrupt the receive in GirsLite before the timeout elapses, by sending a command such as "end receive", and having it take effect immediately.

bengtmartensson commented 6 years ago

The "receive" command terminates immediately if there are data available in the input stream. So (for example) sending a blank line achieves what you are asking for. You can try it manually in the Arduino serial monitor.

The "capture" command is not interruptable though.

ebukh commented 6 years ago

I tired it over serial, Issued a receive command (receive led goes on). Then immediately pressed enter (i.e. send a blank line). It took ~10s to get back the OK corresponding to the blank line. I got the receive timeout response (".") first. Maybe I misunderstood what you mean by input stream.

bengtmartensson commented 6 years ago

Current version? Try setting the line ending (of the Arduino serial console) to "Carrage return" (bottom row, first entry of the right part).

ebukh commented 6 years ago

Yes (GirsLite 2015-12-01). Set it to carriage return (I had it set to \r\n, which is what my program does), but it still does the same behavior.

bengtmartensson commented 6 years ago

I cannot reproduce; works perfectly for me. Please describe the stuff you are using, your operating system, board, version of the Arduino IDE, version of the AGirs, exactly how you installed etc.

You can also try to send another string like "sdkfsd" to interrupt.

ebukh commented 6 years ago

My OS is windows 7 x64. Board is Arduino nano chinese clone (atmega 328p). USB driver is whatever is installed by the OS automatically. My guess is arduino IDE version doesn't matter, since I can reproduce the same behavior in my own code, but I have version 1.8.5. The firmware was downloaded from here: https://github.com/bengtmartensson/AGirs/files/76248/GirsLite.nano.hex.zip, I also tried compiling my own version, with similar results. It doesn't seem to matter what string I send after I send the receive command. The device only responds after the receive operation has timed out. If I send some random characters, it responds ERROR. If I send newline, it responds OK. capture

bengtmartensson commented 6 years ago

Ok, problem solved. That version is many releases old, 2 and a half years. Yes, it shows the behavior you do not like. Update to the current release 1.0.0. alternatively install AGirs from the Arduino library manager; it is example "Girs". (Must install "Infrared" too).

ebukh commented 6 years ago

That works, thanks a lot. You should update the firmware-related download links in your hardware guide.

bengtmartensson commented 6 years ago

Glad that it is resolved. Ok to close?

Feel free to open issues for the other stuff you mentioned in the personal mail.