Formatting, no functional changes
This commit is contained in:
parent
5ab1db583a
commit
38375ea750
@ -11,7 +11,8 @@
|
||||
void setup();
|
||||
void loop();
|
||||
|
||||
void setup() {
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
|
||||
// Disable the watchdog timers
|
||||
@ -26,11 +27,11 @@ void setup() {
|
||||
|
||||
// Set pin modes
|
||||
pinMode(EN_PIN, OUTPUT);
|
||||
digitalWrite(EN_PIN, HIGH); // Disable motor initially
|
||||
digitalWrite(EN_PIN, HIGH); // Disable motor initially
|
||||
pinMode(beeperPin, OUTPUT);
|
||||
// Set stepper motor properties
|
||||
stepper.setMaxSpeed(SPEED);
|
||||
stepper.setAcceleration(9600); // Set acceleration
|
||||
stepper.setAcceleration(9600); // Set acceleration
|
||||
|
||||
// Display welcome message
|
||||
lcd.setCursor(6, 1);
|
||||
@ -41,6 +42,7 @@ void setup() {
|
||||
lcd.clear();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
void loop()
|
||||
{
|
||||
startingMenu();
|
||||
}
|
||||
|
@ -1,19 +1,18 @@
|
||||
#include "config.h"
|
||||
|
||||
// Global variables definition
|
||||
const char* version = "V0.1.0 20240625";
|
||||
const char *version = "V0.1.0 20240625";
|
||||
const byte ROWS = 5;
|
||||
const byte COLS = 4;
|
||||
byte rowPins[ROWS] = { 19, 18, 5, 17, 16 };
|
||||
byte colPins[COLS] = { 15, 2, 0, 4 };
|
||||
byte rowPins[ROWS] = {19, 18, 5, 17, 16};
|
||||
byte colPins[COLS] = {15, 2, 0, 4};
|
||||
|
||||
char keys[ROWS][COLS] = {
|
||||
{ 'F', 'E', '#', '*' },
|
||||
{ '1', '2', '3', 'U' },
|
||||
{ '4', '5', '6', 'D' },
|
||||
{ '7', '8', '9', 'X' },
|
||||
{ 'L', '0', 'R', 'E' }
|
||||
};
|
||||
{'F', 'E', '#', '*'},
|
||||
{'1', '2', '3', 'U'},
|
||||
{'4', '5', '6', 'D'},
|
||||
{'7', '8', '9', 'X'},
|
||||
{'L', '0', 'R', 'E'}};
|
||||
|
||||
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
|
||||
LiquidCrystal_I2C lcd(0x27, LCD_COLUMNS, LCD_ROWS);
|
||||
@ -32,12 +31,11 @@ unsigned long processStartTime;
|
||||
unsigned long processTimeMillis;
|
||||
|
||||
byte thermometer[8] = {
|
||||
B00100,
|
||||
B01100,
|
||||
B00100,
|
||||
B01100,
|
||||
B00100,
|
||||
B01110,
|
||||
B01110,
|
||||
B01110
|
||||
};
|
||||
B00100,
|
||||
B01100,
|
||||
B00100,
|
||||
B01100,
|
||||
B00100,
|
||||
B01110,
|
||||
B01110,
|
||||
B01110};
|
||||
|
@ -21,7 +21,7 @@
|
||||
#define TEMP_SENSOR_PIN 13
|
||||
#define NUM_DEV_SEQUENCES 6
|
||||
|
||||
extern const char* version;
|
||||
extern const char *version;
|
||||
extern Keypad keypad;
|
||||
extern LiquidCrystal_I2C lcd;
|
||||
extern AccelStepper stepper;
|
||||
|
@ -1,103 +1,72 @@
|
||||
#include "devSequence.h"
|
||||
|
||||
struct devSequence devSequences[NUM_DEV_SEQUENCES] = {
|
||||
{
|
||||
"C41",
|
||||
7,
|
||||
{ 180, 195, 45, 180, 60, 60, 30 }, //processTime
|
||||
{ "Prewarm", "Developer", "Bleach", "Fix", "Rinse 1", "Rinse 2", "Fin Rinse" }, //processName
|
||||
{
|
||||
{ 1, 5.5, 5.5, 5.5, 3.5, 3.5, 1 }, //CW rotations processCycle
|
||||
{ 1, 5, 5, 5, 3, 3, 1 }
|
||||
}, //CCW rotations processCycle
|
||||
{
|
||||
{ 37.8, 37.8, 32, 32, 32, 32, 32 }, //min processTemp
|
||||
{ 38, 38, 38, 38, 38, 38, 38 }, //preferred processTemp
|
||||
{ 38.2, 38.2, 38.2, 38.2, 38.2, 38.2, 38.2 } //max processTemp
|
||||
}
|
||||
},
|
||||
{
|
||||
"E6",
|
||||
12,
|
||||
{180, 360, 120, 120, 360, 120, 360, 240, 120, 120, 120, 30},
|
||||
{"Preheat", "FirstDev", "Wash 1", "Reversal", "ColorDev", "PreBleach", "Bleach", "Fixer", "Wash 2", "Wash 3", "Wash 4", "Fin Rinse"},
|
||||
{
|
||||
{1, 5.5, 3.5, 5, 5.5, 5.5, 5.5, 5.5, 3.5, 3.5, 3.5, 3.5},
|
||||
{1, 5, 3, 5.5, 5, 5.5, 5.5, 5.5, 3, 3, 3, 3}
|
||||
},
|
||||
{
|
||||
{37.5, 37.7, 33.0, 37.7, 37.0, 37, 37.5, 37.5, 33.0, 33.0, 33.0, 19.0},
|
||||
{38.0, 38.0, 38.0, 38.0, 38.0, 38.0, 38.0, 38.0, 38.0, 38.0, 38.0, 20.0},
|
||||
{38.5, 38.3, 38.0, 38.3, 39.0, 38, 38.5, 38.5, 38.5, 38.5, 38.5, 21.0}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ECN-2",
|
||||
9,
|
||||
{180, 0, 210, 60, 180, 150, 120, 300, 120},
|
||||
{"Prebath", "RemJet", "Developer", "Stop Bath", "Wash", "Bleach", "Fixer", "Wash 2", "Fin Rinse"},
|
||||
{
|
||||
{1, 0, 5.5, 3.5, 3.5, 5.5, 5.5, 3.5, 1},
|
||||
{1, 0, 5, 3, 3, 5, 5, 3, 1}
|
||||
},
|
||||
{
|
||||
{27.0, 0, 40.8, 27.0, 27.0, 27.0, 27.0, 27.0, 27.0},
|
||||
{38.0, 0, 41.0, 38.0, 38.0, 38.0, 38.0, 38.0, 38.0},
|
||||
{38.0, 0, 41.2, 38.0, 38.0, 38.0, 38.0, 38.0, 38.0}
|
||||
}
|
||||
},
|
||||
{
|
||||
"B&W",
|
||||
7,
|
||||
{510, 30, 300, 60, 90, 120, 30},
|
||||
{"Developer", "Stop", "Fix", "Rinse 1", "Rinse 2", "Rinse 3", "Fin Rinse"},
|
||||
{
|
||||
{ 5.5, 3.5, 3.5, 3.5, 3.5, 3.5, 1},
|
||||
{ 5, 3, 3, 3, 3, 3, 1}
|
||||
},
|
||||
{
|
||||
{19, 19, 19, 19, 19, 19, 19},
|
||||
{20, 20, 20, 20, 20, 20, 20},
|
||||
{21, 21, 21, 21, 21, 21, 21}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Custom",
|
||||
4,
|
||||
{10, 10, 10, 10},
|
||||
{"Developer", "Stop", "Fix", "Rinse"},
|
||||
{
|
||||
{ 5.5, 3.5, 3.5, 3.5},
|
||||
{ 5, 3, 3, 3}
|
||||
},
|
||||
{
|
||||
{19, 19, 19, 19},
|
||||
{20, 20, 20, 20},
|
||||
{21, 21, 21, 21}
|
||||
}
|
||||
},
|
||||
{
|
||||
"B&WREV",
|
||||
12,
|
||||
{720, 300, 300, 60, 120, 60, 120, 360, 60, 300, 60, 60},
|
||||
{"FirstDev", "Wash 1", "Bleach", "Wash 2", "Clearing", "Wash 3", "Reversal", "SecondDev", "Wash 4", "Fix", "Wash 5", "Fin Rinse"},
|
||||
{
|
||||
{5.5, 3.5, 5.5, 3.5, 5.5, 3.5, 5.5, 5.5, 3.5, 5.5, 3.5, 3.5},
|
||||
{5, 3, 5, 3, 5, 3, 5, 5, 3, 5, 3, 3}
|
||||
},
|
||||
{
|
||||
{19.5, 15.5, 19.5, 15.5, 19.5, 15.5, 19.5, 19.5, 15.5, 19.5, 15.5, 15.5},
|
||||
{20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0},
|
||||
{20.5, 22.5, 22.5, 22.5, 22.5, 22.5, 22.5, 22.5, 22.5, 22.5, 22.5, 22.5}
|
||||
}
|
||||
}
|
||||
};
|
||||
{"C41",
|
||||
7,
|
||||
{180, 195, 45, 180, 60, 60, 30}, // processTime
|
||||
{"Prewarm", "Developer", "Bleach", "Fix", "Rinse 1", "Rinse 2", "Fin Rinse"}, // processName
|
||||
{
|
||||
{1, 5.5, 5.5, 5.5, 3.5, 3.5, 1}, // CW rotations processCycle
|
||||
{1, 5, 5, 5, 3, 3, 1}}, // CCW rotations processCycle
|
||||
{
|
||||
{37.8, 37.8, 32, 32, 32, 32, 32}, // min processTemp
|
||||
{38, 38, 38, 38, 38, 38, 38}, // preferred processTemp
|
||||
{38.2, 38.2, 38.2, 38.2, 38.2, 38.2, 38.2} // max processTemp
|
||||
}},
|
||||
{"E6",
|
||||
12,
|
||||
{180, 360, 120, 120, 360, 120, 360, 240, 120, 120, 120, 30},
|
||||
{"Preheat", "FirstDev", "Wash 1", "Reversal", "ColorDev", "PreBleach", "Bleach", "Fixer", "Wash 2", "Wash 3", "Wash 4", "Fin Rinse"},
|
||||
{{1, 5.5, 3.5, 5, 5.5, 5.5, 5.5, 5.5, 3.5, 3.5, 3.5, 3.5},
|
||||
{1, 5, 3, 5.5, 5, 5.5, 5.5, 5.5, 3, 3, 3, 3}},
|
||||
{{37.5, 37.7, 33.0, 37.7, 37.0, 37, 37.5, 37.5, 33.0, 33.0, 33.0, 19.0},
|
||||
{38.0, 38.0, 38.0, 38.0, 38.0, 38.0, 38.0, 38.0, 38.0, 38.0, 38.0, 20.0},
|
||||
{38.5, 38.3, 38.0, 38.3, 39.0, 38, 38.5, 38.5, 38.5, 38.5, 38.5, 21.0}}},
|
||||
{"ECN-2",
|
||||
9,
|
||||
{180, 0, 210, 60, 180, 150, 120, 300, 120},
|
||||
{"Prebath", "RemJet", "Developer", "Stop Bath", "Wash", "Bleach", "Fixer", "Wash 2", "Fin Rinse"},
|
||||
{{1, 0, 5.5, 3.5, 3.5, 5.5, 5.5, 3.5, 1},
|
||||
{1, 0, 5, 3, 3, 5, 5, 3, 1}},
|
||||
{{27.0, 0, 40.8, 27.0, 27.0, 27.0, 27.0, 27.0, 27.0},
|
||||
{38.0, 0, 41.0, 38.0, 38.0, 38.0, 38.0, 38.0, 38.0},
|
||||
{38.0, 0, 41.2, 38.0, 38.0, 38.0, 38.0, 38.0, 38.0}}},
|
||||
{"B&W",
|
||||
7,
|
||||
{510, 30, 300, 60, 90, 120, 30},
|
||||
{"Developer", "Stop", "Fix", "Rinse 1", "Rinse 2", "Rinse 3", "Fin Rinse"},
|
||||
{{5.5, 3.5, 3.5, 3.5, 3.5, 3.5, 1},
|
||||
{5, 3, 3, 3, 3, 3, 1}},
|
||||
{{19, 19, 19, 19, 19, 19, 19},
|
||||
{20, 20, 20, 20, 20, 20, 20},
|
||||
{21, 21, 21, 21, 21, 21, 21}}},
|
||||
{"Custom",
|
||||
4,
|
||||
{10, 10, 10, 10},
|
||||
{"Developer", "Stop", "Fix", "Rinse"},
|
||||
{{5.5, 3.5, 3.5, 3.5},
|
||||
{5, 3, 3, 3}},
|
||||
{{19, 19, 19, 19},
|
||||
{20, 20, 20, 20},
|
||||
{21, 21, 21, 21}}},
|
||||
{"B&WREV",
|
||||
12,
|
||||
{720, 300, 300, 60, 120, 60, 120, 360, 60, 300, 60, 60},
|
||||
{"FirstDev", "Wash 1", "Bleach", "Wash 2", "Clearing", "Wash 3", "Reversal", "SecondDev", "Wash 4", "Fix", "Wash 5", "Fin Rinse"},
|
||||
{{5.5, 3.5, 5.5, 3.5, 5.5, 3.5, 5.5, 5.5, 3.5, 5.5, 3.5, 3.5},
|
||||
{5, 3, 5, 3, 5, 3, 5, 5, 3, 5, 3, 3}},
|
||||
{{19.5, 15.5, 19.5, 15.5, 19.5, 15.5, 19.5, 19.5, 15.5, 19.5, 15.5, 15.5},
|
||||
{20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0},
|
||||
{20.5, 22.5, 22.5, 22.5, 22.5, 22.5, 22.5, 22.5, 22.5, 22.5, 22.5, 22.5}}}};
|
||||
|
||||
struct devSequence* findSequenceByName(const char* processName) {
|
||||
for (int i = 0; i < NUM_DEV_SEQUENCES; i++) {
|
||||
if (strcmp(devSequences[i].processName, processName) == 0) {
|
||||
return &devSequences[i];
|
||||
}
|
||||
}
|
||||
return NULL; // Return NULL if not found
|
||||
struct devSequence *findSequenceByName(const char *processName)
|
||||
{
|
||||
for (int i = 0; i < NUM_DEV_SEQUENCES; i++)
|
||||
{
|
||||
if (strcmp(devSequences[i].processName, processName) == 0)
|
||||
{
|
||||
return &devSequences[i];
|
||||
}
|
||||
}
|
||||
return NULL; // Return NULL if not found
|
||||
}
|
||||
|
@ -3,7 +3,8 @@
|
||||
#define NUM_DEV_SEQUENCES 6
|
||||
#include <Arduino.h>
|
||||
|
||||
struct devSequence {
|
||||
struct devSequence
|
||||
{
|
||||
char processName[7];
|
||||
int cycles;
|
||||
unsigned long int processTime[20];
|
||||
@ -14,6 +15,6 @@ struct devSequence {
|
||||
|
||||
extern struct devSequence devSequences[NUM_DEV_SEQUENCES];
|
||||
|
||||
struct devSequence* findSequenceByName(const char* processName);
|
||||
struct devSequence *findSequenceByName(const char *processName);
|
||||
|
||||
#endif
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include "display.h"
|
||||
#include "menu.h"
|
||||
|
||||
|
||||
void startingMenu() {
|
||||
void startingMenu()
|
||||
{
|
||||
lcd.clear();
|
||||
lcd.setCursor(0, 0);
|
||||
lcd.print("Select Programme:");
|
||||
@ -19,17 +19,20 @@ void startingMenu() {
|
||||
lcd.setCursor(10, 3);
|
||||
lcd.print("6. B&W Rev");
|
||||
|
||||
while (devPgm == "") {
|
||||
while (devPgm == "")
|
||||
{
|
||||
getMenuInput();
|
||||
}
|
||||
lcd.print(devPgm);
|
||||
|
||||
if (devPgm == "C41" || devPgm == "E6" || devPgm == "B&W" || devPgm == "ECN-2" || devPgm == "Custom" || devPgm == "B&WREV") {
|
||||
if (devPgm == "C41" || devPgm == "E6" || devPgm == "B&W" || devPgm == "ECN-2" || devPgm == "Custom" || devPgm == "B&WREV")
|
||||
{
|
||||
startDev();
|
||||
}
|
||||
}
|
||||
|
||||
void processHeadings() {
|
||||
void processHeadings()
|
||||
{
|
||||
lcd.clear();
|
||||
lcd.setCursor(0, 0);
|
||||
lcd.print("Step");
|
||||
@ -39,11 +42,11 @@ void processHeadings() {
|
||||
lcd.print("Temp");
|
||||
}
|
||||
|
||||
|
||||
|
||||
char* secondsToMinutesSeconds(int seconds) {
|
||||
char* result = (char*)malloc(6 * sizeof(char));
|
||||
if (result == NULL) {
|
||||
char *secondsToMinutesSeconds(int seconds)
|
||||
{
|
||||
char *result = (char *)malloc(6 * sizeof(char));
|
||||
if (result == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -4,10 +4,10 @@
|
||||
#include <LiquidCrystal_I2C.h>
|
||||
#include "config.h"
|
||||
|
||||
void updateTempDisplay(void* parameter);
|
||||
void updateTempDisplay(void *parameter);
|
||||
void startingMenu();
|
||||
void processHeadings();
|
||||
void readTemperature();
|
||||
char* secondsToMinutesSeconds(int seconds);
|
||||
char *secondsToMinutesSeconds(int seconds);
|
||||
|
||||
#endif
|
||||
|
163
src/menu.cpp
163
src/menu.cpp
@ -1,66 +1,80 @@
|
||||
#include "menu.h"
|
||||
|
||||
void getMenuInput() {
|
||||
char key = keypad.getKey();
|
||||
if (key != NO_KEY) {
|
||||
switch (key) {
|
||||
case '1':
|
||||
devPgm = "C41";
|
||||
break;
|
||||
case '2':
|
||||
devPgm = "E6";
|
||||
break;
|
||||
case '3':
|
||||
devPgm = "B&W";
|
||||
break;
|
||||
case '4':
|
||||
devPgm = "ECN-2";
|
||||
break;
|
||||
case '5':
|
||||
devPgm = "Custom";
|
||||
break;
|
||||
case '6':
|
||||
devPgm = "B&WREV";
|
||||
break;
|
||||
}
|
||||
}
|
||||
void getMenuInput()
|
||||
{
|
||||
char key = keypad.getKey();
|
||||
if (key != NO_KEY)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case '1':
|
||||
devPgm = "C41";
|
||||
break;
|
||||
case '2':
|
||||
devPgm = "E6";
|
||||
break;
|
||||
case '3':
|
||||
devPgm = "B&W";
|
||||
break;
|
||||
case '4':
|
||||
devPgm = "ECN-2";
|
||||
break;
|
||||
case '5':
|
||||
devPgm = "Custom";
|
||||
break;
|
||||
case '6':
|
||||
devPgm = "B&WREV";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
char getScrollEntEscInput() {
|
||||
while (true) {
|
||||
char getScrollEntEscInput()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
char key = keypad.getKey();
|
||||
if (key != NO_KEY) {
|
||||
if (key == 'U' || key == 'D' || key == 'X' || key == 'E' || key == 'L' || key == 'R') {
|
||||
if (key != NO_KEY)
|
||||
{
|
||||
if (key == 'U' || key == 'D' || key == 'X' || key == 'E' || key == 'L' || key == 'R')
|
||||
{
|
||||
return key;
|
||||
}
|
||||
}
|
||||
if (millis() % 1000 == 0) {
|
||||
if (millis() % 1000 == 0)
|
||||
{
|
||||
readTemperature();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
char getEntEscInput() {
|
||||
while (true) {
|
||||
char getEntEscInput()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
char key = keypad.getKey();
|
||||
if (key != NO_KEY) {
|
||||
if (key == 'X' || key == 'E') {
|
||||
if (key != NO_KEY)
|
||||
{
|
||||
if (key == 'X' || key == 'E')
|
||||
{
|
||||
return key;
|
||||
}
|
||||
}
|
||||
if (millis() % 1000 == 0) {
|
||||
if (millis() % 1000 == 0)
|
||||
{
|
||||
readTemperature();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int startProcessing(struct devSequence* sequence, int sequenceStep) {
|
||||
int startProcessing(struct devSequence *sequence, int sequenceStep)
|
||||
{
|
||||
run = 1;
|
||||
lcd.clear();
|
||||
lcd.setCursor(0, 0);
|
||||
lcd.print(sequence->processCycleName[sequenceStep]);
|
||||
for (int x = strlen(sequence->processCycleName[sequenceStep]); x < 10; x++) {
|
||||
for (int x = strlen(sequence->processCycleName[sequenceStep]); x < 10; x++)
|
||||
{
|
||||
lcd.print(" ");
|
||||
}
|
||||
|
||||
@ -73,7 +87,8 @@ int startProcessing(struct devSequence* sequence, int sequenceStep) {
|
||||
lcd.print("Ent:start Esc:quit");
|
||||
|
||||
char key = getEntEscInput();
|
||||
if (key == 'X') {
|
||||
if (key == 'X')
|
||||
{
|
||||
devPgm = "";
|
||||
run = 0;
|
||||
return 0;
|
||||
@ -81,7 +96,7 @@ int startProcessing(struct devSequence* sequence, int sequenceStep) {
|
||||
processTimeMillis = (unsigned long)sequence->processTime[sequenceStep] * 1000;
|
||||
processStartTime = millis();
|
||||
|
||||
MotorTaskParams* params = new MotorTaskParams();
|
||||
MotorTaskParams *params = new MotorTaskParams();
|
||||
params->cwRotations = sequence->processCycle[0][sequenceStep];
|
||||
params->ccwRotations = sequence->processCycle[1][sequenceStep];
|
||||
params->processEndTime = processStartTime + processTimeMillis;
|
||||
@ -94,24 +109,26 @@ int startProcessing(struct devSequence* sequence, int sequenceStep) {
|
||||
Serial.println(params->processEndTime);
|
||||
|
||||
xTaskCreatePinnedToCore(
|
||||
runMotorTask,
|
||||
"MotorTask",
|
||||
8192,
|
||||
(void*)params,
|
||||
1,
|
||||
&motorTaskHandle,
|
||||
0);
|
||||
runMotorTask,
|
||||
"MotorTask",
|
||||
8192,
|
||||
(void *)params,
|
||||
1,
|
||||
&motorTaskHandle,
|
||||
0);
|
||||
|
||||
while (millis() < processStartTime + processTimeMillis) {
|
||||
while (millis() < processStartTime + processTimeMillis)
|
||||
{
|
||||
lcd.setCursor(0, 1);
|
||||
lcd.print("Remaining: " + (String)secondsToMinutesSeconds((processStartTime + processTimeMillis - millis()) / 1000) + " ");
|
||||
delay(410);
|
||||
Serial.println("before temp read" + (String) millis() + "\n");
|
||||
Serial.println("before temp read" + (String)millis() + "\n");
|
||||
readTemperature();
|
||||
Serial.println("after temp read" + (String) millis() + "\n");
|
||||
Serial.println("after temp read" + (String)millis() + "\n");
|
||||
}
|
||||
|
||||
if (motorTaskHandle != NULL) {
|
||||
if (motorTaskHandle != NULL)
|
||||
{
|
||||
vTaskDelete(motorTaskHandle);
|
||||
motorTaskHandle = NULL;
|
||||
}
|
||||
@ -121,12 +138,15 @@ int startProcessing(struct devSequence* sequence, int sequenceStep) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
void startDev() {
|
||||
const char* searchName = devPgm.c_str();
|
||||
struct devSequence* currentSequence = findSequenceByName(searchName);
|
||||
void startDev()
|
||||
{
|
||||
const char *searchName = devPgm.c_str();
|
||||
struct devSequence *currentSequence = findSequenceByName(searchName);
|
||||
|
||||
for (int i = 0; i < currentSequence->cycles; i++) {
|
||||
if (run == 1) {
|
||||
for (int i = 0; i < currentSequence->cycles; i++)
|
||||
{
|
||||
if (run == 1)
|
||||
{
|
||||
run = startProcessing(currentSequence, i);
|
||||
continue;
|
||||
}
|
||||
@ -134,7 +154,8 @@ void startDev() {
|
||||
processHeadings();
|
||||
lcd.setCursor(0, 1);
|
||||
lcd.print(currentSequence->processCycleName[i]);
|
||||
for (int x = strlen(currentSequence->processCycleName[i]); x < 10; x++) {
|
||||
for (int x = strlen(currentSequence->processCycleName[i]); x < 10; x++)
|
||||
{
|
||||
lcd.print(" ");
|
||||
}
|
||||
|
||||
@ -147,29 +168,43 @@ void startDev() {
|
||||
lcd.print("Scroll / Esc / Ent");
|
||||
|
||||
char key = getScrollEntEscInput();
|
||||
if (key == 'U') {
|
||||
if (i > 0) {
|
||||
if (key == 'U')
|
||||
{
|
||||
if (i > 0)
|
||||
{
|
||||
i--;
|
||||
}
|
||||
i--;
|
||||
} else if (key == 'D' && i < currentSequence->cycles - 1) {
|
||||
}
|
||||
else if (key == 'D' && i < currentSequence->cycles - 1)
|
||||
{
|
||||
continue;
|
||||
} else if (key == 'D' && i == currentSequence->cycles - 1) {
|
||||
}
|
||||
else if (key == 'D' && i == currentSequence->cycles - 1)
|
||||
{
|
||||
i--;
|
||||
continue;
|
||||
} else if (key == 'X') {
|
||||
}
|
||||
else if (key == 'X')
|
||||
{
|
||||
devPgm = "";
|
||||
run = 0;
|
||||
return;
|
||||
} else if (key == 'E') {
|
||||
}
|
||||
else if (key == 'E')
|
||||
{
|
||||
int run = 1;
|
||||
startProcessing(currentSequence, i);
|
||||
} else if (key == 'L') {
|
||||
}
|
||||
else if (key == 'L')
|
||||
{
|
||||
currentSequence->processTime[i] -= 5;
|
||||
lcd.setCursor(10, 1);
|
||||
lcd.print(secondsToMinutesSeconds(currentSequence->processTime[i]));
|
||||
i--;
|
||||
} else if (key == 'R') {
|
||||
}
|
||||
else if (key == 'R')
|
||||
{
|
||||
currentSequence->processTime[i] += 5;
|
||||
lcd.setCursor(10, 1);
|
||||
lcd.print(secondsToMinutesSeconds(currentSequence->processTime[i]));
|
||||
|
@ -10,7 +10,7 @@
|
||||
void getMenuInput();
|
||||
char getScrollEntEscInput();
|
||||
char getEntEscInput();
|
||||
int startProcessing(struct devSequence* sequence, int sequenceStep);
|
||||
int startProcessing(struct devSequence *sequence, int sequenceStep);
|
||||
void startDev();
|
||||
|
||||
#endif
|
||||
|
@ -1,16 +1,19 @@
|
||||
#include "motor.h"
|
||||
|
||||
void runMotorTask(void* parameter) {
|
||||
MotorTaskParams* params = (MotorTaskParams*)parameter;
|
||||
void runMotorTask(void *parameter)
|
||||
{
|
||||
MotorTaskParams *params = (MotorTaskParams *)parameter;
|
||||
|
||||
// Enable the motor
|
||||
digitalWrite(EN_PIN, LOW);
|
||||
while (true) {
|
||||
while (true)
|
||||
{
|
||||
// Rotate clockwise
|
||||
Serial.println("Rotating CW" + (String)params->cwRotations);
|
||||
stepper.setCurrentPosition(0);
|
||||
stepper.moveTo(STEPS_PER_REV * params->cwRotations);
|
||||
while (stepper.distanceToGo() != 0) {
|
||||
while (stepper.distanceToGo() != 0)
|
||||
{
|
||||
stepper.run();
|
||||
}
|
||||
|
||||
@ -18,12 +21,13 @@ void runMotorTask(void* parameter) {
|
||||
Serial.println("Rotating CCW" + (String)params->ccwRotations);
|
||||
stepper.setCurrentPosition(0);
|
||||
stepper.moveTo(-STEPS_PER_REV * params->ccwRotations);
|
||||
while (stepper.distanceToGo() != 0) {
|
||||
while (stepper.distanceToGo() != 0)
|
||||
{
|
||||
stepper.run();
|
||||
}
|
||||
}
|
||||
// Disable the motor
|
||||
digitalWrite(EN_PIN, HIGH);
|
||||
|
||||
vTaskDelete(NULL); // Delete the task when done
|
||||
vTaskDelete(NULL); // Delete the task when done
|
||||
}
|
||||
|
@ -4,12 +4,13 @@
|
||||
#include <AccelStepper.h>
|
||||
#include "config.h"
|
||||
|
||||
struct MotorTaskParams {
|
||||
struct MotorTaskParams
|
||||
{
|
||||
float cwRotations;
|
||||
float ccwRotations;
|
||||
unsigned long int processEndTime;
|
||||
};
|
||||
|
||||
void runMotorTask(void* parameter);
|
||||
void runMotorTask(void *parameter);
|
||||
|
||||
#endif
|
||||
|
@ -1,15 +1,14 @@
|
||||
#include "sound.h"
|
||||
|
||||
|
||||
int melody[] = {
|
||||
262, 294, 330, 349, 392, 440, 494, 523, 587, 659, 698, 784, 880, 988, 1047
|
||||
};
|
||||
262, 294, 330, 349, 392, 440, 494, 523, 587, 659, 698, 784, 880, 988, 1047};
|
||||
int noteDurations[] = {
|
||||
250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250
|
||||
};
|
||||
250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250};
|
||||
|
||||
void playTune() {
|
||||
for (int thisNote = 0; thisNote < 15; thisNote++) {
|
||||
void playTune()
|
||||
{
|
||||
for (int thisNote = 0; thisNote < 15; thisNote++)
|
||||
{
|
||||
int noteDuration = noteDurations[thisNote];
|
||||
tone(beeperPin, melody[thisNote], noteDuration);
|
||||
|
||||
@ -20,8 +19,10 @@ void playTune() {
|
||||
}
|
||||
}
|
||||
|
||||
void playAlarmTone() {
|
||||
for (int i = 1; i <= 10; i++) {
|
||||
void playAlarmTone()
|
||||
{
|
||||
for (int i = 1; i <= 10; i++)
|
||||
{
|
||||
tone(beeperPin, 2000);
|
||||
delay(500);
|
||||
noTone(beeperPin);
|
||||
|
@ -1,2 +0,0 @@
|
||||
spec.o: \
|
||||
C:/Users/gordon/Documents/sloeber-workspace/.metadata/.plugins/org.eclipse.cdt.managedbuilder.core/spec.cpp
|
@ -1,29 +1,37 @@
|
||||
#include "temperature.h"
|
||||
|
||||
void readTemperature() {
|
||||
void readTemperature()
|
||||
{
|
||||
sensors.requestTemperatures();
|
||||
float temperatureC = sensors.getTempCByIndex(0);
|
||||
lcd.setCursor(13, 3);
|
||||
lcd.write(byte(0));
|
||||
if (temperatureC == DEVICE_DISCONNECTED_C) {
|
||||
if (temperatureC == DEVICE_DISCONNECTED_C)
|
||||
{
|
||||
lcd.print("--");
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
lcd.print(temperatureC, 1);
|
||||
lcd.print("C");
|
||||
}
|
||||
}
|
||||
|
||||
void updateTempDisplay(void* parameter) {
|
||||
void updateTempDisplay(void *parameter)
|
||||
{
|
||||
sensors.requestTemperatures();
|
||||
float temperatureC = sensors.getTempCByIndex(0);
|
||||
lcd.setCursor(13, 3);
|
||||
lcd.write(byte(0));
|
||||
if (temperatureC == DEVICE_DISCONNECTED_C) {
|
||||
if (temperatureC == DEVICE_DISCONNECTED_C)
|
||||
{
|
||||
lcd.print("--");
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
lcd.print(temperatureC, 1);
|
||||
lcd.print("C");
|
||||
}
|
||||
|
||||
vTaskDelete(NULL); // Delete the task when done
|
||||
vTaskDelete(NULL); // Delete the task when done
|
||||
}
|
||||
|
@ -6,7 +6,8 @@
|
||||
#include "esp_task_wdt.h"
|
||||
|
||||
// Disable the watchdog timers
|
||||
void disableWatchdogTimers() {
|
||||
void disableWatchdogTimers()
|
||||
{
|
||||
esp_task_wdt_deinit();
|
||||
TaskHandle_t idle_0 = xTaskGetIdleTaskHandleForCPU(0);
|
||||
TaskHandle_t idle_1 = xTaskGetIdleTaskHandleForCPU(1);
|
||||
|
Loading…
Reference in New Issue
Block a user