// set operation state | INPUT : TRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
// Position the cursor at the begining of where the temperature template goes onto the screen
lcd.home();
// Print the target and measured temperature template
if(cooking){
lcd.print("ON : 000*C/000*C");
}
else{
lcd.print("OFF: 000*C/000*C");
}
// Position the cursor at the begining of where the mode and time template goes onto the screen
lcd.setCursor(0,LCD_VERTICAL_RESOLUTION-1);
lcd.print("**** 00:00");
}
voiddisplayStatus(){
// Check whether a template repaint is required
if(repaint){
// Repaint the LCD template
xPaintStatusTemplate();
// Reset the repaint flag after the repaint has been done
repaint=false;
}
// Print positions with no numbers, before the measured temperature value
lcd.setCursor(3,0);
if(basePT100.getCurrentTemperature()<10){
lcd.print(" ");
}
else{
if(basePT100.getCurrentTemperature()<100){
lcd.print(" ");
}
}
// Print measured temperature value onto the LCD
lcd.print(basePT100.getCurrentTemperature(),1);
// Print positions with no numbers, before the target temperature value
lcd.setCursor(11,0);
if(cookTemperature<10){
lcd.print(" ");
}
else{
if(cookTemperature<100){
lcd.print(" ");
}
}
// Print target temperature value onto the LCD
lcd.print(cookTemperature);
// Calculate the numbers on the timer clock
intminutes=(clockCounter-clockIgnore)/60;
intseconds=(clockCounter-clockIgnore)-minutes*60;
// Position the cursor at the begining of where the timer goes onto the screen
lcd.setCursor(10,1);
// Print the timer values onto the LCD
if(minutes<10){
lcd.print(" 0");
}
else{
if(minutes<100){
lcd.print(" ");
}
}
lcd.print(minutes);
lcd.print(":");
if(seconds<10){
lcd.print("0");
}
lcd.print(seconds);
}
voiddisplayMainMenu(){
switch(menu_position[0]){
caseeMainMenu_GO:{
MainMenu_GO();
menu_position[0]=-1;
// reset operation state | INPUT : TRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
// reset operation state | INPUT : TRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
// reset operation state | INPUT : TRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
// reset operation state | INPUT : TRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
// reset operation state | INPUT : TRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
// reset operation state | INPUT : TRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
lcdPrint("Error","The brewer has stoped working properly. Please shutdown NOW for your safety!");
MainMenu_Proteolytic();
state=state_error;
error=catastrofic_failure_program;
menu_position[0]=-1;
// reset operation state | INPUT : TRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
// reset operation state | INPUT : TRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
if(!(digitalRead(PinSW))){// check if pushbutton is pressed
menu_position[1]=rotaryEncoderVirtualPosition;
while(!digitalRead(PinSW)){}// wait til switch is released
delay(10);// debounce
break;
}
}
}
}
break;
break;
}
}
casemain_auto:{
caseeMainMenu_AlphaAmylase:{
switch(menu_position[1]){
MainMenu_AlphaAmylase();
caseauto_recipe:{
// do work
menu_position[0]=-1;
menu_position[1]=-1;
// reset operation state | INPUT : TRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
if(!(digitalRead(PinSW))){// check if pushbutton is pressed
menu_position[1]=rotaryEncoderVirtualPosition;
while(!digitalRead(PinSW)){}// wait til switch is released
delay(10);// debounce
break;
}
}
}
}
break;
break;
}
}
default:{
caseeMainMenu_Mashout:{
// reset menu variables
MainMenu_Mashout();
//rotaryEncoderVirtualPosition = 0;
menuSize=2;
menu_position[0]=-1;
// reset operation state | INPUT : TRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
// reset operation state | INPUT : TRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
// reset operation state | INPUT : TRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
// reset operation state | INPUT : TRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
// reset operation state | INPUT : TRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
// reset operation state | INPUT : TRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
// reset operation state | INPUT : TRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
// reset operation state | INPUT : TRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
// Deviation between the cook temperature set and the cook temperature measured
if(diference<0.0){
diference=diference*(-1.0);
overTemperature=true;
}
// Calculate applied wattage, based on the distance from the target temperature
if(overTemperature){
// turn it off
wattage=0.0;
}else{
if(diffrence<=1){
// turn it off
wattage=0.0;
}else{
if(diffrence<=3){
// pulse lightly at 500 watt
wattage=500.0;
}else{
if(diffrence<=6){
// pulse moderately at 1000 watt
wattage=1000.0;
}else{
if(diffrence<=9){
// pulse hardly at 2000 watt
wattage=2000.0;
}else{
//pulse constantly at HEATING_ELEMENT_MAX_WATTAGE watt
wattage=HEATING_ELEMENT_MAX_WATTAGE;
}
}
}
}
}
// Update the recorded time for the begining of the window, if the previous window has passed
while((millis()-windowStartTime)>WindowSize){// Check if it's time to vary the pulse width modulation and if so do it by shifting the "Relay in ON" Window
// #################################################### Set Variables ##################################################################
intgetTimer(intinit){
intgetTimer(intinit){
state_machineinitialState=state;
// set operation state | INPUT : TRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
// set operation state | INPUT : TRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep