Browse Source

firmware fixes

master
Barb 1 month ago
parent
commit
d725c632d9
5 changed files with 1175 additions and 1121 deletions
  1. +4
    -1
      PyCoffeeESP8266/PyCoffeeESP8266.ino
  2. BIN
      PyCoffeeESP8266/PyCoffeeESP8266.ino.d1_mini.bin
  3. +48
    -19
      PyCoffeeNano/PyCoffeeNano.ino
  4. +562
    -551
      PyCoffeeNano/PyCoffeeNano.ino.eightanaloginputs.hex
  5. +561
    -550
      PyCoffeeNano/PyCoffeeNano.ino.with_bootloader.eightanaloginputs.hex

+ 4
- 1
PyCoffeeESP8266/PyCoffeeESP8266.ino View File

@ -10,11 +10,12 @@
AsyncWebServer server(80);
// coffee times (in seconds) and temperature (in C) settings:
// Warning! these are currently hard-coded in the arduino nano
//int rist = 15;
//int espr = 20;
//int lung = 25;
//int amer = 60;
int desiredTemp = 70;
//int desiredTemp = 70;
// support variables used by checktraywater() to interact with EEPROM
int mem0 = 0;
@ -71,6 +72,8 @@ const char index_html[] PROGMEM = R"rawliteral(
<option value="pump">pumpWater</option>
<option value="pres">Press</option>
<option value="unpr">un-Press</option>
<option value="f-pr">Force-Press</option>
<option value="f-un">Force-unpress</option>
<option value="heat">Heat Boiler</option>
<option value="grin">GrindPowder</option>
<option value="drop">Drop Powder</option>


BIN
PyCoffeeESP8266/PyCoffeeESP8266.ino.d1_mini.bin View File


+ 48
- 19
PyCoffeeNano/PyCoffeeNano.ino View File

@ -55,21 +55,27 @@ void loop() {
digitalWrite(greenLED, HIGH);
// Check if unrecoverable error has occurred:
if (unrecoverableErr == 1) {
startTime = millis();
//startTime = millis();
delay(100);
Serial.write("Error has occurred.\n"); delay(100); Serial.write("Check machine and restart\n");
digitalWrite(greenLED, LOW);
while (true){
while (true){ // lock the machine in a loop while blinking the RED LED to indicate an error
digitalWrite(redLED, HIGH);
delay(1000);
delay(100);
digitalWrite(redLED, LOW);
delay(1000);
// reset arduino after 30s
if (millis() - startTime == 30000) {
delay(900);
if (Serial.available() > 0) {
warning = 0;
warned = 0;
unrecoverableErr = 0; // added on 19/11/24 to reset unrecoverable error when serial com is received
break;
}
// reset arduino after 30s -> removed reset on 19/11/24, LED should stay blinking and machine locked until reboot or serialcom received
//if (millis() - startTime == 30000) {
// break;
//}
}
resetFunc(); //call reset.
//resetFunc(); //call reset.
}
// check if data has been sent on serial from ESP or PC:
@ -86,21 +92,21 @@ void loop() {
// set parameters for ristretto:
delay(100);
Serial.write("Ristretto\n");
pumpRatio = 15;
pumpRatio = 10; // updated from 15 to 10s after fixing restriction 19/11/24
}
if (incomingData == "espr") {
// set parameters for espresso:
delay(100);
Serial.write("Espresso\n");
pumpRatio = 20;
pumpRatio = 15; // updated from 20 to 15s after fixing restriction 19/11/24
}
if (incomingData == "long") {
// set parameters for lungo:
delay(100);
Serial.write("Lungo\n");
pumpRatio = 25;
pumpRatio = 20; // updated from 25 to 20s after fixing restriction 19/11/24
}
if (incomingData == "amer") {
@ -119,7 +125,7 @@ void loop() {
}
if (incomingData == "dryr") {
// run the code to make a dry run (no powder, no water):
// run the code to perform a dry run (no powder, nor water):
delay(100);
Serial.write("DryRun\n");
dry = 1;
@ -127,10 +133,10 @@ void loop() {
}
if (incomingData == "noco") {
// run the code to make a dry run (no powder, nor water):
// run the code to perform a wet run (water, but no powder):
delay(100);
Serial.write("NoCo\n");
pumpRatio = 12;
pumpRatio = 10;
noCoffee = 1;
makeCoffee();
}
@ -178,6 +184,20 @@ void loop() {
delay(100);
Serial.write("S-cleaning done.\n");
}
if (incomingData == "f-un") {
Serial.write("F-Unpress\n");
delay(1000);
digitalWrite(invertWheelPin, HIGH);
delay(5000);
digitalWrite(invertWheelPin, LOW);
}
if (incomingData == "f-pr") {
Serial.write("F-Press\n");
delay(1000);
digitalWrite(wheelPin, HIGH);
delay(5000);
digitalWrite(wheelPin, LOW);
}
}
// making steam:
@ -186,7 +206,8 @@ void loop() {
Serial.write("Vapor heating\n");
delay(500);
Heat(); // Heat the boiler to vapor temperature
delay(20000);
//delay(20000); // no idea why if had a 20s delay originally, I attempted to remove it to see how it goes on 19/11/24
delay(200); // assuming 20000 was a type error, 200ms seems sensible
if (unrecoverableErr == 1) {
break;
@ -275,7 +296,7 @@ void Heat() {
if (millis() - startTime > 500 && millis() - startTime < 1500) {
Tstart = Tc; // support variable to store temp at beginning, so that we can be sure it's increasing
delay(1001); // make sure we only set startTime once!
delay(1001); // make sure we only set Tstart once!
}
// check if temperature is within the acceptable range and break out of the loop without error if done heating:
@ -387,7 +408,7 @@ void Press() {
Serial.write("Pressed\n");
break;
}
if (millis() - startTime > 15000) {
if (millis() - startTime > 20000) { // changed from 15s to 20s to account for motor slowdown over the years
delay(100);
Serial.write("p-end of pressing not detected\n");
digitalWrite(wheelPin, LOW);
@ -421,7 +442,7 @@ void unPress() {
Serial.write("UnPressed\n");
break;
}
if (millis() - startTime > 15000) {
if (millis() - startTime > 20000) { // changed from 15s to 20s to account for motor slowdown over the years
delay(100);
Serial.write("u-end of unPressing not detected\n");
digitalWrite(invertWheelPin, LOW);
@ -437,15 +458,18 @@ void Pump() {
digitalWrite(greenLED, LOW);
delay(100);
Serial.write("pumping Water...\n");
pumpStatus = 1; // set pumpStatus variable to 1 to tell Heat() function to pump
pumpStatus = 1; // set pumpStatus variable to 1 to tell Heat() function to pump; this is so that Proportional heating control can still function while pumping, preventing overheat
Heat(); // call Heat function with current parameters
pumpStatus = 0; // set pumpStatus variable to 0
// OLD PUMPING LOGIC BEFORE MOVING INSIDE Heat()
//digitalWrite(pumpPin, HIGH);
//while (pumpRatio > 1) {
// pumpRatio--;
// delay(1000);
//}
//digitalWrite(pumpPin, LOW);
delay(100);
Serial.write("Pumping water done\n");
digitalWrite(greenLED, HIGH);
@ -504,7 +528,7 @@ void makeCoffee() {
delay(1000); // this delay is mandatory to prevent powder spillage caused by grinder inertia.
// Slightly move the press in the opposite direction to make sure the press sensor makes contact
// Slightly move the press in the opposite direction to make sure the press sensor detects contact
digitalWrite(wheelPin, HIGH);
delay(1000);
digitalWrite(wheelPin, LOW);
@ -535,6 +559,11 @@ void makeCoffee() {
Pump(); // Pump ratio (in seconds) will be read from serial input in final release
digitalWrite(boilerPin, LOW);
}
// Slightly move the press back to create a way for vapor to escape (added 19/11/24)
digitalWrite(invertWheelPin, HIGH);
delay(3000);
digitalWrite(invertWheelPin, LOW);
delay(3000); // Allow pressure to wane
unPress(); // unpressing the press to reset the machine


+ 562
- 551
PyCoffeeNano/PyCoffeeNano.ino.eightanaloginputs.hex
File diff suppressed because it is too large
View File


+ 561
- 550
PyCoffeeNano/PyCoffeeNano.ino.with_bootloader.eightanaloginputs.hex
File diff suppressed because it is too large
View File


Loading…
Cancel
Save