1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-25 01:05:27 +03:00

Add optional high framerate OSD

This commit is contained in:
Alexey Stankevich 2020-10-04 14:09:16 +03:00
parent f793c1b000
commit 03e878306b
3 changed files with 23 additions and 0 deletions

View file

@ -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_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_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_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_high_framerate", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_OSD_CONFIG, offsetof(osdConfig_t, high_framerate) },
#endif // end of #ifdef USE_OSD #endif // end of #ifdef USE_OSD
// PG_SYSTEM_CONFIG // PG_SYSTEM_CONFIG

View file

@ -56,6 +56,7 @@
#include "drivers/display.h" #include "drivers/display.h"
#include "drivers/dshot.h" #include "drivers/dshot.h"
#include "drivers/flash.h" #include "drivers/flash.h"
#include "drivers/osd.h"
#include "drivers/osd_symbols.h" #include "drivers/osd_symbols.h"
#include "drivers/sdcard.h" #include "drivers/sdcard.h"
#include "drivers/time.h" #include "drivers/time.h"
@ -63,6 +64,7 @@
#include "fc/rc_controls.h" #include "fc/rc_controls.h"
#include "fc/rc_modes.h" #include "fc/rc_modes.h"
#include "fc/runtime_config.h" #include "fc/runtime_config.h"
#include "fc/tasks.h"
#if defined(USE_GYRO_DATA_ANALYSE) #if defined(USE_GYRO_DATA_ANALYSE)
#include "flight/gyroanalyse.h" #include "flight/gyroanalyse.h"
@ -83,6 +85,7 @@
#include "pg/pg.h" #include "pg/pg.h"
#include "pg/pg_ids.h" #include "pg/pg_ids.h"
#include "pg/stats.h" #include "pg/stats.h"
#include "pg/vcd.h"
#include "rx/crsf.h" #include "rx/crsf.h"
#include "rx/rx.h" #include "rx/rx.h"
@ -339,6 +342,8 @@ void pgResetFn_osdConfig(osdConfig_t *osdConfig)
osdConfig->camera_frame_width = 24; osdConfig->camera_frame_width = 24;
osdConfig->camera_frame_height = 11; osdConfig->camera_frame_height = 11;
osdConfig->high_framerate = 0;
} }
void pgResetFn_osdElementConfig(osdElementConfig_t *osdElementConfig) void pgResetFn_osdElementConfig(osdElementConfig_t *osdElementConfig)
@ -413,6 +418,22 @@ static void osdCompleteInitialization(void)
osdAnalyzeActiveElements(); osdAnalyzeActiveElements();
displayCommitTransaction(osdDisplayPort); displayCommitTransaction(osdDisplayPort);
#if defined(USE_MAX7456) || defined(USE_FRSKYOSD)
task_t *taskOsd;
taskOsd = getTask(TASK_OSD);
if (osdConfig()->high_framerate) {
switch (vcdProfile()->video_system) {
case VIDEO_SYSTEM_PAL:
taskOsd->desiredPeriodUs = TASK_PERIOD_HZ(125);
break;
case VIDEO_SYSTEM_NTSC:
default:
taskOsd->desiredPeriodUs = TASK_PERIOD_HZ(150);
break;
}
}
#endif
osdIsReady = true; osdIsReady = true;
} }

View file

@ -284,6 +284,7 @@ typedef struct osdConfig_s {
uint8_t logo_on_arming_duration; // display duration in 0.1s units 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_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 uint8_t camera_frame_height; // The height of the box for the camera frame element
uint8_t high_framerate;
} osdConfig_t; } osdConfig_t;
PG_DECLARE(osdConfig_t, osdConfig); PG_DECLARE(osdConfig_t, osdConfig);