Compare commits

..

No commits in common. "b4086ddea039ff1d87a1f95421e9e58e007ef00b" and "a7d3ceaffe37eb1b311101817d7ac45dd7453fb0" have entirely different histories.

View File

@ -353,7 +353,7 @@ uint16_t pid(int16_t delta, int16_t max_duty)
// PID coefficients
const fp16_t Kp = num2fp( 1, 1700, 4);
const fp16_t Ti = num2fp(10, 0000, 4);
const fp16_t Td = num2fp( 0, 1500, 4);
const fp16_t Td = num2fp( 0, 700, 4);
static fp16_t err_p, err_i, intgrt, err_d, dt, prev_err;
static u32 t, prev_t;
@ -361,9 +361,6 @@ uint16_t pid(int16_t delta, int16_t max_duty)
t = funSysTick32();
dt = fp_div(i2fp((t-prev_t)/DELAY_MS_TIME), i2fp(1000));
// if pid was paused, reset the integrator
if (dt > num2fp(0, 2, 1)) intgrt = 0;
fp16_t err = i2fp(delta); // temperature delta as fixed point number
err_p = err;
@ -463,8 +460,6 @@ static inline void setup(void)
__attribute__((noreturn)) int main(void)
{
setup();
u8g2_ClearBuffer(u8g2);
u8g2_SetFont(u8g2, u8g2_font_5x8_tr);
u8g2_DrawStr(u8g2, x_off+0, y_off+7, "Negotiating...");
@ -485,11 +480,11 @@ __attribute__((noreturn)) int main(void)
Delay_Ms(100);
}
} else {
pd_get_profile(&pd_profile, 100);
pd_get_profile(&pd_profile, 60);
// TODO: let the user decide the power profile
pd_profile.set_temp = 200;
pd_profile.set_power = 95; // Slightly below max power to avoid overloading
pd_profile.set_power = 60; // Slightly below max power to avoid overloading
pd_profile.tip_r = 2500; // TODO: tip check and resistance calculator
pd_profile.max_duty = MIN(
(100*(u32)isqrt((