settings v6

This commit is contained in:
Lubos Petrovic
2020-12-24 18:00:18 +01:00
parent b69c44c0b8
commit 662ae3ae7a
2 changed files with 22 additions and 7 deletions

View File

@@ -73,8 +73,12 @@ void Board320_240::afterSetup() {
// Init GPS
if (liveData->settings.gpsHwSerialPort <= 2) {
Serial.print("GPS initialization on hw uart: ");
Serial.print("GPS initialization on hwUart: ");
Serial.println(liveData->settings.gpsHwSerialPort);
if (liveData->settings.gpsHwSerialPort == 0) {
Serial.println("hwUart0 collision with serial console! Disabling serial console");
Serial.end();
}
gpsHwUart = new HardwareSerial(liveData->settings.gpsHwSerialPort);
gpsHwUart->begin(9600);
}

View File

@@ -38,7 +38,7 @@ void BoardInterface::shutdownDevice() {
}
#ifdef SIM800L_ENABLED
if(sim800l->isConnectedGPRS()) {
if (sim800l->isConnectedGPRS()) {
sim800l->disconnectGPRS();
}
sim800l->setPowerMode(MINIMUM);
@@ -49,7 +49,7 @@ void BoardInterface::shutdownDevice() {
//WiFi.disconnect(true);
//WiFi.mode(WIFI_OFF);
commInterface->disconnectDevice();
commInterface->disconnectDevice();
//adc_power_off();
//esp_wifi_stop();
esp_bt_controller_disable();
@@ -137,6 +137,10 @@ void BoardInterface::loadSettings() {
liveData->settings.headlightsReminder = 0;
liveData->settings.gpsHwSerialPort = 255; // off
liveData->settings.gprsHwSerialPort = 255; // off
liveData->settings.serialConsolePort = 0; // hwuart0
liveData->settings.debugLevel = 1; // 0 - info only, 1 - debug communication (BLE/CAN), 2 - debug GSM, 3 - debug SDcard
liveData->settings.sdcardLogIntervalSec = 2;
liveData->settings.gprsLogIntervalSec = 60;
// Load settings and replace default values
Serial.println("Reading settings from eeprom.");
@@ -191,6 +195,13 @@ void BoardInterface::loadSettings() {
liveData->tmpSettings.settingsVersion = 5;
liveData->tmpSettings.gpsHwSerialPort = 255; // off
}
if (liveData->tmpSettings.settingsVersion == 5) {
liveData->tmpSettings.settingsVersion = 6;
liveData->tmpSettings.serialConsolePort = 0; // hwuart0
liveData->tmpSettings.debugLevel = 1; // 1 - debug communication (BLE/CAN)
liveData->tmpSettings.sdcardLogIntervalSec = 2;
liveData->tmpSettings.gprsLogIntervalSec = 60;
}
// Save upgraded structure
liveData->settings = liveData->tmpSettings;
@@ -210,7 +221,7 @@ void BoardInterface::afterSetup() {
// Init Comm iterface
Serial.print("Init communication device: ");
Serial.println(liveData->settings.commType);
if (liveData->settings.commType == COMM_TYPE_OBD2BLE4) {
commInterface = new CommObd2Ble4();
} else if (liveData->settings.commType == COMM_TYPE_OBD2CAN) {
@@ -247,10 +258,10 @@ void BoardInterface::customConsoleCommand(String cmd) {
}
/**
* Parser response from obd2/can
*/
Parser response from obd2/can
*/
void BoardInterface::parseRowMerged() {
carInterface->parseRowMerged();
}