1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-21 07:15:18 +03:00

Rccommand scaled to FPV cam (cli command: rc_fpv_cam_correct_degrees)

This commit is contained in:
borisbstyle 2016-01-10 20:51:58 +01:00
parent bd39f07c1f
commit a42aed332b
4 changed files with 16 additions and 1 deletions

View file

@ -207,6 +207,13 @@ void filterRc(void){
}
}
void scaleRcCommandToFpvCamAngle(void) {
int16_t roll = rcCommand[ROLL];
int16_t yaw = rcCommand[YAW];
rcCommand[ROLL] = constrain(cos(masterConfig.rxConfig.fpvCamAngleDegrees) * roll + sin(masterConfig.rxConfig.fpvCamAngleDegrees) * yaw, -500, 500);
rcCommand[YAW] = constrain(cos(masterConfig.rxConfig.fpvCamAngleDegrees) * yaw + sin(masterConfig.rxConfig.fpvCamAngleDegrees) * roll, -500, 500);
}
void annexCode(void)
{
int32_t tmp, tmp2;
@ -285,6 +292,11 @@ void annexCode(void)
filterRc();
}
// experimental scaling of RC command to FPV cam angle
if (masterConfig.rxConfig.fpvCamAngleDegrees && !FLIGHT_MODE(HEADFREE_MODE)) {
scaleRcCommandToFpvCamAngle();
}
if (ARMING_FLAG(ARMED)) {
LED0_ON;
} else {