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 // Init GPS
if (liveData->settings.gpsHwSerialPort <= 2) { if (liveData->settings.gpsHwSerialPort <= 2) {
Serial.print("GPS initialization on hw uart: "); Serial.print("GPS initialization on hwUart: ");
Serial.println(liveData->settings.gpsHwSerialPort); 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 = new HardwareSerial(liveData->settings.gpsHwSerialPort);
gpsHwUart->begin(9600); gpsHwUart->begin(9600);
} }

View File

@@ -137,6 +137,10 @@ void BoardInterface::loadSettings() {
liveData->settings.headlightsReminder = 0; liveData->settings.headlightsReminder = 0;
liveData->settings.gpsHwSerialPort = 255; // off liveData->settings.gpsHwSerialPort = 255; // off
liveData->settings.gprsHwSerialPort = 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 // Load settings and replace default values
Serial.println("Reading settings from eeprom."); Serial.println("Reading settings from eeprom.");
@@ -191,6 +195,13 @@ void BoardInterface::loadSettings() {
liveData->tmpSettings.settingsVersion = 5; liveData->tmpSettings.settingsVersion = 5;
liveData->tmpSettings.gpsHwSerialPort = 255; // off 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 // Save upgraded structure
liveData->settings = liveData->tmpSettings; liveData->settings = liveData->tmpSettings;
@@ -247,7 +258,7 @@ void BoardInterface::customConsoleCommand(String cmd) {
} }
/** /**
* Parser response from obd2/can Parser response from obd2/can
*/ */
void BoardInterface::parseRowMerged() { void BoardInterface::parseRowMerged() {