Serial console commands
This commit is contained in:
@@ -183,10 +183,25 @@ void BoardInterface::loadSettings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom commands
|
Custom commands
|
||||||
*/
|
*/
|
||||||
void BoardInterface::customConsoleCommand(String cmd) {
|
void BoardInterface::customConsoleCommand(String cmd) {
|
||||||
|
|
||||||
|
int8_t idx = cmd.indexOf("=");
|
||||||
|
if (idx == -1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
String key = cmd.substring(0, idx);
|
||||||
|
String value = cmd.substring(idx + 1);
|
||||||
|
|
||||||
|
if (key == "serviceUUID") value.toCharArray(liveData->settings.serviceUUID, value.length() + 1);
|
||||||
|
if (key == "charTxUUID") value.toCharArray(liveData->settings.charTxUUID, value.length() + 1);
|
||||||
|
if (key == "charRxUUID") value.toCharArray(liveData->settings.charRxUUID, value.length() + 1);
|
||||||
|
if (key == "wifiSsid") value.toCharArray(liveData->settings.wifiSsid, value.length() + 1);
|
||||||
|
if (key == "wifiPassword") value.toCharArray(liveData->settings.wifiPassword, value.length() + 1);
|
||||||
|
if (key == "gprsApn") value.toCharArray(liveData->settings.gprsApn, value.length() + 1);
|
||||||
|
if (key == "remoteApiUrl") value.toCharArray(liveData->settings.remoteApiUrl, value.length() + 1);
|
||||||
|
if (key == "remoteApiKey") value.toCharArray(liveData->settings.remoteApiKey, value.length() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // BOARDINTERFACE_CPP
|
#endif // BOARDINTERFACE_CPP
|
||||||
|
|||||||
@@ -5,6 +5,15 @@
|
|||||||
- settings v4 (wifi/gprs/sdcard/ntp/..)
|
- settings v4 (wifi/gprs/sdcard/ntp/..)
|
||||||
- ble4 skipped if mac is not set (00:00:00:00:00:00)
|
- ble4 skipped if mac is not set (00:00:00:00:00:00)
|
||||||
- improved menu
|
- improved menu
|
||||||
|
- supported serial console commands
|
||||||
|
serviceUUID=xxx
|
||||||
|
charTxUUID=xxx
|
||||||
|
charRxUUID=xxx
|
||||||
|
wifiSsid=xxx
|
||||||
|
wifiPassword=xxx
|
||||||
|
gprsApn=xxx
|
||||||
|
remoteApiUrl=xxx
|
||||||
|
remoteApiKey=xxx
|
||||||
|
|
||||||
### v2.0.0 2020-12-02
|
### v2.0.0 2020-12-02
|
||||||
- Project renamed from eNiroDashboard to evDash
|
- Project renamed from eNiroDashboard to evDash
|
||||||
|
|||||||
21
evDash.ino
21
evDash.ino
@@ -1,11 +1,22 @@
|
|||||||
/*
|
/*
|
||||||
* 2020-12-02
|
2020-12-02
|
||||||
* Project renamed from eNiroDashboard to evDash
|
Project renamed from eNiroDashboard to evDash
|
||||||
*
|
|
||||||
!! working only with OBD BLE 4.0 adapters
|
!! working only with OBD BLE 4.0 adapters
|
||||||
!! Supported adapter is Vgate ICar Pro (must be BLE4.0 version)
|
!! Supported adapter is Vgate ICar Pro (must be BLE4.0 version)
|
||||||
!! Not working with standard BLUETOOTH 3 adapters
|
!! Not working with standard BLUETOOTH 3 adapters
|
||||||
|
|
||||||
|
Supported serial console commands
|
||||||
|
|
||||||
|
serviceUUID=xxx
|
||||||
|
charTxUUID=xxx
|
||||||
|
charRxUUID=xxx
|
||||||
|
wifiSsid=xxx
|
||||||
|
wifiPassword=xxx
|
||||||
|
gprsApn=xxx
|
||||||
|
remoteApiUrl=xxx
|
||||||
|
remoteApiKey=xxx
|
||||||
|
|
||||||
Required libraries
|
Required libraries
|
||||||
- esp32 board support
|
- esp32 board support
|
||||||
- tft_espi
|
- tft_espi
|
||||||
@@ -632,19 +643,19 @@ void loop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Send command from TTY to OBD2
|
// Send command from TTY to OBD2
|
||||||
if (liveData->bleConnected) {
|
|
||||||
if (Serial.available()) {
|
if (Serial.available()) {
|
||||||
ch = Serial.read();
|
ch = Serial.read();
|
||||||
if (ch == '\r' || ch == '\n') {
|
if (ch == '\r' || ch == '\n') {
|
||||||
board->customConsoleCommand(line);
|
board->customConsoleCommand(line);
|
||||||
line = line + ch;
|
line = line + ch;
|
||||||
Serial.println(line);
|
Serial.println(line);
|
||||||
|
if (liveData->bleConnected) {
|
||||||
liveData->pRemoteCharacteristicWrite->writeValue(line.c_str(), line.length());
|
liveData->pRemoteCharacteristicWrite->writeValue(line.c_str(), line.length());
|
||||||
|
}
|
||||||
line = "";
|
line = "";
|
||||||
} else {
|
} else {
|
||||||
line = line + ch;
|
line = line + ch;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Can send next command from queue to OBD
|
// Can send next command from queue to OBD
|
||||||
if (liveData->canSendNextAtCommand) {
|
if (liveData->canSendNextAtCommand) {
|
||||||
|
|||||||
Reference in New Issue
Block a user