Esempio n. 1
0
        static vesc_values GetVescValuesFromBff(byte[] bff)
        {
            vesc_values logFont = new vesc_values();
            IntPtr      ptPoit  = Marshal.AllocHGlobal(92);

            Marshal.Copy(bff, 0, ptPoit, 92);
            logFont = (vesc_values)Marshal.PtrToStructure(ptPoit, typeof(vesc_values));
            Marshal.FreeHGlobal(ptPoit);
            return(logFont);
        }
Esempio n. 2
0
        private bool GetDataFromClient_MotorStatus(int vescIndex, out vesc_values retVal)
        {
            retVal = null;
            var ret = Protocol.com_protocol_SendDataCommand_p2p(com_commands.GET_MOTOR_STATUS, new byte[] { (byte)vescIndex }, 1);

            if (ret != null)
            {
                if ((ret.command == com_commands.RESPONSE_DATA) && (ret.dataLength >= 2))
                {
                    retVal = GetVescValuesFromBff(ret.data);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
            return(true);
        }