diff --git a/src/main/fc/cli.c b/src/main/fc/cli.c index 5173a86fd3e..e402ecf8875 100644 --- a/src/main/fc/cli.c +++ b/src/main/fc/cli.c @@ -2396,8 +2396,8 @@ static void cliFlashRead(char *cmdline) #ifdef USE_OSD static void printOsdLayout(uint8_t dumpMask, const osdLayoutsConfig_t *config, const osdLayoutsConfig_t *configDefault, int layout, int item) { - // " " // CR22 - const char *format = "osd_layout %d %d %d %d %c %c"; // CR22 + // " " + const char *format = "osd_layout %d %d %d %d %c"; for (int ii = 0; ii < OSD_LAYOUT_COUNT; ii++) { if (layout >= 0 && layout != ii) { continue; @@ -2413,15 +2413,13 @@ static void printOsdLayout(uint8_t dumpMask, const osdLayoutsConfig_t *config, c ii, jj, OSD_X(defaultLayoutItems[jj]), OSD_Y(defaultLayoutItems[jj]), - OSD_VISIBLE(defaultLayoutItems[jj]) ? 'V' : 'H', // CR22 - OSD_INFOCYCLE(defaultLayoutItems[jj]) ? 'O' : 'A'); // CR22 + OSD_VISIBLE(defaultLayoutItems[jj]) ? 'V' : 'H'); cliDumpPrintLinef(dumpMask, equalsDefault, format, ii, jj, OSD_X(layoutItems[jj]), OSD_Y(layoutItems[jj]), - OSD_VISIBLE(layoutItems[jj]) ? 'V' : 'H', // CR22 - OSD_INFOCYCLE(layoutItems[jj]) ? 'A' : 'O'); // CR22 + OSD_VISIBLE(layoutItems[jj]) ? 'V' : 'H'); } } } @@ -2435,7 +2433,6 @@ static void cliOsdLayout(char *cmdline) int col = 0; int row = 0; bool visible = false; - bool infocycle = false; // CR22 char *tok = strtok_r(cmdline, " ", &saveptr); int ii; @@ -2483,21 +2480,6 @@ static void cliOsdLayout(char *cmdline) return; } break; - // CR22 - case 5: - switch (*tok) { - case 'O': - infocycle = false; - break; - case 'A': - infocycle = true; - break; - default: - cliShowParseError(); - return; - } - break; - // CR22 default: cliShowParseError(); return; @@ -2519,18 +2501,9 @@ static void cliOsdLayout(char *cmdline) // No visibility provided. Keep the previous one. visible = OSD_VISIBLE(osdLayoutsConfig()->item_pos[layout][item]); FALLTHROUGH; - // CR22 case 5: - // No infocycle provided. Keep the previous one. - infocycle = OSD_INFOCYCLE(osdLayoutsConfig()->item_pos[layout][item]); - FALLTHROUGH; - case 6: - // Layout, item, pos, visibility and infocycle. Set the item. - if (item == OSD_INFO_CYCLE) { - infocycle = false; // always exclude Infocycle field, for obvious reasons - } - osdLayoutsConfigMutable()->item_pos[layout][item] = OSD_POS(col, row) | (visible ? OSD_VISIBLE_FLAG : 0) | (infocycle ? OSD_INFOCYCLE_FLAG : 0); - // CR22 + // Layout, item, pos and visibility. Set the item. + osdLayoutsConfigMutable()->item_pos[layout][item] = OSD_POS(col, row) | (visible ? OSD_VISIBLE_FLAG : 0); break; default: // Unhandled @@ -3344,8 +3317,8 @@ static void cliStatus(char *cmdline) #if defined(AT32F43x) cliPrintLine("AT32 system clocks:"); crm_clocks_freq_type clocks; - crm_clocks_freq_get(&clocks); - + crm_clocks_freq_get(&clocks); + cliPrintLinef(" SYSCLK = %d MHz", clocks.sclk_freq / 1000000); cliPrintLinef(" ABH = %d MHz", clocks.ahb_freq / 1000000); cliPrintLinef(" ABP1 = %d MHz", clocks.apb1_freq / 1000000); @@ -3993,7 +3966,7 @@ const clicmd_t cmdTable[] = { CLI_COMMAND_DEF("wp", "waypoint list", NULL, cliWaypoints), #endif #ifdef USE_OSD - CLI_COMMAND_DEF("osd_layout", "get or set the layout of OSD items", "[ [ [ [] []]]]", cliOsdLayout), // CR22 + CLI_COMMAND_DEF("osd_layout", "get or set the layout of OSD items", "[ [ [ []]]]", cliOsdLayout), #endif }; diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index 627e0624522..7090219764a 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -3473,14 +3473,6 @@ groups: min: -36 max: 36 - # CR22 - - name: osd_infocycle_interval_time - description: Info Cycle field item display time (milliseconds). - field: infocycle_interval_time - default_value: 2000 - min: 500 - max: 5000 - # CR22 - name: osd_pan_servo_offcentre_warning description: Degrees either side of the pan servo centre; where it is assumed camera is wanted to be facing forwards, but isn't at 0. If in this range and not 0 for longer than 10 seconds, the pan servo offset OSD element will blink. 0 means the warning is disabled. field: pan_servo_offcentre_warning diff --git a/src/main/io/osd.c b/src/main/io/osd.c index a59cd235835..057c9522511 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -188,7 +188,6 @@ static bool fullRedraw = false; static uint8_t armState; -static bool infocycleSuspended = false; // CR22 // Multifunction display CR88 static textAttributes_t osdGetMultiFunctionMessage(char *buff); static uint8_t osdWarningsFlags = 0; @@ -1659,90 +1658,15 @@ void osdDisplaySwitchIndicator(const char *swName, int rcValue, char *buff) { buff[ptr] = '\0'; } -// CR22 -bool hiddenInfocycleItem(uint8_t item) -{ - if (item == OSD_ARTIFICIAL_HORIZON) { - return true; - } - return false; -} -bool isItemSelectedForDisplay(uint8_t *elemPosX, uint8_t *elemPosY, uint8_t item) +static bool osdDrawSingleElement(uint8_t item) { - static uint8_t infocycleItemCounter; - if (item == 0) { - infocycleItemCounter = 0; - } - uint16_t pos = osdLayoutsConfig()->item_pos[currentLayout][item]; - if (!OSD_VISIBLE(pos)) { return false; } - // normal position of item if not active in Infocycle field - *elemPosX = OSD_X(pos); - *elemPosY = OSD_Y(pos); - - /* Infocycle routine to direct selected OSD items to Info Cycle field on OSD. - Items cycled in field unless BOXOSD mode selected for < 2s in which case items are displayed in normal positions - and Infocycle is suspended. Infocycle starts again by selecting BOXOSD again for < 2s. - BOXOSD switches off OSD if selected for > 2s*/ - - uint16_t infocyclePos = osdLayoutsConfig()->item_pos[currentLayout][OSD_INFO_CYCLE]; - - if (OSD_VISIBLE(infocyclePos)) { - static uint8_t infocycleNumItems; - static uint8_t infocycleLastLayout = 5; - - if (currentLayout != infocycleLastLayout) { - infocycleNumItems = 0; - for (uint8_t i = 0; i < OSD_ITEM_COUNT; i++) { - if (OSD_INFOCYCLE(osdLayoutsConfig()->item_pos[currentLayout][i])) { // count number infocycle items - infocycleNumItems += 1; - } - } - infocycleLastLayout = currentLayout; - infocycleSuspended = true; - } - - if (infocycleNumItems > 0 && !infocycleSuspended) { - static uint8_t infocyclePreviousItem; - - if (OSD_INFOCYCLE(pos)) { - infocycleItemCounter += 1; - if (infocycleItemCounter == OSD_ALTERNATING_CHOICES(osdConfig()->infocycle_interval_time, infocycleNumItems) + 1) { - if (hiddenInfocycleItem(item)) { - return false; - } - *elemPosX = OSD_X(infocyclePos); - *elemPosY = OSD_Y(infocyclePos); - if (infocyclePreviousItem != item) { // clear infocycle field before displaying new item - infocyclePreviousItem = item; - displayWrite(osdDisplayPort, *elemPosX, *elemPosY, " "); // 12 characters long - } - } else { - return false; - } - } - } - } - - return true; -} -// CR22 - -static bool osdDrawSingleElement(uint8_t item) -{ - // CR22 - uint8_t elemPosX; - uint8_t elemPosY; - - if (!isItemSelectedForDisplay(&elemPosX, &elemPosY, item)) { - return false; - } - // CR22 - + uint8_t elemPosX = OSD_X(pos); + uint8_t elemPosY = OSD_Y(pos); textAttributes_t elemAttr = TEXT_ATTRIBUTES_NONE; char buff[32] = {0}; @@ -3524,13 +3448,6 @@ static bool osdDrawSingleElement(uint8_t item) displayWrite(osdDisplayPort, elemPosX, elemPosY, buff); return true; } - // CR22 - case OSD_INFO_CYCLE: - { - // deliberately left blank - return true; - } - // CR22 // CR88 case OSD_MULTI_FUNCTION: { @@ -3783,7 +3700,6 @@ PG_RESET_TEMPLATE(osdConfig_t, osdConfig, .osd_home_position_arm_screen = SETTING_OSD_HOME_POSITION_ARM_SCREEN_DEFAULT, .pan_servo_index = SETTING_OSD_PAN_SERVO_INDEX_DEFAULT, .pan_servo_pwm2centideg = SETTING_OSD_PAN_SERVO_PWM2CENTIDEG_DEFAULT, - .infocycle_interval_time = SETTING_OSD_INFOCYCLE_INTERVAL_TIME_DEFAULT, // CR22 .pan_servo_offcentre_warning = SETTING_OSD_PAN_SERVO_OFFCENTRE_WARNING_DEFAULT, .pan_servo_indicator_show_degrees = SETTING_OSD_PAN_SERVO_INDICATOR_SHOW_DEGREES_DEFAULT, .esc_rpm_precision = SETTING_OSD_ESC_RPM_PRECISION_DEFAULT, @@ -3962,7 +3878,6 @@ void pgResetFn_osdLayoutsConfig(osdLayoutsConfig_t *osdLayoutsConfig) osdLayoutsConfig->item_pos[0][OSD_GVAR_2] = OSD_POS(1, 3); osdLayoutsConfig->item_pos[0][OSD_GVAR_3] = OSD_POS(1, 4); - osdLayoutsConfig->item_pos[0][OSD_INFO_CYCLE] = OSD_POS(1, 1); // CR22 osdLayoutsConfig->item_pos[0][OSD_MULTI_FUNCTION] = OSD_POS(1, 4); // CR88 osdLayoutsConfig->item_pos[0][OSD_SWITCH_INDICATOR_0] = OSD_POS(2, 7); @@ -4656,28 +4571,10 @@ static void osdRefresh(timeUs_t currentTimeUs) { osdFilterData(currentTimeUs); - // CR22 - bool boxOsdClearDisplay = false; - static timeMs_t boxOsdTimer = 0; - const uint16_t boxOsdTimeDelay_Ms = 1000; - - if (IS_RC_MODE_ACTIVE(BOXOSD)) { - if (boxOsdTimer == 0) { - boxOsdTimer = millis(); - } - boxOsdClearDisplay = millis() - boxOsdTimer > boxOsdTimeDelay_Ms; - } else { - if (millis() - boxOsdTimer < boxOsdTimeDelay_Ms) { - infocycleSuspended = !infocycleSuspended; - displayClearScreen(osdDisplayPort); - } - boxOsdTimer = 0; - } - // CR22 #ifdef USE_CMS - if (boxOsdClearDisplay && (!cmsInMenu) && !(osdConfig()->osd_failsafe_switch_layout && FLIGHT_MODE(FAILSAFE_MODE))) { // CR22 + if (IS_RC_MODE_ACTIVE(BOXOSD) && (!cmsInMenu) && !(osdConfig()->osd_failsafe_switch_layout && FLIGHT_MODE(FAILSAFE_MODE))) { #else - if (boxOsdClearDisplay && !(osdConfig()->osd_failsafe_switch_layout && FLIGHT_MODE(FAILSAFE_MODE))) { // CR22 + if (IS_RC_MODE_ACTIVE(BOXOSD) && !(osdConfig()->osd_failsafe_switch_layout && FLIGHT_MODE(FAILSAFE_MODE))) { #endif displayClearScreen(osdDisplayPort); armState = ARMING_FLAG(ARMED); diff --git a/src/main/io/osd.h b/src/main/io/osd.h index 4be46c879d6..3391d21a057 100644 --- a/src/main/io/osd.h +++ b/src/main/io/osd.h @@ -29,13 +29,11 @@ #endif #define OSD_LAYOUT_COUNT (OSD_ALTERNATE_LAYOUT_COUNT + 1) -// 0ivb yyyy yyxx xxxx CR22x -// (infocycle)(visible)(blink)(yCoord)(xCoord) CR22x +// 00vb yyyy yyxx xxxx +// (visible)(blink)(yCoord)(xCoord) #define OSD_VISIBLE_FLAG 0x2000 -#define OSD_INFOCYCLE_FLAG 0x4000 // CR22x changed for HD system bit changes 270222 #define OSD_VISIBLE(x) ((x) & OSD_VISIBLE_FLAG) -#define OSD_INFOCYCLE(x) ((x) & OSD_INFOCYCLE_FLAG) // CR22 #define OSD_POS(x,y) (((x) & 0x3F) | (((y) & 0x3F) << 6)) #define OSD_X(x) ((x) & 0x3F) @@ -274,7 +272,6 @@ typedef enum { OSD_PILOT_NAME, OSD_PAN_SERVO_CENTRED, OSD_MULTI_FUNCTION, // 144 CR88 - OSD_INFO_CYCLE, // 145 CR22 OSD_ITEM_COUNT // MUST BE LAST } osd_items_e; @@ -438,7 +435,6 @@ typedef struct osdConfig_s { uint8_t telemetry; // use telemetry on displayed pixel line 0 uint8_t esc_rpm_precision; // Number of characters used for the RPM numbers. uint16_t system_msg_display_time; // system message display time for multiple messages (ms) - uint16_t infocycle_interval_time; // Info Cycle field item display time interval (ms) CR22 uint8_t mAh_used_precision; // Number of numbers used for mAh drawn. Plently of packs now are > 9999 mAh uint8_t ahi_pitch_interval; // redraws AHI at set pitch interval (Not pixel OSD) char osd_switch_indicator0_name[OSD_SWITCH_INDICATOR_NAME_LENGTH + 1]; // Name to use for switch indicator 0. diff --git a/src/main/navigation/navigation.c b/src/main/navigation/navigation.c index 0620b36ba3d..5e8e4cdfd24 100644 --- a/src/main/navigation/navigation.c +++ b/src/main/navigation/navigation.c @@ -2809,7 +2809,7 @@ void setDesiredPosition(const fpVector3_t * pos, int32_t yaw, navSetWaypointFlag if ((useMask & NAV_POS_UPDATE_XY) != 0 && !STATE(NAV_CRUISE_BRAKING)) { posControl.desiredState.pos.x = pos->x; posControl.desiredState.pos.y = pos->y; - } + } // CR99 - add check if target changed significantly -> reset PIDS if so. Same for Altitude // Z-position if ((useMask & NAV_POS_UPDATE_Z) != 0) {