Exemplo n.º 1
0
        public void handle(object s, USBInterface.ReportEventArgs a)
        {
            if (IgnoreReport)
            {
                return;
            }

            int val       = a.Data[1] << 8 | a.Data[2];
            int buttonNum = ButtonMapper.GetButtonIndex((ushort)val) + 1;

            if (buttonNum <= 0)
            {
                return;
            }

            if (currentBrightness == 0)
            {
                SetDeviceBrightness(Settings.Default.Brightness == 0 ? 80 : Settings.Default.Brightness);
                lastButtonPressTime = DateTime.Now;
                lastButtonPressNum  = buttonNum;
                return;
            }

            // Not sure why each report happens twice, but this will try and weed them out
            if (lastButtonPressNum == buttonNum && DateTime.Now.Subtract(lastButtonPressTime).TotalSeconds < 1)
            {
                return;
            }
            lastButtonPressTime = DateTime.Now;
            lastButtonPressNum  = buttonNum;

            Console.WriteLine(string.Join(", ", a.Data));
            Console.WriteLine("Button " + buttonNum);
            PerformAction(buttonNum);
        }
 public void handle(object s, USBInterface.ReportEventArgs a)
 {
     // Debug.Log(string.Join(", ", a.Data));
     if (a.Data[0] == 0x1) button_state = true;
     else button_state = false;
     if (a.Data[1] == 0x1) angle_delta += 1;
     else if (a.Data[1] == 0xff) angle_delta -= 1;
 }
Exemplo n.º 3
0
 public static void handle(object s, USBInterface.ReportEventArgs a)
 {
     Console.WriteLine(string.Join(", ", a.Data));
 }