System page improvements

This commit is contained in:
Thomas Hooge 2025-06-12 15:23:21 +02:00
parent c7eafbf9b8
commit 1bac5d8b16
2 changed files with 122 additions and 45 deletions

View File

@ -520,9 +520,14 @@ prebuild(env)
board="PLATFORM_BOARD_%s"%env["BOARD"].replace("-","_").upper()
print("Board=#%s#"%board)
print("BuildFlags=%s"%(" ".join(env["BUILD_FLAGS"])))
res=[x for x in env["BUILD_FLAGS"] if x.startswith("-D DISPLAY_")]
if res:
epdtype = res[0].split('_')[1]
else:
epdtype = 'unknown'
env.Append(
LINKFLAGS=[ "-u", "custom_app_desc" ],
CPPDEFINES=[(board,"1")]
CPPDEFINES=[(board,"1"), ("BOARD", env["BOARD"]), ("EPDTYPE", epdtype)]
)
#script does not run on clean yet - maybe in the future
env.AddPostAction("clean",cleangenerated)

View File

@ -9,16 +9,23 @@
#define STRINGIZE_IMPL(x) #x
#define STRINGIZE(x) STRINGIZE_IMPL(x)
#define VERSINFO STRINGIZE(GWDEVVERSION)
#define BOARDINFO STRINGIZE(BOARD)
#define DISPLAYINFO STRINGIZE(EPDTYPE)
/*
* Special system page, called directly with fast key sequence 5,4
* Out of normal page order.
* Consists of some sub-pages with following content:
* 1. Hard and software information
* 2. System settings
* 3. NMEA2000 device list
*/
class PageSystem : public Page
{
uint64_t chipid;
bool simulation;
bool sdcard;
String buzzer_mode;
uint8_t buzzer_power;
String cpuspeed;
@ -26,7 +33,12 @@ String rtc_module;
String gps_module;
String env_module;
char mode = 'N'; // (N)ormal, (D)evice list
String batt_sensor;
String solar_sensor;
String gen_sensor;
String rot_sensor;
char mode = 'N'; // (N)ormal, (S)ettings, (D)evice list
public:
PageSystem(CommonData &common){
@ -37,12 +49,18 @@ public:
}
chipid = ESP.getEfuseMac();
simulation = common.config->getBool(common.config->useSimuData);
sdcard = common.config->getBool(common.config->useSDCard);
buzzer_mode = common.config->getString(common.config->buzzerMode);
buzzer_mode.toLowerCase();
buzzer_power = common.config->getInt(common.config->buzzerPower);
cpuspeed = common.config->getString(common.config->cpuSpeed);
env_module = common.config->getString(common.config->useEnvSensor);
rtc_module = common.config->getString(common.config->useRTC);
gps_module = common.config->getString(common.config->useGPS);
batt_sensor = common.config->getString(common.config->usePowSensor1);
solar_sensor = common.config->getString(common.config->usePowSensor2);
gen_sensor = common.config->getString(common.config->usePowSensor3);
gen_sensor = common.config->getString(common.config->useRotSensor);
}
virtual void setupKeys(){
@ -60,6 +78,8 @@ public:
commonData->logger->logDebug(GwLog::LOG, "System keyboard handler");
if (key == 2) {
if (mode == 'N') {
mode = 'S';
} else if (mode == 'S') {
mode = 'D';
} else {
mode = 'N';
@ -144,19 +164,22 @@ public:
// Draw page
//***********************************************************
const uint16_t y0 = 120; // data table starts here
uint16_t x0 = 8; // left column
uint16_t y0 = 48; // data table starts here
// Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
if (mode == 'N') {
getdisplay().setFont(&Ubuntu_Bold12pt7b);
getdisplay().setCursor(8, 50);
getdisplay().setCursor(8, 48);
getdisplay().print("System Information");
getdisplay().drawXBitmap(320, 25, logo64_bits, logo64_width, logo64_height, commonData->fgcolor);
getdisplay().setFont(&Ubuntu_Bold8pt7b);
y0 = 120;
char ssid[13];
snprintf(ssid, 13, "%04X%08X", (uint16_t)(chipid >> 32), (uint32_t)chipid);
@ -164,10 +187,21 @@ public:
getdisplay().setCursor(8, 70);
getdisplay().print(String("MUDEVICE-") + String(ssid));
getdisplay().setCursor(8, 90);
getdisplay().setCursor(8, 100);
getdisplay().print("Firmware Version: ");
getdisplay().setCursor(160, 100);
getdisplay().print(VERSINFO);
getdisplay().setCursor(8, 120);
getdisplay().print("Board version: ");
getdisplay().setCursor(160, 120);
getdisplay().print(BOARDINFO);
getdisplay().setCursor(8, 140);
getdisplay().print("Display version: ");
getdisplay().setCursor(160, 140);
getdisplay().print(DISPLAYINFO);
getdisplay().setCursor(8, 265);
#ifdef BOARD_OBP60S3
getdisplay().print("Press STBY to enter deep sleep mode");
@ -176,69 +210,107 @@ public:
getdisplay().print("Press wheel to enter deep sleep mode");
#endif
getdisplay().setCursor(2, y0);
getdisplay().print("Simulation:");
getdisplay().setCursor(120, y0);
getdisplay().print(simulation ? "on" : "off");
getdisplay().setCursor(2, y0 + 16);
getdisplay().print("Environment:");
getdisplay().setCursor(120, y0 + 16);
getdisplay().print(env_module);
// total RAM free
int Heap_free = esp_get_free_heap_size();
getdisplay().setCursor(202, y0);
getdisplay().setCursor(8, y0 + 64);
getdisplay().print("Total free:");
getdisplay().setCursor(300, y0);
getdisplay().setCursor(120, y0 + 64);
getdisplay().print(String(Heap_free));
getdisplay().setCursor(2, y0 + 32);
getdisplay().print("Buzzer:");
getdisplay().setCursor(120, y0 + 32);
getdisplay().print(buzzer_mode);
// RAM free for task
int RAM_free = uxTaskGetStackHighWaterMark(NULL);
getdisplay().setCursor(202, y0 + 16);
getdisplay().print("Task free:");
getdisplay().setCursor(300, y0 + 16);
getdisplay().print(String(RAM_free));
// FRAM available / status
getdisplay().setCursor(202, y0 + 32);
getdisplay().print("FRAM:");
getdisplay().setCursor(300, y0 + 32);
getdisplay().print(hasFRAM ? "available" : "not found");
getdisplay().setCursor(202, y0 + 64);
// CPU speed config / active
getdisplay().setCursor(8, y0 + 48);
getdisplay().print("CPU speed:");
getdisplay().setCursor(300, y0 + 64);
getdisplay().setCursor(120, y0 + 48);
getdisplay().print(cpuspeed);
getdisplay().print(" / ");
int cpu_freq = esp_clk_cpu_freq() / 1000000;
getdisplay().print(String(cpu_freq));
getdisplay().setCursor(2, y0 + 64);
// RAM free for task
int RAM_free = uxTaskGetStackHighWaterMark(NULL);
getdisplay().setCursor(8, y0 + 80);
getdisplay().print("Task free:");
getdisplay().setCursor(120, y0 + 80);
getdisplay().print(String(RAM_free));
// FRAM available / status
getdisplay().setCursor(8, y0 + 96);
getdisplay().print("FRAM:");
getdisplay().setCursor(120, y0 + 96);
getdisplay().print(hasFRAM ? "available" : "not found");
} else if (mode == 'S') {
// Settings
getdisplay().setFont(&Ubuntu_Bold12pt7b);
getdisplay().setCursor(x0, 48);
getdisplay().print("System settings");
getdisplay().setFont(&Ubuntu_Bold8pt7b);
x0 = 8;
y0 = 72;
// left column
getdisplay().setCursor(x0, y0);
getdisplay().print("Simulation:");
getdisplay().setCursor(140, y0);
getdisplay().print(simulation ? "on" : "off");
getdisplay().setCursor(x0, y0 + 16);
getdisplay().print("Environment:");
getdisplay().setCursor(140, y0 + 16);
getdisplay().print(env_module);
getdisplay().setCursor(x0, y0 + 32);
getdisplay().print("Buzzer:");
getdisplay().setCursor(140, y0 + 32);
getdisplay().print(buzzer_mode);
getdisplay().setCursor(x0, y0 + 64);
getdisplay().print("GPS:");
getdisplay().setCursor(120, y0 + 64);
getdisplay().setCursor(140, y0 + 64);
getdisplay().print(gps_module);
getdisplay().setCursor(2, y0 + 80);
getdisplay().setCursor(x0, y0 + 80);
getdisplay().print("RTC:");
getdisplay().setCursor(120, y0 + 80);
getdisplay().setCursor(140, y0 + 80);
getdisplay().print(rtc_module);
getdisplay().setCursor(2, y0 + 96);
getdisplay().setCursor(x0, y0 + 96);
getdisplay().print("Wifi:");
getdisplay().setCursor(120, y0 + 96);
getdisplay().print(commonData->status.wifiApOn ? "On" : "Off");
getdisplay().setCursor(140, y0 + 96);
getdisplay().print(commonData->status.wifiApOn ? "on" : "off");
// right column
getdisplay().setCursor(202, y0);
getdisplay().print("Batt. sensor:");
getdisplay().setCursor(320, y0);
getdisplay().print(batt_sensor);
// Solar sensor
getdisplay().setCursor(202, y0 + 16);
getdisplay().print("Solar sensor:");
getdisplay().setCursor(320, y0 + 16);
getdisplay().print(solar_sensor);
// Generator sensor
getdisplay().setCursor(202, y0 + 32);
getdisplay().print("Gen. sensor:");
getdisplay().setCursor(320, y0 + 32);
getdisplay().print(gen_sensor);
// Gyro sensor
// SD-Card
getdisplay().setCursor(202, y0 + 64);
getdisplay().print("SD-Card:");
getdisplay().setCursor(320, y0 + 64);
getdisplay().print(sdcard ? "on" : "off");
} else {
// NMEA2000 device list
getdisplay().setFont(&Ubuntu_Bold12pt7b);
getdisplay().setCursor(20, 50);
getdisplay().setCursor(8, 48);
getdisplay().print("NMEA2000 device list");
getdisplay().setFont(&Ubuntu_Bold8pt7b);