Serial console commands

This commit is contained in:
Lubos Petrovic
2020-12-05 14:42:20 +01:00
parent faf930425b
commit 1869ca1da5
3 changed files with 61 additions and 26 deletions

View File

@@ -183,10 +183,25 @@ void BoardInterface::loadSettings() {
}
/**
* Custom commands
Custom commands
*/
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

View File

@@ -5,6 +5,15 @@
- settings v4 (wifi/gprs/sdcard/ntp/..)
- ble4 skipped if mac is not set (00:00:00:00:00:00)
- 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
- Project renamed from eNiroDashboard to evDash

View File

@@ -1,11 +1,22 @@
/*
* 2020-12-02
* Project renamed from eNiroDashboard to evDash
*
2020-12-02
Project renamed from eNiroDashboard to evDash
!! working only with OBD BLE 4.0 adapters
!! Supported adapter is Vgate ICar Pro (must be BLE4.0 version)
!! 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
- esp32 board support
- tft_espi
@@ -632,19 +643,19 @@ void loop() {
}
// Send command from TTY to OBD2
if (liveData->bleConnected) {
if (Serial.available()) {
ch = Serial.read();
if (ch == '\r' || ch == '\n') {
board->customConsoleCommand(line);
line = line + ch;
Serial.println(line);
if (liveData->bleConnected) {
liveData->pRemoteCharacteristicWrite->writeValue(line.c_str(), line.length());
}
line = "";
} else {
line = line + ch;
}
}
// Can send next command from queue to OBD
if (liveData->canSendNextAtCommand) {