void start_autotune() { power = 127; auto_tune.SetControlType(1); auto_tune.SetNoiseBand(config.noise_band); auto_tune.SetOutputStep(127); auto_tune.SetLookbackSec((int)(config.lookback_min * 60)); Serial.println("Starting Autotune"); tuning = true; }
void setup() { pinMode(MOSFET_PIN, OUTPUT); pinMode(HEAT_ON_LED_PIN, OUTPUT); pid.SetOutputLimits(-PID_OUTPUT_RANGE, PID_OUTPUT_RANGE); pid_autotune.SetOutputStep(PID_OUTPUT_RANGE); pid_autotune.SetControlType(1); // PID control type. EEPROM.begin(EEPROM_TOTAL_BYTES); byte* p = (byte*)(void*)&settings; for (unsigned int i = 0; i < sizeof(settings); i++) { *p++ = EEPROM.read(EEPROM_SETTINGS_LOCATION + i); } update_pid_tunings(); handle_enabled(); }