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