1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-16 07:23:07 +01:00

16 Commits

Author SHA1 Message Date
5b477331de More work on anchor page 2025-11-05 20:02:36 +01:00
9b9bf76e4d Added page anchor with background map 2025-11-03 20:04:31 +01:00
Norbert Walter
470c0e5f4d Merge pull request #208 from thooge/fonts
Added small 8x8px font mainly for use with graphs
2025-10-06 18:25:44 +02:00
Norbert Walter
9a792b49db Merge pull request #206 from TobiasE-github/master
disabe mode x in PageWind
2025-10-06 18:23:56 +02:00
8f851a4b61 Added small 8x8px font mainly for use with graphs
Page skyview improved with the new font as example usage
2025-10-06 13:19:42 +02:00
Norbert Walter
f46a43d7fd Merge pull request #207 from thooge/configfix
Config file fixes and  generation script update
2025-10-06 10:44:58 +02:00
84e99365f7 Config file fixes and generation script update 2025-09-29 14:31:28 +02:00
TobiasE-github
e5950f95fd disabe mode x in PageWind 2025-09-27 20:30:00 +02:00
Norbert Walter
d0076f336d Merge pull request #205 from TobiasE-github/master
use a smaller font on long names in WindRoseFlex
2025-09-25 23:59:28 +02:00
Tobias E
d94c4bbbdb optimize font size 2025-09-20 11:16:17 +00:00
TobiasE-github
6ef7681a40 use a smaller font on long names in WindRoseFlex 2025-09-14 21:00:02 +02:00
norbert-walter
34a289048f Fix HDOP and more delay for page refresh after new page 2025-09-10 18:48:24 +02:00
Norbert Walter
df1bd498ae Merge pull request #204 from Scorgan01/PSRAM
Data History Buffer: Moved buffers to PSRAM; extended wind buffer sizes to 1920 values
2025-09-10 18:17:00 +02:00
Scorgan01
de448974d9 Delete serial_output.txt 2025-08-27 23:21:21 +02:00
Scorgan01
6b91400cfc Merge branch 'norbert-walter:master' into PSRAM 2025-08-27 23:17:18 +02:00
Ulrich Meine
1abcb158ec Moved history buffers to PSRAM; extended buffer to 1920 values each (32 min.) 2025-08-26 23:21:36 +02:00
16 changed files with 3371 additions and 2743 deletions

View File

@@ -24,6 +24,7 @@
#include "fonts/Ubuntu_Bold20pt8b.h"
#include "fonts/Ubuntu_Bold32pt8b.h"
#include "fonts/Atari16px8b.h" // Key label font
#include "fonts/IBM8x8px.h"
// E-Ink Display
#define GxEPD_WIDTH 400 // Display width

View File

@@ -51,6 +51,7 @@ extern const GFXfont Ubuntu_Bold16pt8b;
extern const GFXfont Ubuntu_Bold20pt8b;
extern const GFXfont Ubuntu_Bold32pt8b;
extern const GFXfont Atari16px;
extern const GFXfont IBM8x8px;
// Global functions
#ifdef DISPLAY_GDEW042T2

View File

@@ -39,12 +39,13 @@ public:
HstryBuf(){
hstryBufList = {&twdHstry, &twsHstry, &awdHstry, &awsHstry}; // Generate history buffers of zero size
};
HstryBuf(int size) {
hstryBufList = {&twdHstry, &twsHstry, &awdHstry, &awsHstry};
hstryBufList.twdHstry->resize(960); // store 960 TWD values for 16 minutes history
hstryBufList.twsHstry->resize(960);
hstryBufList.awdHstry->resize(960);
hstryBufList.awsHstry->resize(960);
hstryBufList.twdHstry->resize(size); // store <size> xWD values for <size>/60 minutes history
hstryBufList.twsHstry->resize(size);
hstryBufList.awdHstry->resize(size);
hstryBufList.awsHstry->resize(size);
};
void init(BoatValueList* boatValues, GwLog *log);
void handleHstryBuf(bool useSimuData);

View File

@@ -1,15 +1,48 @@
#pragma once
#include "GwSynchronized.h"
#include "WString.h"
#include "esp_heap_caps.h"
#include <algorithm>
#include <limits>
#include <stdexcept>
#include <vector>
#include "WString.h"
template <typename T>
struct PSRAMAllocator {
using value_type = T;
PSRAMAllocator() = default;
template <class U>
constexpr PSRAMAllocator(const PSRAMAllocator<U>&) noexcept { }
T* allocate(std::size_t n)
{
void* ptr = heap_caps_malloc(n * sizeof(T), MALLOC_CAP_SPIRAM);
if (!ptr) {
return nullptr;
} else {
return static_cast<T*>(ptr);
}
}
void deallocate(T* p, std::size_t) noexcept
{
heap_caps_free(p);
}
};
template <class T, class U>
bool operator==(const PSRAMAllocator<T>&, const PSRAMAllocator<U>&) { return true; }
template <class T, class U>
bool operator!=(const PSRAMAllocator<T>&, const PSRAMAllocator<U>&) { return false; }
template <typename T>
class RingBuffer {
private:
std::vector<T> buffer; // THE buffer vector
// std::vector<T> buffer; // THE buffer vector
std::vector<T, PSRAMAllocator<T>> buffer; // THE buffer vector, allocated in PSRAM
size_t capacity;
size_t head; // Points to the next insertion position
size_t first; // Points to the first (oldest) valid element

View File

@@ -35,6 +35,8 @@ RingBuffer<T>::RingBuffer(size_t size)
, is_Full(false)
{
initCommon();
buffer.reserve(size);
buffer.resize(size, MAX_VAL); // MAX_VAL indicate invalid values
}
@@ -405,6 +407,7 @@ void RingBuffer<T>::resize(size_t newSize)
is_Full = false;
buffer.clear();
buffer.reserve(newSize);
buffer.resize(newSize, MAX_VAL);
}

View File

@@ -0,0 +1,443 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
/*
This page is in experimental stage so be warned!
North is up.
Anchor page with background map from mapservice
Boatdata used
DBS - Water depth
HDT - Boat heading
AWS - Wind strength; Boat not moving so we assume AWS=TWS and AWD=TWD
AWD - Wind direction
LAT/LON - Boat position, current
HDOP - Position error
Drop / raise function in device OBP40 has to be done inside
config mode because of limited number of buttons.
TODO
gzip for data transfer,
manually inflating with tinflate from ROM
Save position in FRAM
Alarm: gps fix lost
switch unit feet/meter
force map update if new position is different from old position by
a certain level (e.g. 10m)
*/
#include <WiFi.h>
#include <HTTPClient.h>
#include "Pagedata.h"
#include "OBP60Extensions.h"
#define anchor_width 16
#define anchor_height 16
static unsigned char anchor_bits[] PROGMEM = {
0x80, 0x01, 0x40, 0x02, 0x40, 0x02, 0x80, 0x01, 0xf0, 0x0f, 0x80, 0x01,
0x80, 0x01, 0x88, 0x11, 0x8c, 0x31, 0x8e, 0x71, 0x84, 0x21, 0x86, 0x61,
0x86, 0x61, 0xfc, 0x3f, 0xf8, 0x1f, 0x80, 0x01 };
class PageAnchor : public Page
{
private:
char mode = 'N'; // (N)ormal, (C)onfig
int8_t editmode = -1; // marker for menu/edit/set function
//uint8_t *mapbuf = new uint8_t[10000]; // 8450 Byte without header
//int mapbuf_size = 10000;
//uint8_t *mapbuf = (uint8_t*) heap_caps_malloc(mapbuf_size, MALLOC_CAP_SPIRAM);
GFXcanvas1 *canvas;
const uint16_t map_width = 264;
const uint16_t map_height = 260;
bool map_valid = false;
double map_lat = 0; // current center of valid map
double map_lon = 0;
String server_name; // server with map service
String tile_path;
String lengthformat;
double scale = 50; // Radius of display circle in meter, depends on lat
uint8_t zoom = 15; // map zoom level
bool alarm = false;
bool alarm_enabled = false;
uint8_t alarm_range;
uint8_t chain_length;
uint8_t chain = 0;
bool anchor_set = false;
double anchor_lat;
double anchor_lon;
double anchor_depth;
int anchor_ts; // time stamp anchor dropped
void displayModeNormal(PageData &pageData) {
// Boatvalues: DBS, HDT, AWS, AWD, LAT, LON, HDOP
GwApi::BoatValue *bv_dbs = pageData.values[0]; // DBS
String sval_dbs = formatValue(bv_dbs, *commonData).svalue;
String sunit_dbs = formatValue(bv_dbs, *commonData).unit;
GwApi::BoatValue *bv_hdt = pageData.values[1]; // HDT
String sval_hdt = formatValue(bv_hdt, *commonData).svalue;
GwApi::BoatValue *bv_aws = pageData.values[2]; // AWS
String sval_aws = formatValue(bv_aws, *commonData).svalue;
String sunit_aws = formatValue(bv_aws, *commonData).unit;
GwApi::BoatValue *bv_awd = pageData.values[3]; // AWD
String sval_awd = formatValue(bv_awd, *commonData).svalue;
GwApi::BoatValue *bv_lat = pageData.values[4]; // LAT
String sval_lat = formatValue(bv_lat, *commonData).svalue;
GwApi::BoatValue *bv_lon = pageData.values[5]; // LON
String sval_lon = formatValue(bv_lon, *commonData).svalue;
GwApi::BoatValue *bv_hdop = pageData.values[6]; // HDOP
String sval_hdop = formatValue(bv_hdop, *commonData).svalue;
String sunit_hdop = formatValue(bv_hdop, *commonData).unit;
commonData->logger->logDebug(GwLog::DEBUG, "Drawing at PageAnchor; DBS=%f, HDT=%f, AWS=%f", bv_dbs->value, bv_hdt->value, bv_aws->value);
// Draw canvas with background map
// rhumb(map_lat, map_lon, bv_lat->value, bv_lon->value)
int posdiff = 0;
if (map_valid) {
if (bv_lat->valid and bv_lon->valid) {
// calculate movement since last map refresh
posdiff = rhumb(map_lat, map_lon, bv_lat->value, bv_lon->value);
if (posdiff > 25) {
map_lat = bv_lat->value;
map_lon = bv_lon->value;
getBackgroundMap(map_lat, map_lon, zoom);
if (map_valid) {
// prepare visible space for anchor-symbol or boat
canvas->fillCircle(132, 130, 12, commonData->fgcolor);
}
}
}
getdisplay().drawBitmap(68, 20, canvas->getBuffer(), map_width, map_height, commonData->fgcolor);
}
Point c = {200, 150}; // center = anchor position
uint16_t r = 125;
// Circle as map border
getdisplay().drawCircle(c.x, c.y, r, commonData->fgcolor);
getdisplay().drawCircle(c.x, c.y, r + 1, commonData->fgcolor);
Point b = {200, 180}; // boat position while dropping anchor
const std::vector<Point> pts_boat = { // polygon lines
{b.x - 5, b.y},
{b.x - 5, b.y - 10},
{b.x, b.y - 16},
{b.x + 5, b.y - 10},
{b.x + 5, b.y}
};
//rotatePoints und dann Linien zeichnen
// TODO rotate boat according to current heading
if (bv_hdt->valid) {
if (map_valid) {
Point b1 = rotatePoint(c, {b.x, b.y - 8}, RadToDeg(bv_hdt->value));
getdisplay().fillCircle(b1.x, b1.y, 10, commonData->bgcolor);
}
drawPoly(rotatePoints(c, pts_boat, RadToDeg(bv_hdt->value)), commonData->fgcolor);
} else {
// no heading available draw north oriented
if (map_valid) {
getdisplay().fillCircle(b.x, b.y - 8, 10, commonData->bgcolor);
}
drawPoly(pts_boat, commonData->fgcolor);
}
// Draw wind arrow
const std::vector<Point> pts_wind = {
{c.x, c.y - r + 25},
{c.x - 12, c.y - r - 4},
{c.x, c.y - r + 6},
{c.x + 12, c.y - r - 4}
};
if (bv_awd->valid) {
fillPoly4(rotatePoints(c, pts_wind, bv_awd->value), commonData->fgcolor);
}
// Title and corner value headings
getdisplay().setTextColor(commonData->fgcolor);
getdisplay().setFont(&Ubuntu_Bold10pt8b);
// Left
getdisplay().setCursor(8, 36);
getdisplay().print("Anchor");
getdisplay().setCursor(8, 210);
getdisplay().print("Depth");
// Right
drawTextRalign(392, 80, "Chain");
drawTextRalign(392, 210, "Wind");
// Units
getdisplay().setCursor(8, 272);
getdisplay().print(sunit_dbs);
drawTextRalign(392, 272, sunit_aws);
// drawTextRalign(392, 100, lengthformat); // chain unit not implemented
// Corner values
getdisplay().setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(8, 54);
getdisplay().print(anchor_set ? "Dropped" : "Ready"); // Anchor state
getdisplay().setCursor(8, 72);
getdisplay().print("Alarm: "); // Alarm state
getdisplay().print(alarm_enabled ? "on" : "off");
getdisplay().setCursor(8, 120);
getdisplay().print("Zoom");
getdisplay().setCursor(8, 136);
getdisplay().print(zoom);
getdisplay().setCursor(8, 160);
getdisplay().print("diff");
getdisplay().setCursor(8, 176);
if (map_valid and bv_lat->valid and bv_lon->valid) {
getdisplay().print(String(posdiff));
} else {
getdisplay().print("n/a");
}
// Chain out TODO lengthformat ft/m
drawTextRalign(392, 96, String(chain) + " m");
drawTextRalign(392, 96+16, "of " + String(chain_length) + " m");
getdisplay().setFont(&DSEG7Classic_BoldItalic16pt7b);
// Depth
getdisplay().setCursor(8, 250);
getdisplay().print(sval_dbs);
// Wind
getdisplay().setCursor(320, 250);
getdisplay().print(sval_aws);
// Position of boat in center of map
getdisplay().setFont(&IBM8x8px);
drawTextRalign(392, 34, sval_lat);
drawTextRalign(392, 44, sval_lon);
// quality
String hdop = "HDOP: ";
if (bv_hdop->valid) {
hdop += String(round(bv_hdop->value));
} else {
hdop += " n/a";
}
drawTextRalign(392, 54, hdop);
// zoom scale
getdisplay().drawLine(c.x + 10, c.y, c.x + r - 4, c.y, commonData->fgcolor);
// arrow left
getdisplay().drawLine(c.x + 10, c.y, c.x + 16, c.y - 4, commonData->fgcolor);
getdisplay().drawLine(c.x + 10, c.y, c.x + 16, c.y + 4, commonData->fgcolor);
// arrow right
getdisplay().drawLine(c.x + r - 4, c.y, c.x + r - 10, c.y - 4, commonData->fgcolor);
getdisplay().drawLine(c.x + r - 4, c.y, c.x + r - 10, c.y + 4, commonData->fgcolor);
getdisplay().setFont(&Ubuntu_Bold8pt8b);
drawTextCenter(c.x + r / 2, c.y + 8, String(scale, 0) + "m");
// draw anchor symbol (as bitmap)
getdisplay().drawXBitmap(c.x - anchor_width / 2, c.y - anchor_height / 2,
anchor_bits, anchor_width, anchor_height, commonData->fgcolor);
}
void displayModeConfig() {
getdisplay().setTextColor(commonData->fgcolor);
getdisplay().setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(8, 48);
getdisplay().print("Anchor configuration");
}
public:
PageAnchor(CommonData &common)
{
commonData = &common;
common.logger->logDebug(GwLog::LOG,"Instantiate PageAnchor");
server_name = common.config->getString(common.config->mapServer);
tile_path = common.config->getString(common.config->mapTilePath);
lengthformat = common.config->getString(common.config->lengthFormat);
chain_length = common.config->getInt(common.config->chainLength);
canvas = new GFXcanvas1(264, 260); // Byte aligned, no padding!
}
void setupKeys(){
Page::setupKeys();
commonData->keydata[0].label = "MODE";
#ifdef BOARD_OBP40S3
commonData->keydata[1].label = "DROP";
#endif
#ifdef BOARD_OBP60S3
commonData->keydata[4].label = "DROP";
#endif
}
// TODO OBP40 / OBP60 different handling
int handleKey(int key) {
if (key == 1) { // Switch between normal and config mode
if (mode == 'N') {
mode = 'C';
commonData->keydata[1].label = "EDIT";
} else {
mode = 'N';
#ifdef BOARD_OBP40S3
commonData->keydata[1].label = anchor_set ? "RAISE": "DROP";
#endif
#ifdef BOARD_OBP60S3
commonData->keydata[4].label = anchor_set ? "RAISE": "DROP";
#endif
}
return 0;
}
if (key == 2) {
anchor_set = !anchor_set;
commonData->keydata[1].label = anchor_set ? "RAISE": "DROP";
return 0;
}
// Code for keylock
if (key == 11){
commonData->keylock = !commonData->keylock;
return 0;
}
return key;
}
int rhumb(double lat1, double lon1, double lat2, double lon2) {
// calc distance in m between two geo points
static const double degToRad = M_PI / 180.0;
lat1 = degToRad * lat1;
lon1 = degToRad * lon1;
lat2 = degToRad * lat2;
lon2 = degToRad * lon2;
double dlon = lon2 - lon1;
double dlat = lat2 - lat1;
double mlat = (lat1 + lat2) / 2;
return (int) (6371000 * sqrt(pow(dlat, 2) + pow(cos(mlat) * dlon, 2)));
}
bool getBackgroundMap(double lat, double lon, uint8_t zoom) {
// HTTP-Request for map
// TODO über pagedata -> status abfragen?
if (WiFi.status() != WL_CONNECTED) {
return false;
}
bool valid = false;
HTTPClient http;
String url = "http://" + server_name + "/" + tile_path;
String parameter = "?lat=" + String(lat, 6) + "&lon=" + String(lon, 6)+ "&zoom=" + String(zoom)
+ "&width=" + String(map_width) + "&height=" + String(map_height);
commonData->logger->logDebug(GwLog::LOG, "HTTP query: %s", String(url + parameter).c_str());
http.begin(url + parameter);
// http.SetAcceptEncoding("gzip");
// TODO miniz.c from ROM
int httpCode = http.GET();
if (httpCode > 0) {
if (httpCode == HTTP_CODE_OK) {
WiFiClient* stream = http.getStreamPtr();
int size = http.getSize();
commonData->logger->logDebug(GwLog::LOG, "HTTP get size: %d", size);
// header: P4<LF><width> <height><LF> (e.g. 11 byte)
uint8_t header[14]; // max: P4<LF>wwww wwww<LF>
bool header_read = false;
int header_size = 0;
uint8_t* buf = canvas->getBuffer();
int n = 0;
int ix = 0;
while (stream->available()) {
uint8_t b = stream->read();
n += 1;
if ((! header_read) and (n < 13) ) {
header[n-1] = b;
if ((n > 3) and (b == 0x0a)) {
header_read = true;
header_size = n;
header[n] = 0;
}
} else {
// write image data to canvas buffer
buf[ix++] = b;
}
}
if (n == size) {
valid = true;
}
commonData->logger->logDebug(GwLog::LOG, "HTTP: final bytesRead=%d, header-size=%d", n, header_size);
} else {
commonData->logger->logDebug(GwLog::LOG, "HTTP result #%d", httpCode);
}
} else {
commonData->logger->logDebug(GwLog::ERROR, "HTTP error #%d", httpCode);
}
http.end();
return valid;
}
void displayNew(PageData &pageData){
GwApi::BoatValue *bv_lat = pageData.values[4]; // LAT
GwApi::BoatValue *bv_lon = pageData.values[5]; // LON
// check if valid data available
if (!bv_lat->valid or !bv_lon->valid) {
map_valid = false;
return;
}
map_lat = bv_lat->value; // save for later comparison
map_lon = bv_lon->value;
map_valid = getBackgroundMap(map_lat, map_lon, zoom);
if (map_valid) {
// prepare visible space for anchor-symbol or boat
canvas->fillCircle(132, 130, 10, commonData->fgcolor);
}
};
int displayPage(PageData &pageData) {
GwLog *logger = commonData->logger;
// Logging boat values
logger->logDebug(GwLog::LOG, "Drawing at PageAnchor; Mode=%c", mode);
// Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
if (mode == 'N') {
displayModeNormal(pageData);
} else if (mode == 'C') {
displayModeConfig();
}
return PAGE_UPDATE;
};
};
static Page *createPage(CommonData &common){
return new PageAnchor(common);
}
/**
* with the code below we make this page known to the PageTask
* we give it a type (name) that can be selected in the config
* we define which function is to be called
* and we provide the number of user parameters we expect
* this will be number of BoatValue pointers in pageData.values
*/
PageDescription registerPageAnchor(
"Anchor", // Page name
createPage, // Action
0, // Number of bus values depends on selection in Web configuration
{"DBS", "HDT", "AWS", "AWD", "LAT", "LON", "HDOP"}, // Names of bus values undepends on selection in Web configuration (refer GwBoatData.h)
true // Show display header on/off
);
#endif

View File

@@ -121,18 +121,20 @@ public:
getdisplay().setCursor(c.x - r + 3 , c.y + h / 2);
getdisplay().print("W");
getdisplay().setFont(&Ubuntu_Bold8pt8b);
// show satellites in "map"
getdisplay().setFont(&IBM8x8px);
for (int i = 0; i < nSat; i++) {
float arad = (sats[i].Azimut * M_PI / 180.0) + M_PI;
float erad = sats[i].Elevation * M_PI / 180.0;
uint16_t x = c.x + sin(arad) * erad * r1;
uint16_t y = c.y + cos(arad) * erad * r1;
getdisplay().fillRect(x-4, y-4, 8, 8, commonData->fgcolor);
getdisplay().setCursor(x-7, y+12);
getdisplay().printf("%02d", static_cast<int>(sats[i].PRN));
}
// Signal / Noise bars
getdisplay().setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(325, 34);
getdisplay().print("SNR");
// getdisplay().drawRect(270, 20, 125, 257, commonData->fgcolor);
@@ -169,8 +171,10 @@ public:
getdisplay().print("HDOP:");
GwApi::BoatValue *bv_hdop = pageData.values[1]; // HDOP
String sval_hdop = formatValue(bv_hdop, *commonData).svalue;
sval_hdop = sval_hdop + "m";
double hdop = formatValue(bv_hdop, *commonData).value * 4; // 4 is factor for UERE (translation in meter)
char sval_hdop[20];
dtostrf(hdop, 0, 1, sval_hdop); // Only one prefix
strcat(sval_hdop, "m");
getdisplay().setCursor(220, 269);
getdisplay().print(sval_hdop);

View File

@@ -247,8 +247,8 @@ public:
if(key == 1){ // Mode switch
if(mode == 'N'){
mode = 'L';
} else if (mode == 'L') {
mode = 'X';
// } else if (mode == 'L') {
// mode = 'X';
} else {
mode = 'N';
}

View File

@@ -83,7 +83,7 @@ class PageWindPlot : public Page {
bool oldShowTruW = false; // remember recent user selection of wind data type
int dataIntv = 1; // Update interval for wind history chart:
// (1)|(2)|(3)|(4) seconds for approx. 4, 8, 12, 16 min. history chart
// (1)|(2)|(3)|(4)|(8) x 240 seconds for 4, 8, 12, 16, 32 min. history chart
bool useSimuData;
String flashLED;
String backlightMode;
@@ -147,6 +147,8 @@ public:
dataIntv = 3;
} else if (dataIntv == 3) {
dataIntv = 4;
} else if (dataIntv == 4) {
dataIntv = 8;
} else {
dataIntv = 1;
}
@@ -204,7 +206,7 @@ public:
static int xCenter; // Center of screen in x direction
static const int yOffset = 48; // Offset for y coordinates of chart area
static int cHeight; // height of chart area
static int bufSize; // History buffer size: 960 values for appox. 16 min. history chart
static int bufSize; // History buffer size: 1.920 values for 32 min. history chart
static int intvBufSize; // Buffer size used for currently selected time interval
int count; // current size of buffer
static int numWndVals; // number of wind values available for current interval selection
@@ -285,7 +287,7 @@ public:
currIdx = wdHstry->getLastIdx();
numAddedBufVals = (currIdx - lastAddedIdx + bufSize) % bufSize; // Number of values added to buffer since last display
if (dataIntv != oldDataIntv || count == 1) {
// new data interval selected by user
// new data interval selected by user; this is only x * 230 values instead of 240 seconds (4 minutes) per interval step
intvBufSize = cHeight * dataIntv;
numWndVals = min(count, (cHeight - 60) * dataIntv);
bufStart = max(0, count - numWndVals);
@@ -298,6 +300,7 @@ public:
bufStart = max(0, bufStart - numAddedBufVals);
}
}
// LOG_DEBUG(GwLog::DEBUG,"PSRAM Size: %d kByte; free: %d Byte", ESP.getPsramSize()/1024, ESP.getFreePsram());
LOG_DEBUG(GwLog::DEBUG, "PageWindPlot Dataset: count: %d, xWD: %.1f, xWS: %.2f, xWD_valid? %d, intvBufSize: %d, numWndVals: %d, bufStart: %d, numAddedBufVals: %d, lastIdx: %d, wind source: %s",
count, wdHstry->getLast() / 1000.0 * radToDeg, wsHstry->getLast() / 1000.0 * 1.94384, BDataValid[0], intvBufSize, numWndVals, bufStart, numAddedBufVals, wdHstry->getLastIdx(),
showTruW ? "True" : "App");

View File

@@ -58,6 +58,11 @@ public:
static String unit5old = "";
static String svalue6old = "";
static String unit6old = "";
static GFXfont name3font;
static GFXfont name4font;
static GFXfont name5font;
static GFXfont name6font;
// Get config data
String lengthformat = config->getString(config->lengthFormat);
@@ -114,6 +119,12 @@ public:
GwApi::BoatValue *bvalue3 = pageData.values[0];
String name3 = xdrDelete(bvalue3->getName()); // Value name
name3 = name3.substring(0, 6); // String length limit for value name
if (name3.length()>3){
name3font=Ubuntu_Bold8pt8b;
}
else{
name3font=Ubuntu_Bold12pt8b;
}
calibrationData.calibrateInstance(bvalue3, logger); // Check if boat data value is to be calibrated
double value3 = bvalue3->value; // Value as double in SI unit
bool valid3 = bvalue3->valid; // Valid information
@@ -128,6 +139,12 @@ public:
GwApi::BoatValue *bvalue4 = pageData.values[1];
String name4 = xdrDelete(bvalue4->getName()); // Value name
name4 = name4.substring(0, 6); // String length limit for value name
if (name4.length()>3){
name4font=Ubuntu_Bold8pt8b;
}
else{
name4font=Ubuntu_Bold12pt8b;
}
calibrationData.calibrateInstance(bvalue4, logger); // Check if boat data value is to be calibrated
double value4 = bvalue4->value; // Value as double in SI unit
bool valid4 = bvalue4->valid; // Valid information
@@ -142,6 +159,12 @@ public:
GwApi::BoatValue *bvalue5 = pageData.values[2];
String name5 = xdrDelete(bvalue5->getName()); // Value name
name5 = name5.substring(0, 6); // String length limit for value name
if (name5.length()>3){
name5font=Ubuntu_Bold8pt8b;
}
else{
name5font=Ubuntu_Bold12pt8b;
}
calibrationData.calibrateInstance(bvalue5, logger); // Check if boat data value is to be calibrated
double value5 = bvalue5->value; // Value as double in SI unit
bool valid5 = bvalue5->valid; // Valid information
@@ -152,10 +175,16 @@ public:
unit5old = unit5; // Save old unit
}
// Get boat value for center
// Get boat value for center (name is not displayed)
GwApi::BoatValue *bvalue6 = pageData.values[3];
String name6 = xdrDelete(bvalue6->getName()); // Value name
name6 = name6.substring(0, 6); // String length limit for value name
if (name6.length()>3){
name6font=Ubuntu_Bold8pt8b;
}
else{
name6font=Ubuntu_Bold8pt8b;
}
calibrationData.calibrateInstance(bvalue6, logger); // Check if boat data value is to be calibrated
double value6 = bvalue6->value; // Value as double in SI unit
bool valid6 = bvalue6->valid; // Valid information
@@ -209,7 +238,7 @@ public:
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(10, 270);
getdisplay().print(svalue3); // Value
getdisplay().setFont(&Ubuntu_Bold12pt8b);
getdisplay().setFont(&name3font);
getdisplay().setCursor(10, 220);
getdisplay().print(name3); // Name
getdisplay().setFont(&Ubuntu_Bold8pt8b);
@@ -224,18 +253,13 @@ public:
// Show value 4 (=second user-configured parameter) at top right
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(295, 65);
if(valid3 == true){
getdisplay().print(svalue4); // Value
}
else{
getdisplay().print("---"); // Value
}
getdisplay().setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(335, 95);
getdisplay().setCursor(295, 65);
getdisplay().print(svalue4); // Value
getdisplay().setFont(&name4font);
getdisplay().setCursor(325, 95);
getdisplay().print(name4); // Name
getdisplay().setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(335, 115);
getdisplay().setCursor(325, 115);
getdisplay().print(" ");
if(holdvalues == false){
getdisplay().print(unit4); // Unit
@@ -251,11 +275,11 @@ public:
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(295, 270);
getdisplay().print(svalue5); // Value
getdisplay().setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(335, 220);
getdisplay().setFont(&name5font);
getdisplay().setCursor(325, 220);
getdisplay().print(name5); // Name
getdisplay().setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(335, 190);
getdisplay().setCursor(325, 190);
getdisplay().print(" ");
if(holdvalues == false){
getdisplay().print(unit5); // Unit

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,202 @@
const uint8_t IBM8x8pxBitmaps[] PROGMEM = {
0x00, /* 0x20 space */
0x6F, 0xF6, 0x60, 0x60, /* 0x21 exclam */
0xDE, 0xF6, /* 0x22 quotedbl */
0x6C, 0xDB, 0xFB, 0x6F, 0xED, 0x9B, 0x00, /* 0x23 numbersign */
0x31, 0xFC, 0x1E, 0x0F, 0xE3, 0x00, /* 0x24 dollar */
0xC7, 0x98, 0x61, 0x86, 0x78, 0xC0, /* 0x25 percent */
0x38, 0xD8, 0xE3, 0xBD, 0xD9, 0x9D, 0x80, /* 0x26 ampersand */
0x6F, 0x00, /* 0x27 quotesingle */
0x36, 0xCC, 0xC6, 0x30, /* 0x28 parenleft */
0xC6, 0x33, 0x36, 0xC0, /* 0x29 parenright */
0x66, 0x3C, 0xFF, 0x3C, 0x66, /* 0x2A asterisk */
0x30, 0xCF, 0xCC, 0x30, /* 0x2B plus */
0x6F, 0x00, /* 0x2C comma */
0xFC, /* 0x2D hyphen */
0xF0, /* 0x2E period */
0x06, 0x18, 0x61, 0x86, 0x18, 0x20, 0x00, /* 0x2F slash */
0x7D, 0x8F, 0x3E, 0xFF, 0x7C, 0xDF, 0x00, /* 0x30 zero */
0x31, 0xC3, 0x0C, 0x30, 0xCF, 0xC0, /* 0x31 one */
0x7B, 0x30, 0xCE, 0x63, 0x1F, 0xC0, /* 0x32 two */
0x7B, 0x30, 0xCE, 0x0F, 0x37, 0x80, /* 0x33 three */
0x1C, 0x79, 0xB6, 0x6F, 0xE1, 0x87, 0x80, /* 0x34 four */
0xFF, 0x0F, 0x83, 0x0F, 0x37, 0x80, /* 0x35 five */
0x39, 0x8C, 0x3E, 0xCF, 0x37, 0x80, /* 0x36 six */
0xFF, 0x30, 0xC6, 0x30, 0xC3, 0x00, /* 0x37 seven */
0x7B, 0x3C, 0xDE, 0xCF, 0x37, 0x80, /* 0x38 eight */
0x7B, 0x3C, 0xDF, 0x0C, 0x67, 0x00, /* 0x39 nine */
0xF0, 0xF0, /* 0x3A colon */
0x6C, 0x37, 0x80, /* 0x3B semicolon */
0x19, 0x99, 0x86, 0x18, 0x60, /* 0x3C less */
0xFC, 0x00, 0x3F, /* 0x3D equal */
0xC3, 0x0C, 0x33, 0x33, 0x00, /* 0x3E greater */
0x7B, 0x30, 0xC6, 0x30, 0x03, 0x00, /* 0x3F question */
0x7D, 0x8F, 0x7E, 0xFD, 0xF8, 0x1E, 0x00, /* 0x40 at */
0x31, 0xEC, 0xF3, 0xFF, 0x3C, 0xC0, /* 0x41 A */
0xFC, 0xCD, 0x9B, 0xE6, 0x6C, 0xFF, 0x00, /* 0x42 B */
0x3C, 0xCF, 0x06, 0x0C, 0x0C, 0xCF, 0x00, /* 0x43 C */
0xF8, 0xD9, 0x9B, 0x36, 0x6D, 0xBE, 0x00, /* 0x44 D */
0xFE, 0xC5, 0xA3, 0xC6, 0x8C, 0x7F, 0x80, /* 0x45 E */
0xFE, 0xC5, 0xA3, 0xC6, 0x8C, 0x3C, 0x00, /* 0x46 F */
0x3C, 0xCF, 0x06, 0x0C, 0xEC, 0xCF, 0x80, /* 0x47 G */
0xCF, 0x3C, 0xFF, 0xCF, 0x3C, 0xC0, /* 0x48 H */
0xF6, 0x66, 0x66, 0xF0, /* 0x49 I */
0x1E, 0x18, 0x30, 0x6C, 0xD9, 0x9E, 0x00, /* 0x4A J */
0xE6, 0xCD, 0xB3, 0xC6, 0xCC, 0xF9, 0x80, /* 0x4B K */
0xF0, 0xC1, 0x83, 0x06, 0x2C, 0xFF, 0x80, /* 0x4C L */
0xC7, 0xDF, 0xFF, 0xFD, 0x78, 0xF1, 0x80, /* 0x4D M */
0xC7, 0xCF, 0xDE, 0xFC, 0xF8, 0xF1, 0x80, /* 0x4E N */
0x38, 0xDB, 0x1E, 0x3C, 0x6D, 0x8E, 0x00, /* 0x4F O */
0xFC, 0xCD, 0x9B, 0xE6, 0x0C, 0x3C, 0x00, /* 0x50 P */
0x7B, 0x3C, 0xF3, 0xDD, 0xE1, 0xC0, /* 0x51 Q */
0xFC, 0xCD, 0x9B, 0xE6, 0xCC, 0xF9, 0x80, /* 0x52 R */
0x7B, 0x3E, 0x1C, 0x1F, 0x37, 0x80, /* 0x53 S */
0xFE, 0xD3, 0x0C, 0x30, 0xC7, 0x80, /* 0x54 T */
0xCF, 0x3C, 0xF3, 0xCF, 0x3F, 0xC0, /* 0x55 U */
0xCF, 0x3C, 0xF3, 0xCD, 0xE3, 0x00, /* 0x56 V */
0xC7, 0x8F, 0x1E, 0xBF, 0xFD, 0xF1, 0x80, /* 0x57 W */
0xC7, 0x8D, 0xB1, 0xC3, 0x8D, 0xB1, 0x80, /* 0x58 X */
0xCF, 0x3C, 0xDE, 0x30, 0xC7, 0x80, /* 0x59 Y */
0xFF, 0x8E, 0x30, 0xC3, 0x2C, 0xFF, 0x80, /* 0x5A Z */
0xFC, 0xCC, 0xCC, 0xF0, /* 0x5B bracketleft */
0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0x80, /* 0x5C backslash */
0xF3, 0x33, 0x33, 0xF0, /* 0x5D bracketright */
0x10, 0x71, 0xB6, 0x30, /* 0x5E asciicircum */
0xFF, /* 0x5F underscore */
0xD9, 0x80, /* 0x60 grave */
0x78, 0x19, 0xF6, 0x67, 0x60, /* 0x61 a */
0xE0, 0xC1, 0x83, 0xE6, 0x6C, 0xF7, 0x00, /* 0x62 b */
0x7B, 0x3C, 0x33, 0x78, /* 0x63 c */
0x1C, 0x18, 0x33, 0xEC, 0xD9, 0x9D, 0x80, /* 0x64 d */
0x7B, 0x3F, 0xF0, 0x78, /* 0x65 e */
0x39, 0xB6, 0x3C, 0x61, 0x8F, 0x00, /* 0x66 f */
0x77, 0x9B, 0x33, 0xE0, 0xDF, 0x00, /* 0x67 g */
0xE0, 0xC1, 0xB3, 0xB6, 0x6C, 0xF9, 0x80, /* 0x68 h */
0x60, 0xE6, 0x66, 0xF0, /* 0x69 i */
0x0C, 0x00, 0xC3, 0x0F, 0x3C, 0xDE, /* 0x6A j */
0xE0, 0xC1, 0x9B, 0x67, 0x8D, 0xB9, 0x80, /* 0x6B k */
0xE6, 0x66, 0x66, 0xF0, /* 0x6C l */
0xCD, 0xFF, 0xFE, 0xBC, 0x60, /* 0x6D m */
0xFB, 0x3C, 0xF3, 0xCC, /* 0x6E n */
0x7B, 0x3C, 0xF3, 0x78, /* 0x6F o */
0xDC, 0xCD, 0x9B, 0xE6, 0x1E, 0x00, /* 0x70 p */
0x77, 0x9B, 0x33, 0xE0, 0xC3, 0xC0, /* 0x71 q */
0xDC, 0xED, 0x9B, 0x0F, 0x00, /* 0x72 r */
0x7F, 0x07, 0x83, 0xF8, /* 0x73 s */
0x23, 0x3E, 0xC6, 0x34, 0xC0, /* 0x74 t */
0xCD, 0x9B, 0x36, 0x67, 0x60, /* 0x75 u */
0xCF, 0x3C, 0xDE, 0x30, /* 0x76 v */
0xC7, 0xAF, 0xFF, 0xF6, 0xC0, /* 0x77 w */
0xC6, 0xD8, 0xE3, 0x6C, 0x60, /* 0x78 x */
0xCF, 0x3C, 0xDF, 0x0F, 0xE0, /* 0x79 y */
0xFE, 0x63, 0x19, 0xFC, /* 0x7A z */
0x1C, 0xC3, 0x38, 0x30, 0xC1, 0xC0, /* 0x7B braceleft */
0xFC, 0xFC, /* 0x7C bar */
0xE0, 0xC3, 0x07, 0x30, 0xCE, 0x00, /* 0x7D braceright */
0x77, 0xB8, /* 0x7E asciitilde */
0x10, 0x71, 0xB6, 0x3C, 0x7F, 0xC0 /* 0x7F uni007F */
};
const GFXglyph IBM8x8pxGlyphs[] PROGMEM = {
{ 0, 1, 1, 2, 0, -1 }, /* 0x20 space */
{ 1, 4, 7, 5, 0, -7 }, /* 0x21 exclam */
{ 5, 5, 3, 6, 0, -7 }, /* 0x22 quotedbl */
{ 7, 7, 7, 8, 0, -7 }, /* 0x23 numbersign */
{ 14, 6, 7, 7, 0, -7 }, /* 0x24 dollar */
{ 20, 7, 6, 8, 0, -6 }, /* 0x25 percent */
{ 26, 7, 7, 8, 0, -7 }, /* 0x26 ampersand */
{ 33, 3, 3, 4, 0, -7 }, /* 0x27 quotesingle */
{ 35, 4, 7, 5, 0, -7 }, /* 0x28 parenleft */
{ 39, 4, 7, 5, 0, -7 }, /* 0x29 parenright */
{ 43, 8, 5, 9, 0, -6 }, /* 0x2A asterisk */
{ 48, 6, 5, 7, 0, -6 }, /* 0x2B plus */
{ 52, 3, 3, 4, 0, -2 }, /* 0x2C comma */
{ 54, 6, 1, 7, 0, -4 }, /* 0x2D hyphen */
{ 55, 2, 2, 3, 0, -2 }, /* 0x2E period */
{ 56, 7, 7, 8, 0, -7 }, /* 0x2F slash */
{ 63, 7, 7, 8, 0, -7 }, /* 0x30 zero */
{ 70, 6, 7, 7, 0, -7 }, /* 0x31 one */
{ 76, 6, 7, 7, 0, -7 }, /* 0x32 two */
{ 82, 6, 7, 7, 0, -7 }, /* 0x33 three */
{ 88, 7, 7, 8, 0, -7 }, /* 0x34 four */
{ 95, 6, 7, 7, 0, -7 }, /* 0x35 five */
{ 101, 6, 7, 7, 0, -7 }, /* 0x36 six */
{ 107, 6, 7, 7, 0, -7 }, /* 0x37 seven */
{ 113, 6, 7, 7, 0, -7 }, /* 0x38 eight */
{ 119, 6, 7, 7, 0, -7 }, /* 0x39 nine */
{ 125, 2, 6, 3, 0, -6 }, /* 0x3A colon */
{ 127, 3, 6, 4, 0, -6 }, /* 0x3B semicolon */
{ 130, 5, 7, 6, 0, -7 }, /* 0x3C less */
{ 135, 6, 4, 7, 0, -5 }, /* 0x3D equal */
{ 138, 5, 7, 6, 0, -7 }, /* 0x3E greater */
{ 143, 6, 7, 7, 0, -7 }, /* 0x3F question */
{ 149, 7, 7, 8, 0, -7 }, /* 0x40 at */
{ 156, 6, 7, 7, 0, -7 }, /* 0x41 A */
{ 162, 7, 7, 8, 0, -7 }, /* 0x42 B */
{ 169, 7, 7, 8, 0, -7 }, /* 0x43 C */
{ 176, 7, 7, 8, 0, -7 }, /* 0x44 D */
{ 183, 7, 7, 8, 0, -7 }, /* 0x45 E */
{ 190, 7, 7, 8, 0, -7 }, /* 0x46 F */
{ 197, 7, 7, 8, 0, -7 }, /* 0x47 G */
{ 204, 6, 7, 7, 0, -7 }, /* 0x48 H */
{ 210, 4, 7, 5, 0, -7 }, /* 0x49 I */
{ 214, 7, 7, 8, 0, -7 }, /* 0x4A J */
{ 221, 7, 7, 8, 0, -7 }, /* 0x4B K */
{ 228, 7, 7, 8, 0, -7 }, /* 0x4C L */
{ 235, 7, 7, 8, 0, -7 }, /* 0x4D M */
{ 242, 7, 7, 8, 0, -7 }, /* 0x4E N */
{ 249, 7, 7, 8, 0, -7 }, /* 0x4F O */
{ 256, 7, 7, 8, 0, -7 }, /* 0x50 P */
{ 263, 6, 7, 7, 0, -7 }, /* 0x51 Q */
{ 269, 7, 7, 8, 0, -7 }, /* 0x52 R */
{ 276, 6, 7, 7, 0, -7 }, /* 0x53 S */
{ 282, 6, 7, 7, 0, -7 }, /* 0x54 T */
{ 288, 6, 7, 7, 0, -7 }, /* 0x55 U */
{ 294, 6, 7, 7, 0, -7 }, /* 0x56 V */
{ 300, 7, 7, 8, 0, -7 }, /* 0x57 W */
{ 307, 7, 7, 8, 0, -7 }, /* 0x58 X */
{ 314, 6, 7, 7, 0, -7 }, /* 0x59 Y */
{ 320, 7, 7, 8, 0, -7 }, /* 0x5A Z */
{ 327, 4, 7, 5, 0, -7 }, /* 0x5B bracketleft */
{ 331, 7, 7, 8, 0, -7 }, /* 0x5C backslash */
{ 338, 4, 7, 5, 0, -7 }, /* 0x5D bracketright */
{ 342, 7, 4, 8, 0, -7 }, /* 0x5E asciicircum */
{ 346, 8, 1, 9, 0, 0 }, /* 0x5F underscore */
{ 347, 3, 3, 4, 0, -7 }, /* 0x60 grave */
{ 349, 7, 5, 8, 0, -5 }, /* 0x61 a */
{ 354, 7, 7, 8, 0, -7 }, /* 0x62 b */
{ 361, 6, 5, 7, 0, -5 }, /* 0x63 c */
{ 365, 7, 7, 8, 0, -7 }, /* 0x64 d */
{ 372, 6, 5, 7, 0, -5 }, /* 0x65 e */
{ 376, 6, 7, 7, 0, -7 }, /* 0x66 f */
{ 382, 7, 6, 8, 0, -5 }, /* 0x67 g */
{ 388, 7, 7, 8, 0, -7 }, /* 0x68 h */
{ 395, 4, 7, 5, 0, -7 }, /* 0x69 i */
{ 399, 6, 8, 7, 0, -7 }, /* 0x6A j */
{ 405, 7, 7, 8, 0, -7 }, /* 0x6B k */
{ 412, 4, 7, 5, 0, -7 }, /* 0x6C l */
{ 416, 7, 5, 8, 0, -5 }, /* 0x6D m */
{ 421, 6, 5, 7, 0, -5 }, /* 0x6E n */
{ 425, 6, 5, 7, 0, -5 }, /* 0x6F o */
{ 429, 7, 6, 8, 0, -5 }, /* 0x70 p */
{ 435, 7, 6, 8, 0, -5 }, /* 0x71 q */
{ 441, 7, 5, 8, 0, -5 }, /* 0x72 r */
{ 446, 6, 5, 7, 0, -5 }, /* 0x73 s */
{ 450, 5, 7, 6, 0, -7 }, /* 0x74 t */
{ 455, 7, 5, 8, 0, -5 }, /* 0x75 u */
{ 460, 6, 5, 7, 0, -5 }, /* 0x76 v */
{ 464, 7, 5, 8, 0, -5 }, /* 0x77 w */
{ 469, 7, 5, 8, 0, -5 }, /* 0x78 x */
{ 474, 6, 6, 7, 0, -5 }, /* 0x79 y */
{ 479, 6, 5, 7, 0, -5 }, /* 0x7A z */
{ 483, 6, 7, 7, 0, -7 }, /* 0x7B braceleft */
{ 489, 2, 7, 3, 0, -7 }, /* 0x7C bar */
{ 491, 6, 7, 7, 0, -7 }, /* 0x7D braceright */
{ 497, 7, 2, 8, 0, -7 }, /* 0x7E asciitilde */
{ 499, 7, 6, 8, 0, -6 } /* 0x7F uni007F */
};
const GFXfont IBM8x8px PROGMEM = {
(uint8_t *)IBM8x8pxBitmaps,
(GFXglyph *)IBM8x8pxGlyphs,
0x20, 0x7F, 8 };

View File

@@ -20,7 +20,7 @@ import getopt
import re
import json
__version__ = "0.2"
__version__ = "0.3"
def detect_pages(filename):
# returns a dictionary with page name and the number of gui fields
@@ -87,6 +87,11 @@ def create_json(device, no_of_pages, pagedata):
output = []
for page_no in range(1, no_of_pages + 1):
category = f"{device.upper()} Page {page_no}"
capabilities = {device.lower(): "true"}
visiblepages = [str(vp) for vp in range(page_no, no_of_pages + 1)]
page_data = {
"name": f"page{page_no}type",
"label": "Type",
@@ -94,9 +99,11 @@ def create_json(device, no_of_pages, pagedata):
"default": get_default_page(page_no),
"description": f"Type of page for page {page_no}",
"list": pages,
"category": f"{device.upper()} Page {page_no}",
"category": category,
"capabilities": {device.lower(): "true"},
"condition": [{"visiblePages": vp} for vp in range(page_no, no_of_pages + 1)],
"condition": {
"visiblePages": visiblepages
},
#"fields": [],
}
output.append(page_data)
@@ -108,39 +115,59 @@ def create_json(device, no_of_pages, pagedata):
"type": "boatData",
"default": "",
"description": "The display for field {}".format(number_to_text(field_no)),
"category": f"{device.upper()} Page {page_no}",
"capabilities": {device.lower(): "true"},
"condition": [
{f"page{page_no}type": page}
for page in pages
if pagedata[page] >= field_no
],
"category": category,
"capabilities": capabilities,
"condition": {
f"page{page_no}type": [ p for p in pages if pagedata[p] >= field_no ]
,"visiblePages": visiblepages
}
}
output.append(field_data)
fluid_data ={
fluid_data = {
"name": f"page{page_no}fluid",
"label": "Fluid type",
"type": "list",
"default": "0",
"list": [
{"l":"Fuel (0)","v":"0"},
{"l":"Water (1)","v":"1"},
{"l":"Gray Water (2)","v":"2"},
{"l":"Live Well (3)","v":"3"},
{"l":"Oil (4)","v":"4"},
{"l":"Black Water (5)","v":"5"},
{"l":"Fuel Gasoline (6)","v":"6"}
{"l":"Fuel (0)","v":"0"},
{"l":"Water (1)","v":"1"},
{"l":"Gray Water (2)","v":"2"},
{"l":"Live Well (3)","v":"3"},
{"l":"Oil (4)","v":"4"},
{"l":"Black Water (5)","v":"5"},
{"l":"Fuel Gasoline (6)","v":"6"}
],
"description": "Fluid type in tank",
"category": f"{device.upper()} Page {page_no}",
"capabilities": {
device.lower(): "true"
},
"condition":[{f"page{page_no}type":"Fluid"}]
"category": category,
"capabilities": capabilities,
"condition": {
f"page{page_no}type": "Fluid",
"visiblePages": visiblepages
}
}
output.append(fluid_data)
if device.upper() == 'OBP40':
windsource = {
"name": f"page{page_no}wndsrc",
"label": "Wind source",
"type": "list",
"default": "True wind",
"description": f"Wind source for page {page_no}: [true|apparent]",
"list": [
"True wind",
"Apparant wind"
],
"category": category,
"capabilities": capabilities,
"condition": {
f"page{page_no}type": "WindPlot",
"visiblePages": visiblepages
}
}
output.append(windsource)
return json.dumps(output, indent=4)
def usage():

View File

@@ -260,6 +260,8 @@ void registerAllPages(PageList &list){
list.add(&registerPageFluid);
extern PageDescription registerPageSkyView;
list.add(&registerPageSkyView);
extern PageDescription registerPageAnchor;
list.add(&registerPageAnchor);
}
// Undervoltage detection for shutdown display
@@ -431,7 +433,7 @@ void OBP60Task(GwApi *api){
int lastPage=pageNumber;
BoatValueList boatValues; //all the boat values for the api query
HstryBuf hstryBufList(960); // Create ring buffers for history storage of some boat data
HstryBuf hstryBufList(1920); // Create ring buffers for history storage of some boat data (1920 seconds = 32 minutes)
WindUtils trueWind(&boatValues); // Create helper object for true wind calculation
//commonData.distanceformat=config->getString(xxx);
//add all necessary data to common data
@@ -710,8 +712,8 @@ void OBP60Task(GwApi *api){
}
}
// Full display update afer a new selected page and 4s wait time
if(millis() > starttime4 + 4000 && delayedDisplayUpdate == true){
// Full display update afer a new selected page and 8s wait time
if(millis() > starttime4 + 8000 && delayedDisplayUpdate == true){
starttime1 = millis();
starttime2 = millis();
getdisplay().setFullWindow(); // Set full update

View File

@@ -41,6 +41,8 @@ lib_deps =
milesburton/DallasTemperature@3.11.0
signetica/SunRise@2.0.2
adafruit/Adafruit FRAM I2C@2.0.3
WifiClientSecure
HTTPClient
build_flags=
#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 (serial device)
@@ -93,6 +95,8 @@ lib_deps =
milesburton/DallasTemperature@3.11.0
signetica/SunRise@2.0.2
adafruit/Adafruit FRAM I2C@2.0.3
WifiClientSecure
HTTPClient
build_flags=
-D DISABLE_DIAGNOSTIC_OUTPUT #Disable diagnostic output for GxEPD2 lib
-D BOARD_OBP40S3 #Board OBP40 with ESP32S3