f211

Dependencies:   mbed-dev1

Fork of OBD21121 by Surendar S

Files at this revision

API Documentation at this revision

Comitter:
takeuz
Date:
Thu Aug 10 11:38:15 2017 +0000
Parent:
16:02f94a84e211
Commit message:
updated OBD code

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Mon Aug 07 14:11:10 2017 +0000
+++ b/main.cpp	Thu Aug 10 11:38:15 2017 +0000
@@ -41,7 +41,7 @@
 int _powerSaveFlag=0;
 int isKeepAliveCommand=0;
 int isPoweredupNow=1;
-int interFace=0;
+int interFace=1;
 int debug=1;
 int currentOBDProtocol=0;
 const int protCan=1;
@@ -98,11 +98,11 @@
 void canReader()
 {
 //    serialPorts[debug]->puts("a");
-    serialPorts[debug]->printf("can Reader\r\n");
+   // serialPorts[debug]->printf("can Reader\r\n");
     if (canBus->read(can_MsgRx)) {
-        serialPorts[debug]->printf("one : %s\r\n",can_MsgRx);
+       // serialPorts[debug]->printf("one : %s\r\n",can_MsgRx);
         lastOBDCmdRcvdTime=0;
-        if (1/*(can_MsgRx.id == PID_REPLY)*/) {
+        if (can_MsgRx.id == PID_REPLY) {
             for (int i = 0; i < (int)can_MsgRx.len && currentOBDProtocol!=0; i++) {
                 char c;
 //                sprintf(c, "%02X",can_MsgRx.data[i]);
@@ -306,19 +306,19 @@
     }
     int mode=strtol(_mode,NULL, 16);
     cmd=strtol((_cmd+2),NULL, 16);
-    /*can_msg[0] = len;
+    can_msg[0] = len;
     can_msg[1] = mode;
     can_msg[2] = cmd;
     can_msg[3] = 0;
     can_msg[4] = 0;
     can_msg[5] = 0;
     can_msg[6] = 0;
-    can_msg[7] = 0;*/
+    can_msg[7] = 0;
     
-    can_MsgTx.len = len;
+    /*can_MsgTx.len = len;
     can_MsgTx.data[0] = mode;
     can_MsgTx.data[1] = cmd;
-    /*can_MsgTx.data[3] = 0;
+    can_MsgTx.data[3] = 0;
     can_MsgTx.data[4] = 0;
     can_MsgTx.data[5] = 0;
     can_MsgTx.data[6] = 0;
@@ -782,10 +782,10 @@
     LPC_SWM->PINASSIGN5 = 0xffffffffUL;
     LPC_SWM->PINASSIGN8 = 0xffffffffUL;
 //    LPC_SYSCON->SYSAHBCLKCTRL1 |= (0<<7);
-   /* serialPorts[0] = new Serial(P0_11,P0_13);
-    serialPorts[1] = new Serial(P0_15,P0_14);*/
-    serialPorts[0] = new Serial(P0_16,P0_12);
-    serialPorts[1] = new Serial(USBTX,USBRX);
+    serialPorts[0] = new Serial(P0_11,P0_13);
+    serialPorts[1] = new Serial(P0_15,P0_14);
+   /* serialPorts[0] = new Serial(P0_16,P0_12);
+    serialPorts[1] = new Serial(USBTX,USBRX);*/
     klineWakeup = new DigitalOut(P0_28);
     canBus = new CAN(P0_22, P0_23);
     canDisableKey=new DigitalOut(P0_0,0);