From 33baef8d7e1eeb52811d2c907fd3f54117748355 Mon Sep 17 00:00:00 2001 From: Adema Date: Wed, 12 Mar 2025 08:16:50 +0100 Subject: [PATCH] Upload files to "Hotplate_Oled_420CW_31856_20221122_eeprom" --- .../ActionScreen0.ino | 36 ++++ .../ActionScreen1.ino | 176 ++++++++++++++++++ .../ActionScreen2.ino | 102 ++++++++++ .../ActionScreen3.ino | 105 +++++++++++ .../Actionscripts.ino | 79 ++++++++ 5 files changed, 498 insertions(+) create mode 100644 Hotplate_Oled_420CW_31856_20221122_eeprom/ActionScreen0.ino create mode 100644 Hotplate_Oled_420CW_31856_20221122_eeprom/ActionScreen1.ino create mode 100644 Hotplate_Oled_420CW_31856_20221122_eeprom/ActionScreen2.ino create mode 100644 Hotplate_Oled_420CW_31856_20221122_eeprom/ActionScreen3.ino create mode 100644 Hotplate_Oled_420CW_31856_20221122_eeprom/Actionscripts.ino diff --git a/Hotplate_Oled_420CW_31856_20221122_eeprom/ActionScreen0.ino b/Hotplate_Oled_420CW_31856_20221122_eeprom/ActionScreen0.ino new file mode 100644 index 0000000..5efb761 --- /dev/null +++ b/Hotplate_Oled_420CW_31856_20221122_eeprom/ActionScreen0.ino @@ -0,0 +1,36 @@ +void enter0Script(){ + + if(setAlert == true){ + + setAlert = false; + statusMessage(enter1Pos); + + }else{ + + if (curpos == 0) { + singleScreen(); + } + if (curpos == 1) { + curveSetupScreen(); + } + + } +} + +void down0Script(){ + + changePos(curpos,false); + curpos = curpos + 1; + if (curpos > POSX[scrNr][0]-1) curpos = POSX[scrNr][0]-1; + changePos(curpos,true); + repeatUpdownKeyblk = false; +} + +void up0Script(){ //configure recipes + + changePos(curpos,false); + curpos = curpos - 1; + if (curpos < 0) curpos = 0; + changePos(curpos,true); + repeatUpdownKeyblk = false; +} diff --git a/Hotplate_Oled_420CW_31856_20221122_eeprom/ActionScreen1.ino b/Hotplate_Oled_420CW_31856_20221122_eeprom/ActionScreen1.ino new file mode 100644 index 0000000..4c8dc7b --- /dev/null +++ b/Hotplate_Oled_420CW_31856_20221122_eeprom/ActionScreen1.ino @@ -0,0 +1,176 @@ +void enter1Script(){ + + if(setAlert == true){ + + setAlert = false; + statusMessage(enter1Pos); + + }else{ + + oldenter1Pos = enter1Pos; + if(enter1Pos == 3) enter1Pos = 1; // run after standby + enter1Pos = enter1Pos + 1; + if (enter1Pos > enterMax-1) enter1Pos = 0; + + changeMode(oldenter1Pos, enter1Pos); + if(enter1Pos == 0){ //STOP + enter1Pos0(); + } + if(enter1Pos == 1){ //HEAT + enter1Pos1(); + } + if(enter1Pos == 2){ //RUN + enter1Pos2(); + } + //if(enter1Pos == 3){ //STANDBY + // enter1Pos3(); + //} + } +} + +void enter1Pos0(){ //STOP + statusMessage(enter1Pos); + digitalWrite(vacuum, false); + pins_up_with_delay= 1; + Setpoint = 0; + process_start = false; + oldtimeCounter0 = timeCounter0; + timeCounter0 = 0; + placeValue(0, POSX[1][3]+1, 3, 0, oldtimeCounter0, timeCounter0); //place actual procestime on screen +} + +void enter1Pos1(){ //HEAT + PutEeprom(); + statusMessage(enter1Pos); + pins_up_with_delay= 1; + //digitalWrite(pins, true); + digitalWrite(vacuum, false); + Setpoint = RECIPES[recipeNr0][0]; +} + +void enter1Pos2(){ //RUN + statusMessage(enter1Pos); + digitalWrite(vacuum, true); + digitalWrite(pins, false); + oldenter1Pos = enter1Pos; + Setpoint = RECIPES[recipeNr0][0]; + process_start = true; +} + +void enter1Pos3(){ //STANDBY + statusMessage(enter1Pos); + process_start = false; +} + +void right1Script(){ //configure recipes + + changePos(curpos,false); + curpos = curpos + 1; + if (curpos > POSX[scrNr][0]-1) curpos = POSX[scrNr][0]-1; + changePos(curpos,true); + if (curpos>0) {repeatUpdownKeyblk = true;} else {repeatUpdownKeyblk = false;} +} + +void left1Script(){ + + changePos(curpos,false); + curpos = curpos - 1; + if (curpos < 0 ){ + curpos = 0; + if (enter1Pos == 0) mainScreen(); + } + changePos(curpos,true); + if (curpos>0) {repeatUpdownKeyblk = true;} else {repeatUpdownKeyblk = false;} +} + +void up1Script(){ //configure recipes + + if(enter1Pos == 1){ //HEAT to STOP + process_start = false; + oldenter1Pos = enter1Pos; + enter1Pos = 0; + changeMode(oldenter1Pos, enter1Pos); + statusMessage(enter1Pos); + } else if(enter1Pos == 2){ //RUN to STANDBY + process_start = false; + oldenter1Pos = enter1Pos; + enter1Pos = 3; + changeMode(oldenter1Pos, enter1Pos); + statusMessage(enter1Pos); + //} else if(enter1Pos == 3){ //STNDBY + //process_start = false; + //oldenter1Pos = enter1Pos; + //enter1Pos = 0; + //changeMode(oldenter1Pos, enter1Pos); + //statusMessage(enter1Pos); + } else if(enter1Pos == 3 || enter1Pos == 0){ + if (curpos == 0){ + oldrecipeNr0 = recipeNr0; + recipeNr0 = recipeNr0 + 1; + if (recipeNr0 > recipeMax0) recipeNr0 = 0; + placeValue(2, POSX[1][1]+1, 2, 0, oldrecipeNr0, recipeNr0); //place set recipe number on screen + oldtempValue0 = tempValue0; tempValue0 = RECIPES[recipeNr0][0]; placeValue(2, POSX[1][2]+1, 3, 0, oldtempValue0, tempValue0); + oldtimeValue0 = timeValue0; timeValue0 = RECIPES[recipeNr0][1]; placeValue(2, POSX[1][3]+1, 3, 0, oldtimeValue0, timeValue0); + } + if (curpos == 1){ + oldtempValue0 = tempValue0; + tempValue0 = tempValue0 + 1; + if (tempValue0 > tempMax0) tempValue0 = 0; + RECIPES[recipeNr0][0] = tempValue0; + placeValue(2, POSX[1][2]+1, 3, 0, oldtempValue0, tempValue0); //place set temperature on screen + } + if (curpos == 2){ + oldtimeValue0 = timeValue0; + timeValue0 = timeValue0 + 1; + if (timeValue0 > timeMax0) timeValue0 = 0; + RECIPES[recipeNr0][1] = timeValue0; + placeValue(2, POSX[1][3]+1, 3, 0, oldtimeValue0, timeValue0); //place actual procestime on screen + } + } +} + +void down1Script(){ //configure recipes + + if(enter1Pos == 1){ //HEAT to STOP + process_start = false; + oldenter1Pos = enter1Pos; + enter1Pos = 0; + changeMode(oldenter1Pos, enter1Pos); + statusMessage(enter1Pos); + } else if(enter1Pos == 2){ //RUN to STANDBY + process_start = false; + oldenter1Pos = enter1Pos; + enter1Pos = 3; + changeMode(oldenter1Pos, enter1Pos); + statusMessage(enter1Pos); + //} else if(enter1Pos == 3){ //STANDBY + //process_start = false; + //oldenter1Pos = enter1Pos; + //enter1Pos = 1; + //changeMode(oldenter1Pos, enter1Pos); + //statusMessage(enter1Pos); + } else if(enter1Pos == 3 || enter1Pos == 0){ + if (curpos == 0){ + oldrecipeNr0 = recipeNr0; + recipeNr0 = recipeNr0 - 1; + if (recipeNr0 < 0) recipeNr0 = recipeMax0; + placeValue(2, POSX[1][1]+1, 2, 0, oldrecipeNr0, recipeNr0); //place set recipe number on screen + oldtempValue0 = tempValue0; tempValue0 = RECIPES[recipeNr0][0]; placeValue(2, POSX[1][2]+1, 3, 0, oldtempValue0, tempValue0); + oldtimeValue0 = timeValue0; timeValue0 = RECIPES[recipeNr0][1]; placeValue(2, POSX[1][3]+1, 3, 0, oldtimeValue0, timeValue0); + } + if (curpos == 1){ + oldtempValue0 = tempValue0; + tempValue0 = tempValue0 - 1; + if (tempValue0 < 0) tempValue0 = tempMax0; + RECIPES[recipeNr0][0] = tempValue0; + placeValue(2, POSX[1][2]+1, 3, 0, oldtempValue0, tempValue0); //place set temperature on screen + } + if (curpos == 2){ + oldtimeValue0 = timeValue0; + timeValue0 = timeValue0 - 1; + if (timeValue0 < 0) timeValue0 = timeMax0; + RECIPES[recipeNr0][1] = timeValue0; + placeValue(2, POSX[1][3]+1, 3, 0, oldtimeValue0, timeValue0); //place actual procestime on screen + } + } +} diff --git a/Hotplate_Oled_420CW_31856_20221122_eeprom/ActionScreen2.ino b/Hotplate_Oled_420CW_31856_20221122_eeprom/ActionScreen2.ino new file mode 100644 index 0000000..84803ce --- /dev/null +++ b/Hotplate_Oled_420CW_31856_20221122_eeprom/ActionScreen2.ino @@ -0,0 +1,102 @@ +void enter2Script(){ + + if(setAlert == true){ + + setAlert = false; + statusMessage(enter1Pos); + + }else{ + PutEeprom(); + curveScreen(); + } +} + + +void right2Script(){ //configure curves + + changePos(curpos,false); + curpos = curpos + 1; + if (curpos > POSX[scrNr][0]-1) curpos = POSX[scrNr][0]-1; + changePos(curpos,true); + if (curpos>1) {repeatUpdownKeyblk = true;} else {repeatUpdownKeyblk = false;} +} + +void left2Script(){ + + changePos(curpos,false); + curpos = curpos - 1; + if (curpos < 0) { + curpos = 0; + mainScreen(); + } + changePos(curpos,true); + if (curpos>1) {repeatUpdownKeyblk = true;} else {repeatUpdownKeyblk = false;} +} + +void up2Script(){ //configure curves + + if (curpos == 0){ + oldcurveNr1 = curveNr1; + curveNr1 = curveNr1 + 1; + if (curveNr1 > curveMax1) curveNr1 = curveMax1; + placeValue(2, POSX[2][1]+1, 2, 0, oldcurveNr1, curveNr1); //place set recipe number on screen + oldpointNr1 = pointNr1; + pointNr1 = 0; + placeValue(2, POSX[2][2]+1, 2, 0, oldpointNr1, pointNr1); + oldtempValue1 = tempValue1; tempValue1 = CURVES[curveNr1][pointNr1][0]; placeValue(2, POSX[2][3]+1, 3, 0, oldtempValue1, tempValue1); + oldtimeValue1 = timeValue1; timeValue1 = CURVES[curveNr1][pointNr1][1]; placeValue(2, POSX[2][4]+1, 3, 0, oldtimeValue1, timeValue1); + } else if (curpos == 1){ + oldpointNr1 = pointNr1; + pointNr1 = pointNr1 + 1; + if (pointNr1 > pointMax1) pointNr1 = pointMax1; + placeValue(2, POSX[2][2]+1, 2, 0, oldpointNr1, pointNr1); + oldtempValue1 = tempValue1; tempValue1 = CURVES[curveNr1][pointNr1][0]; placeValue(2, POSX[2][3]+1, 3, 0, oldtempValue1, tempValue1); + oldtimeValue1 = timeValue1; timeValue1 = CURVES[curveNr1][pointNr1][1]; placeValue(2, POSX[2][4]+1, 3, 0, oldtimeValue1, timeValue1); + } else if (curpos == 2){ + oldtempValue1 = tempValue1; + tempValue1 = tempValue1 + 1; + if (tempValue1 > tempMax1) tempValue1 = tempMax1; + placeValue(2, POSX[2][3]+1, 3, 0, oldtempValue1, tempValue1); //place set temperature on screen + CURVES[curveNr1][pointNr1][0] = tempValue1; + } else if (curpos == 3){ + oldtimeValue1 = timeValue1; + timeValue1 = timeValue1 + 1; + if (timeValue1 > timeMax1) timeValue1 = timeMax1; + placeValue(2, POSX[2][4]+1, 3, 0, oldtimeValue1, timeValue1); //place actual procestime on screen + CURVES[curveNr1][pointNr1][1] = timeValue1; + } +} + +void down2Script(){ //configure curves + + if (curpos == 0){ + oldcurveNr1 = curveNr1; + curveNr1 = curveNr1 - 1; + if (curveNr1 < 0) curveNr1 = 0; + placeValue(2, POSX[2][1]+1, 2, 0, oldcurveNr1, curveNr1); //place set recipe number on screen + oldpointNr1 = pointNr1; + pointNr1 = 0; + placeValue(2, POSX[2][2]+1, 2, 0, oldpointNr1, pointNr1); + oldtempValue1 = tempValue1; tempValue1 = CURVES[curveNr1][pointNr1][0]; placeValue(2, POSX[2][3]+1, 3, 0, oldtempValue1, tempValue1); + oldtimeValue1 = timeValue1; timeValue1 = CURVES[curveNr1][pointNr1][1]; placeValue(2, POSX[2][4]+1, 3, 0, oldtimeValue1, timeValue1); + } else if (curpos == 1){ + oldpointNr1 = pointNr1; + pointNr1 = pointNr1 - 1; + if (pointNr1 < 0) pointNr1 = 0; + placeValue(2, POSX[2][2]+1, 2, 0, oldpointNr1, pointNr1); + oldtempValue1 = tempValue1; tempValue1 = CURVES[curveNr1][pointNr1][0]; placeValue(2, POSX[2][3]+1, 3, 0, oldtempValue1, tempValue1); + oldtimeValue1 = timeValue1; timeValue1 = CURVES[curveNr1][pointNr1][1]; placeValue(2, POSX[2][4]+1, 3, 0, oldtimeValue1, timeValue1); + } else if (curpos == 2){ + oldtempValue1 = tempValue1; + tempValue1 = tempValue1 - 1; + if (tempValue1 < 0) tempValue1 = 0; + placeValue(2, POSX[2][3]+1, 3, 0, oldtempValue1, tempValue1); //place set temperature on screen + CURVES[curveNr1][pointNr1][0] = tempValue1; + } else if (curpos == 3){ + oldtimeValue1 = timeValue1; + timeValue1 = timeValue1 - 1; + if (timeValue1 < CURVES[curveNr1][pointNr1-1][1]*(pointNr1>1)) timeValue1 = CURVES[curveNr1][pointNr1-1][1]*(pointNr1>1); + placeValue(2, POSX[2][4]+1, 3, 0, oldtimeValue1, timeValue1); //place actual procestime on screen + CURVES[curveNr1][pointNr1][1] = timeValue1; + } +} diff --git a/Hotplate_Oled_420CW_31856_20221122_eeprom/ActionScreen3.ino b/Hotplate_Oled_420CW_31856_20221122_eeprom/ActionScreen3.ino new file mode 100644 index 0000000..540d038 --- /dev/null +++ b/Hotplate_Oled_420CW_31856_20221122_eeprom/ActionScreen3.ino @@ -0,0 +1,105 @@ +void enter3Script(){ + + if(setAlert == true){ + + setAlert = false; + statusMessage(enter1Pos); + + }else{ + + oldenter1Pos = enter1Pos; + if(enter1Pos == 3) enter1Pos = 1; // run after standby + enter1Pos = enter1Pos + 1; + if (enter1Pos > enterMax-1) enter1Pos = 0; + changeMode(oldenter1Pos, enter1Pos); + + if(enter1Pos == 0){ //STOP + enter3Pos0(); + } + if(enter1Pos == 1){ //HEAT + enter3Pos1(); + } + if(enter1Pos == 2){ //RUN + enter3Pos2(); + } + //if(enter1Pos == 3){ //STANDBY + // enter3Pos3(); + //} + + } +} + + +void enter3Pos0(){ //STOP + //statusMessage(enter1Pos); + //redrawCurve(); + digitalWrite(vacuum, false); + pins_up_with_delay= 1; + oldSetpoint = Setpoint; + Setpoint = 0; + placeValue(0, POSX[1][2] -2, 3, 0, oldSetpoint, Setpoint); + process_startC = false; + oldtimeCounter1 = timeCounter1; + timeCounter1 = 0; + placeValue(0, POSX[1][3]+1, 3, 0, oldtimeCounter1, timeCounter1); //place actual procestime on screen +} + +void enter3Pos1(){ //HEAT + curveScreen(); + //statusMessage(enter1Pos); + //redrawCurve(); + pins_up_with_delay= 1; + //digitalWrite(pins, true); + digitalWrite(vacuum, false); + oldSetpoint = Setpoint; + Setpoint = CURVES[curveNr1][0][0]; + placeValue(0, POSX[1][2] -2, 3, 0, oldSetpoint, Setpoint); +} + +void enter3Pos2(){ //RUN + //statusMessage(enter1Pos); + //redrawCurve(); + digitalWrite(vacuum, true); + digitalWrite(pins, false); + timeValue1 = curvetimescale; + oldSetpoint = Setpoint; + Setpoint = CURVES[curveNr1][pointcnt][0]; + placeValue(0, POSX[1][2] -2, 3, 0, oldSetpoint, Setpoint); + oldenter1Pos = enter1Pos; + process_startC = true; +} + +void enter3Pos3(){ //STANDBY + //statusMessage(enter1Pos); + //redrawCurve(); + process_startC = false; +} + + + +void left3Script(){ + + if (enter1Pos == 0) curveSetupScreen(); + +} + +void up3Script(){ //configure recipes + if(enter1Pos == 2){ //RUN to STANDBY + process_startC = false; + oldenter1Pos = enter1Pos; + enter1Pos = 3; + changeMode(oldenter1Pos, enter1Pos); + //statusMessage(enter1Pos); + } +} + +void down3Script(){ //configure recipes + + if(enter1Pos == 2){ //RUN to STANDBY + process_startC = false; + oldenter1Pos = enter1Pos; + enter1Pos = 3; + changeMode(oldenter1Pos, enter1Pos); + //statusMessage(enter1Pos); + } +} diff --git a/Hotplate_Oled_420CW_31856_20221122_eeprom/Actionscripts.ino b/Hotplate_Oled_420CW_31856_20221122_eeprom/Actionscripts.ino new file mode 100644 index 0000000..5301dc9 --- /dev/null +++ b/Hotplate_Oled_420CW_31856_20221122_eeprom/Actionscripts.ino @@ -0,0 +1,79 @@ +void readKlixon(){ + if (digitalRead(klixon) == false) { + statusMessage(4); + //setAlert = true; + } +} + +void tempControl(int pos){ + oldtempMeas = tempMeas; //Serial.print(Setpoint); Serial.print(" "); Serial.println(tempMeas); + tempMeas = maxthermo.readThermocoupleTemperature(); + //tempMeas = 20.5; + delay(10); + fault = maxthermo.readFault(); + if (fault) { + //thermocoupleErrors(fault); + } else { + if(scrNr == 3){ + placeValue(0, pos+4, 3, 0, oldtempMeas, tempMeas); + outbar(int(Output/65.0), 139, 64); + } else { + placeValue(0, pos, 3, 0, oldtempMeas, tempMeas); + outbar(int(Output/40.95), 83, 102); + } + } + Input = tempMeas; + myPID.Compute(); + analogWrite(heat, Output); + Serial.println(analogRead(heat)); +} + +void processTime(){ + oldtimeCounter0 = timeCounter0; + timeCounter0++; + if (timeCounter0 <= timeValue0){ + placeValue(0, POSX[1][3]+1, 3, 0, oldtimeCounter0, timeCounter0); //place actual procestime on screen + } else { + enter1Pos = 0; + placeValue(0, POSX[1][3]+1, 3, 0, oldtimeCounter0, 0); + changeMode(oldenter1Pos, enter1Pos); + enter1Pos0(); + enter1Pos3(); //STOP + } +} + +void redrawCurve(){ + curveScreen(); + for( int i=0;i0) oled.drawCircle(i+22, bacTemp[i], 1, SSD1322_WHITE); + if(bacPoints[i]>0) oled.drawCircle(i+22, bacPoints[i], 2, SSD1322_WHITE); + } +} +void processTimeC(){ + oldtimeCounter1 = timeCounter1; + timeCounter1++; + if (timeCounter1 <= timeValue1){ + int x = 22+(timeCounter1/curvetimescale)*210; + int y = 60-(tempMeas/curvetempscale)*38; + oled.drawCircle(x, y, 1, SSD1322_WHITE); + lastx = x - 22; bacTemp[lastx] = y; + if (timeCounter1 == CURVES[curveNr1][pointcnt][1]) { + int x = 22+(CURVES[curveNr1][pointcnt][1]/curvetimescale)*210; + int y = 60-(CURVES[curveNr1][pointcnt][0]/curvetempscale)*38; + oled.drawCircle(x, y, 2, SSD1322_WHITE); + bacPoints[x-22] = y; + + pointcnt++; + oldSetpoint = Setpoint; + Setpoint = CURVES[curveNr1][pointcnt][0]; + placeValue(0, POSX[1][2] -2, 3, 0, oldSetpoint, Setpoint); + + } + placeValue(0, POSX[1][3]+1, 3, 0, oldtimeCounter1, timeCounter1); //place actual procestime on screen + } else { + enter1Pos = 0; + changeMode(oldenter1Pos, enter1Pos); + enter3Pos0(); + enter3Pos3(); //STOP + } +}