polishing
This commit is contained in:
parent
3aa9ab5cbd
commit
05805eeb00
@ -83,21 +83,16 @@ int currentPhase;
|
|||||||
bool isInTransition = false;
|
bool isInTransition = false;
|
||||||
bool inSelectionMode = true;
|
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 "GyverPID.h"
|
||||||
#include "pid.h"
|
#include "pid.h"
|
||||||
double Setpoint, Input, Output;
|
double Setpoint, Input, Output;
|
||||||
GyverPID regulator(10, 2, 10, 1000);
|
GyverPID regulator(50, 1, 0, 1000);
|
||||||
|
|
||||||
bool temperatureSensorError = false;
|
bool temperatureSensorError = false;
|
||||||
|
|
||||||
// Timing variables
|
// Timing variables
|
||||||
long phaseStartTime;
|
long phaseStartTime;
|
||||||
long totalStartTime;
|
long totalStartTime;
|
||||||
long ssrLastSwitchTime;
|
|
||||||
long totalElapsedTime;
|
long totalElapsedTime;
|
||||||
long totalProcessTime;
|
long totalProcessTime;
|
||||||
long finishTime = 0;
|
long finishTime = 0;
|
||||||
@ -107,7 +102,6 @@ bool isClick = false;
|
|||||||
bool isLeft = false;
|
bool isLeft = false;
|
||||||
bool isRight = false;
|
bool isRight = false;
|
||||||
bool isComplete = false;
|
bool isComplete = false;
|
||||||
const int ssrSwitchInterval = 1000; // SSR switching interval in milliseconds
|
|
||||||
|
|
||||||
// Buffer for formatted time strings
|
// Buffer for formatted time strings
|
||||||
char timeBuffer[10];
|
char timeBuffer[10];
|
||||||
@ -117,8 +111,6 @@ bool boolLastCompletedState = false;
|
|||||||
float failedReadingLastValue = 0;
|
float failedReadingLastValue = 0;
|
||||||
int failedReadingCount = 0;
|
int failedReadingCount = 0;
|
||||||
|
|
||||||
#define PARTS 8
|
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
pinMode(activeBuzzerPin, OUTPUT);
|
pinMode(activeBuzzerPin, OUTPUT);
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
LP_THREAD({
|
LP_TIMER(10, checkEncoder);
|
||||||
|
|
||||||
|
void checkEncoder() {
|
||||||
enc1.tick();
|
enc1.tick();
|
||||||
isLeft = enc1.isLeft();
|
isLeft = enc1.isLeft();
|
||||||
isRight = enc1.isRight();
|
isRight = enc1.isRight();
|
||||||
@ -13,8 +15,7 @@ LP_THREAD({
|
|||||||
else {
|
else {
|
||||||
handleExecutionSelection();
|
handleExecutionSelection();
|
||||||
}
|
}
|
||||||
LP_DELAY(10);
|
}
|
||||||
});
|
|
||||||
|
|
||||||
void handleExecutionSelection() {
|
void handleExecutionSelection() {
|
||||||
if (isClick) {
|
if (isClick) {
|
||||||
|
|||||||
@ -90,8 +90,6 @@ void startExecution() {
|
|||||||
phaseStartTime = totalStartTime = millis(); // Start the timer
|
phaseStartTime = totalStartTime = millis(); // Start the timer
|
||||||
totalElapsedTime = 0;
|
totalElapsedTime = 0;
|
||||||
regulator.setpoint = 0;
|
regulator.setpoint = 0;
|
||||||
// digitalWrite(ssrPin, HIGH); // Start with heater on
|
|
||||||
ssrLastSwitchTime = millis();
|
|
||||||
calculateTotalTime();
|
calculateTotalTime();
|
||||||
getPhaseAndTemperature();
|
getPhaseAndTemperature();
|
||||||
writeEEPROM();
|
writeEEPROM();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user