gg

Fork of IntegrationCAN by Stefan Vukcevic

Files at this revision

API Documentation at this revision

Comitter:
formulas
Date:
Sun Jun 17 14:59:05 2018 +0000
Parent:
3:c9a444d3fe1b
Commit message:
nooooovo

Changed in this revision

CAN_library.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r c9a444d3fe1b -r c648a8c57106 CAN_library.cpp
--- a/CAN_library.cpp	Sun Jun 17 11:58:03 2018 +0000
+++ b/CAN_library.cpp	Sun Jun 17 14:59:05 2018 +0000
@@ -1,7 +1,7 @@
 #include "CAN_library.h"
 
 extern CAN can;
-//extern Serial pc;
+extern Serial pc;
 extern CANMessage msgDTA1, msgDTA2, msgDTA3, msgDTA4, msgDTA5, msgDTA6, msgLVDTFront, msgLVDTRear, msgBrakes, msgKm;
 extern uint16_t rx_flag;
 extern uint8_t lvdtref;
@@ -17,44 +17,44 @@
     if (can.read(tmpMsg)) {                 //Detect message
         //pc.printf("%x\n",tmpMsg.id);       
         switch(tmpMsg.id){                  //Find which DTA message is received 
-            case(0):
+            case(0x2000):
                 rx_flag|=(1<<0);
                 msgDTA1=tmpMsg;
                 break;
-            case(1):
+            case(0x2001):
                 rx_flag|=(1<<1);
                 msgDTA2=tmpMsg;
                 //pc.printf("rx_flag=%x\n",rx_flag);
                 break;
-            case(2):
+            case(0x2002):
                 rx_flag|=(1<<2);
                 msgDTA3=tmpMsg;
                 break;
-            case(3):
+            case(0x2003):
                 rx_flag|=(1<<3);
                 msgDTA4=tmpMsg;
                 break;
-            case(4):
+            case(0x2004):
                 rx_flag|=(1<<4);
                 msgDTA5=tmpMsg;
                 break;
-            case(5):
+            case(0x2005):
                 rx_flag|=(1<<5);
                 msgDTA6=tmpMsg;
                 break;
-            case(6):
+            case(0x2006):
                 rx_flag|=(1<<6);
                 msgLVDTFront=tmpMsg;
                 break;
-            case(7):
+            case(0x2007):
                 rx_flag|=(1<<7);
                 msgLVDTRear=tmpMsg;
                 break;
-            case(8):
+            case(0x2008):
                 rx_flag|=(1<<8);
                 msgBrakes=tmpMsg;
                 break;
-            case(9):
+            case(0x2009):
                 rx_flag|=(1<<9);
                 msgKm=tmpMsg;
                 break;
@@ -64,6 +64,7 @@
 };
 
 void UpdateInfo(){                          // Update info for DTA values
+    pc.printf("Im in UpdateInfo\n");
     int noID=9;
     uint16_t *newData;
     for (int i=0;i<noID;i++){               //For loop goes trough Message IDs
@@ -141,6 +142,7 @@
     Water_Temp=newData[2];
     Air_Temp0=Air_Temp;
     Air_Temp=newData[3];
+    pc.printf("id=2000, Rpm= %d, TPS= %d, Water_temp= %d, Air_Temp= %d\n",Rpm,TPS,Water_Temp,Air_Temp);
 };
 
 void UpdateInfoDTA2(uint16_t newData[4]){                //Update values for DTA2 message
@@ -152,6 +154,7 @@
     Speed=newData[2];
     Oil_P0=Oil_P;
     Oil_P=newData[3];
+    pc.printf("id=2001, MAP= %d, Lambda= %d, Speed= %d, Oil_P= %d\n",MAP,Lambda,Speed,Oil_P);
     //pc.printf("MAP=%d, Lambda=%d, Speed=%d, Oil_P=%d\n",MAP,Lambda,Speed,Oil_P);
 };
 
@@ -160,11 +163,13 @@
     Oil_Temp=newData[1];
     Volts0=Volts;
     Volts=newData[2];
+    pc.printf("id=2002, Oil_Temp= %d, Volts= %d\n",Oil_Temp,Volts);
 };
 
 void UpdateInfoDTA4(uint16_t newData[4]){                //Update values for DTA4 message
     Gear0=Gear;
     Gear=newData[0];
+    pc.printf("id=2003, Gear= %d\n",Gear);
 };
 
 void UpdateInfoDTA5(uint16_t newData[4]){                //Update values for DTA5 message
@@ -173,6 +178,7 @@
 void UpdateInfoDTA6(uint16_t newData[4]){                //Update values for DTA6 message
     Crank0=Crank;
     Crank=newData[2];
+    pc.printf("id=2005, Crank\n",Crank);
 };
 
 void UpdateInfoLVDTFront(uint16_t newData[4]){           //Update values for LVDTFront message