I just deleted the can receive from the code...It is not needed.
What I am looking at doing is re-writing the library. Tough it seems to have everything it needs.
I been looking at what BDC-COM sends the jaguars.
Code:
I am filtering for packets with Additional data
When I click on speed mode in BDC-COM:
BYTES: 0xff06020205c018db
Packet Size: 6 MSG: 0x020205c0 DevID: 2 Data: 0x18 0xdb
BYTES: 0xff050202058000
Packet Size: 5 MSG: 0x02020580 DevID: 2 Data: 0x00
When I click on Voltage
BYTES: 0xff0602020100f34f
Packet Size: 6 MSG: 0x02020100 DevID: 2 Data: 0xf3 0x4f
When I click current:
BYTES: 0xff0602021180de91
Packet Size: 6 MSG: 02021180 DevID: 2 Data: 0xde 0x91
When I click Position
BYTES: 0xff0a02020ac0894f00000000
Packet Size: 10 MSG: 02020ac0 DevID: 2 Data: 0x89 0x4f 0x00 0x00 0x00 0x00
Code:
MESSAGE ID
HEX DEC
EN_SPEED 0x020205c0 33686976 <two bytes non consitant data>
0x02020580 33686912 0x00
EN_VOLTAGE
0x02020100 33685760 <two bytes non consitant data>
EN_CURRENT
0x02021180 33689984 <two bytes non consitant data>
EN_POS
0x02020ac0 33688256 <two bytes non consitant data> 0x00 0x00 0x00 0x00
SET_SPEED 0x02020600 33687040 <two bytes non consitant data> (UINT32 RPM)
SET_VOLTAGE 0x02020140 33685824 <two bytes non consitant data> (two bytes voltage data format==???)
The Most significant byte has flags about the manufacturer 0x02 = Luminary Micro
the second MS Byte is the Can Bus type, 0x02 means motor
the next 6 bits are the actual message ID, the last 6 bits hold the device id
device id is a number from 0(broadcast) to 63, you OR it with the message ID
The packets are as fallows
a header consists of two bytes
First byte = 0xff
Second is message size
msgSize = size of msgID (always 4 bytes) + number of data bytes
Code:
< HEADER > | <MSG ID> | <data> |
byte 1 | byte 2| byte 3 - 6 | bytes7-n
0xFF 0xXX 0x0202XXXX
0xFF is escaped by 0xFE for the data
0xFE is escaped by 0xFD for the data
THere is no end of packet, end of packet is determined by second byte in the header (size of packet);
If the amount of data read in is not the same as the data declared in the header the packet, it is thrown out.