diff --git a/CommObd2Ble4.cpp b/CommObd2Ble4.cpp index dfcad0a..3762ae0 100644 --- a/CommObd2Ble4.cpp +++ b/CommObd2Ble4.cpp @@ -332,7 +332,7 @@ void CommObd2Ble4::mainLoop() { board->displayMessage(" > Processing init AT cmds", ""); // Serve first command (ATZ) - doNextAtCommand(); + doNextQueueCommand(); } else { Serial.println("We have failed to connect to the server; there is nothing more we will do."); diff --git a/CommObd2Can.cpp b/CommObd2Can.cpp index d10025a..6f78fec 100644 --- a/CommObd2Can.cpp +++ b/CommObd2Can.cpp @@ -11,18 +11,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; - } + /* 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 -*/ + 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 + + // Serve first command (ATZ) + doNextQueueCommand(); + */ Serial.println("init_can() done"); } @@ -46,21 +49,21 @@ void CommObd2Can::scanDevices() { Main loop */ void CommObd2Can::mainLoop() { - + CommInterface::mainLoop(); } /** - * Send command to CAN bus - */ -void executeCommand(String cmd) { + Send command to CAN bus +*/ +void CommObd2Can::executeCommand(String cmd) { /** - * Serial.println("BMS 220101"); - sendPID(0x00, 0x00); - delay(delayTxRx); - byte b = receivePID(0); - if (b == 0x10) { + Serial.println("BMS 220101"); + sendPID(0x00, 0x00); + delay(delayTxRx); + byte b = receivePID(0); + if (b == 0x10) { Serial.println("CONTINUE"); sendPID(0x01, 0x00); delay(10); @@ -68,5 +71,5 @@ void executeCommand(String cmd) { receivePID(0); delay(10); } - }*/ + }*/ }