diff --git a/lib/obp60task/OBPcharts.cpp b/lib/obp60task/OBPcharts.cpp index e84f906..cdb9dc2 100644 --- a/lib/obp60task/OBPcharts.cpp +++ b/lib/obp60task/OBPcharts.cpp @@ -44,6 +44,7 @@ Chart::Chart(RingBuffer& dataBuf, double dfltRng, CommonData& common, dbMIN_VAL = dataBuf.getMinVal(); dbMAX_VAL = dataBuf.getMaxVal(); bufSize = dataBuf.getCapacity(); + LOG_DEBUG(GwLog::DEBUG, "Chart Init: dbMIN_VAL: %.2f, dbMAX_VAL: %.2fd, bufSize: %d", dbMIN_VAL, dbMAX_VAL, bufSize); smoothCharts = common.config->getBool(common.config->smoothCharts); if (smoothCharts) { @@ -67,7 +68,7 @@ Chart::Chart(RingBuffer& dataBuf, double dfltRng, CommonData& common, chrtDataFmt = OTHER; // Chart is showing any other data format } - // "0" value is the same for any data format but for user defined temperature format + // "0" value is the same for any data format but for user defined temperature and pressure format zeroValue = 0.0; if (chrtDataFmt == TEMPERATURE) { tempFormat = commonData->config->getString(commonData->config->tempFormat); // [K|°C|°F] @@ -113,7 +114,8 @@ Chart::~Chart() // ; print data name on horizontal half chart [true|false] // : print current boat data value [true|false] // : current boat data value; used only for test on valid data -void Chart::showChrt(char chrtDir, int8_t chrtSz, const int8_t chrtIntv, bool prntName, bool showCurrValue, GwApi::BoatValue currValue) +// void Chart::showChrt(ChrtDirection chrtDire, ChrtSize chrtSze, const int8_t chrtIntv, bool prntName, bool showCurrValue, GwApi::BoatValue currValue) +void Chart::showChrt(const char chrtDir, const int8_t chrtSz, const int8_t chrtIntv, bool prntName, bool showCurrValue, GwApi::BoatValue currValue) { if (!setChartDimensions(chrtDir, chrtSz)) { return; // wrong chart dimension parameters @@ -136,6 +138,7 @@ void Chart::showChrt(char chrtDir, int8_t chrtSz, const int8_t chrtIntv, bool pr } // define dimensions and start points for chart +// bool Chart::setChartDimensions(const ChrtDirection direction, const ChrtSize size) bool Chart::setChartDimensions(const char direction, const int8_t size) { if ((direction != HORIZONTAL && direction != VERTICAL) || (size < 0 || size > 3)) { @@ -201,10 +204,10 @@ void Chart::drawChrt(const char chrtDir, const int8_t chrtIntv, GwApi::BoatValue getBufferStartNSize(chrtIntv); - LOG_DEBUG(GwLog::DEBUG, "Chart:drawChart: min: %.1f, mid: %.1f, max: %.1f, rng: %.1f", chrtMin, chrtMid, chrtMax, chrtRng); + // LOG_DEBUG(GwLog::DEBUG, "Chart:drawChart: min: %.1f, mid: %.1f, max: %.1f, rng: %.1f", chrtMin, chrtMid, chrtMax, chrtRng); calcChrtBorders(chrtMin, chrtMid, chrtMax, chrtRng); chrtScale = double(valAxis) / chrtRng; // Chart scale: pixels per value step - LOG_DEBUG(GwLog::DEBUG, "Chart:drawChart: min: %.1f, mid: %.1f, max: %.1f, rng: %.1f", chrtMin, chrtMid, chrtMax, chrtRng); + LOG_DEBUG(GwLog::DEBUG, "Chart:drawChart: min: %.1f, mid: %.1f, max: %.1f, rng: %.1f, data valid: %d", chrtMin, chrtMid, chrtMax, chrtRng, currValue.valid); // Do we have valid buffer data? if (dataBuf.getMax() == dbMAX_VAL) { // only values in buffer -> no valid wind data available @@ -219,7 +222,8 @@ void Chart::drawChrt(const char chrtDir, const int8_t chrtIntv, GwApi::BoatValue numNoData++; bufDataValid = true; - if (numNoData > THRESHOLD_NO_DATA) { // If more than 4 invalid values in a row, flag for invalid data + // if (numNoData > THRESHOLD_NO_DATA) { // If more than 4 invalid values in a row, flag for invalid data + if (numNoData > THRESHOLD_NO_DATA * (dataBuf.getUpdFreq() / 1000)) { // If more than invalid values in a row, flag for invalid data bufDataValid = false; return; } @@ -234,17 +238,15 @@ void Chart::getBufferStartNSize(const int8_t chrtIntv) count = dataBuf.getCurrentSize(); currIdx = dataBuf.getLastIdx(); numAddedBufVals = (currIdx - lastAddedIdx + bufSize) % bufSize; // Number of values added to buffer since last display + lastAddedIdx = currIdx; - if (chrtIntv != oldChrtIntv || count == 1) { - // new data interval selected by user; this is only x * 230 values instead of 240 seconds (4 minutes) per interval step + if (chrtIntv != oldChrtIntv || count == 1) { // new data interval selected by user numBufVals = min(count, (timAxis - MIN_FREE_VALUES) * chrtIntv); // keep free or release MIN_FREE_VALUES on chart for plotting of new values bufStart = max(0, count - numBufVals); - lastAddedIdx = currIdx; oldChrtIntv = chrtIntv; } else { numBufVals = numBufVals + numAddedBufVals; - lastAddedIdx = currIdx; if (count == bufSize) { bufStart = max(0, bufStart - numAddedBufVals); } @@ -348,6 +350,13 @@ void Chart::calcChrtBorders(double& rngMin, double& rngMid, double& rngMax, doub rngMid = (rngMin + rngMax) / 2.0; rng = rngMax - rngMin; + // range values can be undefined if boat data type has not been created at time of chart printing (e.g. XDR data types) + auto chkIsNaN = [](double& val) { if (std::isnan(val)) val = 0.0; }; + chkIsNaN(rngMin); + chkIsNaN(rngMid); + chkIsNaN(rngMax); + chkIsNaN(rng); + LOG_DEBUG(GwLog::DEBUG, "calcChrtRange-end: currMinVal: %.1f, currMaxVal: %.1f, rngMin: %.1f, rngMid: %.1f, rngMax: %.1f, rng: %.1f, rngStep: %.1f, zeroValue: %.1f, dbMIN_VAL: %.1f", currMinVal, currMaxVal, rngMin, rngMid, rngMax, rng, rngStep, zeroValue, dbMIN_VAL); } @@ -592,9 +601,7 @@ void Chart::drawChrtValAxis(const char chrtDir, const int8_t chrtSz, bool prntNa // Print current data value void Chart::prntCurrValue(const char direction, GwApi::BoatValue& currValue) { - // const int xPosVal = (direction == HORIZONTAL) ? cRoot.x + (timAxis / 2) - 56 : cRoot.x + 32; - // const int yPosVal = (direction == HORIZONTAL) ? cRoot.y + valAxis - 7 : cRoot.y + timAxis - 7; - const int xPosVal = (direction == HORIZONTAL) ? cRoot.x + (timAxis / 2) - 73 : cRoot.x + 32; + const int xPosVal = (direction == HORIZONTAL) ? cRoot.x + (timAxis / 2) - 74 : cRoot.x + 31; const int yPosVal = (direction == HORIZONTAL) ? cRoot.y + valAxis : cRoot.y + timAxis; FormattedData frmtDbData = formatValue(&currValue, *commonData, NO_SIMUDATA); @@ -602,27 +609,22 @@ void Chart::prntCurrValue(const char direction, GwApi::BoatValue& currValue) String dbUnit = frmtDbData.unit; // Unit of value; limit length to 3 characters // box - // getdisplay().fillRect(xPosVal - 1, yPosVal - 35, 128, 41, bgColor); // Clear area for TWS value - // getdisplay().drawRect(xPosVal, yPosVal - 34, 126, 40, fgColor); // Draw box for TWS value - getdisplay().fillRect(xPosVal - 1, yPosVal - 40, 146, 39, bgColor); // Clear area for TWS value - getdisplay().drawRect(xPosVal, yPosVal - 39, 144, 37, fgColor); // Draw box for TWS value + getdisplay().fillRect(xPosVal - 1, yPosVal - 40, 148, 39, bgColor); // Clear area for value + getdisplay().drawRect(xPosVal, yPosVal - 39, 146, 37, fgColor); // Draw box for value // value getdisplay().setFont(&DSEG7Classic_BoldItalic16pt7b); getdisplay().setCursor(xPosVal + 1, yPosVal - 6); getdisplay().print(sdbValue); - // drawTextCenter(xPosVal + 70, yPosVal - 19, sdbValue); // name getdisplay().setFont(&Ubuntu_Bold10pt8b); - // getdisplay().setCursor(xPosVal + 76, yPosVal - 17); getdisplay().setCursor(xPosVal + 100, yPosVal - 23); String name = xdrDelete(dbName); getdisplay().print(name.substring(0, 3)); // Name, limited to 3 characters // unit getdisplay().setFont(&Ubuntu_Bold8pt8b); - // getdisplay().setCursor(xPosVal + 76, yPosVal + 0); getdisplay().setCursor(xPosVal + 101, yPosVal - 8); getdisplay().print(dbUnit); } @@ -746,7 +748,6 @@ void Chart::prntHorizChartThreeValueAxisLabel(const GFXfont* font) } else { if (char* dot = strchr(sVal, '.')) *dot = '\0'; // no decimal for bottom axis label - // snprintf(sVal, sizeof(sVal), "%3.0f", axLabel); // no decimal for bottom axis label getdisplay().fillRect(cRoot.x, cRoot.y + 2, xOffset + 3, yOffset, bgColor); // Clear small area to remove potential chart lines drawTextRalign(cRoot.x + xOffset, cRoot.y + yOffset, sVal); // range value } @@ -774,7 +775,6 @@ void Chart::prntHorizChartThreeValueAxisLabel(const GFXfont* font) } else { if (char* dot = strchr(sVal, '.')) *dot = '\0'; // no decimal for bottom axis label - // snprintf(sVal, sizeof(sVal), "%3.0f", axLabel); // no decimal for bottom axis label getdisplay().fillRect(cRoot.x, cRoot.y + valAxis - 14, xOffset + 3, yOffset, bgColor); // Clear small area to remove potential chart lines drawTextRalign(cRoot.x + xOffset, cRoot.y + valAxis, sVal); // range value getdisplay().drawLine(cRoot.x + xOffset + 3, cRoot.y + valAxis, cRoot.x + timAxis, cRoot.y + valAxis, fgColor); diff --git a/lib/obp60task/OBPcharts.h b/lib/obp60task/OBPcharts.h index 00bf2a6..2bfd63c 100644 --- a/lib/obp60task/OBPcharts.h +++ b/lib/obp60task/OBPcharts.h @@ -19,6 +19,28 @@ class RingBuffer; class GwLog; class Chart { +public: + +/* enum class ChrtDirection { + HORIZONTALE, + VERTICALE + }; + + enum class ChrtSize { + FULL_SIZEE, + HALF_SIZE_LEFTE, + HALF_SIZE_RIGHTE, + TWO_THIRD_TOPE + }; */ + + // Define default chart range and range step for each boat data type + static std::map dfltChrtDta; + + Chart(RingBuffer& dataBuf, double dfltRng, CommonData& common, bool useSimuData); // Chart object of data chart + ~Chart(); + void showChrt(const char chrtDir, const int8_t chrtSz, const int8_t chrtIntv, bool prntName, bool showCurrValue, GwApi::BoatValue currValue); // Perform all actions to draw chart +// void showChrt(ChrtDirection chrtDir, ChrtSize chrtSz, const int8_t chrtIntv, bool prntName, bool showCurrValue, GwApi::BoatValue currValue); // Perform all actions to draw chart + protected: CommonData* commonData; GwLog* logger; @@ -79,9 +101,9 @@ protected: int numBufVals; // number of wind values available for current interval selection int bufStart; // 1st data value in buffer to show int numAddedBufVals; // Number of values added to buffer since last display - size_t currIdx; // Current index in TWD history buffer - size_t lastIdx; // Last index of TWD history buffer - size_t lastAddedIdx = 0; // Last index of TWD history buffer when new data was added + size_t currIdx; // Current index in history buffer + size_t lastIdx; // Last index of history buffer + size_t lastAddedIdx = 0; // Last index of history buffer when new data was added int numNoData; // Counter for multiple invalid data values in a row bool bufDataValid = false; // Flag to indicate if buffer data is valid int oldChrtIntv = 0; // remember recent user selection of data interval @@ -92,6 +114,7 @@ protected: int prevX, prevY; // Last x and y coordinates for drawing bool setChartDimensions(const char direction, const int8_t size); // define dimensions and start points for chart +// bool setChartDimensions(const ChrtDirection direction, const ChrtSize size); // define dimensions and start points for chart void drawChrt(const char chrtDir, const int8_t chrtIntv, GwApi::BoatValue& currValue); // Draw chart line void getBufferStartNSize(const int8_t chrtIntv); // Identify buffer size and buffer start position for chart void calcChrtBorders(double& rngMin, double& rngMid, double& rngMax, double& rng); // Calculate chart points for value axis and return range between and @@ -108,12 +131,4 @@ protected: void drawBoldLine(const int16_t x1, const int16_t y1, const int16_t x2, const int16_t y2); // Draw chart line with thickness of 2px String convNformatLabel(const double& label); // Convert and format current axis label to user defined format; helper function for easier handling of OBP60Formatter String formatLabel(const double& label); // Format current axis label for printing w/o data format conversion (has been done earlier) - -public: - // Define default chart range and range step for each boat data type - static std::map dfltChrtDta; - - Chart(RingBuffer& dataBuf, double dfltRng, CommonData& common, bool useSimuData); // Chart object of data chart - ~Chart(); - void showChrt(char chrtDir, int8_t chrtSz, const int8_t chrtIntv, bool prntName, bool showCurrValue, GwApi::BoatValue currValue); // Perform all actions to draw chart }; diff --git a/lib/obp60task/PageWeather.cpp b/lib/obp60task/PageWeather.cpp new file mode 100644 index 0000000..4d7f6ab --- /dev/null +++ b/lib/obp60task/PageWeather.cpp @@ -0,0 +1,310 @@ +#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 + +#include "Pagedata.h" +#include "OBP60Extensions.h" +#include "OBPDataOperations.h" +#include "OBPcharts.h" + +class PageWeather : public Page { +private: + GwLog* logger; + + enum PageMode { + VAL_CHART, + CHART + }; + /* enum DisplayMode { + FULL, + HALF + }; */ + + static constexpr char HORIZONTAL = 'H'; + static constexpr char VERTICAL = 'V'; + static constexpr int8_t FULL_SIZE = 0; + static constexpr int8_t HALF_SIZE_TOP = 1; + static constexpr int8_t HALF_SIZE_BOTTOM = 2; + static constexpr int8_t TWO_THIRD_TOP = 3; + + static constexpr bool PRNT_NAME = true; + static constexpr bool NO_PRNT_NAME = false; + static constexpr bool PRNT_VALUE = true; + static constexpr bool NO_PRNT_VALUE = false; + + static constexpr int XOFFSET = 133; // x offset for display of boat values + + int width; // Screen width + int height; // Screen height + + bool keylock = false; // Keylock + PageMode pageMode = VAL_CHART; // Page display mode + int8_t dataIntv = 1; // Update interval for barograph history chart: + // (1)|(3)|(6)|(12)|(24) x 60 min. for 1, 3, 6, 12, 24 hours history chart + + // String lengthformat; + bool useSimuData; + bool holdValues; + String flashLED; + String backlightMode; + String tempFormat; + + static constexpr int NUMVALUES = 4; // number of boat values used on this page + static constexpr int NUMCHARTS = 1; // one data buffer used on this page + + // Data buffer pointer (owned by HstryBuffers) + RingBuffer* dataHstryBuf[NUMCHARTS] = { nullptr }; + std::unique_ptr dataChart[NUMCHARTS]; // Chart object + + // Old values for hold function + String sValueOld[NUMVALUES] = { "", "", "", "" }; + String unitOld[NUMVALUES] = { "", "", "", "" }; + + // display data values in display mode + void showData(const std::vector& bValue) + { + getdisplay().setTextColor(commonData->fgcolor); + + int numValues = bValue.size(); // How many values do we have to handle? We will ignore value no. 1 + + for (int i = 1; i < numValues; i++) { + String name = xdrDelete(bValue[i]->getName()); // Value name + name = name.substring(0, 7); // String length limit for value name + double value = bValue[i]->value; // Value as double in SI unit + bool valid = bValue[i]->valid; // Valid information + String sValue = formatValue(bValue[i], *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit = formatValue(bValue[i], *commonData).unit; // Unit of value + + int xOffset = XOFFSET * (i - 1); + + // Print name + getdisplay().setFont(&Ubuntu_Bold12pt8b); + getdisplay().setCursor(5 + xOffset, 213); + getdisplay().print(name); // name + + // Print unit + getdisplay().setFont(&Ubuntu_Bold8pt8b); + getdisplay().setCursor(5 + xOffset, 229); + if (holdValues) { + getdisplay().print(unitOld[i]); // name + } else { + getdisplay().print(unit); // name + } + + // Print value + getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); + if (bValue[i]->getFormat() == "formatXdr:P:P" || bValue[i]->getFormat() == "formatXdr:P:B") { + getdisplay().setCursor(6 + xOffset, 275); // pressure format is always 4 digits when all other boat data has 3 digit format + } else { + getdisplay().setCursor(37 + xOffset, 275); + } + if (!holdValues || useSimuData) { + getdisplay().print(sValue); // Real value as formated string + } else { + getdisplay().print(sValueOld[i]); // Old value as formated string + } + + if (valid) { // Save value for hold function + sValueOld[i] = sValue; + unitOld[i] = unit; + } + } + + // print lines for data separation of bottom data values + getdisplay().fillRect(0, 191, 400, 2, commonData->fgcolor); // horizontal line + getdisplay().fillRect(133, 192, 2, 83, commonData->fgcolor); // vertical lines + getdisplay().fillRect(266, 192, 2, 83, commonData->fgcolor); + } + +public: + PageWeather(CommonData& common) + { + commonData = &common; + logger = commonData->logger; + LOG_DEBUG(GwLog::LOG, "Instantiate PageWeather"); + + width = getdisplay().width(); // Screen width + height = getdisplay().height(); // Screen height + + // Get config data + // lengthformat = commonData->config->getString(commonData->config->lengthFormat); + useSimuData = commonData->config->getBool(commonData->config->useSimuData); + holdValues = commonData->config->getBool(commonData->config->holdvalues); + flashLED = commonData->config->getString(commonData->config->flashLED); + backlightMode = commonData->config->getString(commonData->config->backlight); + tempFormat = commonData->config->getString(commonData->config->tempFormat); // [K|°C|°F] + } + + virtual void setupKeys() + { + Page::setupKeys(); + +#if defined BOARD_OBP60S3 + constexpr int ZOOM_KEY = 4; +#elif defined BOARD_OBP40S3 + constexpr int ZOOM_KEY = 1; +#endif + + if (dataHstryBuf) { // show "Mode" key only if chart-supported boat data type is available + commonData->keydata[0].label = "MODE"; + commonData->keydata[ZOOM_KEY].label = "ZOOM"; + } else { + commonData->keydata[0].label = ""; + commonData->keydata[ZOOM_KEY].label = ""; + } + } + + // Key functions + virtual int handleKey(int key) + { + if (dataHstryBuf) { // if boat data type supports charts + + // Set page mode: value/half chart | full chart + if (key == 1) { + switch (pageMode) { + case VAL_CHART: + pageMode = CHART; + break; + case CHART: + pageMode = VAL_CHART; + break; + } + setupKeys(); // Adjust key definition depending on and chart-supported boat data type + return 0; // Commit the key + } + + // Set time frame to show for chart +#if defined BOARD_OBP60S3 + if (key == 5) { +#elif defined BOARD_OBP40S3 + if (key == 2) { +#endif + if (dataIntv == 1) { + dataIntv = 3; + } else if (dataIntv == 3) { + dataIntv = 6; + } else if (dataIntv == 6) { + dataIntv = 12; + } else if (dataIntv == 12) { + dataIntv = 24; + } else { + dataIntv = 1; + } + return 0; // Commit the key + } + } + + // Keylock function + if (key == 11) { // Code for keylock + commonData->keylock = !commonData->keylock; + return 0; // Commit the key + } + return key; + } + + virtual void displayNew(PageData& pageData) + { +#ifdef BOARD_OBP60S3 + // Clear optical warning + if (flashLED == "Limit Violation") { + setBlinkingLED(false); + setFlashLED(false); + } +#endif + + for (int i = 0; i < NUMCHARTS; i++) { + if (!dataChart[i]) { // Create chart objects if they don't exist + + GwApi::BoatValue* bValue = pageData.values[i]; // Page boat data element + String bValName = bValue->getName(); // Value name + String bValFormat = bValue->getFormat(); // Value format + + dataHstryBuf[i] = pageData.hstryBuffers->getBuffer(bValName); + // if (dataHstryBuf[i]->getFormat() == "") { // data format might have been unknown at time of buffer creation + // dataHstryBuf[i]->setFormat(bValFormat); // in that case, we specify it here, because we need it for printing of buffer data + // } + + if (dataHstryBuf[i]) { + dataChart[i].reset(new Chart(*dataHstryBuf[i], Chart::dfltChrtDta[bValFormat].range, *commonData, useSimuData)); + LOG_DEBUG(GwLog::DEBUG, "PageWeather: Created chart object %d for %s, format: %s", i, bValName.c_str(), dataHstryBuf[i]->getFormat().c_str()); + } else { + LOG_DEBUG(GwLog::DEBUG, "PageWeather: No chart object available for %s", bValName.c_str()); + } + } + } + + setupKeys(); // Adjust key definition depending on and chart-supported boat data type + } + + int displayPage(PageData& pageData) + { + + // using CD = Chart::ChrtDirection; + + LOG_DEBUG(GwLog::LOG, "Display PageWeather"); + + // Get latest boat values for page + std::vector bValue; + for (int i = 0; i < NUMVALUES; i++) { + bValue.push_back(pageData.values[i]); + } + + // Optical warning by limit violation (unused) + if (String(flashLED) == "Limit Violation") { + setBlinkingLED(false); + setFlashLED(false); + } + + if (bValue[0] == NULL && bValue[1] == NULL && bValue[2] == NULL && bValue[3] == NULL) + return PAGE_OK; // no data, no page to display + + LOG_DEBUG(GwLog::DEBUG, "PageWeather: printing #1: %s, %.3f, %s, #2: %s, %.3f, %s, #3: %s, %.3f, %s, #4: %s, %.3f, %s", + bValue[0]->getName().c_str(), bValue[0]->value, bValue[0]->getFormat().c_str(), bValue[1]->getName().c_str(), bValue[1]->value, bValue[1]->getFormat().c_str(), + bValue[2]->getName().c_str(), bValue[2]->value, bValue[2]->getFormat().c_str(), bValue[3]->getName().c_str(), bValue[3]->value, bValue[3]->getFormat().c_str()); + + // Draw page + //*********************************************************** + + displaySetPartialWindow(0, 0, width, height); // Set partial update + + if (dataHstryBuf != nullptr) { + if (dataHstryBuf[0]->getFormat() == "") { // data format might have been unknown at time of buffer creation + dataHstryBuf[0]->setFormat(bValue[0]->getFormat()); // in that case, we specify it here, because we need it for printing of buffer data + } + + // if (pageMode == VAL_CHART && dataHstryBuf != nullptr) { + if (pageMode == VAL_CHART) { + if (dataChart[0]) { + dataChart[0]->showChrt(HORIZONTAL, TWO_THIRD_TOP, dataIntv, PRNT_NAME, PRNT_VALUE, *bValue[0]); + } + showData(bValue); + + } else if (pageMode == CHART) { // show only data chart + if (dataChart[0]) { + dataChart[0]->showChrt(HORIZONTAL, FULL_SIZE, dataIntv, PRNT_NAME, PRNT_VALUE, *bValue[0]); + } + } + } + return PAGE_UPDATE; + }; +}; + +static Page* createPage(CommonData& common) +{ + return new PageWeather(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 registerPageWeather( + "Weather", // Page name + createPage, // Action + 4, // Number of bus values depends on selection in Web configuration (air baro pressure, air temperature, humidity, true wind speed) + { }, // Bus values we need in the page + true // Show display header on/off +); + +#endif diff --git a/lib/obp60task/config_obp40.json b/lib/obp60task/config_obp40.json index b009fcc..e73f545 100644 --- a/lib/obp60task/config_obp40.json +++ b/lib/obp60task/config_obp40.json @@ -1590,6 +1590,7 @@ "ThreeValues", "TwoValues", "Voltage", + "Weather", "WhitePage", "Wind", "WindPlot", @@ -1637,6 +1638,7 @@ "SixValues", "ThreeValues", "TwoValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -1671,6 +1673,7 @@ "SixValues", "ThreeValues", "TwoValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -1703,6 +1706,7 @@ "FourValues2", "SixValues", "ThreeValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -1734,6 +1738,7 @@ "FourValues", "FourValues2", "SixValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -1923,6 +1928,7 @@ "ThreeValues", "TwoValues", "Voltage", + "Weather", "WhitePage", "Wind", "WindPlot", @@ -1969,6 +1975,7 @@ "SixValues", "ThreeValues", "TwoValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -2002,6 +2009,7 @@ "SixValues", "ThreeValues", "TwoValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -2033,6 +2041,7 @@ "FourValues2", "SixValues", "ThreeValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -2063,6 +2072,7 @@ "FourValues", "FourValues2", "SixValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -2247,6 +2257,7 @@ "ThreeValues", "TwoValues", "Voltage", + "Weather", "WhitePage", "Wind", "WindPlot", @@ -2292,6 +2303,7 @@ "SixValues", "ThreeValues", "TwoValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -2324,6 +2336,7 @@ "SixValues", "ThreeValues", "TwoValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -2354,6 +2367,7 @@ "FourValues2", "SixValues", "ThreeValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -2383,6 +2397,7 @@ "FourValues", "FourValues2", "SixValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -2562,6 +2577,7 @@ "ThreeValues", "TwoValues", "Voltage", + "Weather", "WhitePage", "Wind", "WindPlot", @@ -2606,6 +2622,7 @@ "SixValues", "ThreeValues", "TwoValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -2637,6 +2654,7 @@ "SixValues", "ThreeValues", "TwoValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -2666,6 +2684,7 @@ "FourValues2", "SixValues", "ThreeValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -2694,6 +2713,7 @@ "FourValues", "FourValues2", "SixValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -2868,6 +2888,7 @@ "ThreeValues", "TwoValues", "Voltage", + "Weather", "WhitePage", "Wind", "WindPlot", @@ -2911,6 +2932,7 @@ "SixValues", "ThreeValues", "TwoValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -2941,6 +2963,7 @@ "SixValues", "ThreeValues", "TwoValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -2996,6 +3019,7 @@ "FourValues", "FourValues2", "SixValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -3165,6 +3189,7 @@ "ThreeValues", "TwoValues", "Voltage", + "Weather", "WhitePage", "Wind", "WindPlot", @@ -3207,6 +3232,7 @@ "SixValues", "ThreeValues", "TwoValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -3236,6 +3262,7 @@ "SixValues", "ThreeValues", "TwoValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -3263,6 +3290,7 @@ "FourValues2", "SixValues", "ThreeValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -3289,6 +3317,7 @@ "FourValues", "FourValues2", "SixValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -3453,6 +3482,7 @@ "ThreeValues", "TwoValues", "Voltage", + "Weather", "WhitePage", "Wind", "WindPlot", @@ -3494,6 +3524,7 @@ "SixValues", "ThreeValues", "TwoValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -3522,6 +3553,7 @@ "SixValues", "ThreeValues", "TwoValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -3548,6 +3580,7 @@ "FourValues2", "SixValues", "ThreeValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -3573,6 +3606,7 @@ "FourValues", "FourValues2", "SixValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -3732,6 +3766,7 @@ "ThreeValues", "TwoValues", "Voltage", + "Weather", "WhitePage", "Wind", "WindPlot", @@ -3772,6 +3807,7 @@ "SixValues", "ThreeValues", "TwoValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -3799,6 +3835,7 @@ "SixValues", "ThreeValues", "TwoValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -3824,6 +3861,7 @@ "FourValues2", "SixValues", "ThreeValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -3848,6 +3886,7 @@ "FourValues", "FourValues2", "SixValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -4002,6 +4041,7 @@ "ThreeValues", "TwoValues", "Voltage", + "Weather", "WhitePage", "Wind", "WindPlot", @@ -4041,6 +4081,7 @@ "SixValues", "ThreeValues", "TwoValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -4067,6 +4108,7 @@ "SixValues", "ThreeValues", "TwoValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -4091,6 +4133,7 @@ "FourValues2", "SixValues", "ThreeValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -4114,6 +4157,7 @@ "FourValues", "FourValues2", "SixValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -4263,6 +4307,7 @@ "ThreeValues", "TwoValues", "Voltage", + "Weather", "WhitePage", "Wind", "WindPlot", @@ -4301,6 +4346,7 @@ "SixValues", "ThreeValues", "TwoValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -4326,6 +4372,7 @@ "SixValues", "ThreeValues", "TwoValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -4349,6 +4396,7 @@ "FourValues2", "SixValues", "ThreeValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -4371,6 +4419,7 @@ "FourValues", "FourValues2", "SixValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ diff --git a/lib/obp60task/config_obp60.json b/lib/obp60task/config_obp60.json index a9e2595..da6f456 100644 --- a/lib/obp60task/config_obp60.json +++ b/lib/obp60task/config_obp60.json @@ -1568,6 +1568,7 @@ "ThreeValues", "TwoValues", "Voltage", + "Weather", "WhitePage", "Wind", "WindPlot", @@ -1615,6 +1616,7 @@ "SixValues", "ThreeValues", "TwoValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -1649,6 +1651,7 @@ "SixValues", "ThreeValues", "TwoValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -1681,6 +1684,7 @@ "FourValues2", "SixValues", "ThreeValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -1712,6 +1716,7 @@ "FourValues", "FourValues2", "SixValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -1871,6 +1876,7 @@ "ThreeValues", "TwoValues", "Voltage", + "Weather", "WhitePage", "Wind", "WindPlot", @@ -1917,6 +1923,7 @@ "SixValues", "ThreeValues", "TwoValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -1950,6 +1957,7 @@ "SixValues", "ThreeValues", "TwoValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -1981,6 +1989,7 @@ "FourValues2", "SixValues", "ThreeValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -2011,6 +2020,7 @@ "FourValues", "FourValues2", "SixValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -2166,6 +2176,7 @@ "ThreeValues", "TwoValues", "Voltage", + "Weather", "WhitePage", "Wind", "WindPlot", @@ -2211,6 +2222,7 @@ "SixValues", "ThreeValues", "TwoValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -2243,6 +2255,7 @@ "SixValues", "ThreeValues", "TwoValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -2273,6 +2286,7 @@ "FourValues2", "SixValues", "ThreeValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -2302,6 +2316,7 @@ "FourValues", "FourValues2", "SixValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -2453,6 +2468,7 @@ "ThreeValues", "TwoValues", "Voltage", + "Weather", "WhitePage", "Wind", "WindPlot", @@ -2497,6 +2513,7 @@ "SixValues", "ThreeValues", "TwoValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -2528,6 +2545,7 @@ "SixValues", "ThreeValues", "TwoValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -2557,6 +2575,7 @@ "FourValues2", "SixValues", "ThreeValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ @@ -2585,6 +2604,7 @@ "FourValues", "FourValues2", "SixValues", + "Weather", "WindRoseFlex" ], "visiblePages": [ diff --git a/lib/obp60task/obp60task.cpp b/lib/obp60task/obp60task.cpp index a8de252..7e3ef01 100644 --- a/lib/obp60task/obp60task.cpp +++ b/lib/obp60task/obp60task.cpp @@ -265,8 +265,8 @@ void registerAllPages(PageList &list){ list.add(®isterPageDigitalOut); extern PageDescription registerPageAutopilot; list.add(®isterPageAutopilot); -// extern PageDescription registerPageWeather; -// list.add(®isterPageWeather); + extern PageDescription registerPageWeather; + list.add(®isterPageWeather); } // Undervoltage detection for shutdown display @@ -504,7 +504,8 @@ void OBP60Task(GwApi *api){ // Read the specified boat data types of relevant pages and create a history buffer for each type for later use in charts // applies only for pages that uses charts - if (pages[i].parameters.pageName == "OneValue" || pages[i].parameters.pageName == "TwoValues" || pages[i].parameters.pageName == "WindPlot") { + if (pages[i].parameters.pageName == "OneValue" || pages[i].parameters.pageName == "TwoValues" + || pages[i].parameters.pageName == "WindPlot" || pages[i].parameters.pageName == "Weather") { for (auto pVal : pages[i].parameters.values) { hstryBufferList.addBuffer(pVal->getName()); }