Some work on system page and SD-card integration
This commit is contained in:
parent
f5cf292804
commit
99c3470a22
|
@ -6,6 +6,11 @@
|
||||||
#include <esp32/clk.h>
|
#include <esp32/clk.h>
|
||||||
#include "qrcode.h"
|
#include "qrcode.h"
|
||||||
|
|
||||||
|
#ifdef BOARD_OBP40S3
|
||||||
|
#include <SD.h>
|
||||||
|
#include <FS.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define STRINGIZE_IMPL(x) #x
|
#define STRINGIZE_IMPL(x) #x
|
||||||
#define STRINGIZE(x) STRINGIZE_IMPL(x)
|
#define STRINGIZE(x) STRINGIZE_IMPL(x)
|
||||||
#define VERSINFO STRINGIZE(GWDEVVERSION)
|
#define VERSINFO STRINGIZE(GWDEVVERSION)
|
||||||
|
@ -39,7 +44,7 @@ String solar_sensor;
|
||||||
String gen_sensor;
|
String gen_sensor;
|
||||||
String rot_sensor;
|
String rot_sensor;
|
||||||
|
|
||||||
char mode = 'N'; // (N)ormal, (S)ettings, (D)evice list
|
char mode = 'N'; // (N)ormal, (S)ettings, (D)evice list, (C)ard
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageSystem(CommonData &common){
|
PageSystem(CommonData &common){
|
||||||
|
@ -63,7 +68,7 @@ public:
|
||||||
batt_sensor = common.config->getString(common.config->usePowSensor1);
|
batt_sensor = common.config->getString(common.config->usePowSensor1);
|
||||||
solar_sensor = common.config->getString(common.config->usePowSensor2);
|
solar_sensor = common.config->getString(common.config->usePowSensor2);
|
||||||
gen_sensor = common.config->getString(common.config->usePowSensor3);
|
gen_sensor = common.config->getString(common.config->usePowSensor3);
|
||||||
gen_sensor = common.config->getString(common.config->useRotSensor);
|
rot_sensor = common.config->getString(common.config->useRotSensor);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void setupKeys(){
|
virtual void setupKeys(){
|
||||||
|
@ -84,6 +89,12 @@ public:
|
||||||
mode = 'S';
|
mode = 'S';
|
||||||
} else if (mode == 'S') {
|
} else if (mode == 'S') {
|
||||||
mode = 'D';
|
mode = 'D';
|
||||||
|
} else if (mode == 'D') {
|
||||||
|
if (sdcard) {
|
||||||
|
mode = 'C';
|
||||||
|
} else {
|
||||||
|
mode = 'N';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
mode = 'N';
|
mode = 'N';
|
||||||
}
|
}
|
||||||
|
@ -239,7 +250,12 @@ public:
|
||||||
getdisplay().setCursor(8, y0 + 48);
|
getdisplay().setCursor(8, y0 + 48);
|
||||||
getdisplay().print("SD-Card:");
|
getdisplay().print("SD-Card:");
|
||||||
getdisplay().setCursor(90, y0 + 48);
|
getdisplay().setCursor(90, y0 + 48);
|
||||||
getdisplay().print(sdcard ? "on" : "off");
|
if (sdcard) {
|
||||||
|
uint64_t cardsize = SD.cardSize() / (1024 * 1024);
|
||||||
|
getdisplay().print(String(cardsize) + String(" MB"));
|
||||||
|
} else {
|
||||||
|
getdisplay().print("off");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// CPU speed config / active
|
// CPU speed config / active
|
||||||
|
@ -265,7 +281,6 @@ public:
|
||||||
getdisplay().setCursor(300, y0 + 32);
|
getdisplay().setCursor(300, y0 + 32);
|
||||||
getdisplay().print(String(RAM_free));
|
getdisplay().print(String(RAM_free));
|
||||||
|
|
||||||
|
|
||||||
} else if (mode == 'S') {
|
} else if (mode == 'S') {
|
||||||
// Settings
|
// Settings
|
||||||
|
|
||||||
|
@ -328,6 +343,19 @@ public:
|
||||||
|
|
||||||
// Gyro sensor
|
// Gyro sensor
|
||||||
|
|
||||||
|
} else if (mode == 'C') {
|
||||||
|
// Card info
|
||||||
|
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||||
|
getdisplay().setCursor(8, 48);
|
||||||
|
getdisplay().print("SD Card info");
|
||||||
|
|
||||||
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
|
|
||||||
|
x0 = 20;
|
||||||
|
y0 = 72;
|
||||||
|
getdisplay().setCursor(x0, y0);
|
||||||
|
getdisplay().print("Work in progress...");
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// NMEA2000 device list
|
// NMEA2000 device list
|
||||||
|
|
|
@ -616,12 +616,8 @@
|
||||||
"name": "useSDCard",
|
"name": "useSDCard",
|
||||||
"label": "SD Card",
|
"label": "SD Card",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": "off",
|
"default": "false",
|
||||||
"description": "Use internal SD card interface [off|on]",
|
"description": "Use internal SD card interface [off|on]",
|
||||||
"list": [
|
|
||||||
"off",
|
|
||||||
"on"
|
|
||||||
],
|
|
||||||
"category": "OBP40 Hardware",
|
"category": "OBP40 Hardware",
|
||||||
"capabilities": {
|
"capabilities": {
|
||||||
"obp40": "true"
|
"obp40": "true"
|
||||||
|
|
|
@ -79,8 +79,8 @@ void OBP60Init(GwApi *api){
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BOARD_OBP40S3
|
#ifdef BOARD_OBP40S3
|
||||||
String sdcard = config->getConfigItem(config->useSDCard, true)->asString();
|
bool sdcard = config->getBool(config->useSDCard);
|
||||||
if (sdcard == "on") {
|
if (sdcard) {
|
||||||
SPIClass SD_SPI = SPIClass(HSPI);
|
SPIClass SD_SPI = SPIClass(HSPI);
|
||||||
SD_SPI.begin(SD_SPI_CLK, SD_SPI_MISO, SD_SPI_MOSI);
|
SD_SPI.begin(SD_SPI_CLK, SD_SPI_MISO, SD_SPI_MOSI);
|
||||||
if (SD.begin(SD_SPI_CS, SD_SPI, 80000000)) {
|
if (SD.begin(SD_SPI_CS, SD_SPI, 80000000)) {
|
||||||
|
|
Loading…
Reference in New Issue