mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2026-09-11 19:55:14 +02:00
1st version of PageWeather with air pressure chart
This commit is contained in:
+26
-11
@@ -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<String, ChartProps> dfltChrtDta;
|
||||
|
||||
Chart(RingBuffer<uint16_t>& 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 <min> and <max>
|
||||
@@ -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<String, ChartProps> dfltChrtDta;
|
||||
|
||||
Chart(RingBuffer<uint16_t>& 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
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user