Can
This commit is contained in:
@@ -404,7 +404,7 @@ bool CommObd2Ble4::parseRow() {
|
||||
// 1 frame data
|
||||
Serial.println(liveData->responseRow);
|
||||
|
||||
// Merge 0:xxxx 1:yyyy 2:zzzz to single xxxxyyyyzzzz string
|
||||
// Merge frames 0:xxxx 1:yyyy 2:zzzz to single response xxxxyyyyzzzz string
|
||||
if (liveData->responseRow.length() >= 2 && liveData->responseRow.charAt(1) == ':') {
|
||||
liveData->responseRowMerged += liveData->responseRow.substring(2);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "CommObd2Can.h"
|
||||
#include "BoardInterface.h"
|
||||
#include "LiveData.h"
|
||||
#include <mcp_can.h>
|
||||
|
||||
/**
|
||||
Connect CAN adapter
|
||||
@@ -8,6 +9,21 @@
|
||||
void CommObd2Can::connectDevice() {
|
||||
|
||||
Serial.println("CAN connectDevice");
|
||||
|
||||
// Initialize MCP2515 running at 16MHz with a baudrate of 500kb/s and the masks and filters disabled.
|
||||
/* if (CAN.begin(MCP_STDEXT, CAN_500KBPS, MCP_8MHZ) == CAN_OK) {
|
||||
Serial.println("MCP2515 Initialized Successfully!");
|
||||
board->displayMessage(" > CAN init OK", "");
|
||||
} else {
|
||||
Serial.println("Error Initializing MCP2515...");
|
||||
board->displayMessage(" > CAN init failed", "");
|
||||
return;
|
||||
}
|
||||
|
||||
CAN.setMode(MCP_NORMAL); // Set operation mode to normal so the MCP2515 sends acks to received data.
|
||||
pinMode(pinCanInt, INPUT); // Configuring pin for /INT input
|
||||
*/
|
||||
Serial.println("init_can() done");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -22,13 +38,13 @@ void CommObd2Can::disconnectDevice() {
|
||||
Scan device list, from menu
|
||||
*/
|
||||
void CommObd2Can::scanDevices() {
|
||||
|
||||
|
||||
Serial.println("COMM scanDevices");
|
||||
}
|
||||
|
||||
/**
|
||||
* Main loop
|
||||
*/
|
||||
Main loop
|
||||
*/
|
||||
void CommObd2Can::mainLoop() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,20 +2,26 @@
|
||||
|
||||
#include "LiveData.h"
|
||||
#include "CommInterface.h"
|
||||
#include <mcp_can.h>
|
||||
|
||||
class CommObd2Can : public CommInterface {
|
||||
|
||||
protected:
|
||||
byte pinCanInt = 15;
|
||||
//MCP_CAN CAN(12); // Set CS to pin 10
|
||||
long unsigned int rxId;
|
||||
unsigned char len = 0;
|
||||
unsigned char rxBuf[512];
|
||||
char msgString[128]; // Array to store serial string
|
||||
public:
|
||||
void connectDevice() override;
|
||||
void disconnectDevice() override;
|
||||
void scanDevices() override;
|
||||
void mainLoop() override;
|
||||
//
|
||||
/* void startBleScan();
|
||||
bool connectToServer(BLEAddress pAddress);
|
||||
bool doNextAtCommand();
|
||||
bool parseRow();
|
||||
bool parseRowMerged(); */
|
||||
/* void startBleScan();
|
||||
bool connectToServer(BLEAddress pAddress);
|
||||
bool doNextAtCommand();
|
||||
bool parseRow();
|
||||
bool parseRowMerged(); */
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user