debug level, serial console turn off

This commit is contained in:
Lubos Petrovic
2020-12-26 09:10:31 +01:00
parent 0c112a9d0f
commit 59b05486c6
5 changed files with 46 additions and 23 deletions

View File

@@ -876,6 +876,15 @@ String Board320_240::menuItemCaption(int16_t menuItemId, String title) {
break;*/
case MENU_GPRS: sprintf(tmpStr1, "[HW UART=%d]", liveData->settings.gprsHwSerialPort); suffix = (liveData->settings.gprsHwSerialPort == 255) ? "[off]" : tmpStr1; break;
case MENU_SDCARD: sprintf(tmpStr1, "[%d] %lluMB", SD.cardType(), SD.cardSize() / (1024 * 1024)); suffix = tmpStr1; break;
case MENU_SERIAL_CONSOLE: suffix = (liveData->settings.serialConsolePort == 255) ? "[off]" : "[on]"; break;
case MENU_DEBUG_LEVEL: switch (liveData->settings.debugLevel) {
case 0: suffix = "[none]" ; break;
case 1: suffix = "[comm]" ; break;
case 2: suffix = "[gsm]" ; break;
case 3: suffix = "[sdcard]" ; break;
default: suffix = "[unknown]";
}
break;
case MENU_SCREEN_ROTATION: suffix = (liveData->settings.displayRotation == 1) ? "[vertical]" : "[normal]"; break;
case MENU_DEFAULT_SCREEN: sprintf(tmpStr1, "[%d]", liveData->settings.defaultScreen); suffix = tmpStr1; break;
case MENU_SCREEN_BRIGHTNESS: sprintf(tmpStr1, "[%d%%]", liveData->settings.lcdBrightness); suffix = (liveData->settings.lcdBrightness == 0) ? "[auto]" : tmpStr1; break;
@@ -890,6 +899,7 @@ String Board320_240::menuItemCaption(int16_t menuItemId, String title) {
(strlen(liveData->params.sdcardFilename) != 0) ? liveData->params.sdcardFilename :
(liveData->params.sdcardInit) ? "READY" : "MOUNT"); suffix = tmpStr1; break;
case MENU_SDCARD_REC: sprintf(tmpStr1, "[%s]", (liveData->settings.sdcardEnabled == 0) ? "n/a" : (liveData->params.sdcardRecording) ? "STOP" : "START"); suffix = tmpStr1; break;
case MENU_SDCARD_INTERVAL: sprintf(tmpStr1, "[%d]", liveData->settings.sdcardLogIntervalSec); suffix = tmpStr1; break;
//
case MENU_WIFI_ENABLED: suffix = (liveData->settings.wifiEnabled == 1) ? "[on]" : "[off]"; break;
case MENU_WIFI_SSID: sprintf(tmpStr1, "%s", liveData->settings.wifiSsid); suffix = tmpStr1; break;
@@ -1038,6 +1048,8 @@ void Board320_240::menuItemClick() {
case MENU_HEADLIGHTS_REMINDER: liveData->settings.headlightsReminder = (liveData->settings.headlightsReminder == 1) ? 0 : 1; showMenu(); return; break;
case MENU_GPRS: liveData->settings.gprsHwSerialPort = (liveData->settings.gprsHwSerialPort == 2) ? 255 : liveData->settings.gprsHwSerialPort + 1; showMenu(); return; break;
case MENU_GPS: liveData->settings.gpsHwSerialPort = (liveData->settings.gpsHwSerialPort == 2) ? 255 : liveData->settings.gpsHwSerialPort + 1; showMenu(); return; break;
case MENU_SERIAL_CONSOLE: liveData->settings.serialConsolePort = (liveData->settings.serialConsolePort == 0) ? 255 : liveData->settings.serialConsolePort + 1; showMenu(); return; break;
case MENU_DEBUG_LEVEL: liveData->settings.debugLevel = (liveData->settings.debugLevel == 3) ? 0 : liveData->settings.debugLevel + 1; showMenu(); return; break;
// Wifi menu
case MENU_WIFI_ENABLED: liveData->settings.wifiEnabled = (liveData->settings.wifiEnabled == 1) ? 0 : 1; showMenu(); return; break;
case MENU_WIFI_SSID: return; break;
@@ -1064,22 +1076,22 @@ void Board320_240::menuItemClick() {
case 9: saveSettings(); break;
// Version
case 10:
/* commInterface->executeCommand("ATSH770");
delay(50);
commInterface->executeCommand("3E");
delay(50);
commInterface->executeCommand("1003");
delay(50);
commInterface->executeCommand("2FBC1003");
delay(5000);
commInterface->executeCommand("ATSH770");
delay(50);
commInterface->executeCommand("3E");
delay(50);
commInterface->executeCommand("1003");
delay(50);
commInterface->executeCommand("2FBC1103");
delay(5000);*/
/* commInterface->executeCommand("ATSH770");
delay(50);
commInterface->executeCommand("3E");
delay(50);
commInterface->executeCommand("1003");
delay(50);
commInterface->executeCommand("2FBC1003");
delay(5000);
commInterface->executeCommand("ATSH770");
delay(50);
commInterface->executeCommand("3E");
delay(50);
commInterface->executeCommand("1003");
delay(50);
commInterface->executeCommand("2FBC1103");
delay(5000);*/
hideMenu(); return;
// Shutdown
case 11: shutdownDevice(); return;

View File

@@ -206,8 +206,6 @@ typedef struct {
byte debugLevel; // 0 - info only, 1 - debug communication (BLE/CAN), 2 - debug GSM, 3 - debug SDcard
uint16_t sdcardLogIntervalSec; // every x seconds
uint16_t gprsLogIntervalSec; // every x seconds
//
} SETTINGS_STRUC;

View File

@@ -81,6 +81,8 @@ typedef struct {
#define MENU_HEADLIGHTS_REMINDER 310
#define MENU_DEBUG_SCREEN 311
#define MENU_GPS 312
#define MENU_SERIAL_CONSOLE 313
#define MENU_DEBUG_LEVEL 314
//
#define MENU_DISTANCE_UNIT 401
#define MENU_TEMPERATURE_UNIT 402
@@ -94,4 +96,5 @@ typedef struct {
#define MENU_SDCARD_AUTOSTARTLOG 3042
#define MENU_SDCARD_MOUNT_STATUS 3043
#define MENU_SDCARD_REC 3044
#define MENU_SDCARD_INTERVAL 3045
//

View File

@@ -72,6 +72,13 @@ void setup(void) {
liveData = new LiveData();
liveData->initParams();
// Turn off serial console
if (liveData->settings.serialConsolePort = 255) {
Serial.println("Serial console disabled...");
Serial.flush();
Serial.end();
}
// Init board
#ifdef BOARD_TTGO_T4
board = new BoardTtgoT4v13();

13
menu.h
View File

@@ -36,6 +36,8 @@ MENU_ITEM menuItemsSource[100] = {
{MENU_SDCARD, 3, -1, "SD card"},
{MENU_GPS, 3, -1, "GPS"},
{MENU_GPRS, 3, -1, "GSM/GPRS"},
{MENU_SERIAL_CONSOLE, 3, -1, "Serial console"},
{MENU_DEBUG_LEVEL, 3, -1, "Debug level"},
//{MENU_REMOTE_UPLOAD, 3, -1, "[dev] Remote upload"},
//{MENU_NTP, 3, -1, "[dev] NTP"},
{MENU_SCREEN_ROTATION, 3, -1, "Screen rotation"},
@@ -68,11 +70,12 @@ MENU_ITEM menuItemsSource[100] = {
{MENU_WIFI_SSID, 301, -1, "SSID"},
{MENU_WIFI_PASSWORD, 301, -1, "Password"},
{3040, 304, 3, "<- parent menu"},
{MENU_SDCARD_ENABLED, 304, -1, "SD enabled"},
{MENU_SDCARD_AUTOSTARTLOG, 304, -1, "Autostart log enabled"},
{MENU_SDCARD_MOUNT_STATUS, 304, -1, "Status"},
{MENU_SDCARD_REC, 304, -1, "Record"},
{MENU_SDCARD*10, MENU_SDCARD, 3, "<- parent menu"},
{MENU_SDCARD_ENABLED, MENU_SDCARD, -1, "SD enabled"},
{MENU_SDCARD_AUTOSTARTLOG, MENU_SDCARD, -1, "Autostart log enabled"},
{MENU_SDCARD_MOUNT_STATUS, MENU_SDCARD, -1, "Status"},
{MENU_SDCARD_REC, MENU_SDCARD, -1, "Record"},
{MENU_SDCARD_INTERVAL, MENU_SDCARD, -1, "Log interval sec."},
{3060, 306, 3, "<- parent menu"},
{3061, 306, -1, "Auto mode"},