Compare commits
No commits in common. "3412da8e18d18e8acb56e44fbb3260cf8b603a0b" and "175f525bcd44301bbb677dd3a7deb07a76163c68" have entirely different histories.
3412da8e18
...
175f525bcd
|
@ -380,14 +380,8 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
}
|
}
|
||||||
//########################################################
|
//########################################################
|
||||||
else if (value->getFormat() == "formatXte"){
|
else if (value->getFormat() == "formatXte"){
|
||||||
double xte = 0;
|
double xte = abs(value->value);
|
||||||
if (!usesimudata) {
|
rawvalue = value->value;
|
||||||
xte = abs(value->value);
|
|
||||||
rawvalue = value->value;
|
|
||||||
} else {
|
|
||||||
rawvalue = 6.0 + float(random(0, 4));
|
|
||||||
xte = rawvalue;
|
|
||||||
}
|
|
||||||
if (xte >= 100) {
|
if (xte >= 100) {
|
||||||
snprintf(buffer,bsize,"%3.0f",value->value);
|
snprintf(buffer,bsize,"%3.0f",value->value);
|
||||||
} else if (xte >= 10) {
|
} else if (xte >= 10) {
|
||||||
|
|
|
@ -493,26 +493,22 @@ void sensorTask(void *param){
|
||||||
float deltaV = sensors.batteryVoltage - sensors.batteryVoltage10;
|
float deltaV = sensors.batteryVoltage - sensors.batteryVoltage10;
|
||||||
// Higher limits for lower voltages
|
// Higher limits for lower voltages
|
||||||
if(sensors.batteryVoltage10 < 4.0){
|
if(sensors.batteryVoltage10 < 4.0){
|
||||||
if(deltaV > 0.045){
|
if(deltaV > 0.045 && deltaV < 4.15){
|
||||||
sensors.BatteryChargeStatus = 1; // Charging active
|
sensors.BatteryChargeStatus = 1; // Charging active
|
||||||
}
|
}
|
||||||
if(deltaV < -0.04){
|
if(deltaV < -0.04 || deltaV >= 4.15){ // Charging stops by grater than 4,15V
|
||||||
sensors.BatteryChargeStatus = 0; // Discharging
|
sensors.BatteryChargeStatus = 0; // Discharging
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Lower limits for higher voltages
|
// Lower limits for higher voltages
|
||||||
else{
|
else{
|
||||||
if(deltaV > 0.03){
|
if(deltaV > 0.03 && deltaV < 4.15){
|
||||||
sensors.BatteryChargeStatus = 1; // Charging active
|
sensors.BatteryChargeStatus = 1; // Charging active
|
||||||
}
|
}
|
||||||
if(deltaV < -0.03){
|
if(deltaV < -0.03 || deltaV >= 4.15){ // Charging stops by grater than 4,15V
|
||||||
sensors.BatteryChargeStatus = 0; // Discharging
|
sensors.BatteryChargeStatus = 0; // Discharging
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Charging stops by grater than 4,15V
|
|
||||||
if(sensors.batteryVoltage10 > 4.15){
|
|
||||||
sensors.BatteryChargeStatus = 0; // Discharging
|
|
||||||
}
|
|
||||||
// Send to NMEA200 bus as instance 10
|
// Send to NMEA200 bus as instance 10
|
||||||
if(!isnan(sensors.batteryVoltage)){
|
if(!isnan(sensors.batteryVoltage)){
|
||||||
SetN2kDCBatStatus(N2kMsg, 10, sensors.batteryVoltage, N2kDoubleNA, N2kDoubleNA, 0);
|
SetN2kDCBatStatus(N2kMsg, 10, sensors.batteryVoltage, N2kDoubleNA, N2kDoubleNA, 0);
|
||||||
|
|
|
@ -5,15 +5,10 @@
|
||||||
|
|
||||||
class PageClock : public Page
|
class PageClock : public Page
|
||||||
{
|
{
|
||||||
bool simulation = false;
|
public:
|
||||||
int simtime;
|
|
||||||
|
|
||||||
public:
|
|
||||||
PageClock(CommonData &common){
|
PageClock(CommonData &common){
|
||||||
commonData = &common;
|
commonData = &common;
|
||||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageClock");
|
common.logger->logDebug(GwLog::LOG,"Instantiate PageClock");
|
||||||
simulation = common.config->getBool(common.config->useSimuData);
|
|
||||||
simtime = 38160; // time value 11:36
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Key functions
|
// Key functions
|
||||||
|
@ -47,6 +42,7 @@ class PageClock : public Page
|
||||||
|
|
||||||
// Get config data
|
// Get config data
|
||||||
String lengthformat = config->getString(config->lengthFormat);
|
String lengthformat = config->getString(config->lengthFormat);
|
||||||
|
bool simulation = config->getBool(config->useSimuData);
|
||||||
bool holdvalues = config->getBool(config->holdvalues);
|
bool holdvalues = config->getBool(config->holdvalues);
|
||||||
String flashLED = config->getString(config->flashLED);
|
String flashLED = config->getString(config->flashLED);
|
||||||
String backlightMode = config->getString(config->backlight);
|
String backlightMode = config->getString(config->backlight);
|
||||||
|
@ -61,7 +57,7 @@ class PageClock : public Page
|
||||||
value1 = bvalue1->value; // Value as double in SI unit
|
value1 = bvalue1->value; // Value as double in SI unit
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
value1 = simtime++; // Simulation data for time value 11:36 in seconds
|
value1 = 38160; // Simulation data for time value 11:36 in seconds
|
||||||
} // Other simulation data see OBP60Formater.cpp
|
} // Other simulation data see OBP60Formater.cpp
|
||||||
bool valid1 = bvalue1->valid; // Valid information
|
bool valid1 = bvalue1->valid; // Valid information
|
||||||
String svalue1 = formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue1 = formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
||||||
|
@ -141,8 +137,6 @@ class PageClock : public Page
|
||||||
if(valid1 == true && valid2 == true && valid3 == true){
|
if(valid1 == true && valid2 == true && valid3 == true){
|
||||||
sunrise = String(commonData->sundata.sunriseHour) + ":" + String(commonData->sundata.sunriseMinute + 100).substring(1);
|
sunrise = String(commonData->sundata.sunriseHour) + ":" + String(commonData->sundata.sunriseMinute + 100).substring(1);
|
||||||
svalue5old = sunrise;
|
svalue5old = sunrise;
|
||||||
} else if (simulation) {
|
|
||||||
sunrise = String("06:42");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
|
@ -161,8 +155,6 @@ class PageClock : public Page
|
||||||
if(valid1 == true && valid2 == true && valid3 == true){
|
if(valid1 == true && valid2 == true && valid3 == true){
|
||||||
sunset = String(commonData->sundata.sunsetHour) + ":" + String(commonData->sundata.sunsetMinute + 100).substring(1);
|
sunset = String(commonData->sundata.sunsetHour) + ":" + String(commonData->sundata.sunsetMinute + 100).substring(1);
|
||||||
svalue6old = sunset;
|
svalue6old = sunset;
|
||||||
} else if (simulation) {
|
|
||||||
sunset = String("21:03");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
|
|
|
@ -66,10 +66,6 @@ static unsigned char fish_bits[] = {
|
||||||
|
|
||||||
class PageFluid : public Page
|
class PageFluid : public Page
|
||||||
{
|
{
|
||||||
bool simulation = false;
|
|
||||||
double simgoto;
|
|
||||||
double simval;
|
|
||||||
double simstep;
|
|
||||||
bool holdvalues = false;
|
bool holdvalues = false;
|
||||||
int fluidtype;
|
int fluidtype;
|
||||||
|
|
||||||
|
@ -77,11 +73,7 @@ class PageFluid : public Page
|
||||||
PageFluid(CommonData &common){
|
PageFluid(CommonData &common){
|
||||||
commonData = &common;
|
commonData = &common;
|
||||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageFluid");
|
common.logger->logDebug(GwLog::LOG,"Instantiate PageFluid");
|
||||||
simulation = common.config->getBool(common.config->useSimuData);
|
|
||||||
holdvalues = common.config->getBool(common.config->holdvalues);
|
holdvalues = common.config->getBool(common.config->holdvalues);
|
||||||
simval = double(random(0, 100));
|
|
||||||
simgoto = double(random(0, 100));
|
|
||||||
simstep = (simgoto - simval) / 20.0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int handleKey(int key){
|
virtual int handleKey(int key){
|
||||||
|
@ -117,18 +109,8 @@ class PageFluid : public Page
|
||||||
|
|
||||||
GwApi::BoatValue *bvalue1 = pageData.values[0];
|
GwApi::BoatValue *bvalue1 = pageData.values[0];
|
||||||
String name1 = bvalue1->getName();
|
String name1 = bvalue1->getName();
|
||||||
double fluidlevel = bvalue1->value;
|
if (holdvalues and bvalue1->valid) {
|
||||||
if (!simulation) {
|
value1old = bvalue1->value;
|
||||||
if (holdvalues and bvalue1->valid) {
|
|
||||||
value1old = bvalue1->value;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
fluidlevel = simval;
|
|
||||||
simval += simstep;
|
|
||||||
if ((simgoto - simval) < 1.5 * simstep) {
|
|
||||||
simgoto = double(random(0, 100));
|
|
||||||
simstep = (simgoto - simval) / 20.0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logging boat values
|
// Logging boat values
|
||||||
|
@ -166,8 +148,8 @@ class PageFluid : public Page
|
||||||
|
|
||||||
// value down centered
|
// value down centered
|
||||||
char buffer[6];
|
char buffer[6];
|
||||||
if (bvalue1->valid or simulation) {
|
if (bvalue1->valid) {
|
||||||
snprintf(buffer, 6, "%3.0f%%", fluidlevel);
|
snprintf(buffer, 6, "%3.0f%%", bvalue1->value);
|
||||||
} else {
|
} else {
|
||||||
strcpy(buffer, "---");
|
strcpy(buffer, "---");
|
||||||
}
|
}
|
||||||
|
@ -240,14 +222,14 @@ class PageFluid : public Page
|
||||||
}
|
}
|
||||||
|
|
||||||
// pointer
|
// pointer
|
||||||
if (bvalue1->valid or simulation) {
|
if (bvalue1->valid) {
|
||||||
pts = {
|
pts = {
|
||||||
{c.x - 1, c.y - (r - 20)},
|
{c.x - 1, c.y - (r - 20)},
|
||||||
{c.x + 1, c.y - (r - 20)},
|
{c.x + 1, c.y - (r - 20)},
|
||||||
{c.x + 6, c.y + 15},
|
{c.x + 6, c.y + 15},
|
||||||
{c.x - 6, c.y + 15}
|
{c.x - 6, c.y + 15}
|
||||||
};
|
};
|
||||||
fillPoly4(rotatePoints(c, pts, -120 + fluidlevel * 2.4), commonData->fgcolor);
|
fillPoly4(rotatePoints(c, pts, -120 + bvalue1->value * 2.4), commonData->fgcolor);
|
||||||
// Pointer axis is white
|
// Pointer axis is white
|
||||||
getdisplay().fillCircle(c.x, c.y, 6, commonData->bgcolor);
|
getdisplay().fillCircle(c.x, c.y, 6, commonData->bgcolor);
|
||||||
}
|
}
|
||||||
|
|
|
@ -307,7 +307,7 @@ public:
|
||||||
|
|
||||||
// Get config data
|
// Get config data
|
||||||
String lengthformat = config->getString(config->lengthFormat);
|
String lengthformat = config->getString(config->lengthFormat);
|
||||||
bool simulation = config->getBool(config->useSimuData);
|
// bool simulation = config->getBool(config->useSimuData);
|
||||||
bool holdvalues = config->getBool(config->holdvalues);
|
bool holdvalues = config->getBool(config->holdvalues);
|
||||||
String flashLED = config->getString(config->flashLED);
|
String flashLED = config->getString(config->flashLED);
|
||||||
String backlightMode = config->getString(config->backlight);
|
String backlightMode = config->getString(config->backlight);
|
||||||
|
@ -338,9 +338,6 @@ public:
|
||||||
name2 = name2.substring(0, 6); // String length limit for value name
|
name2 = name2.substring(0, 6); // String length limit for value name
|
||||||
double value2 = bvalue2->value; // Value as double in SI unit
|
double value2 = bvalue2->value; // Value as double in SI unit
|
||||||
// bool valid2 = bvalue2->valid; // Valid information
|
// bool valid2 = bvalue2->valid; // Valid information
|
||||||
if (simulation) {
|
|
||||||
value2 = 0.62731; // some random value
|
|
||||||
}
|
|
||||||
String svalue2 = formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue2 = formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
||||||
String unit2 = formatValue(bvalue2, *commonData).unit; // Unit of value
|
String unit2 = formatValue(bvalue2, *commonData).unit; // Unit of value
|
||||||
|
|
||||||
|
@ -405,7 +402,7 @@ public:
|
||||||
getdisplay().fillCircle(c.x, c.y, lp + 1, commonData->bgcolor);
|
getdisplay().fillCircle(c.x, c.y, lp + 1, commonData->bgcolor);
|
||||||
|
|
||||||
// Wind pointer
|
// Wind pointer
|
||||||
if (bvalue2->valid or simulation) {
|
if (bvalue2->valid) {
|
||||||
uint8_t lp0 = lp * 0.6; // effective pointer outside size
|
uint8_t lp0 = lp * 0.6; // effective pointer outside size
|
||||||
uint8_t lp1 = lp * 0.4; // effective pointer inside size
|
uint8_t lp1 = lp * 0.4; // effective pointer inside size
|
||||||
// zero position
|
// zero position
|
||||||
|
@ -481,7 +478,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wind pointer (angle)
|
// Wind pointer (angle)
|
||||||
if (bvalue2->valid or simulation) {
|
if (bvalue2->valid) {
|
||||||
float alpha = RadToDeg(value2);
|
float alpha = RadToDeg(value2);
|
||||||
bool port = (alpha > 180);
|
bool port = (alpha > 180);
|
||||||
if (port) {
|
if (port) {
|
||||||
|
@ -597,7 +594,7 @@ public:
|
||||||
getdisplay().print("kts");
|
getdisplay().print("kts");
|
||||||
|
|
||||||
// Wind pointer (angle)
|
// Wind pointer (angle)
|
||||||
if (bvalue2->valid or simulation) {
|
if (bvalue2->valid) {
|
||||||
float alpha = RadToDeg(value2);
|
float alpha = RadToDeg(value2);
|
||||||
getdisplay().fillCircle(c.x, c.y, 8, commonData->fgcolor);
|
getdisplay().fillCircle(c.x, c.y, 8, commonData->fgcolor);
|
||||||
pts = {
|
pts = {
|
||||||
|
|
|
@ -28,15 +28,10 @@ static unsigned char ship_bits[] PROGMEM = {
|
||||||
|
|
||||||
class PageXTETrack : public Page
|
class PageXTETrack : public Page
|
||||||
{
|
{
|
||||||
bool simulation = false;
|
|
||||||
bool holdvalues = false;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageXTETrack(CommonData &common){
|
PageXTETrack(CommonData &common){
|
||||||
commonData = &common;
|
commonData = &common;
|
||||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageXTETrack");
|
common.logger->logDebug(GwLog::LOG,"Instantiate PageXTETrack");
|
||||||
simulation = common.config->getBool(common.config->useSimuData);
|
|
||||||
holdvalues = common.config->getBool(common.config->holdvalues);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawSegment(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1,
|
void drawSegment(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1,
|
||||||
|
@ -145,7 +140,7 @@ class PageXTETrack : public Page
|
||||||
String sval_wpname = "no data";
|
String sval_wpname = "no data";
|
||||||
|
|
||||||
if (valid) {
|
if (valid) {
|
||||||
sval_wpname = "Tonne 122";
|
sval_wpname = "Tonne 122";
|
||||||
}
|
}
|
||||||
|
|
||||||
getdisplay().setFont(&Ubuntu_Bold10pt7b);
|
getdisplay().setFont(&Ubuntu_Bold10pt7b);
|
||||||
|
@ -158,12 +153,7 @@ class PageXTETrack : public Page
|
||||||
|
|
||||||
// draw course segments
|
// draw course segments
|
||||||
|
|
||||||
double diff;
|
double diff = bv_cog->value - bv_btw->value;
|
||||||
if (!simulation) {
|
|
||||||
diff = bv_cog->value - bv_btw->value;
|
|
||||||
} else {
|
|
||||||
diff = 7.0;
|
|
||||||
}
|
|
||||||
if (diff < -180) {
|
if (diff < -180) {
|
||||||
diff += 360;
|
diff += 360;
|
||||||
} else if (diff > 180) {
|
} else if (diff > 180) {
|
||||||
|
|
|
@ -78,7 +78,8 @@ void OBP60Init(GwApi *api){
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BOARD_OBP40S3
|
#ifdef BOARD_OBP40S3
|
||||||
String sdcard = config->getConfigItem(config->useSDCard, true)->asString();
|
// String sdcard = config->getConfigItem(config->useSDCard, true)->asString();
|
||||||
|
String sdcard = "on";
|
||||||
if (sdcard == "on") {
|
if (sdcard == "on") {
|
||||||
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);
|
||||||
|
@ -412,7 +413,8 @@ void OBP60Task(GwApi *api){
|
||||||
String fastrefresh = api->getConfig()->getConfigItem(api->getConfig()->fastRefresh,true)->asString();
|
String fastrefresh = api->getConfig()->getConfigItem(api->getConfig()->fastRefresh,true)->asString();
|
||||||
uint fullrefreshtime = uint(api->getConfig()->getConfigItem(api->getConfig()->fullRefreshTime,true)->asInt());
|
uint fullrefreshtime = uint(api->getConfig()->getConfigItem(api->getConfig()->fullRefreshTime,true)->asInt());
|
||||||
#ifdef BOARD_OBP40S3
|
#ifdef BOARD_OBP40S3
|
||||||
bool syspage_enabled = config->getBool(config->systemPage);
|
// bool syspage_enabled = config->getBool(config->systemPage);
|
||||||
|
bool syspage_enabled = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DISPLAY_GDEY042T81
|
#ifdef DISPLAY_GDEY042T81
|
||||||
|
|
Loading…
Reference in New Issue