mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2025-12-28 13:13:07 +01:00
Compare commits
5 Commits
system
...
e43199b05d
| Author | SHA1 | Date | |
|---|---|---|---|
| e43199b05d | |||
|
|
58adea1da7 | ||
|
|
1043f6defb | ||
| edd07d9632 | |||
| 97b1af71ff |
@@ -64,6 +64,12 @@ PCF8574 pcf8574_Out(PCF8574_I2C_ADDR1); // First digital output modul PCF8574 fr
|
|||||||
Adafruit_FRAM_I2C fram;
|
Adafruit_FRAM_I2C fram;
|
||||||
bool hasFRAM = false;
|
bool hasFRAM = false;
|
||||||
|
|
||||||
|
// SD Card
|
||||||
|
#ifdef BOARD_OBP40S3
|
||||||
|
sdmmc_card_t *sdcard;
|
||||||
|
bool hasSDCard;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Global vars
|
// Global vars
|
||||||
bool blinkingLED = false; // Enable / disable blinking flash LED
|
bool blinkingLED = false; // Enable / disable blinking flash LED
|
||||||
bool statusLED = false; // Actual status of flash LED on/off
|
bool statusLED = false; // Actual status of flash LED on/off
|
||||||
@@ -78,6 +84,9 @@ LedTaskData *ledTaskData=nullptr;
|
|||||||
|
|
||||||
void hardwareInit(GwApi *api)
|
void hardwareInit(GwApi *api)
|
||||||
{
|
{
|
||||||
|
GwLog *logger=api->getLogger();
|
||||||
|
GwConfigHandler *config=api->getConfig();
|
||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
// Init PCF8574 digital outputs
|
// Init PCF8574 digital outputs
|
||||||
Wire.setClock(I2C_SPEED); // Set I2C clock on 10 kHz
|
Wire.setClock(I2C_SPEED); // Set I2C clock on 10 kHz
|
||||||
@@ -87,7 +96,7 @@ void hardwareInit(GwApi *api)
|
|||||||
fram = Adafruit_FRAM_I2C();
|
fram = Adafruit_FRAM_I2C();
|
||||||
if (esp_reset_reason() == ESP_RST_POWERON) {
|
if (esp_reset_reason() == ESP_RST_POWERON) {
|
||||||
// help initialize FRAM
|
// help initialize FRAM
|
||||||
api->getLogger()->logDebug(GwLog::LOG,"Delaying I2C init for 250ms due to cold boot");
|
LOG_DEBUG(GwLog::LOG,"Delaying I2C init for 250ms due to cold boot");
|
||||||
delay(250);
|
delay(250);
|
||||||
}
|
}
|
||||||
// FRAM (e.g. MB85RC256V)
|
// FRAM (e.g. MB85RC256V)
|
||||||
@@ -99,12 +108,53 @@ void hardwareInit(GwApi *api)
|
|||||||
// Boot counter
|
// Boot counter
|
||||||
uint8_t framcounter = fram.read(0x0000);
|
uint8_t framcounter = fram.read(0x0000);
|
||||||
fram.write(0x0000, framcounter+1);
|
fram.write(0x0000, framcounter+1);
|
||||||
api->getLogger()->logDebug(GwLog::LOG,"FRAM detected: 0x%04x/0x%04x (counter=%d)", manufacturerID, productID, framcounter);
|
LOG_DEBUG(GwLog::LOG,"FRAM detected: 0x%04x/0x%04x (counter=%d)", manufacturerID, productID, framcounter);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
hasFRAM = false;
|
hasFRAM = false;
|
||||||
api->getLogger()->logDebug(GwLog::LOG,"NO FRAM detected");
|
LOG_DEBUG(GwLog::LOG,"NO FRAM detected");
|
||||||
}
|
}
|
||||||
|
// SD Card
|
||||||
|
hasSDCard = false;
|
||||||
|
#ifdef BOARD_OBP40S3
|
||||||
|
if (config->getBool(config->useSDCard)) {
|
||||||
|
esp_err_t ret;
|
||||||
|
sdmmc_host_t host = SDSPI_HOST_DEFAULT();
|
||||||
|
host.slot = SPI3_HOST;
|
||||||
|
spi_bus_config_t bus_cfg = {
|
||||||
|
.mosi_io_num = SD_SPI_MOSI,
|
||||||
|
.miso_io_num = SD_SPI_MISO,
|
||||||
|
.sclk_io_num = SD_SPI_CLK,
|
||||||
|
.quadwp_io_num = -1,
|
||||||
|
.quadhd_io_num = -1,
|
||||||
|
.max_transfer_sz = 4000,
|
||||||
|
};
|
||||||
|
ret = spi_bus_initialize((spi_host_device_t) host.slot, &bus_cfg, SDSPI_DEFAULT_DMA);
|
||||||
|
if (ret != ESP_OK) {
|
||||||
|
LOG_DEBUG(GwLog::ERROR,"Failed to initialize SPI bus for SD card");
|
||||||
|
} else {
|
||||||
|
sdspi_device_config_t slot_config = SDSPI_DEVICE_CONFIG_DEFAULT();
|
||||||
|
slot_config.gpio_cs = SD_SPI_CS;
|
||||||
|
slot_config.host_id = (spi_host_device_t) host.slot;
|
||||||
|
esp_vfs_fat_sdmmc_mount_config_t mount_config = {
|
||||||
|
.format_if_mount_failed = false,
|
||||||
|
.max_files = 5,
|
||||||
|
.allocation_unit_size = 16 * 1024
|
||||||
|
};
|
||||||
|
ret = esp_vfs_fat_sdspi_mount(MOUNT_POINT, &host, &slot_config, &mount_config, &sdcard);
|
||||||
|
if (ret != ESP_OK) {
|
||||||
|
if (ret == ESP_FAIL) {
|
||||||
|
LOG_DEBUG(GwLog::ERROR,"Failed to mount SD card filesystem");
|
||||||
|
} else {
|
||||||
|
LOG_DEBUG(GwLog::ERROR,"Failed to initialize SD card");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LOG_DEBUG(GwLog::ERROR,"SD card filesystem mounted");
|
||||||
|
hasSDCard = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void setPortPin(uint pin, bool value){
|
void setPortPin(uint pin, bool value){
|
||||||
@@ -300,6 +350,49 @@ void fillPoly4(const std::vector<Point>& p4, uint16_t color) {
|
|||||||
getdisplay().fillTriangle(p4[0].x, p4[0].y, p4[2].x, p4[2].y, p4[3].x, p4[3].y, color);
|
getdisplay().fillTriangle(p4[0].x, p4[0].y, p4[2].x, p4[2].y, p4[3].x, p4[3].y, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Split string into words, whitespace separated
|
||||||
|
std::vector<String> split(const String &s) {
|
||||||
|
std::vector<String> words;
|
||||||
|
String word = "";
|
||||||
|
for (size_t i = 0; i < s.length(); i++) {
|
||||||
|
if (s[i] == ' ' || s[i] == '\t' || s[i] == '\r' || s[i] == '\n') {
|
||||||
|
if (word.length() > 0) {
|
||||||
|
words.push_back(word);
|
||||||
|
word = "";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
word += s[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (word.length() > 0) {
|
||||||
|
words.push_back(word);
|
||||||
|
}
|
||||||
|
return words;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wordwrap single line, monospaced font
|
||||||
|
std::vector<String> wordwrap(String &line, uint16_t maxwidth) {
|
||||||
|
std::vector<String> lines;
|
||||||
|
std::vector<String> words = split(line);
|
||||||
|
String currentLine = "";
|
||||||
|
for (const auto& word : words) {
|
||||||
|
if (currentLine.length() + word.length() + 1 > maxwidth) {
|
||||||
|
if (currentLine.length() > 0) {
|
||||||
|
lines.push_back(currentLine);
|
||||||
|
currentLine = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currentLine.length() > 0) {
|
||||||
|
currentLine += " ";
|
||||||
|
}
|
||||||
|
currentLine += word;
|
||||||
|
}
|
||||||
|
if (currentLine.length() > 0) {
|
||||||
|
lines.push_back(currentLine);
|
||||||
|
}
|
||||||
|
return lines;
|
||||||
|
}
|
||||||
|
|
||||||
// Draw centered text
|
// Draw centered text
|
||||||
void drawTextCenter(int16_t cx, int16_t cy, String text) {
|
void drawTextCenter(int16_t cx, int16_t cy, String text) {
|
||||||
int16_t x1, y1;
|
int16_t x1, y1;
|
||||||
@@ -545,6 +638,47 @@ void displayFooter(CommonData &commonData) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Alarm overlay, to be drawn as very last draw operation
|
||||||
|
void displayAlarm(CommonData &commonData) {
|
||||||
|
|
||||||
|
const uint16_t x = 50; // overlay area
|
||||||
|
const uint16_t y = 100;
|
||||||
|
const uint16_t w = 300;
|
||||||
|
const uint16_t h = 150;
|
||||||
|
|
||||||
|
getdisplay().setFont(&Atari16px);
|
||||||
|
getdisplay().setTextColor(commonData.fgcolor);
|
||||||
|
|
||||||
|
// overlay
|
||||||
|
getdisplay().drawRect(x, y, w, h, commonData.fgcolor);
|
||||||
|
getdisplay().fillRect(x + 1, y + 1, w - 1, h - 1, commonData.bgcolor);
|
||||||
|
getdisplay().drawRect(x + 3, y + 3, w - 5, h - 5, commonData.fgcolor);
|
||||||
|
|
||||||
|
// exclamation icon in left top corner
|
||||||
|
getdisplay().drawXBitmap(x + 16, y + 16, exclamation_bits, exclamation_width, exclamation_height, commonData.fgcolor);
|
||||||
|
|
||||||
|
// title
|
||||||
|
getdisplay().setCursor(x + 64, y + 30);
|
||||||
|
getdisplay().print("A L A R M");
|
||||||
|
getdisplay().setCursor(x + 64, y + 48);
|
||||||
|
getdisplay().print("#" + commonData.alarm.id);
|
||||||
|
getdisplay().print(" from ");
|
||||||
|
getdisplay().print(commonData.alarm.source);
|
||||||
|
|
||||||
|
// message, but maximum 4 lines
|
||||||
|
std::vector<String> lines = wordwrap (commonData.alarm.message, w - 16 - 8 / 8);
|
||||||
|
int n = 0;
|
||||||
|
for (const auto& l : lines) {
|
||||||
|
getdisplay().setCursor(x + 16, y + 80 + n);
|
||||||
|
getdisplay().print(l);
|
||||||
|
n += 16;
|
||||||
|
if (n > 64) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
drawTextCenter(x + w / 2, y + h - 16, "Press button 1 to dismiss alarm");
|
||||||
|
}
|
||||||
|
|
||||||
// Sunset und sunrise calculation
|
// Sunset und sunrise calculation
|
||||||
SunData calcSunsetSunrise(double time, double date, double latitude, double longitude, float timezone){
|
SunData calcSunsetSunrise(double time, double date, double latitude, double longitude, float timezone){
|
||||||
SunData returnset;
|
SunData returnset;
|
||||||
|
|||||||
@@ -7,6 +7,12 @@
|
|||||||
#include <GxEPD2_BW.h> // E-paper lib V2
|
#include <GxEPD2_BW.h> // E-paper lib V2
|
||||||
#include <Adafruit_FRAM_I2C.h> // I2C FRAM
|
#include <Adafruit_FRAM_I2C.h> // I2C FRAM
|
||||||
|
|
||||||
|
#ifdef BOARD_OBP40S3
|
||||||
|
#include "esp_vfs_fat.h"
|
||||||
|
#include "sdmmc_cmd.h"
|
||||||
|
#define MOUNT_POINT "/sdcard"
|
||||||
|
#endif
|
||||||
|
|
||||||
// FRAM address reservations 32kB: 0x0000 - 0x7FFF
|
// FRAM address reservations 32kB: 0x0000 - 0x7FFF
|
||||||
// 0x0000 - 0x03ff: single variables
|
// 0x0000 - 0x03ff: single variables
|
||||||
#define FRAM_PAGE_NO 0x0002
|
#define FRAM_PAGE_NO 0x0002
|
||||||
@@ -24,6 +30,10 @@
|
|||||||
|
|
||||||
extern Adafruit_FRAM_I2C fram;
|
extern Adafruit_FRAM_I2C fram;
|
||||||
extern bool hasFRAM;
|
extern bool hasFRAM;
|
||||||
|
#ifdef BOARD_OBP40S3
|
||||||
|
extern sdmmc_card_t *sdcard;
|
||||||
|
extern bool hasSDCard;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Fonts declarations for display (#includes see OBP60Extensions.cpp)
|
// Fonts declarations for display (#includes see OBP60Extensions.cpp)
|
||||||
extern const GFXfont DSEG7Classic_BoldItalic16pt7b;
|
extern const GFXfont DSEG7Classic_BoldItalic16pt7b;
|
||||||
@@ -57,6 +67,11 @@ GxEPD2_BW<GxEPD2_420_GYE042A87, GxEPD2_420_GYE042A87::HEIGHT> & getdisplay();
|
|||||||
GxEPD2_BW<GxEPD2_420_SE0420NQ04, GxEPD2_420_SE0420NQ04::HEIGHT> & getdisplay();
|
GxEPD2_BW<GxEPD2_420_SE0420NQ04, GxEPD2_420_SE0420NQ04::HEIGHT> & getdisplay();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Page display return values
|
||||||
|
#define PAGE_OK 0 // all ok, do nothing
|
||||||
|
#define PAGE_UPDATE 1 // page wants display to update
|
||||||
|
#define PAGE_HIBERNATE 2 // page wants displey to hibernate
|
||||||
|
|
||||||
struct Point {
|
struct Point {
|
||||||
double x;
|
double x;
|
||||||
double y;
|
double y;
|
||||||
@@ -97,6 +112,7 @@ void displayTrendLow(int16_t x, int16_t y, uint16_t size, uint16_t color);
|
|||||||
|
|
||||||
void displayHeader(CommonData &commonData, GwApi::BoatValue *date, GwApi::BoatValue *time, GwApi::BoatValue *hdop); // Draw display header
|
void displayHeader(CommonData &commonData, GwApi::BoatValue *date, GwApi::BoatValue *time, GwApi::BoatValue *hdop); // Draw display header
|
||||||
void displayFooter(CommonData &commonData);
|
void displayFooter(CommonData &commonData);
|
||||||
|
void displayAlarm(CommonData &commonData);
|
||||||
|
|
||||||
SunData calcSunsetSunrise(double time, double date, double latitude, double longitude, float timezone); // Calulate sunset and sunrise
|
SunData calcSunsetSunrise(double time, double date, double latitude, double longitude, float timezone); // Calulate sunset and sunrise
|
||||||
SunData calcSunsetSunriseRTC(struct tm *rtctime, double latitude, double longitude, float timezone);
|
SunData calcSunsetSunriseRTC(struct tm *rtctime, double latitude, double longitude, float timezone);
|
||||||
@@ -142,12 +158,12 @@ static unsigned char fram_bits[] PROGMEM = {
|
|||||||
0xff, 0xff, 0xf8, 0x1f, 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1f,
|
0xff, 0xff, 0xf8, 0x1f, 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1f,
|
||||||
0xf8, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1f };
|
0xf8, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1f };
|
||||||
|
|
||||||
static unsigned char ap_bits[] = {
|
static unsigned char ap_bits[] PROGMEM = {
|
||||||
0xe0, 0x03, 0x18, 0x0c, 0x04, 0x10, 0xc2, 0x21, 0x30, 0x06, 0x08, 0x08,
|
0xe0, 0x03, 0x18, 0x0c, 0x04, 0x10, 0xc2, 0x21, 0x30, 0x06, 0x08, 0x08,
|
||||||
0xc0, 0x01, 0x20, 0x02, 0x00, 0x00, 0x80, 0x00, 0xc0, 0x01, 0xc0, 0x01,
|
0xc0, 0x01, 0x20, 0x02, 0x00, 0x00, 0x80, 0x00, 0xc0, 0x01, 0xc0, 0x01,
|
||||||
0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00 };
|
0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00 };
|
||||||
|
|
||||||
static unsigned char dish_bits[] PROGMEM= {
|
static unsigned char dish_bits[] PROGMEM = {
|
||||||
0x3c, 0x00, 0x42, 0x18, 0xfa, 0x1b, 0x02, 0x04, 0x02, 0x0a, 0x02, 0x09,
|
0x3c, 0x00, 0x42, 0x18, 0xfa, 0x1b, 0x02, 0x04, 0x02, 0x0a, 0x02, 0x09,
|
||||||
0x82, 0x08, 0x06, 0x0a, 0x0e, 0x1b, 0x9c, 0x2b, 0x38, 0x2b, 0x74, 0x20,
|
0x82, 0x08, 0x06, 0x0a, 0x0e, 0x1b, 0x9c, 0x2b, 0x38, 0x2b, 0x74, 0x20,
|
||||||
0xec, 0x1f, 0x1c, 0x00, 0xf4, 0x00, 0xfe, 0x03 };
|
0xec, 0x1f, 0x1c, 0x00, 0xf4, 0x00, 0xfe, 0x03 };
|
||||||
|
|||||||
@@ -120,10 +120,10 @@
|
|||||||
#define SHOW_TIME 6000 // Show time in [ms] for logo and WiFi QR code
|
#define SHOW_TIME 6000 // Show time in [ms] for logo and WiFi QR code
|
||||||
#define FULL_REFRESH_TIME 600 // Refresh cycle time in [s][600...3600] for full display update (very important healcy function)
|
#define FULL_REFRESH_TIME 600 // Refresh cycle time in [s][600...3600] for full display update (very important healcy function)
|
||||||
// SPI SD-Card
|
// SPI SD-Card
|
||||||
#define SD_SPI_CS 10
|
#define SD_SPI_CS GPIO_NUM_10
|
||||||
#define SD_SPI_MOSI 40
|
#define SD_SPI_MOSI GPIO_NUM_40
|
||||||
#define SD_SPI_CLK 39
|
#define SD_SPI_CLK GPIO_NUM_39
|
||||||
#define SD_SPI_MISO 13
|
#define SD_SPI_MISO GPIO_NUM_13
|
||||||
|
|
||||||
// GPS (NEO-6M, NEO-M8N, ATGM336H)
|
// GPS (NEO-6M, NEO-M8N, ATGM336H)
|
||||||
#define OBP_GPS_RX 19
|
#define OBP_GPS_RX 19
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class PageBME280 : public Page
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData->config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger = commonData->logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
@@ -176,9 +176,7 @@ class PageBME280 : public Page
|
|||||||
// Show bus data
|
// Show bus data
|
||||||
getdisplay().print(svalue3); // Real value as formated string
|
getdisplay().print(svalue3); // Real value as formated string
|
||||||
|
|
||||||
// Update display
|
return PAGE_UPDATE;
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class PageBattery : public Page
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData->config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger = commonData->logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
@@ -288,9 +288,7 @@ class PageBattery : public Page
|
|||||||
getdisplay().print("---"); // No sensor data (sensor is off)
|
getdisplay().print("---"); // No sensor data (sensor is off)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update display
|
return PAGE_UPDATE;
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public:
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(PageData &pageData)
|
int displayPage(PageData &pageData)
|
||||||
{
|
{
|
||||||
GwConfigHandler *config = commonData->config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger = commonData->logger;
|
GwLog *logger = commonData->logger;
|
||||||
@@ -334,8 +334,7 @@ public:
|
|||||||
getdisplay().setFont(&Ubuntu_Bold16pt8b);
|
getdisplay().setFont(&Ubuntu_Bold16pt8b);
|
||||||
getdisplay().print("W");
|
getdisplay().print("W");
|
||||||
|
|
||||||
// Update display
|
return PAGE_UPDATE;
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ bool homevalid = false; // homelat and homelon are valid
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(PageData &pageData)
|
int displayPage(PageData &pageData)
|
||||||
{
|
{
|
||||||
GwConfigHandler *config = commonData->config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger = commonData->logger;
|
GwLog *logger = commonData->logger;
|
||||||
@@ -162,7 +162,7 @@ bool homevalid = false; // homelat and homelon are valid
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Logging boat values
|
// Logging boat values
|
||||||
if (bvalue1 == NULL) return;
|
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
||||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageClock, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2);
|
LOG_DEBUG(GwLog::LOG,"Drawing at PageClock, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2);
|
||||||
|
|
||||||
// Draw page
|
// Draw page
|
||||||
@@ -438,9 +438,7 @@ bool homevalid = false; // homelat and homelon are valid
|
|||||||
getdisplay().fillCircle(200, 150, startwidth + 6, commonData->bgcolor);
|
getdisplay().fillCircle(200, 150, startwidth + 6, commonData->bgcolor);
|
||||||
getdisplay().fillCircle(200, 150, startwidth + 4, commonData->fgcolor);
|
getdisplay().fillCircle(200, 150, startwidth + 4, commonData->fgcolor);
|
||||||
|
|
||||||
// Update display
|
return PAGE_UPDATE;
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class PageCompass : public Page
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData->config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger = commonData->logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ class PageCompass : public Page
|
|||||||
setFlashLED(false);
|
setFlashLED(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bvalue == NULL) return;
|
if (bvalue == NULL) return PAGE_OK; // WTF why this statement?
|
||||||
|
|
||||||
//***********************************************************
|
//***********************************************************
|
||||||
|
|
||||||
@@ -235,12 +235,11 @@ class PageCompass : public Page
|
|||||||
// if ( x_test > 390)
|
// if ( x_test > 390)
|
||||||
// x_test = 320;
|
// x_test = 320;
|
||||||
|
|
||||||
// Update display
|
return PAGE_UPDATE;
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
static Page *createPage(CommonData &common){
|
static Page *createPage(CommonData &common){
|
||||||
return new PageCompass(common);
|
return new PageCompass(common);
|
||||||
}/**
|
}/**
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public:
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData->config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger = commonData->logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Logging boat values
|
// Logging boat values
|
||||||
if (bvalue1 == NULL) return;
|
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
||||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageDST810, %s: %f, %s: %f, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, name4.c_str(), value4);
|
LOG_DEBUG(GwLog::LOG,"Drawing at PageDST810, %s: %f, %s: %f, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, name4.c_str(), value4);
|
||||||
|
|
||||||
// Draw page
|
// Draw page
|
||||||
@@ -242,9 +242,7 @@ public:
|
|||||||
unit4old = unit4; // Save the old unit
|
unit4old = unit4; // Save the old unit
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update display
|
return PAGE_UPDATE;
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ class PageFluid : public Page
|
|||||||
commonData->logger->logDebug(GwLog::LOG,"New PageFluid: fluidtype=%d", fluidtype);
|
commonData->logger->logDebug(GwLog::LOG,"New PageFluid: fluidtype=%d", fluidtype);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData->config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger = commonData->logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
@@ -252,9 +252,7 @@ class PageFluid : public Page
|
|||||||
getdisplay().fillCircle(c.x, c.y, 6, commonData->bgcolor);
|
getdisplay().fillCircle(c.x, c.y, 6, commonData->bgcolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update display
|
return PAGE_UPDATE;
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class PageFourValues : public Page
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData->config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger = commonData->logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ class PageFourValues : public Page
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Logging boat values
|
// Logging boat values
|
||||||
if (bvalue1 == NULL) return;
|
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
||||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageFourValues, %s: %f, %s: %f, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, name4.c_str(), value4);
|
LOG_DEBUG(GwLog::LOG,"Drawing at PageFourValues, %s: %f, %s: %f, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, name4.c_str(), value4);
|
||||||
|
|
||||||
// Draw page
|
// Draw page
|
||||||
@@ -287,9 +287,7 @@ class PageFourValues : public Page
|
|||||||
unit4old = unit4; // Save the old unit
|
unit4old = unit4; // Save the old unit
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update display
|
return PAGE_UPDATE;
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class PageFourValues2 : public Page
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData->config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger = commonData->logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ class PageFourValues2 : public Page
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Logging boat values
|
// Logging boat values
|
||||||
if (bvalue1 == NULL) return;
|
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
||||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageFourValues2, %s: %f, %s: %f, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, name4.c_str(), value4);
|
LOG_DEBUG(GwLog::LOG,"Drawing at PageFourValues2, %s: %f, %s: %f, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, name4.c_str(), value4);
|
||||||
|
|
||||||
// Draw page
|
// Draw page
|
||||||
@@ -287,9 +287,7 @@ class PageFourValues2 : public Page
|
|||||||
unit4old = unit4; // Save the old unit
|
unit4old = unit4; // Save the old unit
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update display
|
return PAGE_UPDATE;
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public:
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(PageData &pageData)
|
int displayPage(PageData &pageData)
|
||||||
{
|
{
|
||||||
GwConfigHandler *config = commonData->config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger = commonData->logger;
|
GwLog *logger = commonData->logger;
|
||||||
@@ -203,8 +203,7 @@ public:
|
|||||||
getdisplay().setFont(&Ubuntu_Bold16pt8b);
|
getdisplay().setFont(&Ubuntu_Bold16pt8b);
|
||||||
getdisplay().print("W");
|
getdisplay().print("W");
|
||||||
|
|
||||||
// Update display
|
return PAGE_UPDATE;
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public:
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(PageData &pageData)
|
int displayPage(PageData &pageData)
|
||||||
{
|
{
|
||||||
GwConfigHandler *config = commonData->config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger = commonData->logger;
|
GwLog *logger = commonData->logger;
|
||||||
@@ -206,9 +206,7 @@ public:
|
|||||||
getdisplay().print("No sensor data"); // Info missing sensor
|
getdisplay().print("No sensor data"); // Info missing sensor
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update display
|
return PAGE_UPDATE;
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class PageOneValue : public Page
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData->config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger = commonData->logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ class PageOneValue : public Page
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Logging boat values
|
// Logging boat values
|
||||||
if (bvalue1 == NULL) return;
|
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
||||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageOneValue, %s: %f", name1.c_str(), value1);
|
LOG_DEBUG(GwLog::LOG,"Drawing at PageOneValue, %s: %f", name1.c_str(), value1);
|
||||||
|
|
||||||
// Draw page
|
// Draw page
|
||||||
@@ -104,9 +104,7 @@ class PageOneValue : public Page
|
|||||||
unit1old = unit1; // Save the old unit
|
unit1old = unit1; // Save the old unit
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update display
|
return PAGE_UPDATE;
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public:
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData->config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger = commonData->logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Logging boat values
|
// Logging boat values
|
||||||
if (bvalue1 == NULL) return;
|
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
||||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageRollPitch, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2);
|
LOG_DEBUG(GwLog::LOG,"Drawing at PageRollPitch, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2);
|
||||||
|
|
||||||
// Draw page
|
// Draw page
|
||||||
@@ -305,9 +305,7 @@ public:
|
|||||||
getdisplay().print("No sensor data"); // Info missing sensor
|
getdisplay().print("No sensor data"); // Info missing sensor
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update display
|
return PAGE_UPDATE;
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public:
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData->config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger = commonData->logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Logging boat values
|
// Logging boat values
|
||||||
if (bvalue1 == NULL) return;
|
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
||||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageRudderPosition, %s:%f", name1.c_str(), value1);
|
LOG_DEBUG(GwLog::LOG,"Drawing at PageRudderPosition, %s:%f", name1.c_str(), value1);
|
||||||
|
|
||||||
// Draw page
|
// Draw page
|
||||||
@@ -207,8 +207,7 @@ public:
|
|||||||
getdisplay().fillCircle(200, 150, startwidth + 6, commonData->bgcolor);
|
getdisplay().fillCircle(200, 150, startwidth + 6, commonData->bgcolor);
|
||||||
getdisplay().fillCircle(200, 150, startwidth + 4, commonData->fgcolor);
|
getdisplay().fillCircle(200, 150, startwidth + 4, commonData->fgcolor);
|
||||||
|
|
||||||
// Update display
|
return PAGE_UPDATE;
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class PageSixValues : public Page
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData->config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger = commonData->logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ class PageSixValues : public Page
|
|||||||
setFlashLED(false);
|
setFlashLED(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bvalue == NULL) return;
|
if (bvalue == NULL) return PAGE_OK; // WTF why this statement?
|
||||||
|
|
||||||
// Draw page
|
// Draw page
|
||||||
//***********************************************************
|
//***********************************************************
|
||||||
@@ -149,9 +149,7 @@ class PageSixValues : public Page
|
|||||||
getdisplay().fillRect(SixValues_x1+SixValues_DeltaX-8, SixValues_y1+i*SixValues_DeltaY, 3, SixValues_DeltaY, commonData->fgcolor);
|
getdisplay().fillRect(SixValues_x1+SixValues_DeltaX-8, SixValues_y1+i*SixValues_DeltaY, 3, SixValues_DeltaY, commonData->fgcolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update display
|
return PAGE_UPDATE;
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public:
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData->config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger = commonData->logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
@@ -199,8 +199,7 @@ public:
|
|||||||
getdisplay().setFont(&Ubuntu_Bold16pt8b);
|
getdisplay().setFont(&Ubuntu_Bold16pt8b);
|
||||||
getdisplay().print("W");
|
getdisplay().print("W");
|
||||||
|
|
||||||
// Update display
|
return PAGE_UPDATE;
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -6,11 +6,6 @@
|
|||||||
#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)
|
||||||
@@ -164,7 +159,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData->config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger = commonData->logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
@@ -257,12 +252,7 @@ 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);
|
||||||
if (sdcard) {
|
getdisplay().print(hasSDcard ? "ok" : "no");
|
||||||
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
|
||||||
@@ -373,7 +363,6 @@ public:
|
|||||||
getdisplay().setCursor(x0, y0);
|
getdisplay().setCursor(x0, y0);
|
||||||
getdisplay().print("Work in progress...");
|
getdisplay().print("Work in progress...");
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// NMEA2000 device list
|
// NMEA2000 device list
|
||||||
getdisplay().setFont(&Ubuntu_Bold12pt8b);
|
getdisplay().setFont(&Ubuntu_Bold12pt8b);
|
||||||
@@ -391,7 +380,7 @@ public:
|
|||||||
|
|
||||||
// Update display
|
// Update display
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
getdisplay().nextPage(); // Partial update (fast)
|
||||||
|
return PAGE_OK;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class PageThreeValues : public Page
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData->config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger = commonData->logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ class PageThreeValues : public Page
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Logging boat values
|
// Logging boat values
|
||||||
if (bvalue1 == NULL) return;
|
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
||||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageThreeValues, %s: %f, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3);
|
LOG_DEBUG(GwLog::LOG,"Drawing at PageThreeValues, %s: %f, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3);
|
||||||
|
|
||||||
// Draw page
|
// Draw page
|
||||||
@@ -226,8 +226,7 @@ class PageThreeValues : public Page
|
|||||||
unit3old = unit3; // Save the old unit
|
unit3old = unit3; // Save the old unit
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update display
|
return PAGE_UPDATE;
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class PageTwoValues : public Page
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData->config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger = commonData->logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ class PageTwoValues : public Page
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Logging boat values
|
// Logging boat values
|
||||||
if (bvalue1 == NULL) return;
|
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
||||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageTwoValues, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2);
|
LOG_DEBUG(GwLog::LOG,"Drawing at PageTwoValues, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2);
|
||||||
|
|
||||||
// Draw page
|
// Draw page
|
||||||
@@ -166,8 +166,7 @@ class PageTwoValues : public Page
|
|||||||
unit2old = unit2; // Save the old unit
|
unit2old = unit2; // Save the old unit
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update display
|
return PAGE_UPDATE;
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ public:
|
|||||||
getdisplay().fillRect(x + 16, y + 11, 6, 3, color);
|
getdisplay().fillRect(x + 16, y + 11, 6, 3, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData->config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger = commonData->logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
@@ -383,8 +383,7 @@ public:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update display
|
return PAGE_UPDATE;
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public:
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData->config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger = commonData->logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
@@ -67,10 +67,13 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update display
|
// Update display
|
||||||
getdisplay().nextPage();
|
// getdisplay().nextPage();
|
||||||
|
int ret = PAGE_UPDATE;
|
||||||
if (mode == 'W') {
|
if (mode == 'W') {
|
||||||
getdisplay().hibernate();
|
//getdisplay().hibernate();
|
||||||
|
ret |= PAGE_HIBERNATE;
|
||||||
}
|
}
|
||||||
|
return ret;
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -296,7 +296,7 @@ public:
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(PageData &pageData)
|
int displayPage(PageData &pageData)
|
||||||
{
|
{
|
||||||
GwConfigHandler *config = commonData->config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger = commonData->logger;
|
GwLog *logger = commonData->logger;
|
||||||
@@ -354,7 +354,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Logging boat values
|
// Logging boat values
|
||||||
if (bvalue1 == NULL) return;
|
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
||||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageWind, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2);
|
LOG_DEBUG(GwLog::LOG,"Drawing at PageWind, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2);
|
||||||
|
|
||||||
// Draw page
|
// Draw page
|
||||||
@@ -618,9 +618,7 @@ public:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update display
|
return PAGE_UPDATE;
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public:
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData->config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger = commonData->logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Logging boat values
|
// Logging boat values
|
||||||
if (bvalue1 == NULL) return;
|
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
||||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageWindRose, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, name4.c_str(), value4, name5.c_str(), value5, name6.c_str(), value6);
|
LOG_DEBUG(GwLog::LOG,"Drawing at PageWindRose, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, name4.c_str(), value4, name5.c_str(), value5, name6.c_str(), value6);
|
||||||
|
|
||||||
// Draw page
|
// Draw page
|
||||||
@@ -357,8 +357,7 @@ public:
|
|||||||
getdisplay().print(unit6old); // Unit
|
getdisplay().print(unit6old); // Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update display
|
return PAGE_UPDATE;
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public:
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData->config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger = commonData->logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Logging boat values
|
// Logging boat values
|
||||||
if (bvalue1 == NULL) return;
|
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
||||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageWindRoseFlex, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, name4.c_str(), value4, name5.c_str(), value5, name6.c_str(), value6);
|
LOG_DEBUG(GwLog::LOG,"Drawing at PageWindRoseFlex, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, name4.c_str(), value4, name5.c_str(), value5, name6.c_str(), value6);
|
||||||
|
|
||||||
// Draw page
|
// Draw page
|
||||||
@@ -362,8 +362,7 @@ if ( cos(value1) > 0){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Update display
|
return PAGE_UPDATE;
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ class PageXTETrack : public Page
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData->config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger = commonData->logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
@@ -207,9 +207,7 @@ class PageXTETrack : public Page
|
|||||||
drawSegment(399, 100, 318, 24, 289, 24, 350, 100, commonData->fgcolor, seg[4]);
|
drawSegment(399, 100, 318, 24, 289, 24, 350, 100, commonData->fgcolor, seg[4]);
|
||||||
drawSegment(399, 54, 354, 24, 325, 24, 399, 90, commonData->fgcolor, seg[5]);
|
drawSegment(399, 54, 354, 24, 325, 24, 399, 90, commonData->fgcolor, seg[5]);
|
||||||
|
|
||||||
// Update display
|
return PAGE_UPDATE;
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -78,6 +78,22 @@ typedef struct{
|
|||||||
bool on; // fast on/off detector
|
bool on; // fast on/off detector
|
||||||
} BacklightData;
|
} BacklightData;
|
||||||
|
|
||||||
|
enum AlarmSource {
|
||||||
|
Alarm_Generic,
|
||||||
|
Alarm_Local,
|
||||||
|
Alarm_NMEA0183,
|
||||||
|
Alarm_NMEA2000
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
uint8_t id; // alarm-id e.g. 01..99 from NMEA0183
|
||||||
|
AlarmSource source;
|
||||||
|
String message; // single line of plain text
|
||||||
|
bool active = false;
|
||||||
|
uint8_t signal; // how to signal MESSAGE | LED | BUZZER
|
||||||
|
uint8_t length_sec; // seconds until alarm disappeares without user interaction
|
||||||
|
} AlarmData;
|
||||||
|
|
||||||
typedef struct{
|
typedef struct{
|
||||||
GwApi::Status status;
|
GwApi::Status status;
|
||||||
GwLog *logger=NULL;
|
GwLog *logger=NULL;
|
||||||
@@ -86,6 +102,7 @@ typedef struct{
|
|||||||
SunData sundata;
|
SunData sundata;
|
||||||
TouchKeyData keydata[6];
|
TouchKeyData keydata[6];
|
||||||
BacklightData backlight;
|
BacklightData backlight;
|
||||||
|
AlarmData alarm;
|
||||||
GwApi::BoatValue *time=NULL;
|
GwApi::BoatValue *time=NULL;
|
||||||
GwApi::BoatValue *date=NULL;
|
GwApi::BoatValue *date=NULL;
|
||||||
uint16_t fgcolor;
|
uint16_t fgcolor;
|
||||||
@@ -100,7 +117,7 @@ class Page{
|
|||||||
CommonData *commonData;
|
CommonData *commonData;
|
||||||
public:
|
public:
|
||||||
int refreshtime = 1000;
|
int refreshtime = 1000;
|
||||||
virtual void displayPage(PageData &pageData)=0;
|
virtual int displayPage(PageData &pageData)=0;
|
||||||
virtual void displayNew(PageData &pageData){}
|
virtual void displayNew(PageData &pageData){}
|
||||||
virtual void setupKeys() {
|
virtual void setupKeys() {
|
||||||
#ifdef HARDWARE_V21
|
#ifdef HARDWARE_V21
|
||||||
|
|||||||
@@ -79,8 +79,8 @@ void OBP60Init(GwApi *api){
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BOARD_OBP40S3
|
#ifdef BOARD_OBP40S3
|
||||||
bool sdcard = config->getBool(config->useSDCard);
|
// TODO migrate to new code see OBP60Extensions.cpp
|
||||||
if (sdcard) {
|
if (config->getBool(config->useSDCard)) {
|
||||||
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)) {
|
||||||
@@ -99,6 +99,7 @@ void OBP60Init(GwApi *api){
|
|||||||
}
|
}
|
||||||
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);
|
LOG_DEBUG(GwLog::LOG,"SD card type %s of size %d MB detected", sdtype, cardSize);
|
||||||
|
SD_SPI.end();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -382,6 +383,7 @@ void OBP60Task(GwApi *api){
|
|||||||
#ifdef HARDWARE_V21
|
#ifdef HARDWARE_V21
|
||||||
startLedTask(api);
|
startLedTask(api);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PageList allPages;
|
PageList allPages;
|
||||||
registerAllPages(allPages);
|
registerAllPages(allPages);
|
||||||
CommonData commonData;
|
CommonData commonData;
|
||||||
@@ -843,7 +845,16 @@ void OBP60Task(GwApi *api){
|
|||||||
if (pages[pageNumber].description && pages[pageNumber].description->header){
|
if (pages[pageNumber].description && pages[pageNumber].description->header){
|
||||||
displayFooter(commonData);
|
displayFooter(commonData);
|
||||||
}
|
}
|
||||||
currentPage->displayPage(pages[pageNumber].parameters);
|
int ret = currentPage->displayPage(pages[pageNumber].parameters);
|
||||||
|
if (commonData.alarm.active) {
|
||||||
|
displayAlarm(commonData);
|
||||||
|
}
|
||||||
|
if (ret & PAGE_UPDATE) {
|
||||||
|
getdisplay().nextPage(); // Partial update (fast)
|
||||||
|
}
|
||||||
|
if (ret & PAGE_HIBERNATE) {
|
||||||
|
getdisplay().hibernate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ lib_deps =
|
|||||||
paulstoffregen/OneWire@2.3.8
|
paulstoffregen/OneWire@2.3.8
|
||||||
milesburton/DallasTemperature@3.11.0
|
milesburton/DallasTemperature@3.11.0
|
||||||
signetica/SunRise@2.0.2
|
signetica/SunRise@2.0.2
|
||||||
adafruit/Adafruit FRAM I2C@^2.0.3
|
adafruit/Adafruit FRAM I2C@2.0.3
|
||||||
build_flags=
|
build_flags=
|
||||||
#https://thingpulse.com/usb-settings-for-logging-with-the-esp32-s3-in-platformio/?srsltid=AfmBOopGskbkr4GoeVkNlFaZXe_zXkLceKF6Rn-tmoXABCeAR2vWsdHL
|
#https://thingpulse.com/usb-settings-for-logging-with-the-esp32-s3-in-platformio/?srsltid=AfmBOopGskbkr4GoeVkNlFaZXe_zXkLceKF6Rn-tmoXABCeAR2vWsdHL
|
||||||
# -D CORE_DEBUG_LEVEL=1 #Debug level for CPU core via CDC (seral device)
|
# -D CORE_DEBUG_LEVEL=1 #Debug level for CPU core via CDC (seral device)
|
||||||
@@ -91,7 +91,7 @@ lib_deps =
|
|||||||
paulstoffregen/OneWire@2.3.8
|
paulstoffregen/OneWire@2.3.8
|
||||||
milesburton/DallasTemperature@3.11.0
|
milesburton/DallasTemperature@3.11.0
|
||||||
signetica/SunRise@2.0.2
|
signetica/SunRise@2.0.2
|
||||||
adafruit/Adafruit FRAM I2C@^2.0.3
|
adafruit/Adafruit FRAM I2C@2.0.3
|
||||||
build_flags=
|
build_flags=
|
||||||
-D DISABLE_DIAGNOSTIC_OUTPUT #Disable diagnostic output for GxEPD2 lib
|
-D DISABLE_DIAGNOSTIC_OUTPUT #Disable diagnostic output for GxEPD2 lib
|
||||||
-D BOARD_OBP40S3 #Board OBP40 with ESP32S3
|
-D BOARD_OBP40S3 #Board OBP40 with ESP32S3
|
||||||
|
|||||||
Reference in New Issue
Block a user