Skip to content

Commit

Permalink
fix(AFHDS3): Incorrect channel scaling (#3449)
Browse files Browse the repository at this point in the history
* Fixed IRM301/FRM303 channels scaling problem.

* Add back the remarks for calculation.
  • Loading branch information
richardclli authored Apr 8, 2023
1 parent 2ce94e3 commit f01b0f2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion radio/src/pulses/afhds3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,15 @@ void ProtoState::applyConfigFromModel()

inline int16_t ProtoState::convert(int channelValue)
{
return ::limit<int16_t>(AFHDS3_FAILSAFE_MIN, channelValue * 14.65, AFHDS3_FAILSAFE_MAX);
//pulseValue = limit<uint16_t>(0, 988 + ((channelValue + 1024) / 2), 0xfff);
//988 - 750 = 238
//238 * 20 = 4760
//2250 - 2012 = 238
//238 * 20 = 4760
// 988 ---- 2012
//-10240 ---- 10240
//-1024 ---- 1024
return ::limit<int16_t>(AFHDS3_FAILSAFE_MIN, channelValue * 10, AFHDS3_FAILSAFE_MAX);
}

uint8_t ProtoState::setFailSafe(int16_t* target, uint8_t rfchannelsCount )
Expand Down

0 comments on commit f01b0f2

Please sign in to comment.