Merge pull request #177 from thooge/obp40
Apply new OBP60 settings also to the OBP40
This commit is contained in:
commit
a2c1c1042d
|
@ -520,9 +520,19 @@ prebuild(env)
|
|||
board="PLATFORM_BOARD_%s"%env["BOARD"].replace("-","_").upper()
|
||||
print("Board=#%s#"%board)
|
||||
print("BuildFlags=%s"%(" ".join(env["BUILD_FLAGS"])))
|
||||
|
||||
epdtype = "unknown"
|
||||
pcbvers = "unknown"
|
||||
for x in env["BUILD_FLAGS"]:
|
||||
if x.startswith("-D HARDWARE_"):
|
||||
pcbvers = x.split('_')[1]
|
||||
if x.startswith("-D DISPLAY_"):
|
||||
epdtype = x.split('_')[1]
|
||||
|
||||
env.Append(
|
||||
LINKFLAGS=[ "-u", "custom_app_desc" ],
|
||||
CPPDEFINES=[(board,"1")]
|
||||
CPPDEFINES=[(board,"1"), ("BOARD", env["BOARD"]), ("EPDTYPE", epdtype),
|
||||
("PCBVERS", pcbvers)]
|
||||
)
|
||||
#script does not run on clean yet - maybe in the future
|
||||
env.AddPostAction("clean",cleangenerated)
|
||||
|
|
|
@ -6,19 +6,32 @@
|
|||
#include <esp32/clk.h>
|
||||
#include "qrcode.h"
|
||||
|
||||
#ifdef BOARD_OBP40S3
|
||||
#include <SD.h>
|
||||
#include <FS.h>
|
||||
#endif
|
||||
|
||||
#define STRINGIZE_IMPL(x) #x
|
||||
#define STRINGIZE(x) STRINGIZE_IMPL(x)
|
||||
#define VERSINFO STRINGIZE(GWDEVVERSION)
|
||||
#define BOARDINFO STRINGIZE(BOARD)
|
||||
#define PCBINFO STRINGIZE(PCBVERS)
|
||||
#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 +39,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, (C)ard
|
||||
|
||||
public:
|
||||
PageSystem(CommonData &common){
|
||||
|
@ -37,12 +55,20 @@ public:
|
|||
}
|
||||
chipid = ESP.getEfuseMac();
|
||||
simulation = common.config->getBool(common.config->useSimuData);
|
||||
#ifdef BOARD_OBP40S3
|
||||
sdcard = common.config->getBool(common.config->useSDCard);
|
||||
#endif
|
||||
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);
|
||||
rot_sensor = common.config->getString(common.config->useRotSensor);
|
||||
}
|
||||
|
||||
virtual void setupKeys(){
|
||||
|
@ -60,7 +86,15 @@ public:
|
|||
commonData->logger->logDebug(GwLog::LOG, "System keyboard handler");
|
||||
if (key == 2) {
|
||||
if (mode == 'N') {
|
||||
mode = 'S';
|
||||
} else if (mode == 'S') {
|
||||
mode = 'D';
|
||||
} else if (mode == 'D') {
|
||||
if (sdcard) {
|
||||
mode = 'C';
|
||||
} else {
|
||||
mode = 'N';
|
||||
}
|
||||
} else {
|
||||
mode = 'N';
|
||||
}
|
||||
|
@ -144,30 +178,45 @@ 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 = 155;
|
||||
|
||||
char ssid[13];
|
||||
snprintf(ssid, 13, "%04X%08X", (uint16_t)(chipid >> 32), (uint32_t)chipid);
|
||||
displayBarcode(String(ssid), 320, 200, 2);
|
||||
getdisplay().setCursor(8, 70);
|
||||
getdisplay().print(String("MUDEVICE-") + String(ssid));
|
||||
getdisplay().print(String("MCUDEVICE-") + String(ssid));
|
||||
|
||||
getdisplay().setCursor(8, 90);
|
||||
getdisplay().print("Firmware Version: ");
|
||||
getdisplay().setCursor(8, 95);
|
||||
getdisplay().print("Firmware version: ");
|
||||
getdisplay().setCursor(160, 95);
|
||||
getdisplay().print(VERSINFO);
|
||||
|
||||
getdisplay().setCursor(8, 113);
|
||||
getdisplay().print("Board version: ");
|
||||
getdisplay().setCursor(160, 113);
|
||||
getdisplay().print(BOARDINFO);
|
||||
getdisplay().print(String(" HW ") + String(PCBINFO));
|
||||
|
||||
getdisplay().setCursor(8, 131);
|
||||
getdisplay().print("Display version: ");
|
||||
getdisplay().setCursor(160, 131);
|
||||
getdisplay().print(DISPLAYINFO);
|
||||
|
||||
getdisplay().setCursor(8, 265);
|
||||
#ifdef BOARD_OBP60S3
|
||||
getdisplay().print("Press STBY to enter deep sleep mode");
|
||||
|
@ -176,69 +225,142 @@ 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");
|
||||
// Flash memory size
|
||||
uint32_t flash_size = ESP.getFlashChipSize();
|
||||
getdisplay().setCursor(8, y0);
|
||||
getdisplay().print("FLASH:");
|
||||
getdisplay().setCursor(90, y0);
|
||||
getdisplay().print(String(flash_size / 1024) + String(" kB"));
|
||||
|
||||
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().print("Total free:");
|
||||
getdisplay().setCursor(300, y0);
|
||||
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));
|
||||
// PSRAM memory size
|
||||
uint32_t psram_size = ESP.getPsramSize();
|
||||
getdisplay().setCursor(8, y0 + 16);
|
||||
getdisplay().print("PSRAM:");
|
||||
getdisplay().setCursor(90, y0 + 16);
|
||||
getdisplay().print(String(psram_size / 1024) + String(" kB"));
|
||||
|
||||
// FRAM available / status
|
||||
getdisplay().setCursor(202, y0 + 32);
|
||||
getdisplay().setCursor(8, y0 + 32);
|
||||
getdisplay().print("FRAM:");
|
||||
getdisplay().setCursor(300, y0 + 32);
|
||||
getdisplay().setCursor(90, y0 + 32);
|
||||
getdisplay().print(hasFRAM ? "available" : "not found");
|
||||
|
||||
getdisplay().setCursor(202, y0 + 64);
|
||||
#ifdef BOARD_OBP40S3
|
||||
// SD-Card
|
||||
getdisplay().setCursor(8, y0 + 48);
|
||||
getdisplay().print("SD-Card:");
|
||||
getdisplay().setCursor(90, y0 + 48);
|
||||
if (sdcard) {
|
||||
uint64_t cardsize = SD.cardSize() / (1024 * 1024);
|
||||
getdisplay().print(String(cardsize) + String(" MB"));
|
||||
} else {
|
||||
getdisplay().print("off");
|
||||
}
|
||||
#endif
|
||||
|
||||
// CPU speed config / active
|
||||
getdisplay().setCursor(202, y0);
|
||||
getdisplay().print("CPU speed:");
|
||||
getdisplay().setCursor(300, y0 + 64);
|
||||
getdisplay().setCursor(300, y0);
|
||||
getdisplay().print(cpuspeed);
|
||||
getdisplay().print(" / ");
|
||||
int cpu_freq = esp_clk_cpu_freq() / 1000000;
|
||||
getdisplay().print(String(cpu_freq));
|
||||
|
||||
getdisplay().setCursor(2, y0 + 64);
|
||||
// total RAM free
|
||||
int Heap_free = esp_get_free_heap_size();
|
||||
getdisplay().setCursor(202, y0 + 16);
|
||||
getdisplay().print("Total free:");
|
||||
getdisplay().setCursor(300, y0 + 16);
|
||||
getdisplay().print(String(Heap_free));
|
||||
|
||||
// RAM free for task
|
||||
int RAM_free = uxTaskGetStackHighWaterMark(NULL);
|
||||
getdisplay().setCursor(202, y0 + 32);
|
||||
getdisplay().print("Task free:");
|
||||
getdisplay().setCursor(300, y0 + 32);
|
||||
getdisplay().print(String(RAM_free));
|
||||
|
||||
} 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
|
||||
|
||||
} 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 {
|
||||
// NMEA2000 device list
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 50);
|
||||
getdisplay().setCursor(8, 48);
|
||||
getdisplay().print("NMEA2000 device list");
|
||||
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
"description": "NTP time server. Use only one hostname or IP address",
|
||||
"category": "wifi client",
|
||||
"capabilities": {
|
||||
"obp40": "true"
|
||||
"obp60": "true"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -1249,6 +1249,7 @@
|
|||
"min": 1,
|
||||
"max": 10,
|
||||
"default":"10",
|
||||
"description": "Number of visible data pages [1...10]",
|
||||
"category":"OBP60 Pages",
|
||||
"capabilities": {
|
||||
"obp60":"true"
|
||||
|
@ -1262,6 +1263,7 @@
|
|||
"min": 1,
|
||||
"max": 10,
|
||||
"default":"1",
|
||||
"description": "First page number to display after device startup",
|
||||
"category":"OBP60 Pages",
|
||||
"capabilities": {
|
||||
"obp60":"true"
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -79,8 +79,8 @@ void OBP60Init(GwApi *api){
|
|||
}
|
||||
|
||||
#ifdef BOARD_OBP40S3
|
||||
String sdcard = config->getConfigItem(config->useSDCard, true)->asString();
|
||||
if (sdcard == "on") {
|
||||
bool sdcard = config->getBool(config->useSDCard);
|
||||
if (sdcard) {
|
||||
SPIClass SD_SPI = SPIClass(HSPI);
|
||||
SD_SPI.begin(SD_SPI_CLK, SD_SPI_MISO, SD_SPI_MOSI);
|
||||
if (SD.begin(SD_SPI_CS, SD_SPI, 80000000)) {
|
||||
|
|
|
@ -94,7 +94,8 @@ lib_deps =
|
|||
adafruit/Adafruit FRAM I2C@^2.0.3
|
||||
build_flags=
|
||||
-D DISABLE_DIAGNOSTIC_OUTPUT #Disable diagnostic output for GxEPD2 lib
|
||||
-D BOARD_OBP40S3 #Board OBP40 V1.0 with ESP32S3 SKU:DIE07300S (CrowPanel 4.2)
|
||||
-D BOARD_OBP40S3 #Board OBP40 with ESP32S3
|
||||
-D HARDWARE_V10 #OBP40 hardware revision V1.0 SKU:DIE07300S V1.1 (CrowPanel 4.2)
|
||||
-D DISPLAY_GDEY042T81 #new E-Ink display from Waveshare, R10 2.2 ohm
|
||||
#-D LIPO_ACCU_1200 #Hardware extension, LiPo accu 3,7V 1200mAh
|
||||
#-D VOLTAGE_SENSOR #Hardware extension, LiPo voltage sensor with two resistors
|
||||
|
|
Loading…
Reference in New Issue