main/task_driver.h

Sat, 06 Jun 2020 13:28:46 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 06 Jun 2020 13:28:46 +0200
changeset 77
66c77497d86d
parent 1
ad2c8b13eb88
child 101
1bc6e9263ada
permissions
-rw-r--r--

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.

#ifndef	_TASK_DRIVER_H
#define	_TASK_DRIVER_H

/**
 * @file task_driver.h
 * @brief The interface to the FreeRTOS driver task. This task drives the Solid
 *        State Relays (SSR) to power the Mash Lauter Tun (MLT) and the Hot
 *        Liquer Tank (HLT) heating elements. It also controls the pump relay.
 *
 * It takes the temperature readings from the DS18B20 task.
 */


/**
 * @brief MLT working mode.
 */
typedef enum {
    MLT_MODE_NONE = 0,			///< Not active
    MLT_MODE_BANG = 1,			///< Bang on/off mode
    MLT_MODE_PID = 2,			///< PID mode
    MLT_MODE_OFF = 3,			///< Off but show setpoint
    MLT_MODE_EXT = 4,			///< External regulation
} MLT_MODE_TYPE;

/**
 * @brief HLT working mode.
 */
typedef enum {
    HLT_MODE_NONE = 0,			///< Not active
    HLT_MODE_BANG = 1,			///< Bang on/off mode
    HLT_MODE_OFF = 2,			///< Off but show setpoint
    HLT_MODE_ON = 3,			///< On if free
} HLT_MODE_TYPE;


/**
 * @brief Structure containing the information of the driver task.
 */
typedef struct {
    bool   enable;			///< Enable outputs
    int    mlt_gpio;			///< MLT SSR GPIO pin
    int    mlt_mode;			///< MLT Mode: 0 = off, 1 = bang on/off, 2 = PID, 3 = cooling
    double mlt_sp;			///< Setpoint MLT temperature
    double mlt_pv;			///< Current MLT temperature
    int    mlt_power;			///< Current MLT drive power %
    int    hlt_gpio;			///< HLT SSR  GPIO pin
    int    hlt_mode;			///< HLT Mode:  0 = off, 1 = bang on/off, 2 = always on
    double hlt_sp;			///< Setpoint HLT temperature
    double hlt_pv;			///< Current HLT temperature
    int    hlt_power;			///< Current HLT drive power %
    bool   hlt_and_mlt;			///< True if both MLT and HLT are allowed at the same time.
    int	   pump_gpio;			///< Pump SSR GPIO pin
    int	   pump_run;			///< Pump on/off
} DRIVER_State;


/**
 * @brief FreeRTOS driver task. This task drives the Solid
 *        State Relays (SSR) to power the Mash Lauter Tun (MLT) and the Hot
 *        Liquer Tank (HLT) heating elements. It also controls the pump relay.
 */
void task_driver(void *);

#endif

mercurial