66,7 → 66,7 |
|
if (staticParams.GlobalConfig & CFG_HEIGHT_SWITCH) { |
// If switch is activated in config, the MaxHeight parameter is a switch value: ON in both ends of the range; OFF in the middle. |
DebugOut.Digital[0] |= DEBUG_HEIGHT_SWITCH; |
// DebugOut.Digital[0] |= DEBUG_HEIGHT_SWITCH; |
if (dynamicParams.MaxHeight < 40 || dynamicParams.MaxHeight > 255 - 40) { |
// Switch is ON |
if (setHeightLatch <= LATCH_TIME) { |
73,7 → 73,7 |
if (setHeightLatch == LATCH_TIME) { |
// Freeze the height as target. We want to do this exactly once each time the switch is thrown ON. |
targetHeight = height; |
DebugOut.Digital[1] |= DEBUG_HEIGHT_SWITCH; |
// DebugOut.Digital[1] |= DEBUG_HEIGHT_SWITCH; |
} |
// Time not yet reached. |
setHeightLatch++; |
81,11 → 81,11 |
} else { |
// Switch is OFF. |
setHeightLatch = 0; |
DebugOut.Digital[1] &= ~DEBUG_HEIGHT_SWITCH; |
// DebugOut.Digital[1] &= ~DEBUG_HEIGHT_SWITCH; |
} |
} else { |
// Switch is not activated; take the "max-height" as the target height. |
DebugOut.Digital[0] &= ~DEBUG_HEIGHT_SWITCH; |
// DebugOut.Digital[0] &= ~DEBUG_HEIGHT_SWITCH; |
targetHeight = (uint16_t) dynamicParams.MaxHeight * 100; //getHeight() + 10 * 100; |
} |
|
99,7 → 99,7 |
} |
|
// height, in meters (so the division factor is: 100) |
DebugOut.Analog[30] = height / 100; |
DebugOut.Analog[30] = height / 10; |
} |
|
// ParamSet.GlobalConfig & CFG_HEIGHT_CONTROL |
148,10 → 148,7 |
else if (dThrottle < -staticParams.HeightMinGas) |
dThrottle = -staticParams.HeightMinGas; |
|
//DebugOut.Analog[18] = dThrottle; |
//DebugOut.Analog[19] = iHeight / 10000L; |
|
// TODO: Eliminate repitition. |
// TODO: Eliminate repetition. |
if (staticParams.GlobalConfig & CFG_HEIGHT_CONTROL) { |
if (!(staticParams.GlobalConfig & CFG_HEIGHT_SWITCH) |
|| (dynamicParams.MaxHeight < 40 || dynamicParams.MaxHeight > 255 - 40)) { |
174,6 → 171,10 |
// DebugOut.Analog[18] = hoverThrottle; |
} else |
DebugOut.Digital[0] &= ~DEBUG_HOVERTHROTTLE; |
|
DebugOut.Analog[20] = dThrottle; |
DebugOut.Analog[21] = hoverThrottle; |
|
return throttle; |
} |
|