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

[Feature] Two different modes of OSD working simultaneously #29129

Open
lida2003 opened this issue Jan 23, 2025 · 4 comments
Open

[Feature] Two different modes of OSD working simultaneously #29129

lida2003 opened this issue Jan 23, 2025 · 4 comments

Comments

@lida2003
Copy link
Contributor

lida2003 commented Jan 23, 2025

Feature request

Two different modes of OSD working simultaneously

Details: https://discuss.ardupilot.org/t/is-it-possible-for-two-osd-resolution-working-at-the-same-time/125505

Platform
[ ] All
[ ] AntennaTracker
[x] Copter
[ ] Plane
[ ] Rover
[ ] Submarine

Additional context
Copter 4.5.6 Analog+ MSP Display port

25/1/23 17:35:56 : ChibiOS: 6a85082c
25/1/23 17:35:56 : ArduCopter V4.5.6 (b867abc8)
25/1/23 17:35:56 : Frame: QUAD/X_REV
25/1/23 17:35:56 : RCOut: DS600:1-4 PWM:5-13
25/1/23 17:35:56 : Aocoda-RC-H743Dual 00290029 30315119 
@lida2003
Copy link
Contributor Author

lida2003 commented Jan 24, 2025

How about add an OSD_CONCURRENTLY = 3 below for anlog+msp display port as guide says: https://ardupilot.org/copter/docs/common-osd-overview.html#osd or what I want in discussion: https://discuss.ardupilot.org/t/is-it-possible-for-two-osd-resolution-working-at-the-same-time/125505

Hope someone familiar with the code can give some tips and join the discussion here.

enum switch_method {
TOGGLE=0,
PWM_RANGE=1,
AUTO_SWITCH=2,

Add code when following conditions are met:

  • switch_method = OSD_CONCURRENTLY
  • OSD screen is enabled
  • OSD_TYPEx is porperly set

switch (sw_method) {
//switch to next screen if channel value was changed
default:
case TOGGLE:
if (previous_channel_value == 0) {
//do not switch to the next screen just after initialization
previous_channel_value = channel_value;
}
if (abs(channel_value-previous_channel_value) > 200) {
if (switch_debouncer) {
next_screen();
previous_channel_value = channel_value;
} else {
switch_debouncer = true;
return;
}
}
break;
//select screen based on pwm ranges specified
case PWM_RANGE:
for (int i=0; i<AP_OSD_NUM_SCREENS; i++) {
if (get_screen(i).enabled && get_screen(i).channel_min <= channel_value && get_screen(i).channel_max > channel_value) {
if (previous_pwm_screen == i) {
break;
} else {
current_screen = previous_pwm_screen = i;
}
}
}
break;
//switch to next screen after low to high transition and every 1s while channel value is high
case AUTO_SWITCH:
if (channel_value > channel->get_radio_trim()) {
if (switch_debouncer) {
uint32_t now = AP_HAL::millis();
if (now - last_switch_ms > 1000) {
next_screen();
last_switch_ms = now;
}
} else {
switch_debouncer = true;
return;
}
} else {
last_switch_ms = 0;
}
break;
}
switch_debouncer = false;
#endif // AP_RC_CHANNEL_ENABLED
}

@lida2003
Copy link
Contributor Author

I also find an issue when OSD init:

  • init procedure asked if it's compatible
  • MSP Display responses with false
  • then the init_backend returns, there will be NO probe
  • finally, _backend_count will not be increased in AP_OSD::init

I'm NOT sure if it works this way?

bool AP_OSD::init_backend(const AP_OSD::osd_types type, const uint8_t instance)
{
// check if we can run this backend instance in parallel with backend instance 0
if (instance > 0) {
if (_backends[0] && !_backends[0]->is_compatible_with_backend_type(type)) {
return false;
}
}

bool is_compatible_with_backend_type(AP_OSD::osd_types type) const override {
switch(type) {
case AP_OSD::osd_types::OSD_MSP:
case AP_OSD::osd_types::OSD_MSP_DISPLAYPORT:
return false;

@lida2003
Copy link
Contributor Author

lida2003 commented Jan 27, 2025

I think I may understand OSD not correctly.

Here is the case:

  • I have analog Camera with: OSD_TYPE=1, OSD screen 1 (30x16)
  • Another OpenIPC digital Camera with: OSD_TYPE2=5, OSD screen 2(50x18)

Now the issue is all OSD uses OSD screen 1(30x16). Right now, it's working simultaneously, but OSD layout is not what I expected.

The code seems to run only one OSD screen, and it can't be used for two OSD screen simultaneouosly.

@lida2003
Copy link
Contributor Author

lida2003 commented Jan 27, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant