There is no code shown for the character queue, so we can only guess what it does.
Upon a timer event, the contents of the queue are displayed on the LCD. This
assumes that the contents of an entire message are present in the queue, which might not be true.
@ Bst - Not sure if this is related but I like to mention that someone had problem with USB mouse not receiving all events when moved quickly. Maybe we are not pooling the USB bus fast enough or the device is not able to keep up. We will investigate this some more.
If you have urgent needs then let us know as this is not high priority otherwise,
I think I was the one talking about the mouse events, it seems some mice needed a huge scale (20) while other only needed a small one (2-3). Once I got that sorted I think the events came through just fine.
Thanks for your responses. I tryed different things. Without debug, without print calls etc. I set the transmission speed (intercharacter delay) on the barcodescanner to slow. In this case the USB Host poll rate is ~255 ms. Result: I get from a QR code with 30 characters only about 10-11. Is this poll rate really to fast?
Hi,
I just plugged a USB scanner into my FEZ spider, running a testprogram that displays Mouse or keyboard actions, and it actually displays barcodes as should be…
(nothing modified to the code… )
the Spider seems to pick up the scanner as keyboard and when i bleep a barcode each character is picked u by the USBH_KeyboardEventHandler(keyb_KeyDown) event
As my testcode collects pressed keycodes and displays when RETURN is pressed, the scanner output is nicely displayed on my display, including detected RETURN.
Did you solved this issue?
I’m having the exactly the same problem, I tried somethings, like disabling debug, deploying assemblies as Release, running without debugger attached already, none solved, but I still have more to try.
This issue is kind of urgent, for me, i have to deploy the project at the end of October.
The first time I type anything it is doing fine.
But then it gets really slow.
The app is doing other things, it is checking if the reflective sensor are getting anything, each 200ms.
It is also has a TimeoutTimer witch is set 30s, and if during this 30s nothing happens it fire an event, and display a message.
And when I press Enter at the Keyboard it displays the buffer in a DisplayN18.
I’ll try to isolate each of the components today, to check what is causing this behavior.
Gus, just tried the app with only the scanner and one display N18.
I passed a barcode throw the scanner many times and it showed me the following result:
"\n8385857817171918585858585858585"
It should have read “7898215151319”
Following is the code, No Debug, I even tried it without the debugger attached.
public partial class Program
{
USBH_Keyboard keyboard;
void ProgramStarted()
{
display_N18.SimpleGraphics.BackgroundColor = GT.Color.White;
USBHostController.DeviceConnectedEvent += USBHostController_DeviceConnectedEvent;
var devices = USBHostController.GetDevices();
if (devices.Length > 0)
InitializeBarcodeReader(devices[0]);
}
void USBHostController_DeviceConnectedEvent(GHI.Premium.System.USBH_Device device)
{
if (device.TYPE != GHI.Premium.System.USBH_DeviceType.Keyboard)
return;
InitializeBarcodeReader(device);
}
private void InitializeBarcodeReader(GHI.Premium.System.USBH_Device device)
{
keyboard = new USBH_Keyboard(device);
keyboard.InternalThreadPriority = ThreadPriority.Highest;
keyboard.KeyDown += keyboard_KeyDown;
}
string line;
void keyboard_KeyDown(USBH_Keyboard sender, USBH_KeyboardEventArgs args)
{
if (args.Key == USBH_Key.Enter)
{
display_N18.SimpleGraphics.DisplayText(line, Resources.GetFont(Resources.FontResources.small), GT.Color.Black, 10, 10);
line = "";
}
else
line += args.KeyAscii;
}
}