commConnected
This commit is contained in:
@@ -1188,7 +1188,7 @@ void Board320_240::redrawScreen() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// BLE not connected
|
// BLE not connected
|
||||||
if (!liveData->bleConnected && liveData->bleConnect && liveData->tmpSettings.commType == COMM_TYPE_OBD2BLE4) {
|
if (!liveData->commConnected && liveData->bleConnect && liveData->tmpSettings.commType == COMM_TYPE_OBD2BLE4) {
|
||||||
// Print message
|
// Print message
|
||||||
spr.setTextSize(1);
|
spr.setTextSize(1);
|
||||||
spr.setTextColor(TFT_WHITE, TFT_BLACK);
|
spr.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class MyClientCallback : public BLEClientCallbacks {
|
|||||||
|
|
||||||
// On BLE disconnect
|
// On BLE disconnect
|
||||||
void onDisconnect(BLEClient* pclient) {
|
void onDisconnect(BLEClient* pclient) {
|
||||||
//connected = false;
|
liveDataObj->commConnected = false;
|
||||||
Serial.println("onDisconnect");
|
Serial.println("onDisconnect");
|
||||||
|
|
||||||
boardObj->displayMessage("BLE disconnected", "");
|
boardObj->displayMessage("BLE disconnected", "");
|
||||||
@@ -323,7 +323,7 @@ void CommObd2Ble4::mainLoop() {
|
|||||||
liveData->pServerAddress = new BLEAddress(liveData->settings.obdMacAddress);
|
liveData->pServerAddress = new BLEAddress(liveData->settings.obdMacAddress);
|
||||||
if (connectToServer(*liveData->pServerAddress)) {
|
if (connectToServer(*liveData->pServerAddress)) {
|
||||||
|
|
||||||
liveData->bleConnected = true;
|
liveData->commConnected = true;
|
||||||
liveData->bleConnect = false;
|
liveData->bleConnect = false;
|
||||||
|
|
||||||
Serial.println("We are now connected to the BLE device.");
|
Serial.println("We are now connected to the BLE device.");
|
||||||
@@ -354,7 +354,7 @@ void CommObd2Ble4::mainLoop() {
|
|||||||
void CommObd2Ble4::executeCommand(String cmd) {
|
void CommObd2Ble4::executeCommand(String cmd) {
|
||||||
|
|
||||||
String tmpStr = cmd + "\r";
|
String tmpStr = cmd + "\r";
|
||||||
if (liveData->bleConnected) {
|
if (liveData->commConnected) {
|
||||||
liveData->pRemoteCharacteristicWrite->writeValue(tmpStr.c_str(), tmpStr.length());
|
liveData->pRemoteCharacteristicWrite->writeValue(tmpStr.c_str(), tmpStr.length());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ void CommObd2Can::connectDevice() {
|
|||||||
pinMode(pinCanInt, INPUT); // Configuring pin for /INT input
|
pinMode(pinCanInt, INPUT); // Configuring pin for /INT input
|
||||||
|
|
||||||
// Serve first command (ATZ)
|
// Serve first command (ATZ)
|
||||||
|
liveData->commConnected = true;
|
||||||
doNextQueueCommand();
|
doNextQueueCommand();
|
||||||
|
|
||||||
Serial.println("init_can() done");
|
Serial.println("init_can() done");
|
||||||
@@ -47,6 +48,7 @@ void CommObd2Can::connectDevice() {
|
|||||||
*/
|
*/
|
||||||
void CommObd2Can::disconnectDevice() {
|
void CommObd2Can::disconnectDevice() {
|
||||||
|
|
||||||
|
liveData->commConnected = false;
|
||||||
Serial.println("COMM disconnectDevice");
|
Serial.println("COMM disconnectDevice");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -219,9 +219,10 @@ class LiveData {
|
|||||||
uint16_t scanningDeviceIndex = 0;
|
uint16_t scanningDeviceIndex = 0;
|
||||||
MENU_ITEM* menuItems;
|
MENU_ITEM* menuItems;
|
||||||
|
|
||||||
|
// Comm
|
||||||
|
boolean commConnected = true;
|
||||||
// Bluetooth4
|
// Bluetooth4
|
||||||
boolean bleConnect = true;
|
boolean bleConnect = true;
|
||||||
boolean bleConnected = false;
|
|
||||||
BLEAddress *pServerAddress;
|
BLEAddress *pServerAddress;
|
||||||
BLERemoteCharacteristic* pRemoteCharacteristic;
|
BLERemoteCharacteristic* pRemoteCharacteristic;
|
||||||
BLERemoteCharacteristic* pRemoteCharacteristicWrite;
|
BLERemoteCharacteristic* pRemoteCharacteristicWrite;
|
||||||
|
|||||||
Reference in New Issue
Block a user