Merge branch 'master' of https://github.com/TobiasE-github/esp32-nmea2000-obp60
This commit is contained in:
commit
b875c51f94
|
@ -46,7 +46,7 @@ class PageAutobahn : public Page{
|
|||
// draw outline
|
||||
getdisplay().drawLine(x0, y0, x1, y1, color);
|
||||
getdisplay().drawLine(x1, y1, x2, y2, color);
|
||||
getdisplay().drawLine(x2, y2, x3, y3, color);
|
||||
getdisplay().drawLine(x2, y2, x3, y3, color);
|
||||
getdisplay().drawLine(x3, y3, x0, y0, color);
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ class PageAutobahn : public Page{
|
|||
String backlightMode = config->getString(config->backlight);
|
||||
|
||||
String trackStep = config->getString(config->trackStep);
|
||||
double seg_deg = trackStep.toFloat(); // degrees per display segment
|
||||
double seg_step = trackStep.toFloat() * PI / 180;
|
||||
|
||||
// Optical warning by limit violation (unused)
|
||||
if(String(flashLED) == "Limit Violation"){
|
||||
|
@ -136,20 +136,26 @@ class PageAutobahn : public Page{
|
|||
getdisplay().setCursor(360-w, 257);
|
||||
getdisplay().print(sval_btw);
|
||||
|
||||
bool valid = bv_cog->valid && bv_btw->valid;
|
||||
|
||||
// autobahn view
|
||||
|
||||
// draw ship symbol (as bitmap)
|
||||
getdisplay().drawXBitmap(184, 68, ship_bits, ship_width, ship_height, pixelcolor);
|
||||
|
||||
// draw next waypoint name
|
||||
String sval_wpname = "Tonne 122";
|
||||
String sval_wpname = "no data";
|
||||
|
||||
if (valid) {
|
||||
sval_wpname = "Tonne 122";
|
||||
}
|
||||
|
||||
getdisplay().setFont(&Ubuntu_Bold10pt7b);
|
||||
getdisplay().getTextBounds(sval_wpname, 0, 150, &x, &y, &w, &h);
|
||||
// TODO if text don't fix use smaller font size.
|
||||
// if smallest size does not fit use 2 lines
|
||||
// last resort: clip with ellipsis
|
||||
getdisplay().setCursor(200 - w / 2, 60);
|
||||
|
||||
getdisplay().print(sval_wpname);
|
||||
|
||||
// draw course segments
|
||||
|
@ -161,21 +167,26 @@ class PageAutobahn : public Page{
|
|||
diff -= 360;
|
||||
}
|
||||
|
||||
// default all segments activated
|
||||
bool seg[6] = {true, true, true, true, true, true};
|
||||
// as default all segments activated if valid calculation
|
||||
// values are available
|
||||
bool seg[6]; // segment layout: [2][1][0] | [3][4][5]
|
||||
for (int i=0; i<6; i++) {
|
||||
seg[i] = valid;
|
||||
}
|
||||
|
||||
// number of inactive segments
|
||||
int nseg = std::min(static_cast<int>(std::floor(std::abs(diff) / seg_deg)), 5);
|
||||
int nseg = std::min(static_cast<int>(std::floor(std::abs(diff) / seg_step)), 5);
|
||||
|
||||
int order[6];
|
||||
if (diff < 0) {
|
||||
if (diff > 0) {
|
||||
// right
|
||||
order[0] = 6; order[1] = 5; order[2] = 4;
|
||||
order[3] = 1; order[4] = 2; order[5] = 3;
|
||||
}
|
||||
else if (diff > 0) {
|
||||
order[0] = 3; order[1] = 4; order[2] = 5;
|
||||
order[3] = 0; order[4] = 1; order[5] = 2;
|
||||
}
|
||||
else if (diff < 0) {
|
||||
// left
|
||||
order[0] = 3; order[1] = 2; order[2] = 1;
|
||||
order[3] = 4; order[4] = 5; order[5] = 6;
|
||||
order[0] = 0; order[1] = 1; order[2] = 2;
|
||||
order[3] = 3; order[4] = 4; order[5] = 5;
|
||||
}
|
||||
int i = 0;
|
||||
while (nseg > 0) {
|
||||
|
@ -185,13 +196,13 @@ class PageAutobahn : public Page{
|
|||
}
|
||||
|
||||
// left segments
|
||||
drawSegment(0, 54, 46, 24, 75, 24, 0, 90, pixelcolor, seg[0]);
|
||||
drawSegment(0, 54, 46, 24, 75, 24, 0, 90, pixelcolor, seg[2]);
|
||||
drawSegment(0, 100, 82, 24, 112, 24, 50, 100, pixelcolor, seg[1]);
|
||||
drawSegment(60, 100, 117, 24, 147, 24, 110, 100, pixelcolor,seg[2]);
|
||||
drawSegment(60, 100, 117, 24, 147, 24, 110, 100, pixelcolor,seg[0]);
|
||||
// right segments
|
||||
drawSegment(399, 54, 354, 24, 325, 24, 399, 90, pixelcolor, seg[3]);
|
||||
drawSegment(340, 100, 283, 24, 253, 24, 290, 100, pixelcolor, seg[3]);
|
||||
drawSegment(399, 100, 318, 24, 289, 24, 350, 100, pixelcolor, seg[4]);
|
||||
drawSegment(340, 100, 283, 24, 253, 24, 290, 100, pixelcolor, seg[5]);
|
||||
drawSegment(399, 54, 354, 24, 325, 24, 399, 90, pixelcolor, seg[5]);
|
||||
|
||||
// Key Layout
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
|
|
|
@ -95,7 +95,7 @@ public:
|
|||
else{
|
||||
svalue2 = String(value2/(2*PI)*360,0);
|
||||
}
|
||||
if(valid2 == true){
|
||||
if(valid2 == true){
|
||||
svalue2old = svalue2; // Save the old value
|
||||
}
|
||||
|
||||
|
@ -140,6 +140,8 @@ public:
|
|||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(10, 65);
|
||||
getdisplay().print(rolllimit); // Value
|
||||
//getdisplay().print(svalue1); // Value
|
||||
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(10, 95);
|
||||
getdisplay().print("Limit"); // Name
|
||||
|
|
|
@ -127,7 +127,7 @@ public:
|
|||
}
|
||||
|
||||
// Logging voltage value
|
||||
if (raw == NULL) return;
|
||||
if (raw == 0) return;
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageVoltage, Type:%s %s:=%f", batType, name1.c_str(), raw);
|
||||
|
||||
// Draw page
|
||||
|
|
|
@ -486,7 +486,7 @@ uint8_t RTC_BQ32000::readRegister(uint8_t address) {
|
|||
return Wire.read();
|
||||
}
|
||||
|
||||
uint8_t RTC_BQ32000::writeRegister(uint8_t address, uint8_t value) {
|
||||
void RTC_BQ32000::writeRegister(uint8_t address, uint8_t value) {
|
||||
/* Write the given value to the register at the given address.
|
||||
*/
|
||||
Wire.beginTransmission(BQ32000_ADDRESS);
|
||||
|
@ -513,4 +513,4 @@ DateTime RTC_Millis::now() {
|
|||
return offset + millis() / 1000;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -182,7 +182,7 @@ public:
|
|||
|
||||
// utility functions:
|
||||
static uint8_t readRegister(uint8_t address);
|
||||
static uint8_t writeRegister(uint8_t address, uint8_t value);
|
||||
static void writeRegister(uint8_t address, uint8_t value);
|
||||
static uint8_t bcd2bin (uint8_t val) { return val - 6 * (val >> 4); }
|
||||
static uint8_t bin2bcd (uint8_t val) { return val + 6 * (val / 10); }
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue