Commit b341fe27 authored by João Lino's avatar João Lino

Start from stage

Start from stage
parent 0c5f686d
......@@ -16,6 +16,7 @@ enum eRotaryEncoderMode {
// menu
enum eMenuType {
eMenuType_Main,
eMenuType_StartFromStage,
eMenuType_BeerProfile,
eMenuType_Stage,
eMenuType_Malt,
......@@ -23,7 +24,8 @@ enum eMenuType {
};
enum eMainMenuOptions {
eMainMenu_NULL,
eMainMenu_GO,
eMainMenu_GO_FROM_STAGE,
eMainMenu_GO,
eMainMenu_STOP,
eMainMenu_SKIP,
eMainMenu_BeerProfile,
......@@ -53,15 +55,15 @@ enum eStageMenuOptions {
};
enum eBeerProfileMenuOptions {
eBeerProfileMenu_NULL,
eBeerProfileMenu_Basic,
eBeerProfileMenu_Trigo,
eBeerProfileMenu_IPA,
eBeerProfileMenu_Belga,
eBeerProfileMenu_Red,
eBeerProfileMenu_APA,
eBeerProfileMenu_Custom,
eBeerProfileMenu_Back
eBeerProfileMenu_NULL,
eBeerProfileMenu_Basic,
eBeerProfileMenu_Trigo,
eBeerProfileMenu_IPA,
eBeerProfileMenu_Belga,
eBeerProfileMenu_Red,
eBeerProfileMenu_APA,
eBeerProfileMenu_Custom,
eBeerProfileMenu_Back
};
enum eMaltMenuOptions {
......@@ -73,6 +75,7 @@ enum eMaltMenuOptions {
enum eSettingsMenuOptions {
eSettingsMenu_NULL,
eSettingsMenu_Pump,
eSettingsMenu_PT100_Element,
eSettingsMenu_PT100_Up,
eSettingsMenu_PT100_Down,
......@@ -107,4 +110,4 @@ enum eBeerProfile {
eBeerProfile_Custom
};
#endif
\ No newline at end of file
#endif
......@@ -174,6 +174,11 @@ boolean displayMainMenu(LiquidCrystal_I2C *lcd, eMainMenuOptions position, boole
lcd->print("Brewery Menu");
switch(position) {
case eMainMenu_GO_FROM_STAGE: {
lcd->setCursor (0,1); // go to start of 2nd line
lcd->print("-> GO FROM STAGE");
break;
}
case eMainMenu_GO: {
lcd->setCursor (0,1); // go to start of 2nd line
lcd->print("-> GO ");
......@@ -461,4 +466,4 @@ boolean displaySettingsMenu(LiquidCrystal_I2C *lcd, eSettingsMenuOptions positio
}
return ret;
}
\ No newline at end of file
}
/*
void termometerCalibration() {
float temperaturePumpOFF = 200.0;
float temperaturePumpON = 200.0;
#ifdef DEBUG
debugPrintFunction("termometerCalibration");
#endif
for( int i = 0; i < 300; i++ ) {
basePT100.measure();
delay(100);
}
temperaturePumpOFF = basePT100.getCurrentTemperature();
analogWrite(PUMP_PIN, PUMP_SPEED_MAX);
for( int i = 0; i < 300; i++ ) {
basePT100.measure();
delay(100);
}
temperaturePumpON = basePT100.getCurrentTemperature();
analogWrite(PUMP_PIN, PUMP_SPEED_STOP);
#ifdef DEBUG
debugPrintVar("temperaturePumpOFF", temperaturePumpOFF);
debugPrintVar("temperaturePumpON", temperaturePumpON);
debugPrintVar("diff", temperaturePumpON - temperaturePumpOFF);
#endif
}
*/
\ No newline at end of file
#ifndef MELODY_h
#define MELODY_h
#define NOTE_B0 31
#define NOTE_C1 33
#define NOTE_CS1 35
#define NOTE_D1 37
#define NOTE_DS1 39
#define NOTE_E1 41
#define NOTE_F1 44
#define NOTE_FS1 46
#define NOTE_G1 49
#define NOTE_GS1 52
#define NOTE_A1 55
#define NOTE_AS1 58
#define NOTE_B1 62
#define NOTE_C2 65
#define NOTE_CS2 69
#define NOTE_D2 73
#define NOTE_DS2 78
#define NOTE_E2 82
#define NOTE_F2 87
#define NOTE_FS2 93
#define NOTE_G2 98
#define NOTE_GS2 104
#define NOTE_A2 110
#define NOTE_AS2 117
#define NOTE_B2 123
#define NOTE_C3 131
#define NOTE_CS3 139
#define NOTE_D3 147
#define NOTE_DS3 156
#define NOTE_E3 165
#define NOTE_F3 175
#define NOTE_FS3 185
#define NOTE_G3 196
#define NOTE_GS3 208
#define NOTE_A3 220
#define NOTE_AS3 233
#define NOTE_B3 247
#define NOTE_C4 262
#define NOTE_CS4 277
#define NOTE_D4 294
#define NOTE_DS4 311
#define NOTE_E4 330
#define NOTE_F4 349
#define NOTE_FS4 370
#define NOTE_G4 392
#define NOTE_GS4 415
#define NOTE_A4 440
#define NOTE_AS4 466
#define NOTE_B4 494
#define NOTE_C5 523
#define NOTE_CS5 554
#define NOTE_D5 587
#define NOTE_DS5 622
#define NOTE_E5 659
#define NOTE_F5 698
#define NOTE_FS5 740
#define NOTE_G5 784
#define NOTE_GS5 831
#define NOTE_A5 880
#define NOTE_AS5 932
#define NOTE_B5 988
#define NOTE_C6 1047
#define NOTE_CS6 1109
#define NOTE_D6 1175
#define NOTE_DS6 1245
#define NOTE_E6 1319
#define NOTE_F6 1397
#define NOTE_FS6 1480
#define NOTE_G6 1568
#define NOTE_GS6 1661
#define NOTE_A6 1760
#define NOTE_AS6 1865
#define NOTE_B6 1976
#define NOTE_C7 2093
#define NOTE_CS7 2217
#define NOTE_D7 2349
#define NOTE_DS7 2489
#define NOTE_E7 2637
#define NOTE_F7 2794
#define NOTE_FS7 2960
#define NOTE_G7 3136
#define NOTE_GS7 3322
#define NOTE_A7 3520
#define NOTE_AS7 3729
#define NOTE_B7 3951
#define NOTE_C8 4186
#define NOTE_CS8 4435
#define NOTE_D8 4699
#define NOTE_DS8 4978
// Start by defining the relationship between note, period, & frequency.
#define _c 3830 // 261 Hz
#define _d 3400 // 294 Hz
#define _e 3038 // 329 Hz
#define _f 2864 // 349 Hz
#define _g 2550 // 392 Hz
#define _a 2272 // 440 Hz
#define _b 2028 // 493 Hz
#define _C 1912 // 523 Hz
// Define a special note, 'R', to represent a rest
#define _R 0
#define MELODY_SUPER_MARIO 1
#define MELODY_UNDERWORLD 2
#define MELODY_SUPER_MARIO_START 3
// melody[] is an array of notes, accompanied by beats[],
// which sets each note's relative length (higher #, longer note)
void buzz(int targetPin, long frequency, long length);
void sing(int s, int pin);
#endif
\ No newline at end of file
#ifndef __PROFILES
#define __PROFILES
// BASIC
#define PROFILE_BASIC_STARTPOINT_TIME 120;
#define PROFILE_BASIC_BETAGLUCANASE_TIME 0;
#define PROFILE_BASIC_DEBRANCHING_TIME 0;
#define PROFILE_BASIC_PROTEOLYTIC_TIME 0;
#define PROFILE_BASIC_BETAAMYLASE_TIME 3600;
#define PROFILE_BASIC_ALPHAAMYLASE_TIME 1800;
#define PROFILE_BASIC_MASHOUT_TIME 300;
#define PROFILE_BASIC_RECIRCULATION_TIME 1200;
#define PROFILE_BASIC_SPARGE_TIME 1200;
#define PROFILE_BASIC_BOIL_TIME 5400;
#define PROFILE_BASIC_COOLING_TIME 120;
#define PROFILE_BASIC_STARTPOINT_TEMPERATURE 30;
#define PROFILE_BASIC_BETAGLUCANASE_TEMPERATURE 40;
#define PROFILE_BASIC_DEBRANCHING_TEMPERATURE 40;
#define PROFILE_BASIC_PROTEOLYTIC_TEMPERATURE 50;
#define PROFILE_BASIC_BETAAMYLASE_TEMPERATURE 60;
#define PROFILE_BASIC_ALPHAAMYLASE_TEMPERATURE 70;
#define PROFILE_BASIC_MASHOUT_TEMPERATURE 80;
#define PROFILE_BASIC_RECIRCULATION_TEMPERATURE 80;
#define PROFILE_BASIC_SPARGE_TEMPERATURE 80;
#define PROFILE_BASIC_BOIL_TEMPERATURE 100;
#define PROFILE_BASIC_COOLING_TEMPERATURE 25;
// TRIGO
#define PROFILE_TRIGO_STARTPOINT_TIME PROFILE_BASIC_STARTPOINT_TIME;
#define PROFILE_TRIGO_BETAGLUCANASE_TIME PROFILE_BASIC_BETAGLUCANASE_TIME;
#define PROFILE_TRIGO_DEBRANCHING_TIME PROFILE_BASIC_DEBRANCHING_TIME;
#define PROFILE_TRIGO_PROTEOLYTIC_TIME PROFILE_BASIC_PROTEOLYTIC_TIME;
#define PROFILE_TRIGO_BETAAMYLASE_TIME PROFILE_BASIC_BETAAMYLASE_TIME;
#define PROFILE_TRIGO_ALPHAAMYLASE_TIME PROFILE_BASIC_ALPHAAMYLASE_TIME;
#define PROFILE_TRIGO_MASHOUT_TIME PROFILE_BASIC_MASHOUT_TIME;
#define PROFILE_TRIGO_RECIRCULATION_TIME PROFILE_BASIC_RECIRCULATION_TIME;
#define PROFILE_TRIGO_SPARGE_TIME PROFILE_BASIC_SPARGE_TIME;
#define PROFILE_TRIGO_BOIL_TIME PROFILE_BASIC_BOIL_TIME;
#define PROFILE_TRIGO_COOLING_TIME PROFILE_BASIC_COOLING_TIME;
#define PROFILE_TRIGO_STARTPOINT_TEMPERATURE 45;
#define PROFILE_TRIGO_BETAGLUCANASE_TEMPERATURE PROFILE_BASIC_BETAGLUCANASE_TEMPERATURE;
#define PROFILE_TRIGO_DEBRANCHING_TEMPERATURE PROFILE_BASIC_DEBRANCHING_TEMPERATURE;
#define PROFILE_TRIGO_PROTEOLYTIC_TEMPERATURE PROFILE_BASIC_PROTEOLYTIC_TEMPERATURE;
#define PROFILE_TRIGO_BETAAMYLASE_TEMPERATURE 62;
#define PROFILE_TRIGO_ALPHAAMYLASE_TEMPERATURE PROFILE_BASIC_ALPHAAMYLASE_TEMPERATURE;
#define PROFILE_TRIGO_MASHOUT_TEMPERATURE 78;
#define PROFILE_TRIGO_RECIRCULATION_TEMPERATURE PROFILE_BASIC_RECIRCULATION_TEMPERATURE;
#define PROFILE_TRIGO_SPARGE_TEMPERATURE PROFILE_BASIC_SPARGE_TEMPERATURE;
#define PROFILE_TRIGO_BOIL_TEMPERATURE PROFILE_BASIC_BOIL_TEMPERATURE;
#define PROFILE_TRIGO_COOLING_TEMPERATURE PROFILE_BASIC_COOLING_TEMPERATURE;
// IPA
#define PROFILE_IPA_STARTPOINT_TIME PROFILE_BASIC_STARTPOINT_TIME;
#define PROFILE_IPA_BETAGLUCANASE_TIME PROFILE_BASIC_BETAGLUCANASE_TIME;
#define PROFILE_IPA_DEBRANCHING_TIME PROFILE_BASIC_DEBRANCHING_TIME;
#define PROFILE_IPA_PROTEOLYTIC_TIME PROFILE_BASIC_PROTEOLYTIC_TIME;
#define PROFILE_IPA_BETAAMYLASE_TIME PROFILE_BASIC_BETAAMYLASE_TIME;
#define PROFILE_IPA_ALPHAAMYLASE_TIME PROFILE_BASIC_ALPHAAMYLASE_TIME;
#define PROFILE_IPA_MASHOUT_TIME PROFILE_BASIC_MASHOUT_TIME;
#define PROFILE_IPA_RECIRCULATION_TIME PROFILE_BASIC_RECIRCULATION_TIME;
#define PROFILE_IPA_SPARGE_TIME PROFILE_BASIC_SPARGE_TIME;
#define PROFILE_IPA_BOIL_TIME 3900;
#define PROFILE_IPA_COOLING_TIME PROFILE_BASIC_COOLING_TIME;
#define PROFILE_IPA_STARTPOINT_TEMPERATURE PROFILE_TRIGO_STARTPOINT_TEMPERATURE;
#define PROFILE_IPA_BETAGLUCANASE_TEMPERATURE PROFILE_BASIC_BETAGLUCANASE_TEMPERATURE;
#define PROFILE_IPA_DEBRANCHING_TEMPERATURE PROFILE_BASIC_DEBRANCHING_TEMPERATURE;
#define PROFILE_IPA_PROTEOLYTIC_TEMPERATURE PROFILE_BASIC_PROTEOLYTIC_TEMPERATURE;
#define PROFILE_IPA_BETAAMYLASE_TEMPERATURE PROFILE_TRIGO_BETAAMYLASE_TEMPERATURE;
#define PROFILE_IPA_ALPHAAMYLASE_TEMPERATURE PROFILE_BASIC_ALPHAAMYLASE_TEMPERATURE;
#define PROFILE_IPA_MASHOUT_TEMPERATURE PROFILE_TRIGO_MASHOUT_TEMPERATURE;
#define PROFILE_IPA_RECIRCULATION_TEMPERATURE PROFILE_BASIC_RECIRCULATION_TEMPERATURE;
#define PROFILE_IPA_SPARGE_TEMPERATURE PROFILE_BASIC_SPARGE_TEMPERATURE;
#define PROFILE_IPA_BOIL_TEMPERATURE PROFILE_BASIC_BOIL_TEMPERATURE;
#define PROFILE_IPA_COOLING_TEMPERATURE PROFILE_BASIC_COOLING_TEMPERATURE;
// BELGA
#define PROFILE_BELGA_STARTPOINT_TIME PROFILE_BASIC_STARTPOINT_TIME;
#define PROFILE_BELGA_BETAGLUCANASE_TIME PROFILE_BASIC_BETAGLUCANASE_TIME;
#define PROFILE_BELGA_DEBRANCHING_TIME PROFILE_BASIC_DEBRANCHING_TIME;
#define PROFILE_BELGA_PROTEOLYTIC_TIME PROFILE_BASIC_PROTEOLYTIC_TIME;
#define PROFILE_BELGA_BETAAMYLASE_TIME PROFILE_BASIC_BETAAMYLASE_TIME;
#define PROFILE_BELGA_ALPHAAMYLASE_TIME PROFILE_BASIC_ALPHAAMYLASE_TIME;
#define PROFILE_BELGA_MASHOUT_TIME PROFILE_BASIC_MASHOUT_TIME;
#define PROFILE_BELGA_RECIRCULATION_TIME PROFILE_BASIC_RECIRCULATION_TIME;
#define PROFILE_BELGA_SPARGE_TIME PROFILE_BASIC_SPARGE_TIME;
#define PROFILE_BELGA_BOIL_TIME PROFILE_BASIC_BOIL_TIME;
#define PROFILE_BELGA_COOLING_TIME PROFILE_BASIC_COOLING_TIME;
#define PROFILE_BELGA_STARTPOINT_TEMPERATURE PROFILE_TRIGO_STARTPOINT_TEMPERATURE;
#define PROFILE_BELGA_BETAGLUCANASE_TEMPERATURE PROFILE_BASIC_BETAGLUCANASE_TEMPERATURE;
#define PROFILE_BELGA_DEBRANCHING_TEMPERATURE PROFILE_BASIC_DEBRANCHING_TEMPERATURE;
#define PROFILE_BELGA_PROTEOLYTIC_TEMPERATURE PROFILE_BASIC_PROTEOLYTIC_TEMPERATURE;
#define PROFILE_BELGA_BETAAMYLASE_TEMPERATURE PROFILE_TRIGO_BETAAMYLASE_TEMPERATURE;
#define PROFILE_BELGA_ALPHAAMYLASE_TEMPERATURE PROFILE_BASIC_ALPHAAMYLASE_TEMPERATURE;
#define PROFILE_BELGA_MASHOUT_TEMPERATURE PROFILE_TRIGO_MASHOUT_TEMPERATURE;
#define PROFILE_BELGA_RECIRCULATION_TEMPERATURE PROFILE_BASIC_RECIRCULATION_TEMPERATURE;
#define PROFILE_BELGA_SPARGE_TEMPERATURE PROFILE_BASIC_SPARGE_TEMPERATURE;
#define PROFILE_BELGA_BOIL_TEMPERATURE PROFILE_BASIC_BOIL_TEMPERATURE;
#define PROFILE_BELGA_COOLING_TEMPERATURE PROFILE_BASIC_COOLING_TEMPERATURE;
// RED
#define PROFILE_RED_STARTPOINT_TIME PROFILE_BASIC_STARTPOINT_TIME;
#define PROFILE_RED_BETAGLUCANASE_TIME PROFILE_BASIC_BETAGLUCANASE_TIME;
#define PROFILE_RED_DEBRANCHING_TIME PROFILE_BASIC_DEBRANCHING_TIME;
#define PROFILE_RED_PROTEOLYTIC_TIME PROFILE_BASIC_PROTEOLYTIC_TIME;
#define PROFILE_RED_BETAAMYLASE_TIME PROFILE_BASIC_BETAAMYLASE_TIME;
#define PROFILE_RED_ALPHAAMYLASE_TIME PROFILE_BASIC_ALPHAAMYLASE_TIME;
#define PROFILE_RED_MASHOUT_TIME PROFILE_BASIC_MASHOUT_TIME;
#define PROFILE_RED_RECIRCULATION_TIME PROFILE_BASIC_RECIRCULATION_TIME;
#define PROFILE_RED_SPARGE_TIME PROFILE_BASIC_SPARGE_TIME;
#define PROFILE_RED_BOIL_TIME PROFILE_BASIC_BOIL_TIME;
#define PROFILE_RED_COOLING_TIME PROFILE_BASIC_COOLING_TIME;
#define PROFILE_RED_STARTPOINT_TEMPERATURE PROFILE_TRIGO_STARTPOINT_TEMPERATURE;
#define PROFILE_RED_BETAGLUCANASE_TEMPERATURE PROFILE_BASIC_BETAGLUCANASE_TEMPERATURE;
#define PROFILE_RED_DEBRANCHING_TEMPERATURE PROFILE_BASIC_DEBRANCHING_TEMPERATURE;
#define PROFILE_RED_PROTEOLYTIC_TEMPERATURE PROFILE_BASIC_PROTEOLYTIC_TEMPERATURE;
#define PROFILE_RED_BETAAMYLASE_TEMPERATURE PROFILE_TRIGO_BETAAMYLASE_TEMPERATURE;
#define PROFILE_RED_ALPHAAMYLASE_TEMPERATURE PROFILE_BASIC_ALPHAAMYLASE_TEMPERATURE;
#define PROFILE_RED_MASHOUT_TEMPERATURE PROFILE_TRIGO_MASHOUT_TEMPERATURE;
#define PROFILE_RED_RECIRCULATION_TEMPERATURE PROFILE_BASIC_RECIRCULATION_TEMPERATURE;
#define PROFILE_RED_SPARGE_TEMPERATURE PROFILE_BASIC_SPARGE_TEMPERATURE;
#define PROFILE_RED_BOIL_TEMPERATURE PROFILE_BASIC_BOIL_TEMPERATURE;
#define PROFILE_RED_COOLING_TEMPERATURE PROFILE_BASIC_COOLING_TEMPERATURE;
// APA
#define PROFILE_APA_STARTPOINT_TIME PROFILE_BASIC_STARTPOINT_TIME;
#define PROFILE_APA_BETAGLUCANASE_TIME PROFILE_BASIC_BETAGLUCANASE_TIME;
#define PROFILE_APA_DEBRANCHING_TIME PROFILE_BASIC_DEBRANCHING_TIME;
#define PROFILE_APA_PROTEOLYTIC_TIME PROFILE_BASIC_PROTEOLYTIC_TIME;
#define PROFILE_APA_BETAAMYLASE_TIME PROFILE_BASIC_BETAAMYLASE_TIME;
#define PROFILE_APA_ALPHAAMYLASE_TIME PROFILE_BASIC_ALPHAAMYLASE_TIME;
#define PROFILE_APA_MASHOUT_TIME PROFILE_BASIC_MASHOUT_TIME;
#define PROFILE_APA_RECIRCULATION_TIME PROFILE_BASIC_RECIRCULATION_TIME;
#define PROFILE_APA_SPARGE_TIME PROFILE_BASIC_SPARGE_TIME;
#define PROFILE_APA_BOIL_TIME PROFILE_BASIC_BOIL_TIME;
#define PROFILE_APA_COOLING_TIME PROFILE_BASIC_COOLING_TIME;
#define PROFILE_APA_STARTPOINT_TEMPERATURE PROFILE_TRIGO_STARTPOINT_TEMPERATURE;
#define PROFILE_APA_BETAGLUCANASE_TEMPERATURE PROFILE_BASIC_BETAGLUCANASE_TEMPERATURE;
#define PROFILE_APA_DEBRANCHING_TEMPERATURE PROFILE_BASIC_DEBRANCHING_TEMPERATURE;
#define PROFILE_APA_PROTEOLYTIC_TEMPERATURE PROFILE_BASIC_PROTEOLYTIC_TEMPERATURE;
#define PROFILE_APA_BETAAMYLASE_TEMPERATURE PROFILE_TRIGO_BETAAMYLASE_TEMPERATURE;
#define PROFILE_APA_ALPHAAMYLASE_TEMPERATURE PROFILE_BASIC_ALPHAAMYLASE_TEMPERATURE;
#define PROFILE_APA_MASHOUT_TEMPERATURE PROFILE_TRIGO_MASHOUT_TEMPERATURE;
#define PROFILE_APA_RECIRCULATION_TEMPERATURE PROFILE_BASIC_RECIRCULATION_TEMPERATURE;
#define PROFILE_APA_SPARGE_TEMPERATURE PROFILE_BASIC_SPARGE_TEMPERATURE;
#define PROFILE_APA_BOIL_TEMPERATURE PROFILE_BASIC_BOIL_TEMPERATURE;
#define PROFILE_APA_COOLING_TEMPERATURE PROFILE_BASIC_COOLING_TEMPERATURE;
// CUSTOM
#define PROFILE_CUSTOM_STARTPOINT_TIME PROFILE_BASIC_STARTPOINT_TIME;
#define PROFILE_CUSTOM_BETAGLUCANASE_TIME PROFILE_BASIC_STARTPOINT_TIME;
#define PROFILE_CUSTOM_DEBRANCHING_TIME PROFILE_BASIC_STARTPOINT_TIME;
#define PROFILE_CUSTOM_PROTEOLYTIC_TIME PROFILE_BASIC_STARTPOINT_TIME;
#define PROFILE_CUSTOM_BETAAMYLASE_TIME PROFILE_BASIC_STARTPOINT_TIME;
#define PROFILE_CUSTOM_ALPHAAMYLASE_TIME PROFILE_BASIC_STARTPOINT_TIME;
#define PROFILE_CUSTOM_MASHOUT_TIME PROFILE_BASIC_STARTPOINT_TIME;
#define PROFILE_CUSTOM_RECIRCULATION_TIME PROFILE_BASIC_STARTPOINT_TIME;
#define PROFILE_CUSTOM_SPARGE_TIME PROFILE_BASIC_STARTPOINT_TIME;
#define PROFILE_CUSTOM_BOIL_TIME PROFILE_BASIC_STARTPOINT_TIME;
#define PROFILE_CUSTOM_COOLING_TIME PROFILE_BASIC_STARTPOINT_TIME;
#define PROFILE_CUSTOM_STARTPOINT_TEMPERATURE 30;
#define PROFILE_CUSTOM_BETAGLUCANASE_TEMPERATURE 45;
#define PROFILE_CUSTOM_DEBRANCHING_TEMPERATURE 50;
#define PROFILE_CUSTOM_PROTEOLYTIC_TEMPERATURE 55;
#define PROFILE_CUSTOM_BETAAMYLASE_TEMPERATURE 65;
#define PROFILE_CUSTOM_ALPHAAMYLASE_TEMPERATURE 75;
#define PROFILE_CUSTOM_MASHOUT_TEMPERATURE 70;
#define PROFILE_CUSTOM_RECIRCULATION_TEMPERATURE 85;
#define PROFILE_CUSTOM_SPARGE_TEMPERATURE 90;
#define PROFILE_CUSTOM_BOIL_TEMPERATURE 95;
#define PROFILE_CUSTOM_COOLING_TEMPERATURE 100;
#endif //__PROFILES
/*
Temperature.cpp - Library for measuring temperature with a Temperature.
Created by João Lino, June 24, 2015.
Released into the public domain.
*/
#include "Arduino.h"
#include "Temperature.h"
Temperature::Temperature(char *name,
int OutputPin_SensorPower,
int InputPin_TemperatureReading,
int TimeBetweenReadings,
float m1,
float m2,
float b1,
float b2) {
_name = name;
_OutputPin_SensorPower = OutputPin_SensorPower;
_InputPin_TemperatureReading = InputPin_TemperatureReading;
_TimeBetweenReadings = TimeBetweenReadings;
_m1 = m1;
_m2 = m2;
_b1 = b1;
_b2 = b2;
_temperatureAverage = 24.0;
_measuredTemperature = 24.0;
_lastTemperatureRead = 0;
_VoutAnalogSample = -1;
_VoutPreviousAnalogSample = -1.0;
_temperatureMeasurementsMarker = 0;
_rTemperatureMeasurementsMarker = 0;
_measuredTemperatureDeviation = 0.0;
_pump = false;
analogReference(INTERNAL1V1); // EXTERNAL && INTERNAL2V56 && INTERNAL1V1
pinMode(_OutputPin_SensorPower, OUTPUT); // setup temperature sensor input pin
digitalWrite(_OutputPin_SensorPower, LOW); // initialize sensor on
}
void Temperature::safeHardwarePowerOff() {
digitalWrite(_OutputPin_SensorPower, LOW); // Turn temperature sensor OFF for safety
}
void Temperature::measure(boolean ln) {
if(millis() - _lastTemperatureRead >= _TimeBetweenReadings) { //time to measure temperature
/** measure Vout analog sample */
digitalWrite(_OutputPin_SensorPower, HIGH); // initialize sensor on
delay(10);
_VoutAnalogSample = analogRead(_InputPin_TemperatureReading); // Get a reading
digitalWrite(_OutputPin_SensorPower, LOW); // initialize sensor on
_lastTemperatureRead = millis(); // Mark time of temperature reading
_rTemperatureMeasurementsMarker++; // Position reading buffer marker at the last updated position
if(_rTemperatureMeasurementsMarker >= TEMPERATURE_AVERAGE_VALUE_I) _rTemperatureMeasurementsMarker = 0; // Check that it has not gone out of the buffer range
_rTemperatureMeasurements[_rTemperatureMeasurementsMarker] = _VoutAnalogSample;
//workingSample = GetMedianAverage(_rTemperatureMeasurements, 6);
float workingSample = GetMedian(_rTemperatureMeasurements);
/** Calculate temperature value */
if(_pump) {
_measuredTemperature = ( workingSample - _b1 ) / _m1;
} else {
_measuredTemperature = ( workingSample - _b2 ) / _m2;
}
#ifdef DEBUG
Serial.print(_name);
Serial.print(",");
//Serial.print(_VoutAnalogSample);
//Serial.print(workingSample);
Serial.print(_measuredTemperature);
//Serial.print(GetMedianAverage(_rTemperatureMeasurements, 6));
Serial.print(",");
if(ln) Serial.println("");
#endif
}
}
float Temperature::GetMedian(int array[]){
int sorted[TEMPERATURE_AVERAGE_VALUE_I];
float value = 0.0;
for(int x = 0; x < TEMPERATURE_AVERAGE_VALUE_I; x++) {
sorted[x] = array[x];
}
//ARRANGE VALUES
for(int x = 0; x < TEMPERATURE_AVERAGE_VALUE_I; x++){
for(int y = 0; y < TEMPERATURE_AVERAGE_VALUE_I - 1; y++){
if(sorted[y]>sorted[y+1]){
int temp = sorted[y+1];
sorted[y+1] = sorted[y];
sorted[y] = temp;
}
}
}
//CALCULATE THE MEDIAN (middle number)
if(TEMPERATURE_AVERAGE_VALUE_I % 2 != 0){// is the # of elements odd?
value = (float) sorted[((TEMPERATURE_AVERAGE_VALUE_I-1)/2) + 1];
}
else{// then it's even! :)
value = ((float) ( sorted[(TEMPERATURE_AVERAGE_VALUE_I/2)] + sorted[TEMPERATURE_AVERAGE_VALUE_I/2 + 1] )) / 2.0;
}
return value;
}
float Temperature::GetMedianAverage(int array[], int range) {
int sorted[TEMPERATURE_AVERAGE_VALUE_I];
float value = 0.0;
for(int x = 0; x < TEMPERATURE_AVERAGE_VALUE_I; x++) {
sorted[x] = array[x];
}
//ARRANGE VALUES
for(int x = 0; x < TEMPERATURE_AVERAGE_VALUE_I; x++){
for(int y = 0; y < TEMPERATURE_AVERAGE_VALUE_I - 1; y++){
if(sorted[y]>sorted[y+1]){
int temp = sorted[y+1];
sorted[y+1] = sorted[y];
sorted[y] = temp;
}
}
}
//CALCULATE THE MEDIAN (middle number)
if(TEMPERATURE_AVERAGE_VALUE_I % 2 != 0){// is the # of elements odd?
int temp = ((TEMPERATURE_AVERAGE_VALUE_I+1)/2)-1;
value = (float) sorted[temp];
}
else{// then it's even! :)
value = ((float) ( sorted[(TEMPERATURE_AVERAGE_VALUE_I/2)-1] + sorted[TEMPERATURE_AVERAGE_VALUE_I/2] )) / 2.0;
}
int range_ = range;
if(range_ % 2 != 0) {// is the # of elements odd?
range_++;
}
int sum = 0;
for( int x = 0; x < range_; x++) {
sum += sorted[ (TEMPERATURE_AVERAGE_VALUE_I / 2 - range_ / 2 + x ) ];
}
value = ((float) (sum / range_));
return value;
}
float Temperature::GetMode(float new_array[]) {
int ipRepetition[TEMPERATURE_AVERAGE_VALUE_I];
for (int i = 0; i < TEMPERATURE_AVERAGE_VALUE_I; i++) {
ipRepetition[i] = 0;//initialize each element to 0
int j = 0;//
while ((j < i) && (new_array[i] != new_array[j])) {
if (new_array[i] != new_array[j]) {
j++;
}
}
(ipRepetition[j])++;
}
int iMaxRepeat = 0;
for (int i = 1; i < TEMPERATURE_AVERAGE_VALUE_I; i++) {
if (ipRepetition[i] > ipRepetition[iMaxRepeat]) {
iMaxRepeat = i;
}
}
return new_array[iMaxRepeat];
}
float Temperature::getCurrentTemperature() {
return _measuredTemperature; // - 4.41;
}
float Temperature::setPumpStatus( bool pump ) {
_pump = pump;
return _pump;
}
\ No newline at end of file
/*
Temperature.cpp - Library for measuring temperature with a Temperature.
Created by João Lino, December 22, 2015.
Released into the public domain.
*/
#include "Arduino.h"
#include "Temperature.h"
Temperature::Temperature(char *name,
int OutputPin_SensorPower,
int InputPin_TemperatureReading,
int TimeBetweenReadings) {
_name = name;
_OutputPin_SensorPower = OutputPin_SensorPower;
_InputPin_TemperatureReading = InputPin_TemperatureReading;
_TimeBetweenReadings = TimeBetweenReadings;
_ADCVmax = ADCVmax;
_temperatureAverage = 24.0;
_measuredTemperature = 24.0;
_lastTemperatureRead = 0;
_VoutAnalogSample = -1;
_VoutPreviousAnalogSample = -1.0;
_temperatureMeasurementsMarker = 0;
_rTemperatureMeasurementsMarker = 0;
_rLineMeasurementsMarker = 0;
_measuredTemperatureDeviation = 0.0;
_sampleDeviation = 0.0;
analogReference(INTERNAL1V1); // EXTERNAL && INTERNAL2V56 && INTERNAL1V1
pinMode(_OutputPin_SensorPower, OUTPUT); // setup temperature sensor input pin
digitalWrite(_OutputPin_SensorPower, LOW); // initialize sensor on
}
void Temperature::safeHardwarePowerOff() {
digitalWrite(_OutputPin_SensorPower, LOW); // Turn temperature sensor OFF for safety
digitalWrite(_OutputPin_ThirdLinePower, LOW); // Turn temperature sensor OFF for safety
}
void Temperature::measure1(boolean ln, boolean rline) {
if(millis() - _lastTemperatureRead >= _TimeBetweenReadings) { //time to measure temperature
/** measure Vout analog sample */
digitalWrite(_OutputPin_SensorPower, HIGH); // initialize sensor on
digitalWrite(_OutputPin_ThirdLinePower, HIGH); // initialize sensor on
delay(10);
_VoutAnalogSample = analogRead(_InputPin_TemperatureReading) + _sampleDeviation; // Get a reading
_VoutRAnalogSample = analogRead(_InputPin_ThirdLineReading) + _sampleDeviation; // Get a reading
digitalWrite(_OutputPin_SensorPower, LOW); // initialize sensor on
digitalWrite(_OutputPin_ThirdLinePower, LOW); // initialize sensor on
_lastTemperatureRead = millis(); // Mark time of temperature reading
_rTemperatureMeasurementsMarker++; // Position reading buffer marker at the last updated position
if(_rTemperatureMeasurementsMarker >= TEMPERATURE_AVERAGE_VALUE_I) _rTemperatureMeasurementsMarker = 0; // Check that it has not gone out of the buffer range
_rTemperatureMeasurements[_rTemperatureMeasurementsMarker] = _VoutAnalogSample;
float Vout = GetMedian(_rTemperatureMeasurements) * _ADCVmax / CONSTANT_ADC_STEP_COUNT;
float Rx = _R1 / ( _Vs / Vout - 1.0);
if(rline) {
_rLineMeasurementsMarker++; // Position reading buffer marker at the last updated position
if(_rLineMeasurementsMarker >= TEMPERATURE_AVERAGE_VALUE_I) _rLineMeasurementsMarker = 0; // Check that it has not gone out of the buffer range
_rLineMeasurements[_rLineMeasurementsMarker] = _VoutRAnalogSample;
/** Calculate temperature value */
float VoutR = GetMedian(_rLineMeasurements) * _ADCVmax / CONSTANT_ADC_STEP_COUNT;
float Rline = _R2 / ( _Vs / VoutR - 1.0);
_measuredTemperature = 1.08271 * pow(10.0, -13.0) * (3.12508 * pow(10.0, 16.0) - 5.65566 * pow(10.0, 6.0) * sqrt(3.51501 * pow(10.0, 19.0) - 4.61805 * pow(10.0, 16.0) * (Rx - Rline)));
}
else {
/** Calculate temperature value */
_measuredTemperature = 1.08271 * pow(10.0, -13.0) * (3.12508 * pow(10.0, 16.0) - 5.65566 * pow(10.0, 6.0) * sqrt(3.51501 * pow(10.0, 19.0) - 4.61805 * pow(10.0, 16.0) * Rx));
}
//xFilterNoise(_temperatureMeasurementsMarker);
/*
Serial.print("Temperature : [");
Serial.print(_name);
Serial.print("]\tVoutSample: [");
Serial.print(_VoutAnalogSample);
// Serial.print("]\tVout[");
// Serial.print(Vout,6);
// Serial.print("]\tRx[");
// Serial.print(Rx,6);
Serial.print("]\tTNow[");
Serial.print(measuredTemperatureNow,6);
Serial.print("]\tTCalc[");
Serial.print(_measuredTemperature,6);
Serial.println("] ");
*/
//Serial.print("Temperature : [");
#ifdef DEBUG
Serial.print(_name);
Serial.print(",");
Serial.print(_VoutAnalogSample);
Serial.print(",");
//Serial.print(_VoutRAnalogSample);
//Serial.print(",");
/*Serial.print(test);
Serial.print(",");
Serial.print(Rtest);
Serial.print(",");*/
/*Serial.print(Vout,6);
Serial.print(",");
Serial.print(Rx,6);
Serial.print(",");
Serial.print(measuredTemperatureNow,6);
Serial.print(",");
Serial.print(_measuredTemperature,6);
Serial.print(",");*/
if(ln) Serial.println("");
#endif
}
}
float Temperature::GetMedian(int array[]){
int sorted[TEMPERATURE_AVERAGE_VALUE_I];
float value = 0.0;
for(int x = 0; x < TEMPERATURE_AVERAGE_VALUE_I; x++) {
sorted[x] = array[x];
}
//ARRANGE VALUES
for(int x = 0; x < TEMPERATURE_AVERAGE_VALUE_I; x++){
for(int y = 0; y < TEMPERATURE_AVERAGE_VALUE_I - 1; y++){
if(sorted[y]>sorted[y+1]){
int temp = sorted[y+1];
sorted[y+1] = sorted[y];
sorted[y] = temp;
}
}
}
//CALCULATE THE MEDIAN (middle number)
if(TEMPERATURE_AVERAGE_VALUE_I % 2 != 0){// is the # of elements odd?
int temp = ((TEMPERATURE_AVERAGE_VALUE_I+1)/2)-1;
value = (float) sorted[temp];
}
else{// then it's even! :)
value = ((float) ( sorted[(TEMPERATURE_AVERAGE_VALUE_I/2)-1] + sorted[TEMPERATURE_AVERAGE_VALUE_I/2] )) / 2.0;
}
return value;
}
float Temperature::getCurrentTemperature() {
return _measuredTemperature + _measuredTemperatureDeviation;
}
float Temperature::getMeasuredTemperatureDeviation() {
return _measuredTemperatureDeviation;
}
float Temperature::setMeasuredTemperatureDeviation( float measuredTemperatureDeviation) {
if( _measuredTemperatureDeviation != measuredTemperatureDeviation ) {
_measuredTemperatureDeviation = measuredTemperatureDeviation;
for( int i = 0; i < TEMPERATURE_AVERAGE_VALUE_I; i++ ) {
_temperatureMeasurements[i] = _temperatureMeasurements[i] + ( _measuredTemperatureDeviation * -1 );
}
}
return _measuredTemperatureDeviation;
}
float Temperature::setSampleDeviation( float sampleDeviation) {
_sampleDeviation = sampleDeviation;
return _sampleDeviation;
}
\ No newline at end of file
/*
Temperature.h - Library for measuring temperature with a Temperature.
Created by João Lino, June 24, 2015.
Released into the public domain.
*/
#ifndef Temperature_h
#define Temperature_h
#include "Arduino.h"
#define DEBUG
#define CONSTANT_ADC_STEP_COUNT 1024.0
#define TEMPERATURE_AVERAGE_VALUE_I 50
#define TEMPERATURE_AVERAGE_VALUE_F 50.0
//#define TEMPERATURE_AVERATE_INIT_VALUES 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0
#define TEMPERATURE_AVERATE_INIT_VALUES 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0
#define TEMPERATURE_AVERATE_INIT_VALUES_I 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
#define TEMPERATURE_SETTING_MAX_VALUE 120
class Temperature
{
public:
// Temperature(Temperature_OUTPUT_PIN, Temperature_INPUT_PIN, Temperature_TIME_BETWEEN_READINGS, Temperature_DEFAULT_ADC_VMAX, Temperature_DEFAULT_VS, Temperature_DEFAULT_R1_RESISTENCE, Temperature_DEFAULT_LINE_RESISTENCE, Temperature_DEFAULT_OPERATION_RESISTENCE);
Temperature(char *name,
int OutputPin_SensorPower,
int InputPin_TemperatureReading,
int TimeBetweenReadings,
float m1,
float m2,
float b1,
float b2);
void measure(boolean ln);
void safeHardwarePowerOff();
float getCurrentTemperature();
float setPumpStatus( bool pump );
private:
char *_name;
int _OutputPin_SensorPower;
int _InputPin_TemperatureReading;
int _TimeBetweenReadings;
float _m1;
float _m2;
float _b1;
float _b2;
float _temperatureAverage;
float _measuredTemperature;
float _measuredTemperatureDeviation;
bool _pump;
unsigned long _lastTemperatureRead;
int _VoutAnalogSample;
int _VoutRAnalogSample;
float _VoutPreviousAnalogSample;
int _temperatureMeasurementsMarker;
int _rTemperatureMeasurementsMarker;
float _temperatureMeasurements[TEMPERATURE_AVERAGE_VALUE_I] = {TEMPERATURE_AVERATE_INIT_VALUES};
int _rTemperatureMeasurements[TEMPERATURE_AVERAGE_VALUE_I] = {TEMPERATURE_AVERATE_INIT_VALUES_I};
float GetMedian(int array[]);
float GetMedianAverage(int array[], int range);
float GetMode(float array[]);
};
#endif
/*
Temperature.h - Library for measuring temperature with a Temperature.
Created by João Lino, December 22, 2015.
Released into the public domain.
*/
#ifndef TEMPERATURE_h
#define TEMPERATURE_h
#include "Arduino.h"
#define DEBUG
#define CONSTANT_ADC_STEP_COUNT 1024.0
#define TEMPERATURE_AVERAGE_VALUE_I 50
#define TEMPERATURE_AVERAGE_VALUE_F 50.0
//#define TEMPERATURE_AVERATE_INIT_VALUES 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0
#define TEMPERATURE_AVERATE_INIT_VALUES 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0
#define TEMPERATURE_AVERATE_INIT_VALUES_I 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
#define TEMPERATURE_SETTING_MAX_VALUE 120
class Temperature
{
public:
// Temperature(Temperature_OUTPUT_PIN, Temperature_INPUT_PIN, Temperature_TIME_BETWEEN_READINGS, Temperature_DEFAULT_ADC_VMAX, Temperature_DEFAULT_VS, Temperature_DEFAULT_R1_RESISTENCE, Temperature_DEFAULT_LINE_RESISTENCE, Temperature_DEFAULT_OPERATION_RESISTENCE);
Temperature(char *name,
int OutputPin_SensorPower,
int InputPin_TemperatureReading,
int TimeBetweenReadings = 100);
void measure(boolean ln);
void measure1(boolean ln, boolean rline);
void safeHardwarePowerOff();
float getCurrentTemperature();
float getMeasuredTemperatureDeviation();
float setMeasuredTemperatureDeviation( float measuredTemperatureDeviation);
float setSampleDeviation( float sampleDeviation);
private:
char *_name;
int _OutputPin_SensorPower;
int _OutputPin_ThirdLinePower;
int _InputPin_TemperatureReading;
int _InputPin_ThirdLineReading;
int _TimeBetweenReadings;
float _ADCVmax;
float _Vs;
float _R1;
float _R2;
float __m;
float __b;
float _temperatureAverage;
float _measuredTemperature;
float _measuredTemperatureDeviation;
float _sampleDeviation;
unsigned long _lastTemperatureRead;
int _VoutAnalogSample;
int _VoutRAnalogSample;
float _VoutPreviousAnalogSample;
int _temperatureMeasurementsMarker;
int _rTemperatureMeasurementsMarker;
int _rLineMeasurementsMarker;
float _temperatureMeasurements[TEMPERATURE_AVERAGE_VALUE_I] = {TEMPERATURE_AVERATE_INIT_VALUES};
int _rTemperatureMeasurements[TEMPERATURE_AVERAGE_VALUE_I] = {TEMPERATURE_AVERATE_INIT_VALUES_I};
int _rLineMeasurements[TEMPERATURE_AVERAGE_VALUE_I] = {TEMPERATURE_AVERATE_INIT_VALUES_I};
float GetMedian(int array[]);
};
#endif
\ No newline at end of file
#ifndef __BREW
#define __BREW
void xSetupRotaryEncoder( eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep );
// ######################### START #########################
void xSafeHardwarePowerOff();
void xWelcomeUser();
// ######################### FUNCTIONS ########################
void runMenu();
void runSettingsSelection();
void runMaltSelection();
void runStageSelection();
void runBeerProfileSelection();
void runStartFromStageSelection_Processor( unsigned long *stageTime, int *stageTemperature, eCookingStages nextStage );
void runStartFromStageSelection();
void runMainMenuSelection();
void xCountTheTime( int temperatureRange, boolean bAverageUpDown );
bool isTimeLeft();
double ulWattToWindowTime( double ulAppliedWatts );
bool xRegulateTemperature( boolean bAverageUpDown );
void xPurgePump();
bool xRegulatePumpSpeed();
void xWarnClockEnded();
void xWarnCookEnded();
void xStageFirstRun( int stageTime, int stageTemperature, int stagePumpSpeed, eCookingStages stage );
void xSetupGlobalVariablesForStage(eCookingStages nextStage);
void xTransitionIntoStage(eCookingStages nextStage);
void xBasicStageOperation( int iStageTime, int iStageTemperature, int iStageTemperatureRange, eCookingStages nextStage, boolean bAverageUpDown );
void xManageMachineSystems();
// #################################################### Helpers ##################################################################
void startBrewing();
void stopBrewing();
void resetMenu( boolean requestRepaintPaint );
void backToStatus();
// #################################################### Set Variables ##################################################################
int getTimer( int initialValue, int defaultValue );
int getTimer( int initialValue );
int getTemperature(int initialValue);
int xSetGenericValue(int initialValue, int minimumValue, int maximumValue, char *valueName, char *unit);
int xSetTemperature( int initialValue );
int xSetFinalYield( int initialValue );
// ###################### Set Variables ##################################################
void xWaitForAction(String title, String message);
boolean gotButtonPress(int iPin);
#endif //__BREW
\ No newline at end of file
......@@ -14,7 +14,7 @@
#include <LiquidCrystal_I2C.h>
// ++++++++++++++++++++++++ PT100 +++++++++++++++++++++++++++++++++
#include <PT100.h>
//#include <PT100.h>
// ++++++++++++++++++++++++ OTHER +++++++++++++++++++++++++++++++++
#include "debug.h"
......@@ -25,6 +25,10 @@
#include "Melody.h"
#include "Display.h"
#include "Temperature.h"
#include "Profiles.h"
#include "brew.h"
// ######################### VARIABLES #########################
// ++++++++++++++++++++++++ State Machine ++++++++++++++++++++++++
......@@ -37,6 +41,8 @@ eMenuType eMenuType;
eMainMenuOptions eMainMenuPosition;
eMainMenuOptions eMainMenuSelection;
eStageMenuOptions eStartFromStageMenuPosition;
eStageMenuOptions eStartFromStageMenuSelection;
eBeerProfileMenuOptions eBeerProfileMenuPosition;
eBeerProfileMenuOptions eBeerProfileMenuSelection;
eStageMenuOptions eStageMenuPosition;
......@@ -121,21 +127,72 @@ int iPumpSpeed; // Time frame to operate in
// ++++++++++++++++++++++++ Library - LiquidCrystal_I2C ++++++++++++++++++++++++
LiquidCrystal_I2C lcd(LCD_I2C_ADDR, LCD_EN_PIN, LCD_RW_PIN, LCD_RS_PIN, LCD_D4_PIN, LCD_D5_PIN, LCD_D6_PIN, LCD_D7_PIN);
// +++++++++++++++++++++++ PT100 +++++++++++++++++++++++
PT100 basePT100("base", PT100_BASE_OUTPUT_PIN, PT100_BASE_OUTPUT_R_PIN, PT100_BASE_INPUT_PIN, PT100_BASE_INPUT_R_PIN, PT100_BASE_TIME_BETWEEN_READINGS, PT100_BASE_DEFAULT_ADC_VMAX, PT100_BASE_DEFAULT_VS, PT100_BASE_DEFAULT_R1_RESISTENCE, PT100_BASE_DEFAULT_R2_RESISTENCE, 0.0, 0.0);//0.0, 0.0);
PT100 upPT100("up", PT100_UP_OUTPUT_PIN, PT100_UP_OUTPUT_R_PIN, PT100_UP_INPUT_PIN, PT100_UP_INPUT_R_PIN, PT100_UP_TIME_BETWEEN_READINGS, PT100_UP_DEFAULT_ADC_VMAX, PT100_UP_DEFAULT_VS, PT100_UP_DEFAULT_R1_RESISTENCE, PT100_UP_DEFAULT_R2_RESISTENCE, -0.2, 8.0);//8.0);//0.17, -7.2); //0.195, -7.6);//0.0, 0.0);//0.38, -3.0); //0.112329092, -3.57); //0.0, 0.0);
PT100 downPT100("down", PT100_DOWN_OUTPUT_PIN, PT100_DOWN_OUTPUT_R_PIN, PT100_DOWN_INPUT_PIN, PT100_DOWN_INPUT_R_PIN, PT100_DOWN_TIME_BETWEEN_READINGS, PT100_DOWN_DEFAULT_ADC_VMAX, PT100_DOWN_DEFAULT_VS, PT100_DOWN_DEFAULT_R1_RESISTENCE, PT100_DOWN_DEFAULT_R2_RESISTENCE, 0.0, -2.2);//0.228, -9); //0.26, -10);//0.0, 0.0);//0.53, -6.6); //0.22, -5.5); //0.0, 0.0);
/* +++++++++++++++++++++++ PT100 +++++++++++++++++++++++
PT100 basePT100("base",
PT100_BASE_OUTPUT_PIN,
PT100_BASE_INPUT_PIN,
PT100_BASE_TIME_BETWEEN_READINGS,
PT100_BASE_DEFAULT_ADC_VMAX,
PT100_BASE_DEFAULT_VS,
PT100_BASE_DEFAULT_R1_RESISTENCE);
PT100 upPT100("up",
PT100_UP_OUTPUT_PIN,
PT100_UP_INPUT_PIN,
PT100_UP_TIME_BETWEEN_READINGS,
PT100_UP_DEFAULT_ADC_VMAX,
PT100_UP_DEFAULT_VS,
PT100_UP_DEFAULT_R1_RESISTENCE);
PT100 downPT100("down",
PT100_DOWN_OUTPUT_PIN,
PT100_DOWN_INPUT_PIN,
PT100_DOWN_TIME_BETWEEN_READINGS,
PT100_DOWN_DEFAULT_ADC_VMAX,
PT100_DOWN_DEFAULT_VS,
PT100_DOWN_DEFAULT_R1_RESISTENCE);
*/
// +++++++++++++++++++++++ Temperature +++++++++++++++++++++++
Temperature basePT100("base",
PT100_BASE_OUTPUT_PIN,
PT100_BASE_INPUT_PIN,
PT100_BASE_TIME_BETWEEN_READINGS,
//2.1028, 2.0907, 659.91, 662.88);
//2.0998, 2.0998, 660.02, 662.02);
//2.0986, 2.0898, 660.06, 662.91);
//2.1353, 2.1043, 661.93, 659.7);
//2.0608, 2.058, 664.26, 661.15);
2.0298, 2.0259, 665.24, 662.17);
Temperature upPT100("up",
PT100_UP_OUTPUT_PIN,
PT100_UP_INPUT_PIN,
PT100_UP_TIME_BETWEEN_READINGS,
//2.0949, 2.0835, 654.67, 657.57);
//2.079, 2.079, 655.52, 657.52);
//2.0893, 2.0832, 654.84, 657.58);
//2.1239, 2.1288, 654.89, 653.44);
//2.0564, 2.0539, 658.51, 655.78);
2.0274, 2.0245, 659.43, 656.72);
Temperature downPT100("down",
PT100_DOWN_OUTPUT_PIN,
PT100_DOWN_INPUT_PIN,
PT100_DOWN_TIME_BETWEEN_READINGS,
//2.1016, 2.09, 653.02, 656.00);
//2.0998, 2.0998, 653.02, 655.02);
//2.0974, 2.0894, 653.17, 656.02);
//2.1347, 2.1407, 654.89, 651.84);
//2.0618, 2.0605, 657.16, 654.35);
2.0309, 2.0288, 658.15, 655.35);
// ######################### INTERRUPTS #########################
void isr () { // Interrupt service routine is executed when a HIGH to LOW transition is detected on CLK
unsigned long interruptTime = millis();
unsigned long diff = interruptTime - lastInterruptTime;
lastInterruptTime = interruptTime;
// If interrupts come faster than [ROTARY_ENCODER_DEBOUNCE_TIME]ms, assume it's a bounce and ignore
if (diff > ROTARY_ENCODER_DEBOUNCE_TIME) {
switch(rotaryEncoderMode) {
lastInterruptTime = interruptTime;
switch(rotaryEncoderMode) {
// Input of rotary encoder controling menus
case eRotaryEncoderMode_Menu: {
if (!digitalRead(ROTARY_ENCODER_DT_PIN)) {
......@@ -208,10 +265,10 @@ void isr () { // Interrupt service routine is executed when a HIGH to LOW tr
}
}
repaint = true;
refresh = true;
}
repaint = true;
refresh = true;
}
void xSetupRotaryEncoder( eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep ) {
......@@ -226,17 +283,17 @@ void xSetupRotaryEncoder( eRotaryEncoderMode newMode, int newPosition, int newMa
// ######################### START #########################
void xSafeHardwarePowerOff() {
// Turn off gracefully
iPumpSpeed = PUMP_SPEED_STOP;
iPumpSpeed = PUMP_SPEED_STOP_MOSFET;
xRegulatePumpSpeed();
// Force shutdown
analogWrite(PUMP_PIN, PUMP_SPEED_STOP); // analogWrite values from 0 to 255
analogWrite(PUMP_PIN, PUMP_SPEED_STOP_MOSFET); // analogWrite values from 0 to 255
digitalWrite(HEATING_ELEMENT_OUTPUT_PIN, LOW); // Turn heading element OFF for safety
bStatusElement = false;
basePT100.setSampleDeviation( 0.0 );
upPT100.setSampleDeviation( 0.0 );
downPT100.setSampleDeviation( 0.0 );
basePT100.setPumpStatus( false );
upPT100.setPumpStatus( false );
downPT100.setPumpStatus( false );
//analogWrite(MIXER_PIN, 0); // Turn mixer OFF for safety
}
......@@ -268,24 +325,17 @@ void setup() {
dWattPerPulse = HEATING_ELEMENT_MAX_WATTAGE / HEATING_ELEMENT_AC_FREQUENCY_HZ;
// ++++++++++++++++++++++++ Mixer ++++++++++++++++++++++++
// pinMode (MIXER_PIN, OUTPUT);
// analogWrite (MIXER_PIN, 0);
// ++++++++++++++++++++++++ Pump ++++++++++++++++++++++++
pinMode(PUMP_PIN, OUTPUT); // sets the pin as output
iPumpSpeed = PUMP_SPEED_STOP; // Time frame to operate in
iPumpSpeed = PUMP_SPEED_STOP_MOSFET; // Time frame to operate in
analogWrite(PUMP_PIN, iPumpSpeed); // analogWrite values from 0 to 255
// ++++++++++++++++++++++++ Pump ++++++++++++++++++++++++
// ++++++++++++++++++++++++ Piezo ++++++++++++++++++++++++
pinMode(PIEZO_PIN, OUTPUT);
// ++++++++++++++++++++++++ Temperature Sensor PT100 ++++++++++++++++++++++++
//basePT100.setup();
/*
analogReference (INTERNAL1V1); // EXTERNAL && INTERNAL2V56 && INTERNAL1V1
pinMode (PT100_OUTPUT_PIN, OUTPUT); // setup temperature sensor input pin
digitalWrite (PT100_OUTPUT_PIN, LOW); // initialize sensor off
*/
// ++++++++++++++++++++++++ Serial Monitor ++++++++++++++++++++++++
Serial.begin (SETTING_SERIAL_MONITOR_BAUD_RATE); // setup terminal baud rate
Serial.println (SETTING_SERIAL_MONITOR_WELCOME_MESSAGE); // print a start message to the terminal
......@@ -334,30 +384,30 @@ void setup() {
//cookMixerSpeed = 120;
finalYield = 25;
startpointTime = 120;
betaGlucanaseTime = 0;
debranchingTime = 0;
proteolyticTime = 0;
betaAmylaseTime = 3600;
alphaAmylaseTime = 1800;
mashoutTime = 300;
recirculationTime = 1200;
spargeTime = 1200;
boilTime = 5400;
coolingTime = 120;
startpointTime = PROFILE_BASIC_STARTPOINT_TIME;
betaGlucanaseTime = PROFILE_BASIC_BETAGLUCANASE_TIME;
debranchingTime = PROFILE_BASIC_DEBRANCHING_TIME;
proteolyticTime = PROFILE_BASIC_PROTEOLYTIC_TIME;
betaAmylaseTime = PROFILE_BASIC_BETAAMYLASE_TIME;
alphaAmylaseTime = PROFILE_BASIC_ALPHAAMYLASE_TIME;
mashoutTime = PROFILE_BASIC_MASHOUT_TIME;
recirculationTime = PROFILE_BASIC_RECIRCULATION_TIME;
spargeTime = PROFILE_BASIC_SPARGE_TIME;
boilTime = PROFILE_BASIC_BOIL_TIME;
coolingTime = PROFILE_BASIC_COOLING_TIME;
cleaningTime = SETTING_CLEANING_TIME;
startpointTemperature = 30;
betaGlucanaseTemperature = 40;
debranchingTemperature = 40;
proteolyticTemperature = 50;
betaAmylaseTemperature = 60;
alphaAmylaseTemperature = 70;
mashoutTemperature = 80;
recirculationTemperature = 80;
spargeTemperature = 80;
boilTemperature = 100;
coolingTemperature = 25;
startpointTemperature = PROFILE_BASIC_STARTPOINT_TEMPERATURE;
betaGlucanaseTemperature = PROFILE_BASIC_BETAGLUCANASE_TEMPERATURE;
debranchingTemperature = PROFILE_BASIC_DEBRANCHING_TEMPERATURE;
proteolyticTemperature = PROFILE_BASIC_PROTEOLYTIC_TEMPERATURE;
betaAmylaseTemperature = PROFILE_BASIC_BETAAMYLASE_TEMPERATURE;
alphaAmylaseTemperature = PROFILE_BASIC_ALPHAAMYLASE_TEMPERATURE;
mashoutTemperature = PROFILE_BASIC_MASHOUT_TEMPERATURE;
recirculationTemperature = PROFILE_BASIC_RECIRCULATION_TEMPERATURE;
spargeTemperature = PROFILE_BASIC_SPARGE_TEMPERATURE;
boilTemperature = PROFILE_BASIC_BOIL_TEMPERATURE;
coolingTemperature = PROFILE_BASIC_COOLING_TEMPERATURE;
cleaningTemperature = SETTING_CLEANING_TEMPERATURE;
refresh = true;
......@@ -379,8 +429,6 @@ void setup() {
// ######################### MAIN LOOP #########################
void loop() {
//cleanSerialMonitor();
unsigned long inactivityTime = millis() - lastInterruptTime;
if(inactivityTime > SETTING_MAX_INACTIVITY_TIME) { // Inactivity check
......@@ -424,6 +472,19 @@ void runMenu() {
break;
}
case eMenuType_StartFromStage: {
eStartFromStageMenuPosition = static_cast<eStageMenuOptions>(rotaryEncoderVirtualPosition);
repaint = displayStageMenu( &lcd, eStartFromStageMenuPosition, repaint );
if ( gotButtonPress( ROTARY_ENCODER_SW_PIN ) ) {
eStartFromStageMenuSelection = eStartFromStageMenuPosition;
}
runStartFromStageSelection();
break;
}
case eMenuType_BeerProfile: {
eBeerProfileMenuPosition = static_cast<eBeerProfileMenuOptions>(rotaryEncoderVirtualPosition);
......@@ -487,16 +548,23 @@ void runMenu() {
void runSettingsSelection() {
switch(eSettingsMenuSelection) {
case eSettingsMenu_PT100_Element: {
case eSettingsMenu_Pump: {
// Stuff
if( xSetGenericValue( iPumpSpeed?0:1, 0, 1, "pump", "bool" ) ) {
iPumpSpeed = PUMP_SPEED_MAX_MOSFET;
} else {
iPumpSpeed = PUMP_SPEED_STOP_MOSFET;
}
analogWrite(PUMP_PIN, iPumpSpeed);
backToStatus();
eMenuType = eMenuType_Main;
repaint = true;
// reset operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Menu, eMainMenuPosition, MENU_SIZE_MAIN_MENU - 1, 1, 1, 0 );
break;
}
case eSettingsMenu_PT100_Element: {
// Stuff
backToStatus();
break;
}
......@@ -505,12 +573,6 @@ void runSettingsSelection() {
backToStatus();
eMenuType = eMenuType_Main;
repaint = true;
// reset operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Menu, eMainMenuPosition, MENU_SIZE_MAIN_MENU - 1, 1, 1, 0 );
break;
}
case eSettingsMenu_PT100_Down: {
......@@ -518,12 +580,6 @@ void runSettingsSelection() {
backToStatus();
eMenuType = eMenuType_Main;
repaint = true;
// reset operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Menu, eMainMenuPosition, MENU_SIZE_MAIN_MENU - 1, 1, 1, 0 );
break;
}
case eSettingsMenu_Back: {
......@@ -549,12 +605,6 @@ void runMaltSelection() {
backToStatus();
eMenuType = eMenuType_Main;
repaint = true;
// reset operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Menu, eMainMenuPosition, MENU_SIZE_MAIN_MENU - 1, 1, 1, 0 );
break;
}
case eMaltMenu_CastleMalting_Wheat_Blanc: {
......@@ -562,12 +612,6 @@ void runMaltSelection() {
backToStatus();
eMenuType = eMenuType_Main;
repaint = true;
// reset operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Menu, eMainMenuPosition, MENU_SIZE_MAIN_MENU - 1, 1, 1, 0 );
break;
}
case eMaltMenu_Back: {
......@@ -591,165 +635,99 @@ void runStageSelection() {
case eStageMenu_Startpoint: {
startpointTime = getTimer( startpointTime );
startpointTemperature = xSetGenericValue( startpointTemperature, 0, 120, "temperature", "*C" );
startpointTemperature = xSetGenericValue( startpointTemperature, TEMPERATURE_MIN_VALUE, TEMPERATURE_MAX_VALUE, "temperature", "*C" );
backToStatus();
eMenuType = eMenuType_Main;
repaint = true;
// reset operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Menu, eMainMenuPosition, MENU_SIZE_MAIN_MENU - 1, 1, 1, 0 );
break;
}
case eStageMenu_BetaGlucanase: {
betaGlucanaseTime = getTimer( betaGlucanaseTime );
betaGlucanaseTemperature = xSetGenericValue( betaGlucanaseTemperature, 0, 120, "temperature", "*C" );
betaGlucanaseTemperature = xSetGenericValue( betaGlucanaseTemperature, TEMPERATURE_MIN_VALUE, TEMPERATURE_MAX_VALUE, "temperature", "*C" );
backToStatus();
eMenuType = eMenuType_Main;
repaint = true;
// reset operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Menu, eMainMenuPosition, MENU_SIZE_MAIN_MENU - 1, 1, 1, 0 );
break;
}
case eStageMenu_Debranching: {
debranchingTime = getTimer( debranchingTime );
debranchingTemperature = xSetGenericValue( debranchingTemperature, 0, 120, "temperature", "*C" );
debranchingTemperature = xSetGenericValue( debranchingTemperature, TEMPERATURE_MIN_VALUE, TEMPERATURE_MAX_VALUE, "temperature", "*C" );
backToStatus();
eMenuType = eMenuType_Main;
repaint = true;
// reset operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Menu, eMainMenuPosition, MENU_SIZE_MAIN_MENU - 1, 1, 1, 0 );
break;
}
case eStageMenu_Proteolytic: {
proteolyticTime = getTimer( proteolyticTime );
proteolyticTemperature = xSetGenericValue( proteolyticTemperature, 0, 120, "temperature", "*C" );
proteolyticTemperature = xSetGenericValue( proteolyticTemperature, TEMPERATURE_MIN_VALUE, TEMPERATURE_MAX_VALUE, "temperature", "*C" );
backToStatus();
eMenuType = eMenuType_Main;
repaint = true;
// reset operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Menu, eMainMenuPosition, MENU_SIZE_MAIN_MENU - 1, 1, 1, 0 );
break;
}
case eStageMenu_BetaAmylase: {
betaAmylaseTime = getTimer( betaAmylaseTime );
betaAmylaseTemperature = xSetGenericValue( betaAmylaseTemperature, 0, 120, "temperature", "*C" );
betaAmylaseTemperature = xSetGenericValue( betaAmylaseTemperature, TEMPERATURE_MIN_VALUE, TEMPERATURE_MAX_VALUE, "temperature", "*C" );
backToStatus();
eMenuType = eMenuType_Main;
repaint = true;
// reset operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Menu, eMainMenuPosition, MENU_SIZE_MAIN_MENU - 1, 1, 1, 0 );
break;
}
case eStageMenu_AlphaAmylase: {
alphaAmylaseTime = getTimer( alphaAmylaseTime );
alphaAmylaseTemperature = xSetGenericValue( alphaAmylaseTemperature, 0, 120, "temperature", "*C" );
alphaAmylaseTemperature = xSetGenericValue( alphaAmylaseTemperature, TEMPERATURE_MIN_VALUE, TEMPERATURE_MAX_VALUE, "temperature", "*C" );
backToStatus();
eMenuType = eMenuType_Main;
repaint = true;
// reset operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Menu, eMainMenuPosition, MENU_SIZE_MAIN_MENU - 1, 1, 1, 0 );
break;
}
case eStageMenu_Mashout: {
mashoutTime = getTimer( mashoutTime );
mashoutTemperature = xSetGenericValue( mashoutTemperature, 0, 120, "temperature", "*C" );
mashoutTemperature = xSetGenericValue( mashoutTemperature, TEMPERATURE_MIN_VALUE, TEMPERATURE_MAX_VALUE, "temperature", "*C" );
backToStatus();
eMenuType = eMenuType_Main;
repaint = true;
// reset operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Menu, eMainMenuPosition, MENU_SIZE_MAIN_MENU - 1, 1, 1, 0 );
break;
}
case eStageMenu_Recirculation: {
recirculationTime = getTimer( recirculationTime );
recirculationTemperature = xSetGenericValue( recirculationTemperature, 0, 120, "temperature", "*C" );
recirculationTemperature = xSetGenericValue( recirculationTemperature, TEMPERATURE_MIN_VALUE, TEMPERATURE_MAX_VALUE, "temperature", "*C" );
backToStatus();
eMenuType = eMenuType_Main;
repaint = true;
// reset operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Menu, eMainMenuPosition, MENU_SIZE_MAIN_MENU - 1, 1, 1, 0 );
break;
}
case eStageMenu_Sparge: {
spargeTime = getTimer( spargeTime );
spargeTemperature = xSetGenericValue( spargeTemperature, 0, 120, "temperature", "*C" );
spargeTemperature = xSetGenericValue( spargeTemperature, TEMPERATURE_MIN_VALUE, TEMPERATURE_MAX_VALUE, "temperature", "*C" );
backToStatus();
eMenuType = eMenuType_Main;
repaint = true;
// reset operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Menu, eMainMenuPosition, MENU_SIZE_MAIN_MENU - 1, 1, 1, 0 );
break;
}
case eStageMenu_Boil: {
boilTime = getTimer( boilTime );
boilTemperature = xSetGenericValue( boilTemperature, 0, 120, "temperature", "*C" );
boilTemperature = xSetGenericValue( boilTemperature, TEMPERATURE_MIN_VALUE, TEMPERATURE_MAX_VALUE, "temperature", "*C" );
backToStatus();
eMenuType = eMenuType_Main;
repaint = true;
// reset operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Menu, eMainMenuPosition, MENU_SIZE_MAIN_MENU - 1, 1, 1, 0 );
break;
}
case eStageMenu_Cooling: {
coolingTime = getTimer( coolingTime );
coolingTemperature = xSetGenericValue( coolingTemperature, 0, 120, "temperature", "*C" );
coolingTemperature = xSetGenericValue( coolingTemperature, TEMPERATURE_MIN_VALUE, TEMPERATURE_MAX_VALUE, "temperature", "*C" );
backToStatus();
eMenuType = eMenuType_Main;
repaint = true;
// reset operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Menu, eMainMenuPosition, MENU_SIZE_MAIN_MENU - 1, 1, 1, 0 );
break;
}
......@@ -774,164 +752,218 @@ void runBeerProfileSelection() {
case eBeerProfileMenu_Basic: {
beerProfile = eBeerProfile_Basic;
startpointTime = 120;
betaGlucanaseTime = 0;
debranchingTime = 0;
proteolyticTime = 0;
betaAmylaseTime = 3600;
alphaAmylaseTime = 1800;
mashoutTime = 300;
recirculationTime = 1200;
spargeTime = 1200;
boilTime = 5400;
coolingTime = 120;
startpointTemperature = 30;
betaGlucanaseTemperature = 40;
debranchingTemperature = 40;
proteolyticTemperature = 50;
betaAmylaseTemperature = 60;
alphaAmylaseTemperature = 70;
mashoutTemperature = 80;
recirculationTemperature = 80;
spargeTemperature = 80;
boilTemperature = 100;
coolingTemperature = 25;
startpointTime = PROFILE_BASIC_STARTPOINT_TIME;
betaGlucanaseTime = PROFILE_BASIC_BETAGLUCANASE_TIME;
debranchingTime = PROFILE_BASIC_DEBRANCHING_TIME;
proteolyticTime = PROFILE_BASIC_PROTEOLYTIC_TIME;
betaAmylaseTime = PROFILE_BASIC_BETAAMYLASE_TIME;
alphaAmylaseTime = PROFILE_BASIC_ALPHAAMYLASE_TIME;
mashoutTime = PROFILE_BASIC_MASHOUT_TIME;
recirculationTime = PROFILE_BASIC_RECIRCULATION_TIME;
spargeTime = PROFILE_BASIC_SPARGE_TIME;
boilTime = PROFILE_BASIC_BOIL_TIME;
coolingTime = PROFILE_BASIC_COOLING_TIME;
startpointTemperature = PROFILE_BASIC_STARTPOINT_TEMPERATURE;
betaGlucanaseTemperature = PROFILE_BASIC_BETAGLUCANASE_TEMPERATURE;
debranchingTemperature = PROFILE_BASIC_DEBRANCHING_TEMPERATURE;
proteolyticTemperature = PROFILE_BASIC_PROTEOLYTIC_TEMPERATURE;
betaAmylaseTemperature = PROFILE_BASIC_BETAAMYLASE_TEMPERATURE;
alphaAmylaseTemperature = PROFILE_BASIC_ALPHAAMYLASE_TEMPERATURE;
mashoutTemperature = PROFILE_BASIC_MASHOUT_TEMPERATURE;
recirculationTemperature = PROFILE_BASIC_RECIRCULATION_TEMPERATURE;
spargeTemperature = PROFILE_BASIC_SPARGE_TEMPERATURE;
boilTemperature = PROFILE_BASIC_BOIL_TEMPERATURE;
coolingTemperature = PROFILE_BASIC_COOLING_TEMPERATURE;
backToStatus();
eMenuType = eMenuType_Main;
repaint = true;
// reset operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Menu, eMainMenuPosition, MENU_SIZE_MAIN_MENU - 1, 1, 1, 0 );
break;
}
case eBeerProfileMenu_Trigo: {
beerProfile = eBeerProfile_Trigo;
startpointTime = 120;
betaGlucanaseTime = 0;
debranchingTime = 0;
proteolyticTime = 0;
betaAmylaseTime = 3600;
alphaAmylaseTime = 1800;
mashoutTime = 300
recirculationTime = 1200
spargeTime = 1200;
boilTime = 5400;
coolingTime = 120;
startpointTemperature = 45;
betaGlucanaseTemperature = 40;
debranchingTemperature = 40;
proteolyticTemperature = 50;
betaAmylaseTemperature = 62;
alphaAmylaseTemperature = 70;
mashoutTemperature = 78;
recirculationTemperature = 80;
spargeTemperature = 80;
boilTemperature = 100;
coolingTemperature = 25;
startpointTime = PROFILE_TRIGO_STARTPOINT_TIME;
betaGlucanaseTime = PROFILE_TRIGO_BETAGLUCANASE_TIME;
debranchingTime = PROFILE_TRIGO_DEBRANCHING_TIME;
proteolyticTime = PROFILE_TRIGO_PROTEOLYTIC_TIME;
betaAmylaseTime = PROFILE_TRIGO_BETAAMYLASE_TIME;
alphaAmylaseTime = PROFILE_TRIGO_ALPHAAMYLASE_TIME;
mashoutTime = PROFILE_TRIGO_MASHOUT_TIME;
recirculationTime = PROFILE_TRIGO_RECIRCULATION_TIME;
spargeTime = PROFILE_TRIGO_SPARGE_TIME;
boilTime = PROFILE_TRIGO_BOIL_TIME;
coolingTime = PROFILE_TRIGO_COOLING_TIME;
startpointTemperature = PROFILE_TRIGO_STARTPOINT_TEMPERATURE;
betaGlucanaseTemperature = PROFILE_TRIGO_BETAGLUCANASE_TEMPERATURE;
debranchingTemperature = PROFILE_TRIGO_DEBRANCHING_TEMPERATURE;
proteolyticTemperature = PROFILE_TRIGO_PROTEOLYTIC_TEMPERATURE;
betaAmylaseTemperature = PROFILE_TRIGO_BETAAMYLASE_TEMPERATURE;
alphaAmylaseTemperature = PROFILE_TRIGO_ALPHAAMYLASE_TEMPERATURE;
mashoutTemperature = PROFILE_TRIGO_MASHOUT_TEMPERATURE;
recirculationTemperature = PROFILE_TRIGO_RECIRCULATION_TEMPERATURE;
spargeTemperature = PROFILE_TRIGO_SPARGE_TEMPERATURE;
boilTemperature = PROFILE_TRIGO_BOIL_TEMPERATURE;
coolingTemperature = PROFILE_TRIGO_COOLING_TEMPERATURE;
backToStatus();
eMenuType = eMenuType_Main;
repaint = true;
// reset operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Menu, eMainMenuPosition, MENU_SIZE_MAIN_MENU - 1, 1, 1, 0 );
break;
}
case eBeerProfileMenu_IPA: {
beerProfile = eBeerProfile_IPA;
startpointTime = PROFILE_IPA_STARTPOINT_TIME;
betaGlucanaseTime = PROFILE_IPA_BETAGLUCANASE_TIME;
debranchingTime = PROFILE_IPA_DEBRANCHING_TIME;
proteolyticTime = PROFILE_IPA_PROTEOLYTIC_TIME;
betaAmylaseTime = PROFILE_IPA_BETAAMYLASE_TIME;
alphaAmylaseTime = PROFILE_IPA_ALPHAAMYLASE_TIME;
mashoutTime = PROFILE_IPA_MASHOUT_TIME;
recirculationTime = PROFILE_IPA_RECIRCULATION_TIME;
spargeTime = PROFILE_IPA_SPARGE_TIME;
boilTime = PROFILE_IPA_BOIL_TIME;
coolingTime = PROFILE_IPA_COOLING_TIME;
startpointTemperature = PROFILE_IPA_STARTPOINT_TEMPERATURE;
betaGlucanaseTemperature = PROFILE_IPA_BETAGLUCANASE_TEMPERATURE;
debranchingTemperature = PROFILE_IPA_DEBRANCHING_TEMPERATURE;
proteolyticTemperature = PROFILE_IPA_PROTEOLYTIC_TEMPERATURE;
betaAmylaseTemperature = PROFILE_IPA_BETAAMYLASE_TEMPERATURE;
alphaAmylaseTemperature = PROFILE_IPA_ALPHAAMYLASE_TEMPERATURE;
mashoutTemperature = PROFILE_IPA_MASHOUT_TEMPERATURE;
recirculationTemperature = PROFILE_IPA_RECIRCULATION_TEMPERATURE;
spargeTemperature = PROFILE_IPA_SPARGE_TEMPERATURE;
boilTemperature = PROFILE_IPA_BOIL_TEMPERATURE;
coolingTemperature = PROFILE_IPA_COOLING_TEMPERATURE;
backToStatus();
eMenuType = eMenuType_Main;
repaint = true;
// reset operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Menu, eMainMenuPosition, MENU_SIZE_MAIN_MENU - 1, 1, 1, 0 );
break;
}
case eBeerProfileMenu_Belga: {
beerProfile = eBeerProfile_Belga;
backToStatus();
startpointTime = PROFILE_BELGA_STARTPOINT_TIME;
betaGlucanaseTime = PROFILE_BELGA_BETAGLUCANASE_TIME;
debranchingTime = PROFILE_BELGA_DEBRANCHING_TIME;
proteolyticTime = PROFILE_BELGA_PROTEOLYTIC_TIME;
betaAmylaseTime = PROFILE_BELGA_BETAAMYLASE_TIME;
alphaAmylaseTime = PROFILE_BELGA_ALPHAAMYLASE_TIME;
mashoutTime = PROFILE_BELGA_MASHOUT_TIME;
recirculationTime = PROFILE_BELGA_RECIRCULATION_TIME;
spargeTime = PROFILE_BELGA_SPARGE_TIME;
boilTime = PROFILE_BELGA_BOIL_TIME;
coolingTime = PROFILE_BELGA_COOLING_TIME;
startpointTemperature = PROFILE_BELGA_STARTPOINT_TEMPERATURE;
betaGlucanaseTemperature = PROFILE_BELGA_BETAGLUCANASE_TEMPERATURE;
debranchingTemperature = PROFILE_BELGA_DEBRANCHING_TEMPERATURE;
proteolyticTemperature = PROFILE_BELGA_PROTEOLYTIC_TEMPERATURE;
betaAmylaseTemperature = PROFILE_BELGA_BETAAMYLASE_TEMPERATURE;
alphaAmylaseTemperature = PROFILE_BELGA_ALPHAAMYLASE_TEMPERATURE;
mashoutTemperature = PROFILE_BELGA_MASHOUT_TEMPERATURE;
recirculationTemperature = PROFILE_BELGA_RECIRCULATION_TEMPERATURE;
spargeTemperature = PROFILE_BELGA_SPARGE_TEMPERATURE;
boilTemperature = PROFILE_BELGA_BOIL_TEMPERATURE;
coolingTemperature = PROFILE_BELGA_COOLING_TEMPERATURE;
eMenuType = eMenuType_Main;
repaint = true;
// reset operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Menu, eMainMenuPosition, MENU_SIZE_MAIN_MENU - 1, 1, 1, 0 );
backToStatus();
break;
}
case eBeerProfileMenu_Red: {
beerProfile = eBeerProfile_Red;
startpointTime = PROFILE_RED_STARTPOINT_TIME;
betaGlucanaseTime = PROFILE_RED_BETAGLUCANASE_TIME;
debranchingTime = PROFILE_RED_DEBRANCHING_TIME;
proteolyticTime = PROFILE_RED_PROTEOLYTIC_TIME;
betaAmylaseTime = PROFILE_RED_BETAAMYLASE_TIME;
alphaAmylaseTime = PROFILE_RED_ALPHAAMYLASE_TIME;
mashoutTime = PROFILE_RED_MASHOUT_TIME;
recirculationTime = PROFILE_RED_RECIRCULATION_TIME;
spargeTime = PROFILE_RED_SPARGE_TIME;
boilTime = PROFILE_RED_BOIL_TIME;
coolingTime = PROFILE_RED_COOLING_TIME;
startpointTemperature = PROFILE_RED_STARTPOINT_TEMPERATURE;
betaGlucanaseTemperature = PROFILE_RED_BETAGLUCANASE_TEMPERATURE;
debranchingTemperature = PROFILE_RED_DEBRANCHING_TEMPERATURE;
proteolyticTemperature = PROFILE_RED_PROTEOLYTIC_TEMPERATURE;
betaAmylaseTemperature = PROFILE_RED_BETAAMYLASE_TEMPERATURE;
alphaAmylaseTemperature = PROFILE_RED_ALPHAAMYLASE_TEMPERATURE;
mashoutTemperature = PROFILE_RED_MASHOUT_TEMPERATURE;
recirculationTemperature = PROFILE_RED_RECIRCULATION_TEMPERATURE;
spargeTemperature = PROFILE_RED_SPARGE_TEMPERATURE;
boilTemperature = PROFILE_RED_BOIL_TEMPERATURE;
coolingTemperature = PROFILE_RED_COOLING_TEMPERATURE;
backToStatus();
eMenuType = eMenuType_Main;
repaint = true;
// reset operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Menu, eMainMenuPosition, MENU_SIZE_MAIN_MENU - 1, 1, 1, 0 );
break;
}
case eBeerProfileMenu_APA: {
beerProfile = eBeerProfile_APA;
backToStatus();
startpointTime = PROFILE_APA_STARTPOINT_TIME;
betaGlucanaseTime = PROFILE_APA_BETAGLUCANASE_TIME;
debranchingTime = PROFILE_APA_DEBRANCHING_TIME;
proteolyticTime = PROFILE_APA_PROTEOLYTIC_TIME;
betaAmylaseTime = PROFILE_APA_BETAAMYLASE_TIME;
alphaAmylaseTime = PROFILE_APA_ALPHAAMYLASE_TIME;
mashoutTime = PROFILE_APA_MASHOUT_TIME;
recirculationTime = PROFILE_APA_RECIRCULATION_TIME;
spargeTime = PROFILE_APA_SPARGE_TIME;
boilTime = PROFILE_APA_BOIL_TIME;
coolingTime = PROFILE_APA_COOLING_TIME;
startpointTemperature = PROFILE_APA_STARTPOINT_TEMPERATURE;
betaGlucanaseTemperature = PROFILE_APA_BETAGLUCANASE_TEMPERATURE;
debranchingTemperature = PROFILE_APA_DEBRANCHING_TEMPERATURE;
proteolyticTemperature = PROFILE_APA_PROTEOLYTIC_TEMPERATURE;
betaAmylaseTemperature = PROFILE_APA_BETAAMYLASE_TEMPERATURE;
alphaAmylaseTemperature = PROFILE_APA_ALPHAAMYLASE_TEMPERATURE;
mashoutTemperature = PROFILE_APA_MASHOUT_TEMPERATURE;
recirculationTemperature = PROFILE_APA_RECIRCULATION_TEMPERATURE;
spargeTemperature = PROFILE_APA_SPARGE_TEMPERATURE;
boilTemperature = PROFILE_APA_BOIL_TEMPERATURE;
coolingTemperature = PROFILE_APA_COOLING_TEMPERATURE;
eMenuType = eMenuType_Main;
repaint = true;
// reset operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Menu, eMainMenuPosition, MENU_SIZE_MAIN_MENU - 1, 1, 1, 0 );
backToStatus();
break;
}
case eBeerProfileMenu_Custom: {
beerProfile = eBeerProfile_Custom;
startpointTime = 120;
betaGlucanaseTime = 120;
debranchingTime = 120;
proteolyticTime = 120;
betaAmylaseTime = 120;
alphaAmylaseTime = 120;
mashoutTime = 120;
recirculationTime = 120;
spargeTime = 120;
boilTime = 120;
coolingTime = 120;
startpointTemperature = 50;
betaGlucanaseTemperature = 55;
debranchingTemperature = 60;
proteolyticTemperature = 65;
betaAmylaseTemperature = 70;
alphaAmylaseTemperature = 75;
mashoutTemperature = 80;
recirculationTemperature = 85;
spargeTemperature = 90;
boilTemperature = 95;
coolingTemperature = 100;
startpointTime = PROFILE_CUSTOM_STARTPOINT_TIME;
betaGlucanaseTime = PROFILE_CUSTOM_BETAGLUCANASE_TIME;
debranchingTime = PROFILE_CUSTOM_DEBRANCHING_TIME;
proteolyticTime = PROFILE_CUSTOM_PROTEOLYTIC_TIME;
betaAmylaseTime = PROFILE_CUSTOM_BETAAMYLASE_TIME;
alphaAmylaseTime = PROFILE_CUSTOM_ALPHAAMYLASE_TIME;
mashoutTime = PROFILE_CUSTOM_MASHOUT_TIME;
recirculationTime = PROFILE_CUSTOM_RECIRCULATION_TIME;
spargeTime = PROFILE_CUSTOM_SPARGE_TIME;
boilTime = PROFILE_CUSTOM_BOIL_TIME;
coolingTime = PROFILE_CUSTOM_COOLING_TIME;
startpointTemperature = PROFILE_CUSTOM_STARTPOINT_TEMPERATURE;
betaGlucanaseTemperature = PROFILE_CUSTOM_BETAGLUCANASE_TEMPERATURE;
debranchingTemperature = PROFILE_CUSTOM_DEBRANCHING_TEMPERATURE;
proteolyticTemperature = PROFILE_CUSTOM_PROTEOLYTIC_TEMPERATURE;
betaAmylaseTemperature = PROFILE_CUSTOM_BETAAMYLASE_TEMPERATURE;
alphaAmylaseTemperature = PROFILE_CUSTOM_ALPHAAMYLASE_TEMPERATURE;
mashoutTemperature = PROFILE_CUSTOM_MASHOUT_TEMPERATURE;
recirculationTemperature = PROFILE_CUSTOM_RECIRCULATION_TEMPERATURE;
spargeTemperature = PROFILE_CUSTOM_SPARGE_TEMPERATURE;
boilTemperature = PROFILE_CUSTOM_BOIL_TEMPERATURE;
coolingTemperature = PROFILE_CUSTOM_COOLING_TEMPERATURE;
backToStatus();
eMenuType = eMenuType_Main;
repaint = true;
// reset operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Menu, eMainMenuPosition, MENU_SIZE_MAIN_MENU - 1, 1, 1, 0 );
break;
}
case eBeerProfileMenu_Back: {
......@@ -950,10 +982,92 @@ void runBeerProfileSelection() {
eBeerProfileMenuSelection = eBeerProfileMenu_NULL;
}
void runStartFromStageSelection_Processor( unsigned long *stageTime, int *stageTemperature, eCookingStages nextStage ) {
// Stop anything that might be still going on
xSafeHardwarePowerOff();
finalYield = xSetFinalYield( finalYield );
(*stageTime) = getTimer( clockCounter/1000, (*stageTime) );
(*stageTemperature) = xSetTemperature( (*stageTemperature) );
xSetupGlobalVariablesForStage( nextStage );
startBrewing();
backToStatus();
xPurgePump();
}
void runStartFromStageSelection() {
switch(eStartFromStageMenuSelection) {
case eStageMenu_Startpoint: {
runStartFromStageSelection_Processor( &startpointTime, &startpointTemperature, eCookingStage_Startpoint );
break;
}
case eStageMenu_BetaGlucanase: {
runStartFromStageSelection_Processor( &betaGlucanaseTime, &betaGlucanaseTemperature, eCookingStage_BetaGlucanase );
break;
}
case eStageMenu_Debranching: {
runStartFromStageSelection_Processor( &debranchingTime, &debranchingTemperature, eCookingStage_Debranching );
break;
}
case eStageMenu_Proteolytic: {
runStartFromStageSelection_Processor( &proteolyticTime, &proteolyticTemperature, eCookingStage_Proteolytic );
break;
}
case eStageMenu_BetaAmylase: {
runStartFromStageSelection_Processor( &betaAmylaseTime, &betaAmylaseTemperature, eCookingStage_BetaAmylase );
break;
}
case eStageMenu_AlphaAmylase: {
runStartFromStageSelection_Processor( &alphaAmylaseTime, &alphaAmylaseTemperature, eCookingStage_AlphaAmylase );
break;
}
case eStageMenu_Mashout: {
runStartFromStageSelection_Processor( &mashoutTime, &mashoutTemperature, eCookingStage_Mashout );
break;
}
case eStageMenu_Recirculation: {
runStartFromStageSelection_Processor( &recirculationTime, &recirculationTemperature, eCookingStage_Recirculation );
break;
}
case eStageMenu_Sparge: {
runStartFromStageSelection_Processor( &spargeTime, &spargeTemperature, eCookingStage_Sparge );
break;
}
case eStageMenu_Boil: {
runStartFromStageSelection_Processor( &boilTime, &boilTemperature, eCookingStage_Boil );
break;
}
case eStageMenu_Cooling: {
runStartFromStageSelection_Processor( &coolingTime, &coolingTemperature, eCookingStage_Cooling );
break;
}
case eStageMenu_Back: {
resetMenu( true );
break;
}
default: {
}
}
eStartFromStageMenuSelection = eStageMenu_NULL;
}
void runMainMenuSelection() {
switch(eMainMenuSelection) {
case eMainMenu_GO_FROM_STAGE: {
eMenuType = eMenuType_StartFromStage;
repaint = true;
// reset operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Menu, eBeerProfileMenuPosition, MENU_SIZE_PROFILES_MENU - 1, 1, 1, 0 );
break;
}
case eMainMenu_GO: {
finalYield = xSetGenericValue( finalYield, 0, 50, "Final Yield", "l" );
finalYield = xSetFinalYield( finalYield );
startBrewing();
......@@ -961,9 +1075,6 @@ void runMainMenuSelection() {
backToStatus();
// reset operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Menu, eMainMenuPosition, MENU_SIZE_MAIN_MENU - 1, 1, 1, 0 );
xPurgePump();
break;
......@@ -973,9 +1084,6 @@ void runMainMenuSelection() {
backToStatus();
// reset operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Menu, eMainMenuPosition, MENU_SIZE_MAIN_MENU - 1, 1, 1, 0 );
break;
}
case eMainMenu_SKIP: {
......@@ -983,9 +1091,6 @@ void runMainMenuSelection() {
backToStatus();
// reset operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Menu, eMainMenuPosition, MENU_SIZE_MAIN_MENU - 1, 1, 1, 0 );
break;
}
case eMainMenu_BeerProfile: {
......@@ -1018,9 +1123,6 @@ void runMainMenuSelection() {
case eMainMenu_Hops: {
backToStatus();
// reset operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Menu, eMainMenuPosition, MENU_SIZE_MAIN_MENU - 1, 1, 1, 0 );
break;
}
case eMainMenu_Clean: {
......@@ -1034,9 +1136,6 @@ void runMainMenuSelection() {
backToStatus();
// reset operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Menu, eMainMenuPosition, MENU_SIZE_MAIN_MENU - 1, 1, 1, 0 );
xPurgePump();
break;
......@@ -1052,9 +1151,6 @@ void runMainMenuSelection() {
backToStatus();
// reset operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Menu, eMainMenuPosition, MENU_SIZE_MAIN_MENU - 1, 1, 1, 0 );
xPurgePump();
break;
......@@ -1070,9 +1166,6 @@ void runMainMenuSelection() {
}
case eMainMenu_Back: {
backToStatus();
// reset operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Menu, eMainMenuPosition, MENU_SIZE_MAIN_MENU - 1, 1, 1, 0 );
break;
}
......@@ -1083,7 +1176,6 @@ void runMainMenuSelection() {
eMainMenuSelection = eMainMenu_NULL;
}
void xCountTheTime( int temperatureRange, boolean bAverageUpDown ) {
unsigned long now = millis();
unsigned long elapsedTime = now - clockLastUpdate;
......@@ -1093,10 +1185,10 @@ void xCountTheTime( int temperatureRange, boolean bAverageUpDown ) {
float tup = upPT100.getCurrentTemperature();
float tdown = downPT100.getCurrentTemperature();
if(tup > tdown) {
temperatureCount = tup;
temperatureCount = tdown;
}
else {
temperatureCount = tdown;
temperatureCount = tup;
}
} else {
temperatureCount = basePT100.getCurrentTemperature();
......@@ -1105,12 +1197,21 @@ void xCountTheTime( int temperatureRange, boolean bAverageUpDown ) {
// Check if the machine is in the right temperature range, for the current mode,
//if(!( temperatureCount > (cookTemperature - temperatureRange) && temperatureCount < (cookTemperature + temperatureRange))) {
float margin = temperatureRange;
if( cookTemperature >= 100.0 ) {
/* if( cookTemperature >= 100.0 ) {
margin = 2.0;
}
}*/
if( temperatureCount < (cookTemperature - margin) ) {
clockIgnore += elapsedTime;
}
/*else {
if( (temperatureCount >= (cookTemperature - margin)) && (temperatureCount < cookTemperature ) {
clockIgnore += elapsedTime / margin * (cookTemperature - temperatureCount) ;
}
else {
}
}*/
// Calculate the remaining time on the clock
clockCounter = cookTime * 1000 - (now - clockStartTime - clockIgnore);
......@@ -1149,11 +1250,11 @@ bool xRegulateTemperature( boolean bAverageUpDown ) {
bool overTemperature = false;
double wattage = 0.0;
if( bAverageUpDown ) {
float tbase = basePT100.getCurrentTemperature();
float tup = upPT100.getCurrentTemperature();
float tdown = downPT100.getCurrentTemperature();
float tup = upPT100.getCurrentTemperature();
float tdown = downPT100.getCurrentTemperature();
float tbase = basePT100.getCurrentTemperature();
if( bAverageUpDown ) {
if(tup > tdown) {
difference = cookTemperature - tup;
}
......@@ -1161,16 +1262,15 @@ bool xRegulateTemperature( boolean bAverageUpDown ) {
difference = cookTemperature - tdown;
}
if (tbase > (cookTemperature + 2.0)) {
difference = 0.0;
if(tbase > cookTemperature && (tbase >= (PUMP_TEMPERATURE_MAX_OPERATION - 2.0) || difference >= 5.0)) {
difference = cookTemperature - tbase;
}
if (tbase < (cookTemperature)) {
if( (tbase < cookTemperature) && (difference < (cookTemperature - tbase)) ) {
difference = cookTemperature - tbase;
}
} else {
difference = cookTemperature - basePT100.getCurrentTemperature();
difference = cookTemperature - tbase;
}
// Deviation between the cook temperature set and the cook temperature measured
......@@ -1184,22 +1284,33 @@ bool xRegulateTemperature( boolean bAverageUpDown ) {
// turn it off
wattage = 0.0;
} else {
if(difference <= 0.1) {
//if(difference <= 0.1) {
// turn it off
wattage = 0.0;
} else {
// wattage = 0.0;
//} else {
if(difference <= 0.5) {
// pulse lightly at 500 watt
if(cookTemperature > 99.0) {
wattage = 1500.0;
wattage = 2000.0;
}
else {
wattage = 500.0;
if(cookTemperature > 70.0) {
wattage = 1000.0;
}
else {
wattage = 500.0;
}
}
} else {
if(difference <= 1.0) {
// pulse moderately at 1000 watt
wattage = 1000.0;
if(cookTemperature > 99.0) {
wattage = 2000.0;
}
else {
wattage = 1000.0;
}
} else {
if(difference <= 3.0) {
// pulse hardly at 2000 watt
......@@ -1210,7 +1321,7 @@ bool xRegulateTemperature( boolean bAverageUpDown ) {
}
}
}
}
//}
}
// Update the recorded time for the begining of the window, if the previous window has passed
......@@ -1241,9 +1352,9 @@ bool xRegulateTemperature( boolean bAverageUpDown ) {
void xPurgePump() {
for(int i = 0; i < 2; i++) {
analogWrite(PUMP_PIN, PUMP_SPEED_MAX); // analogWrite values from 0 to 255
analogWrite(PUMP_PIN, PUMP_SPEED_MAX_MOSFET); // analogWrite values from 0 to 255
delay(1000);
analogWrite(PUMP_PIN, PUMP_SPEED_STOP); // analogWrite values from 0 to 255
analogWrite(PUMP_PIN, PUMP_SPEED_STOP_MOSFET); // analogWrite values from 0 to 255
delay(1500);
}
}
......@@ -1252,18 +1363,18 @@ bool xRegulatePumpSpeed() {
// analogWrite(PUMP_PIN, iPumpSpeed); // analogWrite values from 0 to 255
if(basePT100.getCurrentTemperature() > PUMP_TEMPERATURE_MAX_OPERATION) {
analogWrite(PUMP_PIN, PUMP_SPEED_STOP); // analogWrite values from 0 to 255
analogWrite(PUMP_PIN, PUMP_SPEED_STOP_MOSFET); // analogWrite values from 0 to 255
basePT100.setSampleDeviation( 0.0 );
upPT100.setSampleDeviation( 0.0 );
downPT100.setSampleDeviation( 0.0 );
basePT100.setPumpStatus( false );
upPT100.setPumpStatus( false );
downPT100.setPumpStatus( false );
}
else {
analogWrite(PUMP_PIN, iPumpSpeed); // analogWrite values from 0 to 255
basePT100.setSampleDeviation( -2.0 );
upPT100.setSampleDeviation( -2.0 );
downPT100.setSampleDeviation( -2.0 );
basePT100.setPumpStatus( true );
upPT100.setPumpStatus( true );
downPT100.setPumpStatus( true );
}
}
......@@ -1326,6 +1437,28 @@ void xSetupGlobalVariablesForStage(eCookingStages nextStage) {
break;
}
case eBeerProfile_IPA: {
float caramelAmount = 0.013157895 * ((float) finalYield);
float wheatAmount = 0.060526316 * ((float) finalYield);
float pilsnerAmount = 0.115789474 * ((float) finalYield);
float munichAmount = 0.028947368 * ((float) finalYield);
String say = "Cruch ";
say += String(caramelAmount);
say += String("Kg of Caramel 120, ");
say += String(wheatAmount);
say += String("Kg of Wheat, ");
say += String(pilsnerAmount);
say += String("Kg of Pilsner, ");
say += String(munichAmount);
say += String("Kg of Munich into a pot.");
xWaitForAction("Malt", say);
repaint = true;
break;
}
default: {
}
......@@ -1337,7 +1470,7 @@ void xSetupGlobalVariablesForStage(eCookingStages nextStage) {
repaint = true;
// A basic operation for a basic stage
xStageFirstRun( startpointTime, startpointTemperature, PUMP_SPEED_MAX, eCookingStage_Startpoint );
xStageFirstRun( startpointTime, startpointTemperature, PUMP_SPEED_MAX_MOSFET, eCookingStage_Startpoint );
break;
}
......@@ -1359,43 +1492,65 @@ void xSetupGlobalVariablesForStage(eCookingStages nextStage) {
break;
}
case eBeerProfile_IPA: {
float caramelAmount = 0.013157895 * ((float) finalYield);
float wheatAmount = 0.060526316 * ((float) finalYield);
float pilsnerAmount = 0.115789474 * ((float) finalYield);
float munichAmount = 0.028947368 * ((float) finalYield);
String say = "Cruch ";
say += String(caramelAmount);
say += String("Kg of Caramel 120, ");
say += String(wheatAmount);
say += String("Kg of Wheat, ");
say += String(pilsnerAmount);
say += String("Kg of Pilsner, ");
say += String(munichAmount);
say += String("Kg of Munich into a pot.");
xWaitForAction("Malt", say);
repaint = true;
break;
}
default: {
}
}
// A basic operation for a basic stage
xStageFirstRun( betaGlucanaseTime, betaGlucanaseTemperature, PUMP_SPEED_MAX, eCookingStage_BetaGlucanase );
xStageFirstRun( betaGlucanaseTime, betaGlucanaseTemperature, PUMP_SPEED_MAX_MOSFET, eCookingStage_BetaGlucanase );
break;
}
case eCookingStage_Debranching: {
// A basic operation for a basic stage
xStageFirstRun( debranchingTime, debranchingTemperature, PUMP_SPEED_MAX, eCookingStage_Debranching );
xStageFirstRun( debranchingTime, debranchingTemperature, PUMP_SPEED_MAX_MOSFET, eCookingStage_Debranching );
break;
}
case eCookingStage_Proteolytic: {
// A basic operation for a basic stage
xStageFirstRun( proteolyticTime, proteolyticTemperature, PUMP_SPEED_MAX, eCookingStage_Proteolytic );
xStageFirstRun( proteolyticTime, proteolyticTemperature, PUMP_SPEED_MAX_MOSFET, eCookingStage_Proteolytic );
break;
}
case eCookingStage_BetaAmylase: {
// A basic operation for a basic stage
xStageFirstRun( betaAmylaseTime, betaAmylaseTemperature, PUMP_SPEED_MAX, eCookingStage_BetaAmylase );
xStageFirstRun( betaAmylaseTime, betaAmylaseTemperature, PUMP_SPEED_MAX_MOSFET, eCookingStage_BetaAmylase );
break;
}
case eCookingStage_AlphaAmylase: {
// A basic operation for a basic stage
xStageFirstRun( alphaAmylaseTime, alphaAmylaseTemperature, PUMP_SPEED_MAX, eCookingStage_AlphaAmylase );
xStageFirstRun( alphaAmylaseTime, alphaAmylaseTemperature, PUMP_SPEED_MAX_MOSFET, eCookingStage_AlphaAmylase );
break;
}
case eCookingStage_Mashout: {
// A basic operation for a basic stage
xStageFirstRun( mashoutTime, mashoutTemperature, PUMP_SPEED_MAX, eCookingStage_Mashout );
xStageFirstRun( mashoutTime, mashoutTemperature, PUMP_SPEED_MAX_MOSFET, eCookingStage_Mashout );
break;
}
......@@ -1405,7 +1560,7 @@ void xSetupGlobalVariablesForStage(eCookingStages nextStage) {
repaint = true;
// A basic operation for a basic stage
xStageFirstRun( recirculationTime, recirculationTemperature, PUMP_SPEED_MAX, eCookingStage_Recirculation );
xStageFirstRun( recirculationTime, recirculationTemperature, PUMP_SPEED_MAX_MOSFET, eCookingStage_Recirculation );
break;
}
......@@ -1416,7 +1571,7 @@ void xSetupGlobalVariablesForStage(eCookingStages nextStage) {
repaint = true;
// A basic operation for a basic stage
xStageFirstRun( spargeTime, spargeTemperature, PUMP_SPEED_MAX, eCookingStage_Sparge );
xStageFirstRun( spargeTime, spargeTemperature, PUMP_SPEED_MAX_MOSFET, eCookingStage_Sparge );
break;
}
......@@ -1434,6 +1589,18 @@ void xSetupGlobalVariablesForStage(eCookingStages nextStage) {
break;
}
case eBeerProfile_IPA: {
String say = "Get ";
float hopAmount = 0.8 * ((float) finalYield);
say += String(hopAmount);
say += String("g of Chinook, Cascade and Styrian Golding ready.");
xWaitForAction("Hops", say);
break;
}
default: {
xWaitForAction("Hops", "Add the hops in the right order, at the right time.");
......@@ -1443,7 +1610,7 @@ void xSetupGlobalVariablesForStage(eCookingStages nextStage) {
repaint = true;
// A basic operation for a basic stage
xStageFirstRun( boilTime, boilTemperature, PUMP_SPEED_MAX, eCookingStage_Boil );
xStageFirstRun( boilTime, boilTemperature, PUMP_SPEED_MAX_MOSFET, eCookingStage_Boil );
break;
}
......@@ -1454,7 +1621,7 @@ void xSetupGlobalVariablesForStage(eCookingStages nextStage) {
repaint = true;
// A basic operation for a basic stage
xStageFirstRun( coolingTime, coolingTemperature, PUMP_SPEED_MAX, eCookingStage_Cooling );
xStageFirstRun( coolingTime, coolingTemperature, PUMP_SPEED_MAX_MOSFET, eCookingStage_Cooling );
break;
}
......@@ -1468,13 +1635,13 @@ void xSetupGlobalVariablesForStage(eCookingStages nextStage) {
repaint = true;
// A basic operation for a basic stage
xStageFirstRun( cleaningTime, cleaningTemperature, PUMP_SPEED_MAX, eCookingStage_Clean );
xStageFirstRun( cleaningTime, cleaningTemperature, PUMP_SPEED_MAX_MOSFET, eCookingStage_Clean );
break;
}
case eCookingStage_Purge: {
// A basic operation for a basic stage
xStageFirstRun( 0, 0, PUMP_SPEED_MAX, eCookingStage_Purge );
xStageFirstRun( 0, 0, PUMP_SPEED_MAX_MOSFET, eCookingStage_Purge );
xRegulatePumpSpeed();
......@@ -1482,7 +1649,7 @@ void xSetupGlobalVariablesForStage(eCookingStages nextStage) {
}
case eCookingStage_Done: {
// A basic operation for a basic stage
xStageFirstRun( 0, 0, PUMP_SPEED_STOP, eCookingStage_Done );
xStageFirstRun( 0, 0, PUMP_SPEED_STOP_MOSFET, eCookingStage_Done );
break;
}
......@@ -1574,9 +1741,9 @@ void xManageMachineSystems() {
#endif
// Measure temperature, for effect
basePT100.measure1(false, false);
upPT100.measure1(false, false);
downPT100.measure1(true, false);
basePT100.measure(false);
upPT100.measure(false);
downPT100.measure(true);
// If cooking is done, return (this is a nice place to double check safety and ensure the cooking parts aren't on.
if(!cooking) {
......@@ -1589,55 +1756,55 @@ void xManageMachineSystems() {
switch(cookingStage) {
case eCookingStage_Startpoint: {
// A basic operation for a basic stage
xBasicStageOperation( startpointTime, startpointTemperature, 1, eCookingStage_BetaGlucanase, false);
xBasicStageOperation( startpointTime, startpointTemperature, 0, eCookingStage_BetaGlucanase, false);
break;
}
case eCookingStage_BetaGlucanase: {
// A basic operation for a basic stage
xBasicStageOperation( betaGlucanaseTime, betaGlucanaseTemperature, 0, eCookingStage_Debranching, true );
xBasicStageOperation( betaGlucanaseTime, betaGlucanaseTemperature, 3, eCookingStage_Debranching, true );
break;
}
case eCookingStage_Debranching: {
// A basic operation for a basic stage
xBasicStageOperation( debranchingTime, debranchingTemperature, 0, eCookingStage_Proteolytic, true );
xBasicStageOperation( debranchingTime, debranchingTemperature, 3, eCookingStage_Proteolytic, true );
break;
}
case eCookingStage_Proteolytic: {
// A basic operation for a basic stage
xBasicStageOperation( proteolyticTime, proteolyticTemperature, 0, eCookingStage_BetaAmylase, true );
xBasicStageOperation( proteolyticTime, proteolyticTemperature, 3, eCookingStage_BetaAmylase, true );
break;
}
case eCookingStage_BetaAmylase: {
// A basic operation for a basic stage
xBasicStageOperation( betaAmylaseTime, betaAmylaseTemperature, 0, eCookingStage_AlphaAmylase, true );
xBasicStageOperation( betaAmylaseTime, betaAmylaseTemperature, 4, eCookingStage_AlphaAmylase, true );
break;
}
case eCookingStage_AlphaAmylase: {
// A basic operation for a basic stage
xBasicStageOperation( alphaAmylaseTime, alphaAmylaseTemperature, 0, eCookingStage_Mashout, true );
xBasicStageOperation( alphaAmylaseTime, alphaAmylaseTemperature, 2, eCookingStage_Mashout, true );
break;
}
case eCookingStage_Mashout: {
// A basic operation for a basic stage
xBasicStageOperation( mashoutTime, mashoutTemperature, 0, eCookingStage_Recirculation, true );
xBasicStageOperation( mashoutTime, mashoutTemperature, 1, eCookingStage_Recirculation, true );
break;
}
case eCookingStage_Recirculation: {
// A basic operation for a basic stage
xBasicStageOperation( recirculationTime, recirculationTemperature, 0, eCookingStage_Sparge, true );
xBasicStageOperation( recirculationTime, recirculationTemperature, 1, eCookingStage_Sparge, true );
break;
}
case eCookingStage_Sparge: {
// A basic operation for a basic stage
xBasicStageOperation( spargeTime, spargeTemperature, 1, eCookingStage_Boil, false );
xBasicStageOperation( spargeTime, spargeTemperature, 3, eCookingStage_Boil, false );
break;
}
......@@ -1649,20 +1816,20 @@ void xManageMachineSystems() {
}
case eCookingStage_Cooling: {
// A basic operation for a basic stage
xBasicStageOperation( coolingTime, coolingTemperature, 1, eCookingStage_Done, false );
xBasicStageOperation( coolingTime, coolingTemperature, 0, eCookingStage_Done, false );
break;
}
case eCookingStage_Clean: {
// A basic operation for a basic stage
xBasicStageOperation( cleaningTime, cleaningTemperature, 1, eCookingStage_Done, false );
xBasicStageOperation( cleaningTime, cleaningTemperature, 0, eCookingStage_Done, false );
break;
}
case eCookingStage_Purge: {
// A basic operation for a basic stage
//xBasicStageOperation( coolingTime, coolingTemperature, 1, eCookingStage_Done );
iPumpSpeed = PUMP_SPEED_MAX;
iPumpSpeed = PUMP_SPEED_MAX_MOSFET;
xRegulatePumpSpeed();
......@@ -1695,15 +1862,27 @@ void stopBrewing() {
cooking = false;
}
void resetMenu( boolean requestRepaintPaint ) {
eMenuType = eMenuType_Main;
if( requestRepaintPaint ) {
repaint = true;
}
// reset operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Menu, eMainMenuPosition, MENU_SIZE_MAIN_MENU - 1, 1, 1, 0 );
}
void backToStatus() {
lastInterruptTime = millis() - SETTING_MAX_INACTIVITY_TIME - 1;
resetMenu(true);
}
// #################################################### Helpers ##################################################################
// #################################################### Set Variables ##################################################################
int getTimer(int init) {
int getTimer( int initialValue, int defaultValue ) {
// set operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Time, init, 7200, 0, 1, 30 );
xSetupRotaryEncoder( eRotaryEncoderMode_Time, initialValue, 7200, 0, 1, 30 );
// initialize variables
int rotaryEncoderPreviousPosition = 0;
......@@ -1713,7 +1892,16 @@ int getTimer(int init) {
// Setup Screen
lcd.clear();
lcd.home();
lcd.print("Set Time");
lcd.print("Set Time (");
minutes = defaultValue/60;
lcd.print(minutes);
seconds = defaultValue-minutes*60;
lcd.print(":");
if(seconds<10) {
lcd.print("0");
}
lcd.print(seconds);
lcd.print(")");
lcd.setCursor (0,LCD_VERTICAL_RESOLUTION-1);
lcd.print(" 0:00");
......@@ -1740,7 +1928,14 @@ int getTimer(int init) {
seconds = rotaryEncoderVirtualPosition-minutes*60;
lcd.setCursor (0,LCD_VERTICAL_RESOLUTION-1);
lcd.print(" ");
if(minutes<100) {
lcd.print(" ");
}
if(minutes<10) {
lcd.print(" ");
}
lcd.print(" ");
lcd.print(minutes);
lcd.print(":");
if(seconds<10) {
......@@ -1754,11 +1949,15 @@ int getTimer(int init) {
return rotaryEncoderVirtualPosition;
}
int getTemperature(int init) {
int getTimer( int initialValue ) {
return getTimer( initialValue, initialValue );
}
int getTemperature(int initialValue) {
// set operation state
rotaryEncoderMode = eRotaryEncoderMode_Generic;
rotaryEncoderVirtualPosition = init;
rotaryEncoderVirtualPosition = initialValue;
// initialize variables
int rotaryEncoderPreviousPosition = 0;
......@@ -1811,9 +2010,9 @@ int getTemperature(int init) {
return rotaryEncoderVirtualPosition;
}
int xSetGenericValue(int init, int min, int max, char *valueName, char *unit) {
int xSetGenericValue(int initialValue, int minimumValue, int maximumValue, char *valueName, char *unit) {
// set operation state | INPUT : eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep
xSetupRotaryEncoder( eRotaryEncoderMode_Generic, init, max, min, 1, 5 );
xSetupRotaryEncoder( eRotaryEncoderMode_Generic, initialValue, maximumValue, minimumValue, 1, 5 );
// initialize variables
int rotaryEncoderPreviousPosition = 0;
......@@ -1867,6 +2066,14 @@ int xSetGenericValue(int init, int min, int max, char *valueName, char *unit) {
return rotaryEncoderVirtualPosition;
}
int xSetTemperature( int initialValue ) {
return xSetGenericValue( initialValue, TEMPERATURE_MIN_VALUE, TEMPERATURE_MAX_VALUE, "temperature", "*C" );
}
int xSetFinalYield( int initialValue ) {
return xSetGenericValue( initialValue, SETTING_MACHINE_YIELD_CAPACITY_MIN, SETTING_MACHINE_YIELD_CAPACITY_MAX, "Final Yield", "l" );
}
// ###################### Set Variables ##################################################
void xWaitForAction(String title, String message) {
......@@ -1903,9 +2110,3 @@ boolean gotButtonPress(int iPin) {
return ret;
}
void cleanSerialMonitor() {
for (int i = 0; i < 40; i++) {
Serial.println();
}
}
\ No newline at end of file
......@@ -8,8 +8,10 @@
#define CONFIG_h
// ######################### SETTINGS #########################
#define SETTING_CLEANING_TIME 1200 //1200
#define SETTING_CLEANING_TIME 1200 //1200
#define SETTING_CLEANING_TEMPERATURE 45 //45
#define SETTING_MACHINE_YIELD_CAPACITY_MIN 0
#define SETTING_MACHINE_YIELD_CAPACITY_MAX 50
// ++++++++++++++++++++++++ Heating Element Relay ++++++++++++++++++++++++
#define HEATING_ELEMENT_DEFAULT_WINDOW_SIZE 1000
......@@ -20,22 +22,24 @@
#define HEATING_ELEMENT_AC_FREQUENCY_HZ 50.0
// ++++++++++++++++++++++++ Temperature ++++++++++++++++++++++++
#define TEMPERATURE_MIN_VALUE 0
#define TEMPERATURE_MAX_VALUE 120
#define PT100_BASE_INPUT_PIN A4
#define PT100_BASE_OUTPUT_PIN 32
#define PT100_BASE_INPUT_R_PIN A7
#define PT100_BASE_OUTPUT_R_PIN 7
//#define PT100_BASE_INPUT_R_PIN A7
//#define PT100_BASE_OUTPUT_R_PIN 7
#define PT100_BASE_TIME_BETWEEN_READINGS 1
#define PT100_UP_INPUT_PIN A5
#define PT100_UP_OUTPUT_PIN 30
#define PT100_UP_INPUT_R_PIN A8
#define PT100_UP_OUTPUT_R_PIN 9
//#define PT100_UP_INPUT_R_PIN A8
//#define PT100_UP_OUTPUT_R_PIN 9
#define PT100_UP_TIME_BETWEEN_READINGS 1
#define PT100_DOWN_INPUT_PIN A6
#define PT100_DOWN_OUTPUT_PIN 31
#define PT100_DOWN_INPUT_R_PIN A9
#define PT100_DOWN_OUTPUT_R_PIN 8
//#define PT100_DOWN_INPUT_R_PIN A9
//#define PT100_DOWN_OUTPUT_R_PIN 8
#define PT100_DOWN_TIME_BETWEEN_READINGS 1
/*
#define PT100_BASE_DEFAULT_ADC_VMAX 1.1
#define PT100_BASE_DEFAULT_VS 5.0
#define PT100_BASE_DEFAULT_R1_RESISTENCE 605.2
......@@ -48,6 +52,7 @@
#define PT100_DOWN_DEFAULT_VS 5.0
#define PT100_DOWN_DEFAULT_R1_RESISTENCE 616.0
#define PT100_DOWN_DEFAULT_R2_RESISTENCE 611.0
*/
// ++++++++++++++++++++++++ Mixer ++++++++++++++++++++++++
//#define MIXER_PIN 12
......@@ -60,9 +65,11 @@
#define PUMP_PIN 6
#define PUMP_TEMPERATURE_MAX_OPERATION 90
#define PUMP_SPEED_STOP 0
#define PUMP_SPEED_STOP_MOSFET 255
#define PUMP_SPEED_SLOW 64
#define PUMP_SPEED_AVERAGE 128
#define PUMP_SPEED_FAST 192
#define PUMP_SPEED_MAX_MOSFET 0
#define PUMP_SPEED_MAX 255
// ++++++++++++++++++++++++ Rotary Encoder ++++++++++++++++++++++++
......@@ -75,11 +82,13 @@
// ++++++++++++++++++++++++ State Machine ++++++++++++++++++++++++
#define SETTING_WELCOME_TIMEOUT 100
#define SETTING_MAX_INACTIVITY_TIME 3000
#define MENU_SIZE_MAIN_MENU 12
#define MENU_SIZE_MAIN_MENU 13
#define MENU_SIZE_PROFILES_MENU 9
#define MENU_SIZE_STAGE_MENU 13
#define MENU_SIZE_MALT_MENU 4
#define MENU_SIZE_SETTINGS_MENU 5
#define MENU_SIZE_SETTINGS_MENU 6
// ++++++++++++++++++++++++ Serial Monotor ++++++++++++++++++++++++
#define SETTING_SERIAL_MONITOR_BAUD_RATE 9600
#define SETTING_SERIAL_MONITOR_WELCOME_MESSAGE "Let's start Brewing!"
......@@ -97,4 +106,4 @@
#define LCD_D6_PIN 6
#define LCD_D7_PIN 7
#endif
\ No newline at end of file
#endif
......@@ -5,7 +5,7 @@
*/
#ifndef DEBUG_h
#define DEBUB_h
#define DEBUG_h
// ######################### TEMPLATES #########################
template <class T> void debugPrintVar( char *name, const T& value );
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment