diff --git a/Multiprotocol/AFHDS2A_Rx_a7105.ino b/Multiprotocol/AFHDS2A_Rx_a7105.ino index 1e1cf95..9ee15ba 100644 --- a/Multiprotocol/AFHDS2A_Rx_a7105.ino +++ b/Multiprotocol/AFHDS2A_Rx_a7105.ino @@ -45,10 +45,8 @@ static void __attribute__((unused)) AFHDS2A_Rx_build_telemetry_packet() uint32_t val = packet[9+i*2] | (packet[10+i*2] << 8); if (val < 860) val = 860; - else if (val > 2139) - val = 2139; // convert ppm (860-2140) to Multi (0-2047) - val = ((val-860)<<3)/5; + val = min(((val-860)<<3)/5, 2047); bits |= val << bitsavailable; bitsavailable += 11;