Mon, 01 Jul 2019 23:15:49 +0200
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
#ifndef _TASK_SDCARD_H #define _TASK_SDCARD_H /** * @file task_sdcard.h * @brief SD/MMC driver. This driver is for a slot for the user on * the front panel. It will detect an inserted card and then * mount it. It also detects the removal of the card and then * unmounts it. Be carefull, only do this in the main menu. * Also, brew logging is handled here and finished brewlogs * are copied to the SD card if it is mounted. * Recipes to import must go into the /sdcard/recipe folder * and have extension .xml and the contents be a beerxml file. * Backup and restore is also done to this card. */ /** * @brief Annotation types for the log graph. */ typedef enum { ANNOTATION_STAGE = 0, ///< Annotate stage event ANNOTATION_EVENT, ///< Annotate an event ANNOTATION_SYSTEM, ///< Annotate a system event. } ANNOTATION_TYPES; /** * @brief Structure containing the information of the SD cards task. */ typedef struct { bool host_ok; ///< SPI host is Ok. bool card_present; ///< If card is present in the slot. char logfile[32]; ///< Current logfile name. } SDCARD_State; /** * @brief JSON log data */ typedef struct { char time[12]; ///< Time in the brew. float mlt_sp; ///< MLT setpoint. float mlt_pv; ///< MLT temperature. int mlt_power; ///< MLT power in % int mlt_tempreached; ///< MLT temperature reached (0 or 1). int pump_run; ///< Pump run (0 or 1). float hlt_sp; ///< HLT setpoint. float hlt_pv; ///< HLT temperature. int hlt_power; ///< HLT power in %. char event[64]; ///< Event message. } JSON_log; /** * @brief Begin a new logfile. The logfile is created and written to on * the spiffs filesystem. * @param t The time in seconds since the Epoch, to create the filename. */ void log_begin(time_t t); /** * @brief Close an open logfile. The logfile is moved to the SD card if * the card is present and mounted. Then, the temporary logfile * is removed. */ void log_close(void); /** * @brief Clean logfile directory /spiffs/log/ */ void log_clean(void); /** * @brief Log to JSON logfile. */ void log_json(void); /** * @brief Log annotations for the chart. These are stored in a temporary * file and later when the logfile is closed they are merged in * the main json logfile. * @param annotation_type The type of annotation, stage/event/system. * @param label The label text that will be seen in the chart. */ void log_annotation(int annotation_type, char *label); /** * @brief Copy one file. * @param ff The from filename * @param tf The to filename * @return 0 if success. */ int FileCopy(char *ff, char *tf); /** * @brief FreeRTOS sd card task. */ void task_sdcard(void *); #endif