brew.h 3.46 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 16 17 18 19

// ++++++++++++++++++++++++ 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]))

// ++++++++++++++++++++++++ OTHER +++++++++++++++++++++++++++++++++
#include "CustomDataStructures.h"
#include "debug.h"

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

28 29 30 31 32 33 34 35 36
#include "config.h"

#include "Melody.h"
#include "Display.h"
#include "Temperature.h"
#include "Profiles.h"

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

João Lino's avatar
João Lino committed
37 38 39 40 41 42 43 44 45 46 47 48
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
49
void runMenuProcessor( MenuData *data );
João Lino's avatar
João Lino committed
50

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

João Lino's avatar
João Lino committed
53 54 55 56 57
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
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74

void xCountTheTime( int temperatureRange, boolean bAverageUpDown );

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
75
void xPrepareForStage( int stageTime, int stageTemperature, int stagePumpSpeed, eCookingStages stage );
João Lino's avatar
João Lino committed
76

João Lino's avatar
João Lino committed
77
void xSetupStage(eCookingStages nextStage);
João Lino's avatar
João Lino committed
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96

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 ##################################################################

João Lino's avatar
João Lino committed
97
boolean checkForEncoderSwitchPush( bool cancelable );
João Lino's avatar
João Lino committed
98 99

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

João Lino's avatar
João Lino committed
102 103
int getTemperature( int initialValue );
int getTemperature( int initialValue, int defaultValue );
João Lino's avatar
João Lino committed
104

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

João Lino's avatar
João Lino committed
108
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
109

João Lino's avatar
João Lino committed
110 111
unsigned long getInactivityTime();

João Lino's avatar
João Lino committed
112 113 114 115
// ###################### Set Variables ##################################################

void xWaitForAction(String title, String message);

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