update
This commit is contained in:
@@ -838,7 +838,8 @@ String Board320_240::menuItemCaption(int16_t menuItemId, String title) {
|
|||||||
case MENU_DEFAULT_SCREEN: sprintf(tmpStr1, "[%d]", liveData->settings.defaultScreen); suffix = tmpStr1; break;
|
case MENU_DEFAULT_SCREEN: sprintf(tmpStr1, "[%d]", liveData->settings.defaultScreen); suffix = tmpStr1; break;
|
||||||
case MENU_DEBUG_SCREEN: suffix = (liveData->settings.debugScreen == 1) ? "[on]" : "[off]"; break;
|
case MENU_DEBUG_SCREEN: suffix = (liveData->settings.debugScreen == 1) ? "[on]" : "[off]"; break;
|
||||||
case MENU_SCREEN_BRIGHTNESS: sprintf(tmpStr1, "[%d%%]", liveData->settings.lcdBrightness); suffix = (liveData->settings.lcdBrightness == 0) ? "[auto]" : tmpStr1; break;
|
case MENU_SCREEN_BRIGHTNESS: sprintf(tmpStr1, "[%d%%]", liveData->settings.lcdBrightness); suffix = (liveData->settings.lcdBrightness == 0) ? "[auto]" : tmpStr1; break;
|
||||||
case MENU_PREDRAWN_GRAPHS: suffix = (liveData->settings.predrawnChargingGraphs == 1) ? "[on]" : "[off]"; break;
|
case MENU_PREDRAWN_GRAPHS: suffix = (liveData->settings.predrawnChargingGraphs == 1) ? "[on]" : "[off]"; break;
|
||||||
|
case MENU_GPRS: sprintf(tmpStr1, "[%s] %s", (liveData->settings.gprsEnabled == 1) ? "on": "off", liveData->settings.gprsApn); suffix = tmpStr1; break;
|
||||||
//
|
//
|
||||||
case MENU_DISTANCE_UNIT: suffix = (liveData->settings.distanceUnit == 'k') ? "[km]" : "[mi]"; break;
|
case MENU_DISTANCE_UNIT: suffix = (liveData->settings.distanceUnit == 'k') ? "[km]" : "[mi]"; break;
|
||||||
case MENU_TEMPERATURE_UNIT: suffix = (liveData->settings.temperatureUnit == 'c') ? "[C]" : "[F]"; break;
|
case MENU_TEMPERATURE_UNIT: suffix = (liveData->settings.temperatureUnit == 'c') ? "[C]" : "[F]"; break;
|
||||||
@@ -924,6 +925,7 @@ void Board320_240::menuItemClick() {
|
|||||||
MENU_ITEM* tmpMenuItem;
|
MENU_ITEM* tmpMenuItem;
|
||||||
uint16_t tmpCurrMenuItem = 0;
|
uint16_t tmpCurrMenuItem = 0;
|
||||||
int16_t parentMenu = -1;
|
int16_t parentMenu = -1;
|
||||||
|
|
||||||
for (uint16_t i = 0; i < liveData->menuItemsCount; ++i) {
|
for (uint16_t i = 0; i < liveData->menuItemsCount; ++i) {
|
||||||
if (liveData->menuCurrent == liveData->menuItems[i].parentId) {
|
if (liveData->menuCurrent == liveData->menuItems[i].parentId) {
|
||||||
if (parentMenu == -1)
|
if (parentMenu == -1)
|
||||||
|
|||||||
@@ -178,6 +178,9 @@ void BoardInterface::loadSettings() {
|
|||||||
// Apply settings from flash if needed
|
// Apply settings from flash if needed
|
||||||
liveData->settings = liveData->tmpSettings;
|
liveData->settings = liveData->tmpSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void customConsoleCommand(String cmd);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // BOARDINTERFACE_CPP
|
#endif // BOARDINTERFACE_CPP
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ class BoardInterface {
|
|||||||
void saveSettings();
|
void saveSettings();
|
||||||
void resetSettings();
|
void resetSettings();
|
||||||
void loadSettings();
|
void loadSettings();
|
||||||
|
void customConsoleCommand(String cmd);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BOARDINTERFACE_H
|
#endif // BOARDINTERFACE_H
|
||||||
|
|||||||
@@ -11,10 +11,8 @@
|
|||||||
void LiveData::initParams() {
|
void LiveData::initParams() {
|
||||||
|
|
||||||
params.automaticShutdownTimer = 0;
|
params.automaticShutdownTimer = 0;
|
||||||
#ifdef SIM800L_ENABLED
|
|
||||||
params.lastDataSent = 0;
|
params.lastDataSent = 0;
|
||||||
params.sim800l_enabled = false;
|
params.sim800l_enabled = false;
|
||||||
#endif //SIM800L_ENABLED
|
|
||||||
params.ignitionOn = false;
|
params.ignitionOn = false;
|
||||||
params.ignitionOnPrevious = false;
|
params.ignitionOnPrevious = false;
|
||||||
params.chargingStartTime = params.currentTime = 0;
|
params.chargingStartTime = params.currentTime = 0;
|
||||||
@@ -98,6 +96,7 @@ void LiveData::initParams() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Menu
|
// Menu
|
||||||
|
menuItemsCount = sizeof(menuItemsSource) / sizeof(menuItemsSource[0]);
|
||||||
menuItems = menuItemsSource;
|
menuItems = menuItemsSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ class LiveData {
|
|||||||
String currentAtshRequest = "";
|
String currentAtshRequest = "";
|
||||||
// Menu
|
// Menu
|
||||||
bool menuVisible = false;
|
bool menuVisible = false;
|
||||||
uint8_t menuItemsCount = 79;
|
uint8_t menuItemsCount;
|
||||||
uint16_t menuCurrent = 0;
|
uint16_t menuCurrent = 0;
|
||||||
uint8_t menuItemSelected = 0;
|
uint8_t menuItemSelected = 0;
|
||||||
uint8_t menuItemOffset = 0;
|
uint8_t menuItemOffset = 0;
|
||||||
|
|||||||
1
config.h
1
config.h
@@ -73,6 +73,7 @@ typedef struct {
|
|||||||
#define MENU_DEBUG_SCREEN 303
|
#define MENU_DEBUG_SCREEN 303
|
||||||
#define MENU_SCREEN_BRIGHTNESS 304
|
#define MENU_SCREEN_BRIGHTNESS 304
|
||||||
#define MENU_PREDRAWN_GRAPHS 305
|
#define MENU_PREDRAWN_GRAPHS 305
|
||||||
|
#define MENU_GPRS 308
|
||||||
#define MENU_DISTANCE_UNIT 401
|
#define MENU_DISTANCE_UNIT 401
|
||||||
#define MENU_TEMPERATURE_UNIT 402
|
#define MENU_TEMPERATURE_UNIT 402
|
||||||
#define MENU_PRESSURE_UNIT 403
|
#define MENU_PRESSURE_UNIT 403
|
||||||
|
|||||||
@@ -635,11 +635,14 @@ void loop() {
|
|||||||
if (liveData->bleConnected) {
|
if (liveData->bleConnected) {
|
||||||
if (Serial.available()) {
|
if (Serial.available()) {
|
||||||
ch = Serial.read();
|
ch = Serial.read();
|
||||||
line = line + ch;
|
|
||||||
if (ch == '\r' || ch == '\n') {
|
if (ch == '\r' || ch == '\n') {
|
||||||
|
board->customConsoleCommand(line);
|
||||||
|
line = line + ch;
|
||||||
Serial.println(line);
|
Serial.println(line);
|
||||||
liveData->pRemoteCharacteristicWrite->writeValue(line.c_str(), line.length());
|
liveData->pRemoteCharacteristicWrite->writeValue(line.c_str(), line.length());
|
||||||
line = "";
|
line = "";
|
||||||
|
} else {
|
||||||
|
line = line + ch;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
23
menu.h
23
menu.h
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "config.h";
|
#include "config.h";
|
||||||
|
|
||||||
MENU_ITEM menuItemsSource[79] = {
|
MENU_ITEM menuItemsSource[100] = {
|
||||||
|
|
||||||
{0, 0, 0, "<- exit menu"},
|
{0, 0, 0, "<- exit menu"},
|
||||||
{MENU_VEHICLE_TYPE, 0, -1, "Vehicle type"},
|
{MENU_VEHICLE_TYPE, 0, -1, "Vehicle type"},
|
||||||
@@ -31,6 +31,27 @@ MENU_ITEM menuItemsSource[79] = {
|
|||||||
{MENU_PREDRAWN_GRAPHS, 3, -1, "Pre-drawn ch.graphs"},
|
{MENU_PREDRAWN_GRAPHS, 3, -1, "Pre-drawn ch.graphs"},
|
||||||
{306, 3, -1, "[DEV] WiFi network"},
|
{306, 3, -1, "[DEV] WiFi network"},
|
||||||
{307, 3, -1, "[DEV] SD card"},
|
{307, 3, -1, "[DEV] SD card"},
|
||||||
|
{MENU_GPRS, 3, -1, "GPRS"},
|
||||||
|
{309, 3, -1, "[DEV] Remote upload"},
|
||||||
|
/*
|
||||||
|
// Wifi
|
||||||
|
byte wifiEnabled; // 0/1
|
||||||
|
char wifiSsid[32];
|
||||||
|
char wifiPassword[32];
|
||||||
|
// NTP
|
||||||
|
byte ntpEnabled; // 0/1
|
||||||
|
byte ntpTimezone;
|
||||||
|
byte ntpDaySaveTime; // 0/1
|
||||||
|
// SDcard logging
|
||||||
|
byte sdcardEnabled; // 0/1
|
||||||
|
byte sdcardAutstartLog; // 0/1
|
||||||
|
// GPRS SIM800L
|
||||||
|
byte gprsEnabled; // 0/1
|
||||||
|
char gprsApn[64];
|
||||||
|
// Remote upload
|
||||||
|
byte remoteUploadEnabled; // 0/1
|
||||||
|
char remoteApiUrl[64];
|
||||||
|
char remoteApiKey[32];*/
|
||||||
|
|
||||||
{400, 4, 0, "<- parent menu"},
|
{400, 4, 0, "<- parent menu"},
|
||||||
{MENU_DISTANCE_UNIT, 4, -1, "Distance"},
|
{MENU_DISTANCE_UNIT, 4, -1, "Distance"},
|
||||||
|
|||||||
Reference in New Issue
Block a user