config.h 8.54 KB
Newer Older
João Lino's avatar
Rel.3  
João Lino committed
1 2 3 4 5 6 7 8 9 10
/*
  debug.h - Debug functions.
  Created by João Lino, September 25, 2015.
  Released into the public domain.
*/

#ifndef CONFIG_h
#define CONFIG_h

// ######################### SETTINGS #########################
João Lino's avatar
João Lino committed
11
#define SETTING_CLEANING_TIME					      1200 //1200
João Lino's avatar
Rel.3  
João Lino committed
12
#define SETTING_CLEANING_TEMPERATURE			  45 //45
João Lino's avatar
João Lino committed
13 14
#define SETTING_MACHINE_YIELD_CAPACITY_MIN  0
#define SETTING_MACHINE_YIELD_CAPACITY_MAX  50
João Lino's avatar
Rel.3  
João Lino committed
15 16 17 18 19 20 21 22 23 24

// ++++++++++++++++++++++++ Heating Element Relay ++++++++++++++++++++++++
#define HEATING_ELEMENT_DEFAULT_WINDOW_SIZE       1000
#define HEATING_ELEMENT_OUTPUT_PIN                24
#define HEATING_ELEMENT_MAX_HEAT_PWM_INTEGER      5
#define HEATING_ELEMENT_MAX_HEAT_PWM_FLOAT        5.0
#define HEATING_ELEMENT_MAX_WATTAGE               3000.0          // Minimum = 2000.0
#define HEATING_ELEMENT_AC_FREQUENCY_HZ           50.0

// ++++++++++++++++++++++++ Temperature ++++++++++++++++++++++++
João Lino's avatar
João Lino committed
25 26
#define TEMPERATURE_MIN_VALUE                     0
#define TEMPERATURE_MAX_VALUE                     120
João Lino's avatar
Rel.3  
João Lino committed
27 28
#define PT100_BASE_INPUT_PIN                      A4
#define PT100_BASE_OUTPUT_PIN                     32
João Lino's avatar
João Lino committed
29 30
//#define PT100_BASE_INPUT_R_PIN                    A7
//#define PT100_BASE_OUTPUT_R_PIN                   7
João Lino's avatar
Rel.3  
João Lino committed
31 32 33
#define PT100_BASE_TIME_BETWEEN_READINGS          1
#define PT100_UP_INPUT_PIN                        A5
#define PT100_UP_OUTPUT_PIN                       30
João Lino's avatar
João Lino committed
34 35
//#define PT100_UP_INPUT_R_PIN                      A8
//#define PT100_UP_OUTPUT_R_PIN                     9
João Lino's avatar
Rel.3  
João Lino committed
36 37 38
#define PT100_UP_TIME_BETWEEN_READINGS            1
#define PT100_DOWN_INPUT_PIN                      A6
#define PT100_DOWN_OUTPUT_PIN                     31
João Lino's avatar
João Lino committed
39 40
//#define PT100_DOWN_INPUT_R_PIN                    A9
//#define PT100_DOWN_OUTPUT_R_PIN                   8
João Lino's avatar
Rel.3  
João Lino committed
41
#define PT100_DOWN_TIME_BETWEEN_READINGS          1
João Lino's avatar
João Lino committed
42
/*
João Lino's avatar
Rel.3  
João Lino committed
43 44 45 46 47 48 49 50 51 52 53 54
#define PT100_BASE_DEFAULT_ADC_VMAX               1.1
#define PT100_BASE_DEFAULT_VS                     5.0
#define PT100_BASE_DEFAULT_R1_RESISTENCE          605.2
#define PT100_BASE_DEFAULT_R2_RESISTENCE          605.2
#define PT100_UP_DEFAULT_ADC_VMAX                 1.1
#define PT100_UP_DEFAULT_VS                       5.0
#define PT100_UP_DEFAULT_R1_RESISTENCE            630.0 //620.0
#define PT100_UP_DEFAULT_R2_RESISTENCE            610.0
#define PT100_DOWN_DEFAULT_ADC_VMAX               1.1
#define PT100_DOWN_DEFAULT_VS                     5.0
#define PT100_DOWN_DEFAULT_R1_RESISTENCE          616.0
#define PT100_DOWN_DEFAULT_R2_RESISTENCE          611.0
João Lino's avatar
João Lino committed
55
*/
João Lino's avatar
Rel.3  
João Lino committed
56 57 58 59 60 61 62 63 64 65 66 67

// ++++++++++++++++++++++++ Mixer ++++++++++++++++++++++++
//#define MIXER_PIN     12
//#define MIXER_MAX_POSITION   255

// ++++++++++++++++++++++++ Pump ++++++++++++++++++++++++
#define PIEZO_PIN                                 25

// ++++++++++++++++++++++++ Pump ++++++++++++++++++++++++
#define PUMP_PIN                                  6
#define PUMP_TEMPERATURE_MAX_OPERATION            90
#define PUMP_SPEED_STOP                           0
João Lino's avatar
João Lino committed
68
#define PUMP_SPEED_STOP_MOSFET                    255
João Lino's avatar
Rel.3  
João Lino committed
69 70 71
#define PUMP_SPEED_SLOW                           64
#define PUMP_SPEED_AVERAGE                        128
#define PUMP_SPEED_FAST                           192
João Lino's avatar
João Lino committed
72
#define PUMP_SPEED_MAX_MOSFET                     0
João Lino's avatar
Rel.3  
João Lino committed
73 74 75 76 77 78 79 80
#define PUMP_SPEED_MAX                            255

// ++++++++++++++++++++++++ Rotary Encoder ++++++++++++++++++++++++
#define ROTARY_ENCODER_INTERRUPT_NUMBER           1    // On Mega2560 boards, interrupt 1 is on pin 3
#define ROTARY_ENCODER_CLK_PIN                    3    // Used for generating interrupts using CLK signal
#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
João Lino's avatar
João Lino committed
81
#define ROTARY_ENCODER_SW_DEBOUNCE_TIME           10 //20    // Number of miliseconds to ignore new signals a signal is received
João Lino's avatar
Rel.3  
João Lino committed
82 83 84 85

// ++++++++++++++++++++++++ State Machine ++++++++++++++++++++++++
#define SETTING_WELCOME_TIMEOUT                   100
#define SETTING_MAX_INACTIVITY_TIME               3000
João Lino's avatar
João Lino committed
86
#define MENU_SIZE_MAIN_MENU                       13
João Lino's avatar
Rel.3  
João Lino committed
87 88 89
#define MENU_SIZE_PROFILES_MENU                   9
#define MENU_SIZE_STAGE_MENU                      13
#define MENU_SIZE_MALT_MENU                    	  4
João Lino's avatar
João Lino committed
90 91
#define MENU_SIZE_SETTINGS_MENU                   6

92 93 94 95 96 97
// ++++++++++++++++++++++++ Menus ++++++++++++++++++++++++
#define MENU_MAIN_TITLE                           "Brewery Menu"
#define MENU_MAIN_DIALOG                          { "", "-> GO           ", "-> GO from stage", "-> STOP         ", "-> SKIP         ", "-> BeerProfile  ", "-> Stages       ", "-> Malt         ", "-> Hops         ", "-> Clean        ", "-> Purge        ", "-> Settings     ", "-> Back         " }
#define MENU_MAIN_INIT_POSITION                   eMainMenu_GO
#define MENU_MAIN_INIT_SELECTION                  eMainMenu_NULL
#define MENU_MAIN_INIT_REPAINT                    false
João Lino's avatar
João Lino committed
98
#define MENU_MAIN_FUNCTION                        &runMainMenuSelection
99 100 101 102 103 104

#define MENU_PROFILE_TITLE                        "Profile Menu"
#define MENU_PROFILE_DIALOG                       {"", "-> Basic        ", "-> Trigo        ", "-> IPA          ", "-> Belga        ", "-> Red          ", "-> APA          ", "-> Custom       ", "-> Back         " }
#define MENU_PROFILE_INIT_POSITION                eBeerProfileMenu_Basic
#define MENU_PROFILE_INIT_SELECTION               eBeerProfileMenu_NULL
#define MENU_PROFILE_INIT_REPAINT                 false
João Lino's avatar
João Lino committed
105
#define MENU_PROFILE_FUNCTION                     &runBeerProfileSelection
106 107 108 109 110 111

#define MENU_STAGE_TITLE                          "Stage Menu"
#define MENU_STAGE_DIALOG                         {"", "-> Startpoint   ", "-> BetaGlucanase", "-> Debranching  ", "-> Proteolytic  ", "-> Beta Amylase ", "-> Alpha Amylase", "-> Mashout      ", "-> Recirculation", "-> Sparge       ", "-> Boil         ", "-> Cooling      ", "-> Back         " }
#define MENU_STAGE_INIT_POSITION                  eStageMenu_Startpoint
#define MENU_STAGE_INIT_SELECTION                 eStageMenu_NULL
#define MENU_STAGE_INIT_REPAINT                   false
João Lino's avatar
João Lino committed
112
#define MENU_STAGE_FUNCTION                       &runStageSelection
113 114 115 116 117 118

#define MENU_MALT_TITLE                           "Malt Menu"
#define MENU_MALT_DIALOG                          {"", "-> CM Ch. Pilsen", "-> CM Wheat Blan", "-> Back         " }
#define MENU_MALT_INIT_POSITION                   eMaltMenu_CastleMalting_Chteau_Pilsen_2RS
#define MENU_MALT_INIT_SELECTION                  eMaltMenu_NULL
#define MENU_MALT_INIT_REPAINT                    false
João Lino's avatar
João Lino committed
119
#define MENU_MALT_FUNCTION                        &runMaltSelection
120 121 122 123 124 125

#define MENU_SETTINGS_TITLE                       "Settings Menu"
#define MENU_SETTINGS_DIALOG                      {"", "-> PT100 Element", "-> PT100 Up     ", "-> PT100 Down   ", "-> Back         " }
#define MENU_SETTINGS_INIT_POSITION               eSettingsMenu_PT100_Element
#define MENU_SETTINGS_INIT_SELECTION              eSettingsMenu_NULL
#define MENU_SETTINGS_INIT_REPAINT                false
João Lino's avatar
João Lino committed
126 127 128 129
#define MENU_SETTINGS_FUNCTION                    &runSettingsSelection

#define MENU_GLOBAL_STR_TEMPERATURE               "temperature"
#define MENU_GLOBAL_STR_CELSIUS                   "*C"
130 131 132 133 134 135

#define MENU_START_TITLE                          MENU_STAGE_TITLE
#define MENU_START_DIALOG                         MENU_STAGE_DIALOG
#define MENU_START_INIT_POSITION                  MENU_STAGE_INIT_POSITION
#define MENU_START_INIT_SELECTION                 MENU_STAGE_INIT_SELECTION
#define MENU_START_INIT_REPAINT                   MENU_STAGE_INIT_REPAINT
João Lino's avatar
João Lino committed
136
#define MENU_START_FUNCTION                       &runStartFromStageSelection
137

João Lino's avatar
João Lino committed
138
// ++++++++++++++++++++++++ Serial Monotor ++++++++++++++++++++++++
João Lino's avatar
Rel.3  
João Lino committed
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
#define SETTING_SERIAL_MONITOR_BAUD_RATE          9600
#define SETTING_SERIAL_MONITOR_WELCOME_MESSAGE    "Let's start Brewing!"

// ######################### LIBRARIES #########################
// ++++++++++++++++++++++++ LiquidCrystal_I2C ++++++++++++++++++++++++
#define LCD_I2C_ADDR                              0x27    // <<----- Add your address here.  Find it from I2C Scanner
#define LCD_HORIZONTAL_RESOLUTION                 16
#define LCD_VERTICAL_RESOLUTION                   2
#define LCD_BACKLIGHT_PIN                         3
#define LCD_EN_PIN                                2
#define LCD_RW_PIN                                1
#define LCD_RS_PIN                                0
#define LCD_D4_PIN                                4
#define LCD_D5_PIN                                5
#define LCD_D6_PIN                                6
#define LCD_D7_PIN                                7

João Lino's avatar
João Lino committed
156
#endif