More work on system page
This commit is contained in:
parent
cf305e9f5a
commit
e5ca2a3a3d
|
@ -47,9 +47,6 @@
|
||||||
class PageSystem : public Page
|
class PageSystem : public Page
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
GwConfigHandler *config;
|
|
||||||
GwLog *logger;
|
|
||||||
|
|
||||||
// NVRAM config options
|
// NVRAM config options
|
||||||
String flashLED;
|
String flashLED;
|
||||||
|
|
||||||
|
@ -72,6 +69,8 @@ private:
|
||||||
double homelat;
|
double homelat;
|
||||||
double homelon;
|
double homelon;
|
||||||
|
|
||||||
|
Nmea2kTwai *NMEA2000;
|
||||||
|
|
||||||
char mode = 'N'; // (N)ormal, (S)ettings, (C)onfiguration, (D)evice list, c(A)rd
|
char mode = 'N'; // (N)ormal, (S)ettings, (C)onfiguration, (D)evice list, c(A)rd
|
||||||
int8_t editmode = -1; // marker for menu/edit/set function
|
int8_t editmode = -1; // marker for menu/edit/set function
|
||||||
|
|
||||||
|
@ -93,6 +92,7 @@ private:
|
||||||
} else {
|
} else {
|
||||||
mode = 'N';
|
mode = 'N';
|
||||||
}
|
}
|
||||||
|
if (hasFRAM) fram.write(FRAM_SYSTEM_MODE, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void decMode() {
|
void decMode() {
|
||||||
|
@ -111,6 +111,7 @@ private:
|
||||||
} else {
|
} else {
|
||||||
mode = 'D';
|
mode = 'D';
|
||||||
}
|
}
|
||||||
|
if (hasFRAM) fram.write(FRAM_SYSTEM_MODE, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void displayModeNormal() {
|
void displayModeNormal() {
|
||||||
|
@ -381,6 +382,10 @@ private:
|
||||||
epd->setCursor(20, 100);
|
epd->setCursor(20, 100);
|
||||||
epd->print("TxD: ");
|
epd->print("TxD: ");
|
||||||
epd->print(String(commonData->status.n2kTx));
|
epd->print(String(commonData->status.n2kTx));
|
||||||
|
|
||||||
|
epd->setCursor(20, 140);
|
||||||
|
epd->printf("N2k source address: %d", NMEA2000->GetN2kSource());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void storeConfig() {
|
void storeConfig() {
|
||||||
|
@ -396,6 +401,7 @@ public:
|
||||||
logger->logDebug(GwLog::LOG, "Instantiate PageSystem");
|
logger->logDebug(GwLog::LOG, "Instantiate PageSystem");
|
||||||
if (hasFRAM) {
|
if (hasFRAM) {
|
||||||
mode = fram.read(FRAM_SYSTEM_MODE);
|
mode = fram.read(FRAM_SYSTEM_MODE);
|
||||||
|
logger->logDebug(GwLog::LOG, "Loaded mode '%c' from FRAM", mode);
|
||||||
}
|
}
|
||||||
flashLED = common.config->getString(common.config->flashLED);
|
flashLED = common.config->getString(common.config->flashLED);
|
||||||
|
|
||||||
|
@ -452,7 +458,6 @@ public:
|
||||||
commonData->logger->logDebug(GwLog::LOG, "System keyboard handler");
|
commonData->logger->logDebug(GwLog::LOG, "System keyboard handler");
|
||||||
if (key == 2) {
|
if (key == 2) {
|
||||||
incMode();
|
incMode();
|
||||||
if (hasFRAM) fram.write(FRAM_SYSTEM_MODE, mode);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#ifdef BOARD_OBP60S3
|
#ifdef BOARD_OBP60S3
|
||||||
|
@ -518,9 +523,15 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void displayNew(PageData &pageData){
|
||||||
|
};
|
||||||
|
|
||||||
int displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData->config;
|
// GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger = commonData->logger;
|
// GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
|
NMEA2000 = pageData.api->getNMEA2000();
|
||||||
|
logger->logDebug(GwLog::LOG, "PageSystem: N2k source address=%d", NMEA2000->GetN2kSource());
|
||||||
|
|
||||||
// Optical warning by limit violation (unused)
|
// Optical warning by limit violation (unused)
|
||||||
if(flashLED == "Limit Violation"){
|
if(flashLED == "Limit Violation"){
|
||||||
|
@ -529,11 +540,11 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logging page information
|
// Logging page information
|
||||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageSystem, Mode=%c", mode);
|
logger->logDebug(GwLog::LOG,"Drawing at PageSystem, Mode=%c", mode);
|
||||||
|
|
||||||
// Get references from API
|
// Get references from API
|
||||||
Nmea2kTwai *NMEA2000 = pageData.api->getNMEA2000();
|
// NMEA2000 = pageData.api->getNMEA2000();
|
||||||
LOG_DEBUG(GwLog::LOG,"N2k source address=%d", NMEA2000->GetN2kSource());
|
// LOG_DEBUG(GwLog::LOG,"N2k source address=%d", NMEA2000->GetN2kSource());
|
||||||
|
|
||||||
// Set display in partial refresh mode
|
// Set display in partial refresh mode
|
||||||
epd->setPartialWindow(0, 0, epd->width(), epd->height());
|
epd->setPartialWindow(0, 0, epd->width(), epd->height());
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
- fix unstable accesspoint availability
|
||||||
|
|
||||||
|
- page refresh after page change and not connected to key codes
|
||||||
|
|
||||||
|
- fix sd card code
|
||||||
|
|
||||||
|
- config: getFloat, getDouble
|
||||||
|
|
||||||
|
- dseg7 font to new version
|
||||||
|
|
||||||
|
- new pages: ais, autopilot, epropulsion
|
||||||
|
|
||||||
|
- automate config.json generation with extra_task.py
|
||||||
|
|
||||||
|
- extend boatdata: ais, waypoints, alarms
|
||||||
|
|
||||||
|
- page clock: sunrise / sunset in local time or UTC
|
||||||
|
|
||||||
|
- implement alerts
|
|
@ -45,7 +45,7 @@ void OBP60Init(GwApi *api){
|
||||||
String devicename = api->getConfig()->getConfigItem(api->getConfig()->deviceName,true)->asString();
|
String devicename = api->getConfig()->getConfigItem(api->getConfig()->deviceName,true)->asString();
|
||||||
api->getConfig()->setValue(GwConfigDefinitions::systemName, devicename, GwConfigInterface::ConfigType::HIDDEN);
|
api->getConfig()->setValue(GwConfigDefinitions::systemName, devicename, GwConfigInterface::ConfigType::HIDDEN);
|
||||||
|
|
||||||
api->getLogger()->logDebug(GwLog::LOG,"obp60init running");
|
logger->logDebug(GwLog::LOG,"obp60init running");
|
||||||
|
|
||||||
// Check I2C devices
|
// Check I2C devices
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ void OBP60Init(GwApi *api){
|
||||||
|
|
||||||
// Init power
|
// Init power
|
||||||
String powermode = api->getConfig()->getConfigItem(api->getConfig()->powerMode,true)->asString();
|
String powermode = api->getConfig()->getConfigItem(api->getConfig()->powerMode,true)->asString();
|
||||||
api->getLogger()->logDebug(GwLog::DEBUG,"Power Mode is: %s", powermode.c_str());
|
logger->logDebug(GwLog::DEBUG,"Power Mode is: %s", powermode.c_str());
|
||||||
powerInit(powermode);
|
powerInit(powermode);
|
||||||
|
|
||||||
#ifdef BOARD_OBP40S3
|
#ifdef BOARD_OBP40S3
|
||||||
|
@ -77,7 +77,7 @@ void OBP60Init(GwApi *api){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
uint64_t cardSize = SD.cardSize() / (1024 * 1024);
|
uint64_t cardSize = SD.cardSize() / (1024 * 1024);
|
||||||
LOG_DEBUG(GwLog::LOG,"SD card type %s of size %d MB detected", sdtype, cardSize);
|
logger->logDebug(GwLog::LOG,"SD card type %s of size %d MB detected", sdtype, cardSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ void OBP60Init(GwApi *api){
|
||||||
|
|
||||||
// Settings for e-paper display
|
// Settings for e-paper display
|
||||||
String fastrefresh = api->getConfig()->getConfigItem(api->getConfig()->fastRefresh,true)->asString();
|
String fastrefresh = api->getConfig()->getConfigItem(api->getConfig()->fastRefresh,true)->asString();
|
||||||
api->getLogger()->logDebug(GwLog::DEBUG,"Fast Refresh Mode is: %s", fastrefresh.c_str());
|
logger->logDebug(GwLog::DEBUG,"Fast Refresh Mode is: %s", fastrefresh.c_str());
|
||||||
#ifdef DISPLAY_GDEY042T81
|
#ifdef DISPLAY_GDEY042T81
|
||||||
if(fastrefresh == "true"){
|
if(fastrefresh == "true"){
|
||||||
static const bool useFastFullUpdate = true; // Enable fast full display update only for GDEY042T81
|
static const bool useFastFullUpdate = true; // Enable fast full display update only for GDEY042T81
|
||||||
|
@ -108,11 +108,11 @@ void OBP60Init(GwApi *api){
|
||||||
|
|
||||||
// Get CPU speed
|
// Get CPU speed
|
||||||
int freq = getCpuFrequencyMhz();
|
int freq = getCpuFrequencyMhz();
|
||||||
api->getLogger()->logDebug(GwLog::LOG,"CPU speed at boot: %i MHz", freq);
|
logger->logDebug(GwLog::LOG,"CPU speed at boot: %i MHz", freq);
|
||||||
|
|
||||||
// Settings for backlight
|
// Settings for backlight
|
||||||
String backlightMode = api->getConfig()->getConfigItem(api->getConfig()->backlight,true)->asString();
|
String backlightMode = api->getConfig()->getConfigItem(api->getConfig()->backlight,true)->asString();
|
||||||
api->getLogger()->logDebug(GwLog::DEBUG,"Backlight Mode is: %s", backlightMode.c_str());
|
logger->logDebug(GwLog::DEBUG,"Backlight Mode is: %s", backlightMode.c_str());
|
||||||
uint brightness = uint(api->getConfig()->getConfigItem(api->getConfig()->blBrightness,true)->asInt());
|
uint brightness = uint(api->getConfig()->getConfigItem(api->getConfig()->blBrightness,true)->asInt());
|
||||||
String backlightColor = api->getConfig()->getConfigItem(api->getConfig()->blColor,true)->asString();
|
String backlightColor = api->getConfig()->getConfigItem(api->getConfig()->blColor,true)->asString();
|
||||||
if(String(backlightMode) == "On"){
|
if(String(backlightMode) == "On"){
|
||||||
|
@ -127,7 +127,7 @@ void OBP60Init(GwApi *api){
|
||||||
|
|
||||||
// Settings flash LED mode
|
// Settings flash LED mode
|
||||||
String ledMode = api->getConfig()->getConfigItem(api->getConfig()->flashLED,true)->asString();
|
String ledMode = api->getConfig()->getConfigItem(api->getConfig()->flashLED,true)->asString();
|
||||||
api->getLogger()->logDebug(GwLog::DEBUG,"LED Mode is: %s", ledMode.c_str());
|
logger->logDebug(GwLog::DEBUG,"LED Mode is: %s", ledMode.c_str());
|
||||||
if(String(ledMode) == "Off"){
|
if(String(ledMode) == "Off"){
|
||||||
setBlinkingLED(false);
|
setBlinkingLED(false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue