1,14 → 1,9 |
#include <inttypes.h> |
#include "analog.h" |
#include "attitude.h" |
#include "configuration.h" |
#include "controlMixer.h" |
// for digital / LED debug. |
#include "output.h" |
#include "definitions.h" |
#include "debug.h" |
|
// For scope debugging only! |
#include "rc.h" |
|
#define INTEGRAL_LIMIT 100000 |
|
#define LATCH_TIME 3 |
69,7 → 64,7 |
} |
} else { |
// Switch is not activated; take the "max-height" as the target height. |
setHeight = (uint16_t) (HEIGHT_FORMULA(dynamicParams.heightSetting)); // should be: 100 (or make a param out of it) |
setHeight = (uint16_t) (HEIGHT_FORMULA(dynamicParams.heightSetting)); |
} |
|
/* |
96,7 → 91,8 |
// uint8_t heightControlTestOscAmplitude; |
|
hc_testOscPrescaler++; |
if (hc_testOscPrescaler == 488) { |
|
if (hc_testOscPrescaler == 250) { |
hc_testOscPrescaler = 0; |
hc_testOscTimer++; |
if (hc_testOscTimer == staticParams.heightControlTestOscPeriod) { |
127,9 → 123,9 |
|
// takes 180-200 usec (with integral term). That is too heavy!!! |
// takes 100 usec without integral term. |
void HC_periodicTaskAndPRTY(int16_t* PRTY) { |
void HC_periodicTaskAndRPTY(int16_t* RPTY) { |
HC_periodicTask(); |
int16_t throttle = PRTY[CONTROL_THROTTLE]; |
int16_t throttle = RPTY[CONTROL_THROTTLE]; |
int32_t height = analog_getHeight(); |
int32_t heightError = targetHeight - height; |
int16_t dHeight = analog_getDHeight(); |
206,7 → 202,7 |
|
/* Experiment: Find hover-throttle */ |
|
#define DEFAULT_HOVERTHROTTLE 50 |
#define DEFAULT_HOVERTHROTTLE 200 |
int32_t stronglyFilteredHeightDiff = 0; |
// uint16_t hoverThrottle = 0; // DEFAULT_HOVERTHROTTLE; |
uint16_t stronglyFilteredThrottle = DEFAULT_HOVERTHROTTLE; |
227,7 → 223,7 |
|
*/ |
|
PRTY[CONTROL_THROTTLE] = throttle; |
RPTY[CONTROL_THROTTLE] = throttle; |
} |
|
/* |