public void updateStatus()
        {
            if (owner == null)
            {
                return;
            }

            if (!owner.Connected)
            {
                return;
            }

            if (MatrixLedConfig == null)
            {
                Error = null;
            }
            else
            {
                if (!MatrixLed.IsEnabled(owner.PokeysDevice))
                {
                    Error = Translations.Main.MatrixLedErrorNotEnabled;
                }
                else
                {
                    Error = null;
                }
            }

            setOutputStateDirty();
            writeOutputState();
        }
        private void writeOutputState()
        {
            if (string.IsNullOrEmpty(Error) && owner != null && owner.Connected && MatrixLedConfig != null)
            {
                foreach (SevenSegmentDigit digit in SevenSegmentDigits)
                {
                    for (int segmentPosition = 0; segmentPosition < 8; ++segmentPosition)
                    {
                        SevenSegmentDigitSegment segment = digit.Segments[segmentPosition];

                        if (segment.Dirty)
                        {
                            bool setPixelOk;

                            if (MatrixLedConfig.DigitOnRow)
                            {
                                setPixelOk = MatrixLed.SetPixel(owner.PokeysDevice, (byte)(digit.Index - 1), (byte)(MatrixLedConfig.SegmentIndexes[segmentPosition] - 1), segment.Value);
                            }
                            else
                            {
                                setPixelOk = MatrixLed.SetPixel(owner.PokeysDevice, (byte)(MatrixLedConfig.SegmentIndexes[segmentPosition] - 1), (byte)(digit.Index - 1), segment.Value);
                            }

                            if (!setPixelOk)
                            {
                                Error = Translations.Main.MatrixLedErrorWrite;
                            }

                            segment.Dirty = false;
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public void updateStatus()
        {
            if (owner == null)
            {
                return;
            }

            if (!owner.Connected)
            {
                return;
            }

            if (MatrixLed == null || !Row.HasValue || !Column.HasValue)
            {
                Error = null;
            }
            else
            {
                if (!MatrixLed.IsPixelEnabled(owner.PokeysDevice, (byte)(Row.Value - 1), (byte)(Column.Value - 1)))
                {
                    Error = string.Format(Translations.Main.MatrixLedPixelErrorNotEnabled, Row, Column);
                }
                else
                {
                    Error = null;
                }
            }

            writeOutputState();
        }
Ejemplo n.º 4
0
 protected override void writeOutputState()
 {
     if (string.IsNullOrEmpty(Error) && owner != null && owner.Connected && MatrixLed != null && Row.HasValue && Column.HasValue)
     {
         if (!MatrixLed.SetPixel(owner.PokeysDevice, (byte)(Row.Value - 1), (byte)(Column.Value - 1), OutputState))
         {
             Error = Translations.Main.MatrixLedErrorWrite;
         }
     }
 }
 private void updateMatrixLedConfig()
 {
     if (owner != null && MatrixLed != null)
     {
         MatrixLedConfig = MatrixLed.GetSevenSegmentConfig(owner);
     }
     else
     {
         MatrixLedConfig = null;
     }
 }
Ejemplo n.º 6
0
        private void writeOutputState()
        {
            if (string.IsNullOrEmpty(Error) && owner != null && owner.PokeysIndex.HasValue && MatrixLedConfig != null)
            {
                PoKeysDevice_DLL.PoKeysDevice poKeysDevice = PoKeysEnumerator.Singleton.PoKeysDevice;

                if (!poKeysDevice.ConnectToDevice(owner.PokeysIndex.Value))
                {
                    Error = Translations.Main.PokeysConnectError;
                }
                else
                {
                    foreach (SevenSegmentDigit digit in SevenSegmentDigits)
                    {
                        for (int segmentPosition = 0; segmentPosition < 8; ++segmentPosition)
                        {
                            SevenSegmentDigitSegment segment = digit.Segments[segmentPosition];

                            if (segment.Dirty)
                            {
                                bool setPixelOk;

                                if (MatrixLedConfig.DigitOnRow)
                                {
                                    setPixelOk = MatrixLed.SetPixel((byte)(digit.Index - 1), (byte)(MatrixLedConfig.SegmentIndexes[segmentPosition] - 1), segment.Value);
                                }
                                else
                                {
                                    setPixelOk = MatrixLed.SetPixel((byte)(MatrixLedConfig.SegmentIndexes[segmentPosition] - 1), (byte)(digit.Index - 1), segment.Value);
                                }

                                if (!setPixelOk)
                                {
                                    Error = Translations.Main.MatrixLedErrorWrite;
                                }

                                segment.Dirty = false;
                            }
                        }
                    }

                    poKeysDevice.DisconnectDevice();
                }
            }
        }
Ejemplo n.º 7
0
        public void updateStatus()
        {
            if (owner == null)
            {
                return;
            }

            if (MatrixLedConfig == null)
            {
                Error = null;
            }
            else if (!owner.PokeysIndex.HasValue)
            {
                Error = null;
            }
            else
            {
                PoKeysDevice_DLL.PoKeysDevice poKeysDevice = PoKeysEnumerator.Singleton.PoKeysDevice;

                if (!poKeysDevice.ConnectToDevice(owner.PokeysIndex.Value))
                {
                    Error = Translations.Main.PokeysConnectError;
                }
                else
                {
                    if (!MatrixLed.IsEnabled())
                    {
                        Error = Translations.Main.MatrixLedErrorNotEnabled;
                    }
                    else
                    {
                        Error = null;
                    }

                    poKeysDevice.DisconnectDevice();
                }
            }

            setOutputStateDirty();
            writeOutputState();
        }
Ejemplo n.º 8
0
        protected override void writeOutputState()
        {
            if (string.IsNullOrEmpty(Error) && owner != null && owner.PokeysIndex.HasValue && MatrixLed != null && Row.HasValue && Column.HasValue)
            {
                PoKeysDevice_DLL.PoKeysDevice poKeysDevice = PoKeysEnumerator.Singleton.PoKeysDevice;

                if (!poKeysDevice.ConnectToDevice(owner.PokeysIndex.Value))
                {
                    Error = Translations.Main.PokeysConnectError;
                }
                else
                {
                    if (!MatrixLed.SetPixel((byte)(Row.Value - 1), (byte)(Column.Value - 1), OutputState))
                    {
                        Error = Translations.Main.MatrixLedErrorWrite;
                    }

                    poKeysDevice.DisconnectDevice();
                }
            }
        }
Ejemplo n.º 9
0
        public void updateStatus()
        {
            if (owner == null)
            {
                return;
            }

            if (MatrixLed == null || !Row.HasValue || !Column.HasValue)
            {
                Error = null;
            }
            else if (!owner.PokeysIndex.HasValue)
            {
                Error = null;
            }
            else
            {
                PoKeysDevice_DLL.PoKeysDevice poKeysDevice = PoKeysEnumerator.Singleton.PoKeysDevice;

                if (!poKeysDevice.ConnectToDevice(owner.PokeysIndex.Value))
                {
                    Error = Translations.Main.PokeysConnectError;
                }
                else
                {
                    if (!MatrixLed.IsPixelEnabled((byte)(Row.Value - 1), (byte)(Column.Value - 1)))
                    {
                        Error = string.Format(Translations.Main.MatrixLedPixelErrorNotEnabled, Row, Column);
                    }
                    else
                    {
                        Error = null;
                    }

                    poKeysDevice.DisconnectDevice();
                }
            }

            writeOutputState();
        }