main/config.h

changeset 77
66c77497d86d
parent 70
d6838a268020
child 82
7d17e2cb31a8
--- a/main/config.h	Mon Jun 01 20:27:00 2020 +0200
+++ b/main/config.h	Sat Jun 06 13:28:46 2020 +0200
@@ -110,16 +110,9 @@
     MAIN_AUTO_INIT1 = 96,		///< Automatic start part 1
     MAIN_AUTO_INIT2,			///< Automatic start part 2
     MAIN_AUTO_DELAYSTART,		///< Delayed start
-    MAIN_AUTO_HEATUP,			///< Heatup the system
-    MAIN_AUTO_MASH_IN = 100,		///< Mash-in
-    MAIN_AUTO_MASH_1,			///< Mash step 1
-    MAIN_AUTO_MASH_2,			///< Mash step 2
-    MAIN_AUTO_MASH_3,			///< Mash step 3
-    MAIN_AUTO_MASH_4,			///< Mash step 4
-    MAIN_AUTO_MASH_5,			///< Mash step 5
-    MAIN_AUTO_MASH_6,			///< Mash step 6
-    MAIN_AUTO_MASH_OUT,			///< Mash-out
-    MAIN_AUTO_TOBOIL,			///< Going to boil
+    MAIN_AUTO_HEATUP,			///< Heatup the HLT
+    MAIN_AUTO_MASH = 100,		///< Mash steps
+    MAIN_AUTO_TOBOIL = 120,		///< Going to boil
     MAIN_AUTO_BOILING,			///< Boiling
     MAIN_AUTO_WHIRLPOOL9,		///< Whirlpool
     MAIN_AUTO_COOLING_H,		///< Cooling hot type
@@ -141,10 +134,11 @@
     MASH_NONE = 0,			///< Initial Mash state
     MASH_WAITTEMP,			///< Wait to reach temperature.
     MASH_REST,				///< Mash rest
-    MASH_ADD,				///< Add mash wait
+    MASH_ADD,				///< Wait add mash
     MASH_IODINE,			///< Wait iodine test
     MASH_REMOVE,			///< Wait mash remove
     MASH_INFUSE,			///< Wait infusion prompt
+    MASH_DECOCT,			///< Wait decoction prompt
 } MASH_TYPE;
 
 /**
@@ -307,6 +301,8 @@
     bool		UseHLT;				///< Use HLT during brew.
     bool		PumpCooling;			///< Pump during cooling.
     uint32_t		TimeBrewing;			///< Time we are brewing.
+    uint8_t		MashStep;			///< Current mash step.
+    bool		MaltAdded;			///< If malt was added.
 } runtime;						///< Runtime record.
 
 
@@ -323,8 +319,12 @@
 
 
 
+#define	RECIPE_VERSION		2		///< Recipe file version
+#define MASH_MAX		16		///< Maximum 16 mash steps
+#define ADDITION_MAX		20		///< Maximum 20 additions
+
 /**
- * @brief Mash step type
+ * @brief Mash step types
  */
 typedef enum {
     MASHTYPE_INFUSION = 0,
@@ -350,13 +350,14 @@
  * @brief Mash steps
  */
 typedef struct strMashStep {
-    char		Name[32];			///< Step name.
-    uint8_t		Type;				///< Step Type.
-    float		Temperature;			///< Step temperature.
-    uint16_t		Resttime;			///< Step resttime.
-    uint16_t		Ramptime;			///< Step time to reach temp.
-    float		Infusion_amount;		///< Infusion amount in liters.
-    float		Infusion_temp;			///< Infusion temperature.
+    char                Name[32];                       ///< Step name.
+    uint8_t             Type;                           ///< Step Type.
+    float               Step_temp;                      ///< Step start temperature.
+    uint16_t            Step_time;                      ///< Step rest time.
+    uint16_t            Ramp_time;                      ///< Step time to reach temp.
+    float               End_temp;                       ///< Step end temperature.
+    float               Infuse_amount;                  ///< Infuse/decoct amount in liters.
+    float               Infuse_temp;                    ///< Infuse temperature.
 } mashstep_t;
 
 /**
@@ -369,23 +370,31 @@
 } addition_t;
 
 /**
- * @brief Current recipe
+ * @brief Recipes database. Starts with a header block for future upgrades,
+ *        followed by the actual recpie records.
  */
+struct hdrRecipe {
+    uint32_t		version;			///< Structure version.
+    uint32_t		hdrsize;			///< Size of this header.
+    uint32_t		recsize;			///< Size of a record.
+    uint8_t		mashmax;			///< Maximum mash steps.
+    uint8_t		additionmax;			///< Maximum additions.
+} recipe_hdr;
+
 struct strRecipe {
-    uint8_t		Version;			///< Record version number.
-    int			o_Record;			///< Record number, obsolete.
     char		Name[128];			///< Recipe name.
     char		Code[32];			///< Recipe code.
-    mashstep_t		MashStep[8];			///< Mash steps.
     uint16_t		BoilTime;			///< Boil time.
+    uint8_t		Mashsteps;			///< Number of mashsteps.
     uint8_t		Additions;			///< Number of additions.
-    addition_t		Addition[10];			///< Additions
     float		CoolTemp;			///< Cool temperature.
     uint16_t		Whirlpool9;			///< Zero or the Hot Whirlpool time 88..100 °
     uint16_t		Whirlpool7;			///< Zero or the Sub Isomerization Whirlpool time 71..77 °
     uint16_t		Whirlpool6;			///< Zero or the "Tepid" Whirlpool time 60..66 °
     uint16_t		Whirlpool2;			///< Zero or the Cold Whirlpool time < 30 °
     float		SpargeTemp;			///< Sparge water temperature.
+    mashstep_t		MashStep[MASH_MAX];		///< Mash steps.
+    addition_t		Addition[ADDITION_MAX];		///< Additions.
 } recipe;						///< Recipe record.
 
 /**
@@ -411,4 +420,5 @@
  */
 void delete_recipe(int RecNo);
 
+
 #endif

mercurial