polishing

This commit is contained in:
Alexander Belov 2025-01-14 12:43:13 +07:00
parent 3aa9ab5cbd
commit 05805eeb00
3 changed files with 5 additions and 14 deletions

View File

@ -83,21 +83,16 @@ int currentPhase;
bool isInTransition = false;
bool inSelectionMode = true;
// PID Control variables
// double Kp = 0.5, Ki = 1, Kd = 0.05;
// PID myPID(&Input, &Output, &Setpoint, Kp, Ki, Kd, DIRECT);
// #include "GyverPID.h"
#include "pid.h"
double Setpoint, Input, Output;
GyverPID regulator(10, 2, 10, 1000);
GyverPID regulator(50, 1, 0, 1000);
bool temperatureSensorError = false;
// Timing variables
long phaseStartTime;
long totalStartTime;
long ssrLastSwitchTime;
long totalElapsedTime;
long totalProcessTime;
long finishTime = 0;
@ -107,7 +102,6 @@ bool isClick = false;
bool isLeft = false;
bool isRight = false;
bool isComplete = false;
const int ssrSwitchInterval = 1000; // SSR switching interval in milliseconds
// Buffer for formatted time strings
char timeBuffer[10];
@ -117,8 +111,6 @@ bool boolLastCompletedState = false;
float failedReadingLastValue = 0;
int failedReadingCount = 0;
#define PARTS 8
void setup() {
pinMode(activeBuzzerPin, OUTPUT);
Serial.begin(9600);

View File

@ -1,4 +1,6 @@
LP_THREAD({
LP_TIMER(10, checkEncoder);
void checkEncoder() {
enc1.tick();
isLeft = enc1.isLeft();
isRight = enc1.isRight();
@ -13,8 +15,7 @@ LP_THREAD({
else {
handleExecutionSelection();
}
LP_DELAY(10);
});
}
void handleExecutionSelection() {
if (isClick) {

View File

@ -90,8 +90,6 @@ void startExecution() {
phaseStartTime = totalStartTime = millis(); // Start the timer
totalElapsedTime = 0;
regulator.setpoint = 0;
// digitalWrite(ssrPin, HIGH); // Start with heater on
ssrLastSwitchTime = millis();
calculateTotalTime();
getPhaseAndTemperature();
writeEEPROM();