1
0
forked from me/IronOS

Refactor PinecilV2 Tuning

Closes #1688
This commit is contained in:
Ben V. Brown
2023-06-04 12:13:26 +10:00
parent 286afad919
commit e7bcf920ba
7 changed files with 24 additions and 13 deletions

View File

@@ -20,6 +20,8 @@ void power_check();
uint8_t getTipResistanceX10(); uint8_t getTipResistanceX10();
uint8_t getTipThermalMass(); uint8_t getTipThermalMass();
uint8_t getTipInertia();
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -472,3 +472,4 @@ uint64_t getDeviceID() {
uint8_t preStartChecksDone() { return 1; } uint8_t preStartChecksDone() { return 1; }
uint8_t getTipThermalMass() { return TIP_THERMAL_MASS; } uint8_t getTipThermalMass() { return TIP_THERMAL_MASS; }
uint8_t getTipInertia() { return TIP_THERMAL_MASS; }

View File

@@ -258,3 +258,5 @@ uint8_t getTipResistanceX10() { return TIP_RESISTANCE; }
uint8_t preStartChecksDone() { return 1; } uint8_t preStartChecksDone() { return 1; }
uint8_t getTipThermalMass() { return TIP_THERMAL_MASS; } uint8_t getTipThermalMass() { return TIP_THERMAL_MASS; }
uint8_t getTipInertia() { return TIP_THERMAL_MASS; }

View File

@@ -97,3 +97,4 @@ uint8_t getTipResistanceX10() { return TIP_RESISTANCE; }
uint8_t preStartChecksDone() { return 1; } uint8_t preStartChecksDone() { return 1; }
uint8_t getTipThermalMass() { return TIP_THERMAL_MASS; } uint8_t getTipThermalMass() { return TIP_THERMAL_MASS; }
uint8_t getTipInertia() { return TIP_THERMAL_MASS; }

View File

@@ -21,7 +21,7 @@ const uint8_t tempMeasureTicks = 25;
uint16_t totalPWM = 255; // Total length of the cycle's ticks uint16_t totalPWM = 255; // Total length of the cycle's ticks
void resetWatchdog() { void resetWatchdog() {
//#TODO // #TODO
} }
#ifdef TEMP_NTC #ifdef TEMP_NTC
@@ -125,9 +125,7 @@ uint8_t getButtonB() {
return val; return val;
} }
void reboot() { void reboot() { hal_system_reset(); }
hal_system_reset();
}
void delay_ms(uint16_t count) { void delay_ms(uint16_t count) {
// delay_1ms(count); // delay_1ms(count);
@@ -164,7 +162,13 @@ uint8_t getTipThermalMass() {
if (lastTipResistance >= 80) { if (lastTipResistance >= 80) {
return TIP_THERMAL_MASS; return TIP_THERMAL_MASS;
} }
return (TIP_THERMAL_MASS * 25) / 10; return 45;
}
uint8_t getTipInertia() {
if (lastTipResistance >= 80) {
return TIP_THERMAL_MASS;
}
return 10;
} }
// We want to calculate lastTipResistance // We want to calculate lastTipResistance
// If tip is connected, and the tip is cold and the tip is not being heated // If tip is connected, and the tip is cold and the tip is not being heated

View File

@@ -233,6 +233,7 @@ uint8_t getTipResistanceX10() { return TIP_RESISTANCE; }
uint8_t preStartChecksDone() { return 1; } uint8_t preStartChecksDone() { return 1; }
uint8_t getTipThermalMass() { return TIP_THERMAL_INERTIA; } uint8_t getTipThermalMass() { return TIP_THERMAL_MASS; }
uint8_t getTipInertia() { return TIP_THERMAL_INERTIA; }
void setBuzzer(bool on) {} void setBuzzer(bool on) {}

View File

@@ -142,10 +142,10 @@ int32_t getPIDResultX10Watts(int32_t setpointDelta) {
// power CMOS is controlled by TIM3->CTR1 (that is software modulated - on/off - by TIM2-CTR4 interrupts). However, // power CMOS is controlled by TIM3->CTR1 (that is software modulated - on/off - by TIM2-CTR4 interrupts). However,
// TIM3->CTR1 is configured with a duty cycle of 50% so, in real, we get only 50% of the presumed power output // TIM3->CTR1 is configured with a duty cycle of 50% so, in real, we get only 50% of the presumed power output
// so we basically double the need (gain = 2) to get what we want. // so we basically double the need (gain = 2) to get what we want.
return powerStore.update(TIP_THERMAL_MASS * setpointDelta, // the required power return powerStore.update(getTipThermalMass() * setpointDelta, // the required power
getTipThermalMass(), // Inertia, smaller numbers increase dominance of the previous value getTipInertia(), // Inertia, smaller numbers increase dominance of the previous value
2, // gain 2, // gain
rate, // PID cycle frequency rate, // PID cycle frequency
getX10WattageLimits()); getX10WattageLimits());
} }