From 873847e42e6d4289c8cf93f89155ebf6eb596e36 Mon Sep 17 00:00:00 2001 From: "bernet.andre@gmail.com" Date: Tue, 19 Mar 2013 10:53:31 +0000 Subject: [PATCH] PXX scaling was done wrong --- src/pulses_arm.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/pulses_arm.cpp b/src/pulses_arm.cpp index 96be8670a..4d9fbb7af 100644 --- a/src/pulses_arm.cpp +++ b/src/pulses_arm.cpp @@ -327,15 +327,13 @@ void setupPulsesPXX() sendUpperChannels = g_model.ppmNCH*2; } for (uint32_t i=0; i<8; i+=2) { - int32_t out = channelOutputs[8+g_model.ppmSCH+i] * 512 / 682; - int32_t out_1 = channelOutputs[8+g_model.ppmSCH+i+1] * 512 / 682; if (i < sendUpperChannels) { - chan = limit(2048, (int16_t)out + 3072, 4095); - chan_1 = limit(2048, (int16_t)out_1 + 3072, 4095); + chan = limit(2048, (channelOutputs[8+g_model.ppmSCH+i] * 512 / 682) + 3072, 4095); + chan_1 = limit(2048, (channelOutputs[8+g_model.ppmSCH+i+1] * 512 / 682) + 3072, 4095); } else { - chan = limit(0, (int16_t)out + 1024, 2047); - chan_1 = limit(0, (int16_t)out_1 + 1024, 2047); + chan = limit(0, (channelOutputs[g_model.ppmSCH+i] * 512 / 682) + 1024, 2047); + chan_1 = limit(0, (channelOutputs[g_model.ppmSCH+i+1] * 512 / 682) + 1024, 2047); } putPcmByte(chan); // Low byte of channel putPcmByte( ( ( chan >> 8 ) & 0x0F ) | ( chan_1 << 4) ) ; // 4 bits each from 2 channels