Always store CAN IDs as unsigned long.

Explicitly show that the CAN ID is printed in HEX.
This commit is contained in:
Neil Bajorin
2018-05-17 13:08:27 -04:00
parent cefe36904e
commit d7ce9e6779
3 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -97,7 +97,7 @@ void taskCanRecv()
CAN.readMsgBuf(&len, buf); // read data, len: data length, buf: data buf
Serial.println("\r\n------------------------------------------------------------------");
Serial.print("Get Data From id: ");
Serial.print("Get Data From id: 0x");
Serial.println(CAN.getCanId(), HEX);
for(int i = 0; i<len; i++) // print the data
{
+3 -3
View File
@@ -37,11 +37,11 @@ void loop()
{
CAN.readMsgBuf(&len, buf); // read data, len: data length, buf: data buf
unsigned char canId = CAN.getCanId();
unsigned long canId = CAN.getCanId();
Serial.println("-----------------------------");
Serial.println("get data from ID: ");
Serial.println(canId);
Serial.println("get data from ID: 0x");
Serial.println(canId, HEX);
for(int i = 0; i<len; i++) // print the data
{
+2 -2
View File
@@ -36,10 +36,10 @@ void loop()
{
CAN.readMsgBuf(&len, buf); // read data, len: data length, buf: data buf
unsigned int canId = CAN.getCanId();
unsigned long canId = CAN.getCanId();
Serial.println("-----------------------------");
Serial.print("Get data from ID: ");
Serial.print("Get data from ID: 0x");
Serial.println(canId, HEX);
for(int i = 0; i<len; i++) // print the data