Ejemplo n.º 1
0
        private GvLedConfig IdiLedToGvLed(ref IdiLed idiLed)
        {
            GvLedConfig gvLedCfg = new GvLedConfig();

            gvLedCfg.on = idiLed.Enabled;

            switch (idiLed.Mode)
            {
            case IdiLedMode.STATIC:
                gvLedCfg.type = GvLedType.Consistent;
                break;

            case IdiLedMode.FLASH:
                gvLedCfg.type = GvLedType.SingleFlash;
                break;

            default:
                throw new NotImplementedException("Missing implementation of IdiLed mode " + idiLed.Mode.ToString() + " in RGBFusionManager.\n");
            }

            gvLedCfg.color     = new GvLedColour(idiLed.Colour.White, idiLed.Colour.Red, idiLed.Colour.Green, idiLed.Colour.Blue);
            gvLedCfg.maxBright = idiLed.MaxBrightness / 10;
            gvLedCfg.minBright = idiLed.MinBrightness / 10;

            // Not sure what the format of these time values are... can't find information on it in samples of in the docs.
            gvLedCfg.time1 = idiLed.TimeMs0;
            gvLedCfg.time2 = (ushort)(idiLed.TimeMs0 + idiLed.TimeMs1);
            gvLedCfg.time3 = 255;
            gvLedCfg.speed = 1; // Does this solely affect the "flash" speed?

            return(gvLedCfg);
        }
Ejemplo n.º 2
0
        public async Task SetAllLedsAsync(IdiLed idiLed)
        {
            List <Task> taskList = new List <Task>();

            taskList.Add(Task.Run(() => SetAllPeriphLeds(ref idiLed)));
            taskList.Add(Task.Run(() => SetAllMoboLeds(ref idiLed)));

            await Task.WhenAll(taskList);
        }
Ejemplo n.º 3
0
        private GLedSetting IdiLedToGLed(ref IdiLed idiLed)
        {
            GLedSetting gLedSetting = new GLedSetting();

            gLedSetting.m_LedMode = GLedMode.Null;

            switch (idiLed.Mode)
            {
            case IdiLedMode.STATIC:
                gLedSetting.m_LedMode = GLedMode.Static;
                break;

            case IdiLedMode.FLASH:
                gLedSetting.m_LedMode = GLedMode.Flash;
                break;

            default:
                throw new NotImplementedException("Missing implementation of IdiLed mode " + idiLed.Mode.ToString() + " in RGBFusionManager.\n");
            }

            if (idiLed.Enabled)
            {
                gLedSetting.m_Colour = new GLedColour(idiLed.Colour.White, idiLed.Colour.Red, idiLed.Colour.Green, idiLed.Colour.Blue);
            }
            else
            {
                gLedSetting.m_Colour = new GLedColour(0);
            }

            gLedSetting.m_MinBrightness = idiLed.MinBrightness;
            gLedSetting.m_MaxBrightness = idiLed.MaxBrightness;

            // time0 == flash OFF time.
            // time1 =  time0 + flash ON time
            // time2 = 0 (infinite?)
            gLedSetting.m_Time0    = idiLed.TimeMs0;
            gLedSetting.m_Time1    = (ushort)(idiLed.TimeMs0 + idiLed.TimeMs1);
            gLedSetting.m_CtrlVal0 = 10;
            gLedSetting.m_Time2    = (ushort)(gLedSetting.m_CtrlVal0 * gLedSetting.m_Time1);


            return(gLedSetting);
        }
Ejemplo n.º 4
0
 public void SetAllLeds(ref IdiLed idiLed)
 {
     SetAllPeriphLeds(ref idiLed);
     SetAllMoboLeds(ref idiLed);
 }
Ejemplo n.º 5
0
        private void SetAllPeriphLeds(ref IdiLed idiLed)
        {
            GvLedConfig ledConfig = IdiLedToGvLed(ref idiLed);

            SetAllPeriphLeds(ref ledConfig);
        }
Ejemplo n.º 6
0
        private void SetAllMoboLeds(ref IdiLed idiLed)
        {
            GLedSetting gledSetting = IdiLedToGLed(ref idiLed);

            SetAllMoboLeds(ref gledSetting);
        }