diff --git a/lib/obp60task/OBP60Extensions.cpp b/lib/obp60task/OBP60Extensions.cpp index 57471d4..5b3d278 100644 --- a/lib/obp60task/OBP60Extensions.cpp +++ b/lib/obp60task/OBP60Extensions.cpp @@ -942,7 +942,7 @@ void generatorGraphic(uint x, uint y, int pcolor, int bcolor){ // Display rudder position as horizontal bargraph +/-30 degrees void displayRudderPosition(int rudderPosition, uint16_t cx, uint16_t cy, uint16_t fg, uint16_t bg){ - const int w = 300; + const int w = 360; const int h = 20; const int t = 3; // Line thickness const int halfw = w/2; @@ -987,15 +987,14 @@ void displayRudderPosition(int rudderPosition, uint16_t cx, uint16_t cy, uint16_ for (int angle = -30; angle <= 30; angle += 5) { int xpos = int(round(centerx + angle * pxPerDeg)); // Vertical tick inside bar - getdisplay().drawLine(xpos, top, xpos, top + h, fg); + getdisplay().drawLine(xpos, top, xpos, top + h + 2, fg); // Label outside: below the bar String lbl = String(angle); - lbl += "\u00B0"; // Degree symbol int16_t bx, by; uint16_t bw, bh; getdisplay().getTextBounds(lbl, 0, 0, &bx, &by, &bw, &bh); int16_t tx = xpos - bw/2; - int16_t ty = top + h + bh + 2; // A little spacing + int16_t ty = top + h + bh + 5; // A little spacing getdisplay().setCursor(tx, ty); getdisplay().print(lbl); } diff --git a/lib/obp60task/PageAutopilot.cpp b/lib/obp60task/PageAutopilot.cpp index 6cbf299..f5161f5 100644 --- a/lib/obp60task/PageAutopilot.cpp +++ b/lib/obp60task/PageAutopilot.cpp @@ -21,8 +21,9 @@ const int ShowDTW = 7; const int ShowBTW = 8; const int Compass_X0 = 200; // X center point of compass band -const int Compass_Y0 = 220; // Y position of compass lines -const int Compass_LineLength = 22; // Length of compass lines +const int Compass_Y0 = 90; // Y position of compass lines +//const int Compass_LineLength = 22; // Length of compass lines +const int Compass_LineLength = 15; // Length of compass lines const float Compass_LineDelta = 8.0;// Compass band: 1deg = 5 Pixels, 10deg = 50 Pixels class PageAutopilot : public Page @@ -38,8 +39,11 @@ class PageAutopilot : public Page virtual void setupKeys(){ Page::setupKeys(); - commonData->keydata[0].label = "CMP"; - commonData->keydata[1].label = "SRC"; + commonData->keydata[0].label = "-10"; + commonData->keydata[1].label = "-1"; + commonData->keydata[2].label = "Auto"; + commonData->keydata[3].label = "+1"; + commonData->keydata[4].label = "+10"; } virtual int handleKey(int key){ @@ -106,15 +110,13 @@ class PageAutopilot : public Page setBlinkingLED(false); setFlashLED(false); } - - if (bvalue == NULL) return PAGE_OK; // WTF why this statement? //*********************************************************** // Set display in partial refresh mode getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update getdisplay().setTextColor(commonData->fgcolor); - +/* // Horizontal line 2 pix top & bottom // Print data on top half getdisplay().fillRect(0, 130, 400, 2, commonData->fgcolor); @@ -138,7 +140,7 @@ class PageAutopilot : public Page OldDataText[WhichDataDisplay] = DataText[WhichDataDisplay]; // Save the old value OldDataUnits[WhichDataDisplay] = DataUnits[WhichDataDisplay]; // Save the old unit } - +*/ // Now draw compass band // Get the data double TheAngle = DataValue[WhichDataCompass]; @@ -152,13 +154,13 @@ class PageAutopilot : public Page buffer[0]=0; getdisplay().setFont(&Ubuntu_Bold16pt8b); - getdisplay().setCursor(10, Compass_Y0-60); + getdisplay().setCursor(10, Compass_Y0-40); getdisplay().print(DataName[WhichDataCompass]); // Page name - // Draw compass base line and pointer getdisplay().fillRect(0, Compass_Y0, 400, 3, commonData->fgcolor); - getdisplay().fillTriangle(Compass_X0,Compass_Y0-40,Compass_X0-10,Compass_Y0-80,Compass_X0+10,Compass_Y0-80,commonData->fgcolor); + //getdisplay().fillTriangle(Compass_X0,Compass_Y0-40,Compass_X0-10,Compass_Y0-80,Compass_X0+10,Compass_Y0-80,commonData->fgcolor); + getdisplay().fillTriangle(Compass_X0,Compass_Y0-30,Compass_X0-10,Compass_Y0-60,Compass_X0+10,Compass_Y0-60,commonData->fgcolor); // Draw trendlines for ( int i = 1; i < abs(TheTrend) / 2; i++){ int x1; @@ -238,6 +240,8 @@ class PageAutopilot : public Page // if ( x_test > 390) // x_test = 320; + displayRudderPosition(12, 200, 160, commonData->fgcolor, commonData->bgcolor); + return PAGE_UPDATE; };