Add slew rate to the PID output for MHP
This commit is contained in:
@@ -220,7 +220,7 @@
|
|||||||
#define MIN_BOOST_TEMP_C 150 // The min settable temp for boost mode °C
|
#define MIN_BOOST_TEMP_C 150 // The min settable temp for boost mode °C
|
||||||
#define MIN_BOOST_TEMP_F 300 // The min settable temp for boost mode °F
|
#define MIN_BOOST_TEMP_F 300 // The min settable temp for boost mode °F
|
||||||
#define NO_DISPLAY_ROTATE // Disable OLED rotation by accel
|
#define NO_DISPLAY_ROTATE // Disable OLED rotation by accel
|
||||||
|
#define SLEW_LIMIT 50 // Limit to 3.0 Watts per 64ms pid loop update rate slew rate
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MODEL_TS100
|
#ifdef MODEL_TS100
|
||||||
|
|||||||
@@ -34,6 +34,9 @@ void startPIDTask(void const *argument __unused) {
|
|||||||
// be over-ridden rapidly
|
// be over-ridden rapidly
|
||||||
pidTaskNotification = xTaskGetCurrentTaskHandle();
|
pidTaskNotification = xTaskGetCurrentTaskHandle();
|
||||||
uint32_t PIDTempTarget = 0;
|
uint32_t PIDTempTarget = 0;
|
||||||
|
#ifdef SLEW_LIMIT
|
||||||
|
int32_t x10WattsOutLast = 0;
|
||||||
|
#endif
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|
||||||
if (ulTaskNotifyTake(pdTRUE, 2000)) {
|
if (ulTaskNotifyTake(pdTRUE, 2000)) {
|
||||||
@@ -109,12 +112,21 @@ void startPIDTask(void const *argument __unused) {
|
|||||||
x10WattsOut = 0;
|
x10WattsOut = 0;
|
||||||
}
|
}
|
||||||
if (systemSettings.powerLimit && x10WattsOut > (systemSettings.powerLimit * 10)) {
|
if (systemSettings.powerLimit && x10WattsOut > (systemSettings.powerLimit * 10)) {
|
||||||
setTipX10Watts(systemSettings.powerLimit * 10);
|
x10WattsOut = systemSettings.powerLimit * 10;
|
||||||
} else if (powerSupplyWattageLimit && x10WattsOut > powerSupplyWattageLimit * 10) {
|
|
||||||
setTipX10Watts(powerSupplyWattageLimit * 10);
|
|
||||||
} else {
|
|
||||||
setTipX10Watts(x10WattsOut);
|
|
||||||
}
|
}
|
||||||
|
if (powerSupplyWattageLimit && x10WattsOut > powerSupplyWattageLimit * 10) {
|
||||||
|
x10WattsOut = powerSupplyWattageLimit * 10;
|
||||||
|
}
|
||||||
|
#ifdef SLEW_LIMIT
|
||||||
|
if (x10WattsOut - x10WattsOutLast > SLEW_LIMIT) {
|
||||||
|
x10WattsOut = x10WattsOutLast + SLEW_LIMIT;
|
||||||
|
}
|
||||||
|
if (x10WattsOut < 0) {
|
||||||
|
x10WattsOut = 0;
|
||||||
|
}
|
||||||
|
x10WattsOutLast = x10WattsOut;
|
||||||
|
#endif
|
||||||
|
setTipX10Watts(x10WattsOut);
|
||||||
#ifdef DEBUG_UART_OUTPUT
|
#ifdef DEBUG_UART_OUTPUT
|
||||||
log_system_state(x10WattsOut);
|
log_system_state(x10WattsOut);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user