コード例 #1
0
ファイル: C_SPI_READ.cs プロジェクト: gr4viton/eye_out
        public static bool FIND_bestPairInLastSentQueues(C_Packet received, ref C_Packet paired)
        {
            // return through ref the best pairedPacket
            e_rot rot;
            bool  foundMotor = C_MotorControl.GET_motorRotFromId(received.ByteId, out rot);
            int   rotMot     = (int)rot;

            if (foundMotor == true)
            {
                lock (queueSent_locker)
                {
                    if (queueSent[rotMot].Count > 0)
                    {
                        List <C_Packet> listSent      = (queueSent[rotMot]).ToList();
                        bool            foundBestPair = FIND_bestPairInQueue(received, ref paired, ref listSent);
                        queueSent[rotMot]       = new Queue <C_Packet>(listSent);
                        queueSent_Count[rotMot] = listSent.Count;
                        C_MotorControl.ACTUALIZE_queueCounts(queueSent);
                        return(foundBestPair);
                    }
                    else
                    {
                        LOG_debug(string.Format("lastSent queue of this motor[{0}] was empty!", rot));
                        return(false);
                    }
                }
            }
            else
            {
                LOG_debug("Did not found any motor connected with this StatusPacket id : "
                          + received.ByteId.ToString());
            }
            return(false);
        }
コード例 #2
0
ファイル: C_SPI.cs プロジェクト: gr4viton/eye_out
        public static void QUEUE_PacketSent(C_Packet instructionPacket)
        {
            int rotMot = (int)instructionPacket.rotMotor;

            if (C_Packet.IS_statusPacketFollowing(instructionPacket) == true)
            {
                lock (queueSent_locker)
                {
                    instructionPacket.sentTime = DateTime.Now;
                    queueSent[rotMot].Enqueue(instructionPacket);
                    queueSent_Count[rotMot] = queueSent[rotMot].Count;
                    C_MotorControl.ACTUALIZE_queueCounts(queueSent);
                }
            }
        }