Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 1158 → Rev 1159

/branches/thjac/V1_11/pitch_inc.c
10,13 → 10,12
#include "pitch.h"
 
#define STICK_FACTOR ((int16_t) 256)
//#define GAS_SCALE ((uint8_t) 4)
 
static int16_t stickValue = 0; // Aktueller Stick-Wert
static int16_t stickValue = INT16_MIN; // Aktueller Stick-Wert
 
int pitch_inc_value( void ) {
 
long rawStickValue = PPM_in[EE_Parameter.Kanalbelegung[K_GAS]];
int32_t rawStickValue = PPM_in[EE_Parameter.Kanalbelegung[K_GAS]];
 
DebugOut.Analog[25] = rawStickValue;
 
23,8 → 22,8
rawStickValue = ((rawStickValue * rawStickValue * rawStickValue) / (PARAM_INC_GAS_SCALE+1)) / (PARAM_INC_GAS_SCALE+1);
 
// Neuer Stick-Wert
if (rawStickValue < 0 && stickValue < -INT16_MAX - rawStickValue) // ToDo
stickValue = -INT16_MAX;
if (rawStickValue < 0 && stickValue < INT16_MIN - rawStickValue) // ToDo
stickValue = INT16_MIN;
else if (rawStickValue > 0 && stickValue > INT16_MAX - rawStickValue )
stickValue = INT16_MAX;
else if (rawStickValue != 0)
40,7 → 39,7
 
printf("\r\npitch_inc_init()");
 
stickValue = (int) MIN_GAS * STICK_FACTOR;
stickValue = INT16_MIN;
pitchValueFP = pitch_inc_value;
}