ADC Timing alignment bought in
This commit is contained in:
@@ -842,16 +842,14 @@ void startPIDTask(void const *argument) {
|
||||
*/
|
||||
int32_t integralCount = 0;
|
||||
int32_t derivativeLastValue = 0;
|
||||
int32_t kp, ki, kd, kb;
|
||||
int32_t backoffOverflow = 0;
|
||||
kp = 20;
|
||||
ki = 50;
|
||||
kd = 40;
|
||||
kb = 0;
|
||||
int32_t kp, ki, kd;
|
||||
kp = 80;
|
||||
ki = 120;
|
||||
kd = 60;
|
||||
// REMEBER ^^^^ These constants are backwards
|
||||
// They act as dividers, so to 'increase' a P term, you make the number
|
||||
// smaller.
|
||||
const int32_t itermMax = 40;
|
||||
const int32_t itermMax = 60;
|
||||
for (;;) {
|
||||
uint16_t rawTemp = getTipRawTemp(1); // get instantaneous reading
|
||||
if (currentlyActiveTemperatureTarget) {
|
||||
@@ -876,34 +874,27 @@ void startPIDTask(void const *argument) {
|
||||
output += integralCount;
|
||||
if (kd)
|
||||
output -= (dInput / kd);
|
||||
if (kb)
|
||||
output -= backoffOverflow / kb;
|
||||
|
||||
if (output > 100) {
|
||||
backoffOverflow = output;
|
||||
output = 100; // saturate
|
||||
} else if (output < 0) {
|
||||
backoffOverflow = output;
|
||||
output = 0;
|
||||
} else
|
||||
backoffOverflow = 0;
|
||||
if (currentlyActiveTemperatureTarget < rawTemp) {
|
||||
output = 0;
|
||||
integralCount = 0;
|
||||
backoffOverflow = 0;
|
||||
derivativeLastValue = 0;
|
||||
}
|
||||
|
||||
/*if (currentlyActiveTemperatureTarget < rawTemp) {
|
||||
output = 0;
|
||||
}*/
|
||||
setTipPWM(output);
|
||||
derivativeLastValue = rawTemp; // store for next loop
|
||||
|
||||
} else {
|
||||
setTipPWM(0); // disable the output driver if the output is set to be off
|
||||
// elsewhere
|
||||
integralCount = 0;
|
||||
backoffOverflow = 0;
|
||||
derivativeLastValue = 0;
|
||||
}
|
||||
derivativeLastValue = rawTemp; // store for next loop
|
||||
|
||||
HAL_IWDG_Refresh(&hiwdg);
|
||||
osDelay(100); // 10 Hz temp loop
|
||||
osDelay(10); // 100 Hz temp loop
|
||||
}
|
||||
}
|
||||
#define MOVFilter 8
|
||||
@@ -1001,11 +992,10 @@ void startRotationTask(void const *argument) {
|
||||
* This task is used to manage rotation of the LCD screen & button re-mapping
|
||||
*
|
||||
*/
|
||||
if(PCBVersion==3)
|
||||
{
|
||||
for(;;)
|
||||
osDelay(5000);
|
||||
}
|
||||
if (PCBVersion == 3) {
|
||||
for (;;)
|
||||
osDelay(5000);
|
||||
}
|
||||
switch (systemSettings.OrientationMode) {
|
||||
case 0:
|
||||
lcd.setRotation(false);
|
||||
@@ -1024,7 +1014,7 @@ void startRotationTask(void const *argument) {
|
||||
for (;;) {
|
||||
|
||||
// a rotation event has occurred
|
||||
uint8_t rotation;
|
||||
uint8_t rotation = 0;
|
||||
if (PCBVersion == 2) {
|
||||
rotation = accel2.getOrientation();
|
||||
} else if (PCBVersion == 1) {
|
||||
|
||||
Reference in New Issue
Block a user