main/config.h

Mon, 17 May 2021 20:44:35 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Mon, 17 May 2021 20:44:35 +0200
changeset 91
255a75322212
parent 87
47253f294a9f
child 95
c02e12e9c884
permissions
-rw-r--r--

Added 7 sgemnt fonts for the web client. Log messages in the components more compact. Added fonts mime-types to the webserver. Switched to stable esp-idf 4.2.1. Upgraded the SD-mmc card API.

0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /**
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 * @file config.h
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 * @brief The BrewBoard configuration data. These are stored in the
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * spiffs filesystem in a flash partition.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 #ifndef _CONFIG_H
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 #define _CONFIG_H
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 // Global includes for the project
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 #include <stdio.h>
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 #include <stdlib.h>
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 #include <string.h>
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 #include <stdbool.h>
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 #include <time.h>
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 #include <errno.h>
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 #include <sys/unistd.h>
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 #include <sys/fcntl.h>
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 #include <sys/time.h>
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22 #include "freertos/FreeRTOS.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23 #include "freertos/task.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 #include "freertos/semphr.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25 #include "freertos/event_groups.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26 #include "freertos/queue.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27 #include "driver/i2c.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28 #include "esp_log.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
29 #include "esp_spiffs.h"
70
d6838a268020 Version 0.3.7. The WiFi task uses the new event handlers. Cooling temperature top is now 45 instead of 30 degreees for pitching Kveik. One extra cosmetic message during OTA update.
Michiel Broek <mbroek@mbse.eu>
parents: 49
diff changeset
30 #include "esp_event.h"
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31 #include "esp_wifi.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32 #include "esp_wifi_types.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33 #include "esp_system.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35 #include "esp_ota_ops.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
36 #include "esp_http_client.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
37 #include "esp_https_ota.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39 #include "esp_vfs.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40 #include "esp_vfs_fat.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
41 #include "nvs.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42 #include "nvs_flash.h"
34
5c92103c5e72 Version 0.2.10. Fixed spelling error in websocket component. Updated esp-idf to v4.0-dev-459-gba1ff1692 and adjusted several sources for changed headers. Finalized keeping the AP running at all times. Increased websocket server stack depth from 6000 to 7000.
Michiel Broek <mbroek@mbse.eu>
parents: 32
diff changeset
43 #include "esp32/rom/crc.h"
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
44 #include "mdns.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
45 #include "lwip/sockets.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
46 #include "lwip/api.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
47 #include "lwip/err.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
48 #include "lwip/netdb.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
49 #include "lwip/dns.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
50 #include "lwip/opt.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
51 #include "lwip/memp.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
52 #include "lwip/ip.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
53 #include "lwip/raw.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
54 #include "lwip/udp.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
55 #include "sdkconfig.h"
91
255a75322212 Added 7 sgemnt fonts for the web client. Log messages in the components more compact. Added fonts mime-types to the webserver. Switched to stable esp-idf 4.2.1. Upgraded the SD-mmc card API.
Michiel Broek <mbroek@mbse.eu>
parents: 87
diff changeset
56 #include "esp_sntp.h"
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
57 #include "expat.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
58
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
59 #include "tftspi.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
60 #include "tft.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
61 #include "PID_v1.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
62 #include "websocket_server.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
63
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
64 #include "buttons.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
65 #include "calibration.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
66 #include "automation.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
67 #include "manual.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
68 #include "setup.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
69 #include "recipes.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
70 #include "files.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
71 #include "updates.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
72
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
73 #include "task_tft.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
74 #include "task_ds18b20.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
75 #include "task_sdcard.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
76 #include "task_driver.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
77 #include "task_wifi.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
78 #include "task_sound.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
79 #include "task_http.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
80
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
81
19
49e2960d4642 Implemented infusion mash.
Michiel Broek <mbroek@mbse.eu>
parents: 17
diff changeset
82
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
83 /**
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
84 * @brief Main mode different screens
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
85 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
86 typedef enum
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
87 {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
88 MAIN_MODE_UNKNOWN = -1, ///< During system startup
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
89 MAIN_MODE_FREE = 0, ///< Main menu, do nothing
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
90 MAIN_MODE_CALIBRATION, ///< TFT calibration
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
91 MAIN_INFO, ///< Info/about screen
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
92 MAIN_TOOLS, ///< Main tools screen
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
93 MAIN_TOOLS_SETUP, ///< Main setup screen
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
94 MAIN_TOOLS_SETUP_CONFIG, ///< Main setup configuration
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95 MAIN_TOOLS_SETUP_CO_EDIT, ///< Main setup confguration editor
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
96 MAIN_TOOLS_SETUP_EQUIPMENT, ///< Main setup equipment
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
97 MAIN_TOOLS_SETUP_EQ_EDIT, ///< Main setup edit equipment
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
98 MAIN_TOOLS_SETUP_WIFI, ///< Main setup WiFi
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
99 MAIN_TOOLS_SETUP_WIFI_CUR, ///< Main setup WiFi current connection.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
100 MAIN_TOOLS_SETUP_WIFI_CON, ///< Main setup WiFi connect.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
101 MAIN_TOOLS_SETUP_WIFI_NEW, ///< Main setup WiFi new connection.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
102 MAIN_TOOLS_SETUP_CALIBRATION, ///< Main setup TFT calibration
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
103 MAIN_TOOLS_RECIPE, ///< Main recipes screen.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
104 MAIN_TOOLS_RECIPE_EDIT, ///< Main recipes editor.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
105 MAIN_TOOLS_FILES, ///< Main files.
2
7a03d81c0e0d Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents: 1
diff changeset
106 MAIN_TOOLS_FILES_DIR, ///< Main files directory listings.
7a03d81c0e0d Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents: 1
diff changeset
107 MAIN_TOOLS_FILES_RESTORE, ///< Main files restore.
7a03d81c0e0d Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents: 1
diff changeset
108 MAIN_TOOLS_FILES_BACKUP, ///< Main files backup.
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
109 MAIN_TOOLS_UPDATES, ///< Main Updates.
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 39
diff changeset
110 MAIN_AUTO_INIT1 = 96, ///< Automatic start part 1
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 39
diff changeset
111 MAIN_AUTO_INIT2, ///< Automatic start part 2
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
112 MAIN_AUTO_DELAYSTART, ///< Delayed start
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
113 MAIN_AUTO_HEATUP, ///< Heatup the HLT
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
114 MAIN_AUTO_MASH = 100, ///< Mash steps
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
115 MAIN_AUTO_TOBOIL = 120, ///< Going to boil
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
116 MAIN_AUTO_BOILING, ///< Boiling
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
117 MAIN_AUTO_WHIRLPOOL9, ///< Whirlpool
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
118 MAIN_AUTO_COOLING_H, ///< Cooling hot type
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
119 MAIN_AUTO_WHIRLPOOL7, ///< Whirlpool
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
120 MAIN_AUTO_COOLING_M, ///< Cooling medium type
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
121 MAIN_AUTO_WHIRLPOOL6, ///< Whirlpool
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
122 MAIN_AUTO_COOLING_C, ///< Cooling cold type
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
123 MAIN_AUTO_WHIRLPOOL2, ///< Whirlpool
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
124 MAIN_AUTO_DONE, ///< Finished
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
125 MAIN_AUTO_ABORT, ///< Aborted
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
126 MAIN_MANUAL_INIT = 200, ///< Manual control init
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
127 MAIN_MANUAL_MAIN, ///< Manual control main menu
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
128 } MAIN_MODE;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
129
1
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
130 /**
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
131 * @brief The differents stages in the mash steps.
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
132 */
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
133 typedef enum {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
134 MASH_NONE = 0, ///< Initial Mash state
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
135 MASH_WAITTEMP, ///< Wait to reach temperature.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
136 MASH_REST, ///< Mash rest
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
137 MASH_ADD, ///< Wait add mash
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
138 MASH_IODINE, ///< Wait iodine test
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
139 MASH_REMOVE, ///< Wait mash remove
19
49e2960d4642 Implemented infusion mash.
Michiel Broek <mbroek@mbse.eu>
parents: 17
diff changeset
140 MASH_INFUSE, ///< Wait infusion prompt
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
141 MASH_DECOCT, ///< Wait decoction prompt
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
142 } MASH_TYPE;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
143
1
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
144 /**
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
145 * @brief The working mode of the second heater SSR.
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
146 */
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
147 typedef enum {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
148 SSR2_OFF = 0, ///< SSR2 not used.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
149 SSR2_HLT_SHARE, ///< SSR2 for HLT shared with MLT
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
150 SSR2_HLT_IND, ///< SSR2 for HLT independend.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
151 SSR2_ON_IDLE, ///< SSR2 on when NLT is idle.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
152 } SSR2_TYPE;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
153
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
154
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
155
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
156 /**
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
157 * @brief Global configuration. File /spiffs/config.conf
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
158 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
159 struct strConfig {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
160 uint8_t Version; ///< Record version number for updates.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
161 uint8_t Unit; ///< Celsius or Farenheit (not used yet).
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
162 float BoilTemperature; ///< The temperature when water boils.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
163 bool AskAdd; ///< Ask to add the mash.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
164 bool AskRemove; ///< Ask to remove the mash.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
165 bool AskIodine; ///< Ask to confirm the iodine test.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
166 uint8_t IodineTime; ///< Continue after this time if not confirmed.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
167 int EquipmentRec; ///< Equipment record number.
49
4ec04c6f1551 SNTP uses a callback function to mark the system time is valid. SNTP is started after we received a DHCP ip address. Added an config option to set a preffered NTP server name, most likely on your most used LAN. It will always fal back to pool.ntp.org.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
168 char ntp_server[32]; ///< Preffered NTP server.
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
169 char hostname[32]; ///< Our hostname.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
170 char ap_ssid[32]; ///< AP SSID.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
171 char ap_pwd[64]; ///< AP password.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
172 uint8_t ap_channel; ///< AP channel.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
173 uint8_t ap_ssid_hidden; ///< AP SSID hidden.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
174 wifi_bandwidth_t ap_bandwidth; ///< AP channel bandwidth.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
175 uint16_t ts_xleft; ///< TS calibration X left.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
176 uint16_t ts_xright; ///< TS calibration X right.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
177 uint16_t ts_ytop; ///< TS calibration Y top.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
178 uint16_t ts_ybottom; ///< TS calibration Y bottom.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
179 int RecipeRec; ///< Current recipe record.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
180 char uuid[37]; ///< Sort of uuid code.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
181 char lastSSID[32]; ///< Last connected station.
1
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
182 } config; ///< Config record.
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
183
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
184 /**
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
185 * @brief Write configuration to disk.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
186 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
187 void write_config(void);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
188
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
189 /** @brief Read configuration file. If it doesn't exist create and
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
190 * write a new configuration file with sane defaults.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
191 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
192 void read_config(void);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
193
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
194
87
47253f294a9f SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents: 82
diff changeset
195 #define EQUIPMENT_VERSION 2 ///< Equipment file version
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
196
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
197 /**
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
198 * @brief Equipment configuration. File /spiffs/equipments.conf
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
199 */
87
47253f294a9f SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents: 82
diff changeset
200 struct hdrEquipment {
47253f294a9f SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents: 82
diff changeset
201 uint32_t version; ///< Structure version.
47253f294a9f SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents: 82
diff changeset
202 uint32_t hdrsize; ///< Size of this header.
47253f294a9f SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents: 82
diff changeset
203 uint32_t recsize; ///< Size of a record.
47253f294a9f SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents: 82
diff changeset
204 } equipment_hdr;
47253f294a9f SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents: 82
diff changeset
205
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
206 struct strEquipment {
87
47253f294a9f SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents: 82
diff changeset
207 int MLT_watt; ///< MLT watts.
47253f294a9f SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents: 82
diff changeset
208 int HLT_watt; ///< HLT watts.
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
209 char Name[32]; ///< Equipment name.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
210 int BoilPower; ///< The power percentage needed to keep the wort boiling.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
211 int MashPower; ///< The power percentage needed to heat during mash.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
212 int PumpCycle; ///< Minutes to run the pump during mash rest.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
213 int PumpRest; ///< Minutes to pause the pump during mash rests.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
214 bool PumpPreMash; ///< Pump on before mash-in.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
215 bool PumpOnMash; ///< Pump on during mashing.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
216 bool PumpMashOut; ///< Pump on during mash remove.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
217 bool PumpOnBoil; ///< Pump on during the boil.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
218 int PumpMaxTemp; ///< Turn pump off above this temperature.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
219 bool PIDPipe; ///< Run PID during mash removal.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
220 int SSR2; ///< Use second SSR (HLT) or not.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
221 float TempHLT; ///< The temperature of the sparge water.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
222 double PID_kP; ///< PID P setting.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
223 double PID_kI; ///< PID I setting.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
224 double PID_kD; ///< PID D setting.
82
7d17e2cb31a8 The PID workig mode is fixed
Michiel Broek <mbroek@mbse.eu>
parents: 77
diff changeset
225 bool xPID_POn;
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
226 int SampleTime; ///< PID sample time in seconds.
1
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
227 } equipment; ///< Equipment record.
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
228
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
229 /**
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
230 * @brief Append equipments record to disk.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
231 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
232 void append_equipment(void);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
233
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
234 /**
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
235 * @brief Read equipments file. If it doesn't exist create and
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
236 * write a new equipment file with sane defaults.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
237 * This is then the first and default brew equipment.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
238 * @param RecNo Read the record with Record is RecNo. Start at 1.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
239 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
240 void read_equipment(int RecNo);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
241
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
242 /**
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
243 * @brief Write rquipment record. It should exist.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
244 * @param RecNo The equipment record in memory to write at record. Records start at 1.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
245 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
246 void write_equipment(int RecNo);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
247
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
248 /**
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
249 * @brief Delete equipment record, renumber remaining records.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
250 * @param RecNo The record to remove.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
251 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
252 void delete_equipment(int RecNo);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
253
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
254
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
255
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
256 /**
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
257 * @brief Records with WiFi stations we have succesfully connected.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
258 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
259 struct strStations {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
260 char SSID[32]; ///< Station SSID
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
261 char Password[64]; ///< Station password
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
262 bool hide; ///< Hide from AP scan.
1
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
263 } wifiStation; ///< Station record.
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
264
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
265 /**
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
266 * @brief Add a new station record.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
267 * @param SSID The SSID
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
268 * @param Password The password for this SSID
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
269 * @return The record number, or -1 if error.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
270 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
271 int add_station(uint8_t *SSID, uint8_t *Password);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
272
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
273 /**
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
274 * @brief Read station info record.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
275 * @param SSID Search for the SSID and load the record if found.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
276 * @return Return -1 if not found, else the record number and the wifiStation record is filled.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
277 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
278 int read_station(uint8_t *SSID);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
279
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
280 /**
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
281 * @brief Remove station record.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
282 * @param SSID The SSID to remove.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
283 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
284 void remove_station(uint8_t *SSID);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
285
1
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
286 /**
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
287 * @brief Blacklist station SSID
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
288 * @param SSID The SSID to blacklist.
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
289 * @return -1 if error, else the record number.
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
290 */
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
291 int blacklist_station(uint8_t *SSID);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
292
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
293
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
294
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
295 /**
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
296 * @brief Runtime configuration. File /spiffs/runtime.conf
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
297 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
298 struct strRuntime {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
299 uint8_t Version; ///< Record version number for updates.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
300 bool AutoModeStarted; ///< Running automode.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
301 int StageResume; ///< Current Resume Stage.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
302 int StageTimeLeft; ///< Current Stage Time left.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
303 uint8_t HopAddition; ///< Current Hop Addition.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
304 float ManualMLT; ///< Last used MLT temperature.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
305 float ManualHLT; ///< Last used HLT temperature.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
306 time_t BrewStart; ///< Brew start time.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
307 char Logfile[64]; ///< Brew logfile.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
308 bool UseHLT; ///< Use HLT during brew.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
309 bool PumpCooling; ///< Pump during cooling.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
310 uint32_t TimeBrewing; ///< Time we are brewing.
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
311 uint8_t MashStep; ///< Current mash step.
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
312 bool MaltAdded; ///< If malt was added.
87
47253f294a9f SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents: 82
diff changeset
313 TickType_t MLT_usage; ///< MLT usage counter.
47253f294a9f SDK settings to reduce bin size. Some log messages to debug level. Added KWH usage registration. Added equipment power usage for HLT and MLT. Equipment database upgraded to version 2, expandable. Fixed some screen errors during temperature mash steps.
Michiel Broek <mbroek@mbse.eu>
parents: 82
diff changeset
314 TickType_t HLT_usage; ///< HLT usage counter.
1
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
315 } runtime; ///< Runtime record.
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
316
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
317
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
318 /**
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
319 * @brief Write runtime information to disk.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
320 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
321 void write_runtime(void);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
322
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
323 /**
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
324 * @brief Read runtime information file. If it doesn't exist create and
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
325 * write a new runtime file with sane defaults.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
326 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
327 void read_runtime(void);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
328
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
329
1
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
330
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
331 #define RECIPE_VERSION 2 ///< Recipe file version
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
332 #define MASH_MAX 16 ///< Maximum 16 mash steps
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
333 #define ADDITION_MAX 20 ///< Maximum 20 additions
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
334
1
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
335 /**
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
336 * @brief Mash step types
15
34b1eb93e71a Added extra mash step fields for infusion steps. Added these fields in recipe import too.
Michiel Broek <mbroek@mbse.eu>
parents: 7
diff changeset
337 */
34b1eb93e71a Added extra mash step fields for infusion steps. Added these fields in recipe import too.
Michiel Broek <mbroek@mbse.eu>
parents: 7
diff changeset
338 typedef enum {
34b1eb93e71a Added extra mash step fields for infusion steps. Added these fields in recipe import too.
Michiel Broek <mbroek@mbse.eu>
parents: 7
diff changeset
339 MASHTYPE_INFUSION = 0,
34b1eb93e71a Added extra mash step fields for infusion steps. Added these fields in recipe import too.
Michiel Broek <mbroek@mbse.eu>
parents: 7
diff changeset
340 MASHTYPE_TEMPERATURE,
34b1eb93e71a Added extra mash step fields for infusion steps. Added these fields in recipe import too.
Michiel Broek <mbroek@mbse.eu>
parents: 7
diff changeset
341 MASHTYPE_DECOCTION,
34b1eb93e71a Added extra mash step fields for infusion steps. Added these fields in recipe import too.
Michiel Broek <mbroek@mbse.eu>
parents: 7
diff changeset
342 } MASHSTEP_TYPE;
34b1eb93e71a Added extra mash step fields for infusion steps. Added these fields in recipe import too.
Michiel Broek <mbroek@mbse.eu>
parents: 7
diff changeset
343
34b1eb93e71a Added extra mash step fields for infusion steps. Added these fields in recipe import too.
Michiel Broek <mbroek@mbse.eu>
parents: 7
diff changeset
344 /**
1
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
345 * @brief Addition types
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
346 */
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
347 typedef enum {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
348 ADDITION_HOP = 0,
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
349 ADDITION_FERMENTABLE = 1,
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
350 ADDITION_SPICE = 2,
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
351 ADDITION_FINING = 3,
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
352 ADDITION_WATER_AGENT = 4,
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
353 ADDITION_HERB = 5,
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
354 ADDITION_FLAVOR = 6,
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
355 ADDITION_OTHER = 7,
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
356 } ADDITION_TYPE;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
357
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
358 /**
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
359 * @brief Mash steps
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
360 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
361 typedef struct strMashStep {
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
362 char Name[32]; ///< Step name.
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
363 uint8_t Type; ///< Step Type.
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
364 float Step_temp; ///< Step start temperature.
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
365 uint16_t Step_time; ///< Step rest time.
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
366 uint16_t Ramp_time; ///< Step time to reach temp.
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
367 float End_temp; ///< Step end temperature.
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
368 float Infuse_amount; ///< Infuse/decoct amount in liters.
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
369 float Infuse_temp; ///< Infuse temperature.
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
370 } mashstep_t;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
371
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
372 /**
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
373 * @brief Hop and other additions
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
374 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
375 typedef struct strAddition {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
376 uint16_t Time; ///< Time for addition.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
377 uint8_t Type; ///< Addition type, Hop, Syrop ...
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
378 char Name[64]; ///< Addition name.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
379 } addition_t;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
380
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
381 /**
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
382 * @brief Recipes database. Starts with a header block for future upgrades,
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
383 * followed by the actual recpie records.
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
384 */
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
385 struct hdrRecipe {
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
386 uint32_t version; ///< Structure version.
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
387 uint32_t hdrsize; ///< Size of this header.
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
388 uint32_t recsize; ///< Size of a record.
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
389 uint8_t mashmax; ///< Maximum mash steps.
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
390 uint8_t additionmax; ///< Maximum additions.
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
391 } recipe_hdr;
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
392
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
393 struct strRecipe {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
394 char Name[128]; ///< Recipe name.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
395 char Code[32]; ///< Recipe code.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
396 uint16_t BoilTime; ///< Boil time.
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
397 uint8_t Mashsteps; ///< Number of mashsteps.
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
398 uint8_t Additions; ///< Number of additions.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
399 float CoolTemp; ///< Cool temperature.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
400 uint16_t Whirlpool9; ///< Zero or the Hot Whirlpool time 88..100 °
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
401 uint16_t Whirlpool7; ///< Zero or the Sub Isomerization Whirlpool time 71..77 °
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
402 uint16_t Whirlpool6; ///< Zero or the "Tepid" Whirlpool time 60..66 °
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
403 uint16_t Whirlpool2; ///< Zero or the Cold Whirlpool time < 30 °
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
404 float SpargeTemp; ///< Sparge water temperature.
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
405 mashstep_t MashStep[MASH_MAX]; ///< Mash steps.
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
406 addition_t Addition[ADDITION_MAX]; ///< Additions.
1
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
407 } recipe; ///< Recipe record.
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
408
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
409 /**
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
410 * @brief Append a recipe record. Create file if it doesn't exist.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
411 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
412 void append_recipe(void);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
413
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
414 /**
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
415 * @brief Write current recipe
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
416 * @param RecNo Record number starting at 1.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
417 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
418 void write_recipe(int RecNo);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
419
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
420 /**
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
421 * @brief Read current recipe
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
422 * @param RecNo The record to read, start at 1.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
423 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
424 void read_recipe(int RecNo);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
425
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
426 /**
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
427 * @brief Delete recipe record, renumber remaining records.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
428 * @param RecNo The record to remove.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
429 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
430 void delete_recipe(int RecNo);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
431
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
432
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
433 #endif

mercurial