diff --git a/lib/obp60task/OBP60Extensions.cpp b/lib/obp60task/OBP60Extensions.cpp index 3c4d9a2..3b3ee88 100644 --- a/lib/obp60task/OBP60Extensions.cpp +++ b/lib/obp60task/OBP60Extensions.cpp @@ -966,6 +966,9 @@ void displayRudderPosition(int rudderPosition, uint8_t rangeDeg, uint16_t cx, ui // Fill inner area with background getdisplay().fillRect(left + t, top + t, w - 2 * t, h - 2 * t, bg); + // Draw center line + getdisplay().drawRect(cx - 1, top + 1, 3 , h - 2, fg); + // Clamp rudder position to -rangeDeg..rangeDeg if (rudderPosition > (int)rangeDeg) rudderPosition = (int)rangeDeg; if (rudderPosition < -((int)rangeDeg)) rudderPosition = -((int)rangeDeg); @@ -985,6 +988,7 @@ void displayRudderPosition(int rudderPosition, uint8_t rangeDeg, uint16_t cx, ui getdisplay().fillRect(centerx + fillPx, innerTop, -fillPx, innerH, fg); } + // Draw tick marks every 5° and labels outside the bar getdisplay().setTextColor(fg); getdisplay().setFont(&Ubuntu_Bold8pt8b); diff --git a/lib/obp60task/OBP60Extensions.h b/lib/obp60task/OBP60Extensions.h index 6d9e4a9..41e3717 100644 --- a/lib/obp60task/OBP60Extensions.h +++ b/lib/obp60task/OBP60Extensions.h @@ -130,7 +130,7 @@ void startLedTask(GwApi *api); // Display rudder position as horizontal bargraph with configurable +/- range (degrees) // 'rangeDeg' is unsigned and will be clamped to [10,45] -void displayRudderPosition(int rudderPosition, uint8_t rangeDeg, uint16_t x, uint16_t y, uint16_t fg, uint16_t bg); +void displayRudderPosition(int rudderPosition, uint8_t rangeDeg, uint16_t cx, uint16_t cy, uint16_t fg, uint16_t bg); void doImageRequest(GwApi *api, int *pageno, const PageStruct pages[MAX_PAGE_NUMBER], AsyncWebServerRequest *request); diff --git a/lib/obp60task/PageAutopilot.cpp b/lib/obp60task/PageAutopilot.cpp index 8a698ce..09d14e2 100644 --- a/lib/obp60task/PageAutopilot.cpp +++ b/lib/obp60task/PageAutopilot.cpp @@ -5,8 +5,9 @@ // These constants have to match the declaration below in : // PageDescription registerPageAutopilot( -// {"HDM","HDT", "COG", "STW", "SOG", "DBT","XTE", "DTW", "BTW"}, // Bus values we need in the page -const int HowManyValues = 9; +// {"HDM","HDT", "COG", "STW", "SOG", "DBT","XTE", "DTW", "BTW", "RPOS", "ROT"}, // Bus values we need in the page + +const int HowManyValues = 11; const int AverageValues = 4; @@ -19,6 +20,8 @@ const int ShowDBT = 5; const int ShowXTE = 6; const int ShowDTW = 7; const int ShowBTW = 8; +const int ShowRPOS = 9; +const int ShowROT = 10; const int Compass_X0 = 200; // X center point of compass band const int Compass_Y0 = 90; // Y position of compass lines @@ -73,8 +76,8 @@ class PageAutopilot : public Page GwLog *logger = commonData->logger; // Old values for hold function - static String OldDataText[HowManyValues] = {"", "", "","", "", "","", "", ""}; - static String OldDataUnits[HowManyValues] = {"", "", "","", "", "","", "", ""}; + static String OldDataText[HowManyValues] = {"", "", "", "", "", "","", "", "", "", ""}; + static String OldDataUnits[HowManyValues] = {"", "", "", "", "", "","", "", "", "", ""}; // Get config data String lengthformat = config->getString(config->lengthFormat); @@ -240,7 +243,7 @@ class PageAutopilot : public Page // if ( x_test > 390) // x_test = 320; - displayRudderPosition(12, 20, 200, 160, commonData->fgcolor, commonData->bgcolor); + displayRudderPosition(DataValue[ShowRPOS], 20, 200, 160, commonData->fgcolor, commonData->bgcolor); return PAGE_UPDATE; }; @@ -260,7 +263,7 @@ PageDescription registerPageAutopilot( "Autopilot", // Page name createPage, // Action 0, // Number of bus values depends on selection in Web configuration - {"HDM","HDT", "COG", "STW", "SOG", "DBT","XTE", "DTW", "BTW"}, // Bus values we need in the page + {"HDM","HDT", "COG", "STW", "SOG", "DBT","XTE", "DTW", "BTW", "RPOS", "ROT"}, // Bus values we need in the page true // Show display header on/off );