diff --git a/src/main/cli/settings.c b/src/main/cli/settings.c index 0092f6d2f..fe833fab4 100644 --- a/src/main/cli/settings.c +++ b/src/main/cli/settings.c @@ -1426,6 +1426,7 @@ const clivalue_t valueTable[] = { { "osd_rcchannels", VAR_INT8 | MASTER_VALUE | MODE_ARRAY, .config.array.length = OSD_RCCHANNELS_COUNT, PG_OSD_CONFIG, offsetof(osdConfig_t, rcChannels) }, { "osd_camera_frame_width", VAR_UINT8 | MASTER_VALUE, .config.minmaxUnsigned = { OSD_CAMERA_FRAME_MIN_WIDTH, OSD_CAMERA_FRAME_MAX_WIDTH }, PG_OSD_CONFIG, offsetof(osdConfig_t, camera_frame_width) }, { "osd_camera_frame_height", VAR_UINT8 | MASTER_VALUE, .config.minmaxUnsigned = { OSD_CAMERA_FRAME_MIN_HEIGHT, OSD_CAMERA_FRAME_MAX_HEIGHT }, PG_OSD_CONFIG, offsetof(osdConfig_t, camera_frame_height) }, + { "osd_task_frequency", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { OSD_TASK_FREQUENCY_MIN, OSD_TASK_FREQUENCY_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, task_frequency) }, #endif // end of #ifdef USE_OSD // PG_SYSTEM_CONFIG diff --git a/src/main/fc/tasks.c b/src/main/fc/tasks.c index d9b92b25d..6794d236d 100644 --- a/src/main/fc/tasks.c +++ b/src/main/fc/tasks.c @@ -335,6 +335,7 @@ void tasksInit(void) #endif #ifdef USE_OSD + rescheduleTask(TASK_OSD, TASK_PERIOD_HZ(osdConfig()->task_frequency)); setTaskEnabled(TASK_OSD, featureIsEnabled(FEATURE_OSD) && osdGetDisplayPort(NULL)); #endif diff --git a/src/main/osd/osd.c b/src/main/osd/osd.c index cfb09f0d0..2a1eb5289 100644 --- a/src/main/osd/osd.c +++ b/src/main/osd/osd.c @@ -339,6 +339,8 @@ void pgResetFn_osdConfig(osdConfig_t *osdConfig) osdConfig->camera_frame_width = 24; osdConfig->camera_frame_height = 11; + + osdConfig->task_frequency = 60; } void pgResetFn_osdElementConfig(osdElementConfig_t *osdElementConfig) diff --git a/src/main/osd/osd.h b/src/main/osd/osd.h index ed3b6c3c4..303e28dfc 100644 --- a/src/main/osd/osd.h +++ b/src/main/osd/osd.h @@ -49,6 +49,9 @@ extern const char * const osdTimerSourceNames[OSD_NUM_TIMER_TYPES]; #define OSD_CAMERA_FRAME_MIN_HEIGHT 2 #define OSD_CAMERA_FRAME_MAX_HEIGHT 16 // Rows supported by MAX7456 (PAL) +#define OSD_TASK_FREQUENCY_MIN 30 +#define OSD_TASK_FREQUENCY_MAX 300 + #define OSD_PROFILE_BITS_POS 11 #define OSD_PROFILE_MASK (((1 << OSD_PROFILE_COUNT) - 1) << OSD_PROFILE_BITS_POS) #define OSD_POS_MAX 0x3FF @@ -284,6 +287,7 @@ typedef struct osdConfig_s { uint8_t logo_on_arming_duration; // display duration in 0.1s units uint8_t camera_frame_width; // The width of the box for the camera frame element uint8_t camera_frame_height; // The height of the box for the camera frame element + uint16_t task_frequency; } osdConfig_t; PG_DECLARE(osdConfig_t, osdConfig);