can
This commit is contained in:
@@ -332,7 +332,7 @@ void CommObd2Ble4::mainLoop() {
|
|||||||
board->displayMessage(" > Processing init AT cmds", "");
|
board->displayMessage(" > Processing init AT cmds", "");
|
||||||
|
|
||||||
// Serve first command (ATZ)
|
// Serve first command (ATZ)
|
||||||
doNextAtCommand();
|
doNextQueueCommand();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Serial.println("We have failed to connect to the server; there is nothing more we will do.");
|
Serial.println("We have failed to connect to the server; there is nothing more we will do.");
|
||||||
|
|||||||
@@ -11,18 +11,21 @@ void CommObd2Can::connectDevice() {
|
|||||||
Serial.println("CAN connectDevice");
|
Serial.println("CAN connectDevice");
|
||||||
|
|
||||||
// Initialize MCP2515 running at 16MHz with a baudrate of 500kb/s and the masks and filters disabled.
|
// 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) {
|
/* if (CAN.begin(MCP_STDEXT, CAN_500KBPS, MCP_8MHZ) == CAN_OK) {
|
||||||
Serial.println("MCP2515 Initialized Successfully!");
|
Serial.println("MCP2515 Initialized Successfully!");
|
||||||
board->displayMessage(" > CAN init OK", "");
|
board->displayMessage(" > CAN init OK", "");
|
||||||
} else {
|
} else {
|
||||||
Serial.println("Error Initializing MCP2515...");
|
Serial.println("Error Initializing MCP2515...");
|
||||||
board->displayMessage(" > CAN init failed", "");
|
board->displayMessage(" > CAN init failed", "");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CAN.setMode(MCP_NORMAL); // Set operation mode to normal so the MCP2515 sends acks to received data.
|
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
|
pinMode(pinCanInt, INPUT); // Configuring pin for /INT input
|
||||||
*/
|
|
||||||
|
// Serve first command (ATZ)
|
||||||
|
doNextQueueCommand();
|
||||||
|
*/
|
||||||
Serial.println("init_can() done");
|
Serial.println("init_can() done");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,21 +49,21 @@ void CommObd2Can::scanDevices() {
|
|||||||
Main loop
|
Main loop
|
||||||
*/
|
*/
|
||||||
void CommObd2Can::mainLoop() {
|
void CommObd2Can::mainLoop() {
|
||||||
|
|
||||||
CommInterface::mainLoop();
|
CommInterface::mainLoop();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send command to CAN bus
|
Send command to CAN bus
|
||||||
*/
|
*/
|
||||||
void executeCommand(String cmd) {
|
void CommObd2Can::executeCommand(String cmd) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serial.println("BMS 220101");
|
Serial.println("BMS 220101");
|
||||||
sendPID(0x00, 0x00);
|
sendPID(0x00, 0x00);
|
||||||
delay(delayTxRx);
|
delay(delayTxRx);
|
||||||
byte b = receivePID(0);
|
byte b = receivePID(0);
|
||||||
if (b == 0x10) {
|
if (b == 0x10) {
|
||||||
Serial.println("CONTINUE");
|
Serial.println("CONTINUE");
|
||||||
sendPID(0x01, 0x00);
|
sendPID(0x01, 0x00);
|
||||||
delay(10);
|
delay(10);
|
||||||
@@ -68,5 +71,5 @@ void executeCommand(String cmd) {
|
|||||||
receivePID(0);
|
receivePID(0);
|
||||||
delay(10);
|
delay(10);
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user