Commit 9f46351c authored by João Lino's avatar João Lino

press button to enter menu

cleanup
parent b341fe27
......@@ -24,8 +24,8 @@ enum eMenuType {
};
enum eMainMenuOptions {
eMainMenu_NULL,
eMainMenu_GO_FROM_STAGE,
eMainMenu_GO,
eMainMenu_GO_FROM_STAGE,
eMainMenu_STOP,
eMainMenu_SKIP,
eMainMenu_BeerProfile,
......@@ -110,4 +110,12 @@ enum eBeerProfile {
eBeerProfile_Custom
};
typedef struct menuData_ {
char *_title;
int _position;
int _selection;
char **_dialog;
bool _repaint;
} MenuData;
#endif
......@@ -164,6 +164,19 @@ boolean displayStatus(LiquidCrystal_I2C *lcd, boolean cooking, float cookTempera
return ret;
}
boolean displayGenericMenu( LiquidCrystal_I2C *lcd, MenuData *data ) {
boolean repaintRequired = data->_repaint;
if(repaintRequired) {
lcd->clear();
lcd->home (); // go home
lcd->print(data->_title);
lcd->setCursor (0,1); // go to start of 2nd line
lcd->print((data->_dialog)[data->_position]);
repaintRequired = false;
}
return repaintRequired;
}
boolean displayMainMenu(LiquidCrystal_I2C *lcd, eMainMenuOptions position, boolean repaint) {
boolean ret = repaint;
......
......@@ -22,10 +22,11 @@ void xPaintStatusTemplate(LiquidCrystal_I2C *lcd, boolean cooking);
boolean displayStatus(LiquidCrystal_I2C *lcd, boolean cooking, float cookTemperature, float baseTemperature, float upTemperature, float downTemperature, unsigned long clockCounter, boolean repaint);
boolean displayGenericMenu( LiquidCrystal_I2C *lcd, MenuData *data );
boolean displayMainMenu(LiquidCrystal_I2C *lcd, eMainMenuOptions position, boolean repaint);
boolean displayBeerProfileMenu(LiquidCrystal_I2C *lcd, eBeerProfileMenuOptions position, boolean repaint);
boolean displayStageMenu(LiquidCrystal_I2C *lcd, eStageMenuOptions position, boolean repaint);
boolean displayMaltMenu(LiquidCrystal_I2C *lcd, eMaltMenuOptions position, boolean repaint);
boolean displaySettingsMenu(LiquidCrystal_I2C *lcd, eSettingsMenuOptions position, boolean repaint);
#endif
\ No newline at end of file
#endif
......@@ -6,7 +6,7 @@
#include "Arduino.h"
#include "Temperature.h"
Temperature::Temperature(char *name,
Temperature::Temperature(const char *name,
int OutputPin_SensorPower,
int InputPin_TemperatureReading,
int TimeBetweenReadings,
......@@ -184,4 +184,4 @@ float Temperature::setPumpStatus( bool pump ) {
_pump = pump;
return _pump;
}
\ No newline at end of file
}
......@@ -23,7 +23,7 @@ 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,
Temperature(const char *name,
int OutputPin_SensorPower,
int InputPin_TemperatureReading,
int TimeBetweenReadings,
......@@ -40,19 +40,19 @@ class Temperature
float setPumpStatus( bool pump );
private:
char *_name;
int _OutputPin_SensorPower;
int _InputPin_TemperatureReading;
int _TimeBetweenReadings;
const 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;
float _temperatureAverage;
float _measuredTemperature;
float _measuredTemperatureDeviation;
bool _pump;
unsigned long _lastTemperatureRead;
int _VoutAnalogSample;
int _VoutRAnalogSample;
......
......@@ -21,7 +21,11 @@ void runStageSelection();
void runBeerProfileSelection();
void runStartFromStageSelection_Processor( unsigned long *stageTime, int *stageTemperature, eCookingStages nextStage );
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 );
void runStartFromStageSelection();
......@@ -43,9 +47,9 @@ void xWarnClockEnded();
void xWarnCookEnded();
void xStageFirstRun( int stageTime, int stageTemperature, int stagePumpSpeed, eCookingStages stage );
void xPrepareForStage( int stageTime, int stageTemperature, int stagePumpSpeed, eCookingStages stage );
void xSetupGlobalVariablesForStage(eCookingStages nextStage);
void xSetupStage(eCookingStages nextStage);
void xTransitionIntoStage(eCookingStages nextStage);
......@@ -71,16 +75,18 @@ int getTimer( int initialValue );
int getTemperature(int initialValue);
int xSetGenericValue(int initialValue, int minimumValue, int maximumValue, char *valueName, char *unit);
int xSetGenericValue(int initialValue, int minimumValue, int maximumValue, const char *valueName, const char *unit);
int xSetTemperature( int initialValue );
int xSetFinalYield( int initialValue );
unsigned long getInactivityTime();
// ###################### Set Variables ##################################################
void xWaitForAction(String title, String message);
boolean gotButtonPress(int iPin);
#endif //__BREW
\ No newline at end of file
#endif //__BREW
This diff is collapsed.
......@@ -78,6 +78,7 @@
#define ROTARY_ENCODER_DT_PIN 22 // Used for reading DT signal
#define ROTARY_ENCODER_SW_PIN 23 // Used for the push button switch
#define ROTARY_ENCODER_DEBOUNCE_TIME 50 //20 // Number of miliseconds to ignore new signals a signal is received
#define ROTARY_ENCODER_SW_DEBOUNCE_TIME 10 //20 // Number of miliseconds to ignore new signals a signal is received
// ++++++++++++++++++++++++ State Machine ++++++++++++++++++++++++
#define SETTING_WELCOME_TIMEOUT 100
......
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