Skip to content

Commit

Permalink
AP_Mount: Xacti digital zoom percentage fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rmackay9 committed Oct 3, 2023
1 parent 6690b19 commit 8999790
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libraries/AP_Mount/AP_Mount_Xacti.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ bool AP_Mount_Xacti::set_zoom(ZoomType zoom_type, float zoom_value)
}
// digital only zoom
// convert zoom percentage (0 ~ 100) to zoom parameter value (100, 200, 300, ... 1000)
// 0~9pct:100, 10~19pct:200, ... 90~100pct:1000
uint16_t zoom_param_value = constrain_uint16(uint16_t(zoom_value * 0.1) * 10, 100, 1000);
// 0~11pct:100, 12~22pct:200, 23~33pct:300, 34~44pct:400, 45~55pct:500, 56~66pct:600, 67~77pct:700, 78~88pct:800, 89~99pct:900, 100:1000
const uint16_t zoom_param_value = uint16_t(linear_interpolate(1, 10, zoom_value, 0, 100)) * 100;
return set_param_int32(Param::DigitalZoomMagnification, zoom_param_value);
}

Expand Down

0 comments on commit 8999790

Please sign in to comment.