Skip to content

Commit

Permalink
Passthrough handset channels if headtracking switch is off
Browse files Browse the repository at this point in the history
  • Loading branch information
CapnBry committed Mar 27, 2024
1 parent 66998e1 commit 6ce1f3c
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/src/tx_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,24 +452,21 @@ void injectBackpackPanTiltRollData(uint32_t const now)
enable |= !chan;
}
}

if (enable != headTrackingEnabled)
{
headTrackingEnabled = enable;
HTEnableFlagReadyToSend = true;
}

// If enabled and this packet is less that 1 second old then use it
if (enable && now - lastPTRValidTimeMs < 1000)
{
ChannelData[ptrStartChannel + 4] = ptrChannelData[0];
ChannelData[ptrStartChannel + 5] = ptrChannelData[1];
ChannelData[ptrStartChannel + 6] = ptrChannelData[2];
}
else
{
ChannelData[ptrStartChannel + 4] = CRSF_CHANNEL_VALUE_MID;
ChannelData[ptrStartChannel + 5] = CRSF_CHANNEL_VALUE_MID;
ChannelData[ptrStartChannel + 6] = CRSF_CHANNEL_VALUE_MID;
}
// else if not enabled or PTR is old, do not override ChannelData from handset
#endif
}

Expand Down

0 comments on commit 6ce1f3c

Please sign in to comment.