brew.h 3.83 KB
Newer Older
João Lino's avatar
João Lino committed
1 2 3
#ifndef __BREW
#define __BREW

4 5 6 7 8 9 10 11 12 13 14 15

// ++++++++++++++++++++++++ LiquidCrystal_I2C ++++++++++++++++++++++++
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>

// ++++++++++++++++++++++++ PT100 +++++++++++++++++++++++++++++++++
//#include <PT100.h>

// ++++++++++++++++++++++++ Defines +++++++++++++++++++++++++++++++++
#define NELEMS(x)               (sizeof(x) / sizeof((x)[0]))

16 17 18
// ++++++++++++++++++++++++ Cooking Variables ++++++++++++++++++++++++
#define COOKING_MAX_OVER_TEMPERATURE_RANGE_ALLOWED        5.0

19 20 21 22
// ++++++++++++++++++++++++ OTHER +++++++++++++++++++++++++++++++++
#include "CustomDataStructures.h"
#include "debug.h"

João Lino's avatar
João Lino committed
23 24 25 26 27 28 29 30
// ++++++++++++++++++++++++ FUNCTIONS (used in configuration) +++++++++++++++++++++++++++++++++
void runMainMenuSelection();
void runStartFromStageSelection();
void runBeerProfileSelection();
void runStageSelection();
void runMaltSelection();
void runSettingsSelection();

31 32
#include "config.h"

João Lino's avatar
João Lino committed
33
#include "src/Temperature/Temperature.h"
34
#include "src/HeatingElement/HeatingElement.h"
João Lino's avatar
João Lino committed
35
#include "src/Pump/Pump.h"
João Lino's avatar
João Lino committed
36 37
#include "src/Melody/Melody.h"
#include "src/Display/Display.h"
38

39 40 41 42
#include "Profiles.h"

// ++++++++++++++++++++++++ FUNCTIONS +++++++++++++++++++++++++++++++++

João Lino's avatar
João Lino committed
43 44 45 46 47 48 49 50 51 52 53 54
void xSetupRotaryEncoder( eRotaryEncoderMode newMode, int newPosition, int newMaxPosition, int newMinPosition, int newSingleStep, int newMultiStep );

// ######################### START #########################

void xSafeHardwarePowerOff();

void xWelcomeUser();

// ######################### FUNCTIONS ########################

void runMenu();

João Lino's avatar
João Lino committed
55
void runMenuProcessor( MenuData *data );
João Lino's avatar
João Lino committed
56

João Lino's avatar
João Lino committed
57
void runStageSelection_Generic( unsigned long * selectedStageTime, int *selectedStageTemperature);
João Lino's avatar
João Lino committed
58

João Lino's avatar
João Lino committed
59 60 61 62 63
void xStartStage( unsigned long *stageTime, int *stageTemperature, eCookingStages nextStage, bool bPurgePump, bool bSetFinalYield, bool bSetTime, bool bSetTemperature );

void xStartStageHeadless( eCookingStages nextStage, bool bPurgePump );

void xStartStageInteractive( unsigned long *stageTime, int *stageTemperature, eCookingStages nextStage );
João Lino's avatar
João Lino committed
64

João Lino's avatar
João Lino committed
65
void xCountTheTime( float temperatureRange, boolean bAverageUpDown );
João Lino's avatar
João Lino committed
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80

bool isTimeLeft();

double ulWattToWindowTime( double ulAppliedWatts );

bool xRegulateTemperature( boolean bAverageUpDown );

void xPurgePump();

bool xRegulatePumpSpeed();

void xWarnClockEnded();

void xWarnCookEnded();

João Lino's avatar
João Lino committed
81
void xPrepareForStage( int stageTime, int stageTemperature, int stagePumpSpeed, eCookingStages stage );
João Lino's avatar
João Lino committed
82

João Lino's avatar
João Lino committed
83
void xSetupStage(eCookingStages nextStage);
João Lino's avatar
João Lino committed
84 85 86

void xTransitionIntoStage(eCookingStages nextStage);

João Lino's avatar
João Lino committed
87
void xBasicStageOperation( int iStageTime, int iStageTemperature, float iStageTemperatureRange, eCookingStages nextStage, boolean bAverageUpDown );
João Lino's avatar
João Lino committed
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102

void xManageMachineSystems();

// #################################################### Helpers ##################################################################

void startBrewing();

void stopBrewing();

void resetMenu( boolean requestRepaintPaint );

void backToStatus();

// #################################################### Set Variables ##################################################################

João Lino's avatar
João Lino committed
103
boolean checkForEncoderSwitchPush( bool cancelable );
João Lino's avatar
João Lino committed
104 105

int getTimer( int initialValue );
João Lino's avatar
João Lino committed
106
int getTimer( int initialValue, int defaultValue );
João Lino's avatar
João Lino committed
107

João Lino's avatar
João Lino committed
108 109
int getTemperature( int initialValue );
int getTemperature( int initialValue, int defaultValue );
João Lino's avatar
João Lino committed
110

João Lino's avatar
João Lino committed
111 112
int getFinalYield( int initialValue );
int getFinalYield( int initialValue, int defaultValue );
João Lino's avatar
João Lino committed
113

João Lino's avatar
João Lino committed
114
int xSetGenericValue( int initialValue, int defaultValue, int minimumValue, int maximumValue, const char *valueName, const char *unit );
João Lino's avatar
João Lino committed
115

João Lino's avatar
João Lino committed
116 117
unsigned long getInactivityTime();

João Lino's avatar
João Lino committed
118 119 120 121
// ###################### Set Variables ##################################################

void xWaitForAction(String title, String message);

122 123 124 125
void printBeerProfile( void );
void printTime( unsigned long timeToPrint );
void printTemperature( int temparatureToPrint );

João Lino's avatar
João Lino committed
126
#endif //__BREW