Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSD sidebar height option #6896

Merged
merged 3 commits into from
May 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/Settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@
| osd_right_sidebar_scroll_step | 0 | | 255 | Same as left_sidebar_scroll_step, but for the right sidebar |
| osd_row_shiftdown | 0 | 0 | 1 | Number of rows to shift the OSD display (increase if top rows are cut off) |
| osd_rssi_alarm | 20 | 0 | 100 | Value below which to make the OSD RSSI indicator blink |
| osd_sidebar_height | 3 | 0 | 5 | Height of sidebars in rows. 0 leaves only the level indicator arrows (Not for pixel OSD) |
| osd_sidebar_horizontal_offset | 0 | -128 | 127 | Sidebar horizontal offset from default position. Positive values move the sidebars closer to the edges. |
| osd_sidebar_scroll_arrows | OFF | | | |
| osd_snr_alarm | 4 | -20 | 10 | Value below which Crossfire SNR Alarm pops-up. (dB) |
Expand Down
9 changes: 8 additions & 1 deletion src/main/fc/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ tables:
enum: navRTHAllowLanding_e
- name: bat_capacity_unit
values: ["MAH", "MWH"]
enum: batCapacityUnit_e
enum: batCapacityUnit_e
- name: bat_voltage_source
values: ["RAW", "SAG_COMP"]
enum: batVoltageSource_e
Expand Down Expand Up @@ -3304,6 +3304,13 @@ groups:
default_value: 0
description: Same as left_sidebar_scroll_step, but for the right sidebar

- name: osd_sidebar_height
field: sidebar_height
min: 0
max: 5
default_value: 3
description: Height of sidebars in rows. 0 leaves only the level indicator arrows (Not for pixel OSD)

- name: osd_home_position_arm_screen
type: bool
default_value: ON
Expand Down
3 changes: 2 additions & 1 deletion src/main/io/osd.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ static bool osdDisplayHasCanvas;

#define AH_MAX_PITCH_DEFAULT 20 // Specify default maximum AHI pitch value displayed (degrees)

PG_REGISTER_WITH_RESET_TEMPLATE(osdConfig_t, osdConfig, PG_OSD_CONFIG, 0);
PG_REGISTER_WITH_RESET_TEMPLATE(osdConfig_t, osdConfig, PG_OSD_CONFIG, 1);
PG_REGISTER_WITH_RESET_FN(osdLayoutsConfig_t, osdLayoutsConfig, PG_OSD_LAYOUTS_CONFIG, 0);

static int digitCount(int32_t value)
Expand Down Expand Up @@ -2811,6 +2811,7 @@ PG_RESET_TEMPLATE(osdConfig_t, osdConfig,
.sidebar_horizontal_offset = SETTING_OSD_SIDEBAR_HORIZONTAL_OFFSET_DEFAULT,
.left_sidebar_scroll_step = SETTING_OSD_LEFT_SIDEBAR_SCROLL_STEP_DEFAULT,
.right_sidebar_scroll_step = SETTING_OSD_RIGHT_SIDEBAR_SCROLL_STEP_DEFAULT,
.sidebar_height = SETTING_OSD_SIDEBAR_HEIGHT_DEFAULT,
.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,
Expand Down
3 changes: 2 additions & 1 deletion src/main/io/osd.h
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,8 @@ typedef struct osdConfig_s {
uint8_t pan_servo_index; // Index of the pan servo used for home direction offset
int8_t pan_servo_pwm2centideg; // Centidegrees of servo rotation per us pwm
uint8_t crsf_lq_format;
uint8_t telemetry; // use telemetry on displayed pixel line 0
uint8_t sidebar_height; // sidebar height in rows, 0 turns off sidebars leaving only level indicator arrows
uint8_t telemetry; // use telemetry on displayed pixel line 0

} osdConfig_t;

Expand Down
11 changes: 6 additions & 5 deletions src/main/io/osd_grid.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ void osdGridDrawSidebars(displayPort_t *display)
uint8_t rightDecoration = osdUpdateSidebar(osdConfig()->right_sidebar_scroll, &right, currentTimeMs);

const int hudwidth = OSD_AH_SIDEBAR_WIDTH_POS;
const int hudheight = OSD_AH_SIDEBAR_HEIGHT_POS;
const int hudheight = osdConfig()->sidebar_height;

// Arrows
if (osdConfig()->sidebar_scroll_arrows) {
Expand All @@ -315,11 +315,12 @@ void osdGridDrawSidebars(displayPort_t *display)
// Draw AH sides
int leftX = MAX(elemPosX - hudwidth - osdConfig()->sidebar_horizontal_offset, 0);
int rightX = MIN(elemPosX + hudwidth + osdConfig()->sidebar_horizontal_offset, display->cols - 1);
for (int y = -hudheight; y <= hudheight; y++) {
displayWriteChar(display, leftX, elemPosY + y, leftDecoration);
displayWriteChar(display, rightX, elemPosY + y, rightDecoration);
if (osdConfig()->sidebar_height) {
for (int y = -hudheight; y <= hudheight; y++) {
displayWriteChar(display, leftX, elemPosY + y, leftDecoration);
displayWriteChar(display, rightX, elemPosY + y, rightDecoration);
}
}

// AH level indicators
displayWriteChar(display, leftX + 1, elemPosY, SYM_AH_RIGHT);
displayWriteChar(display, rightX - 1, elemPosY, SYM_AH_LEFT);
Expand Down