Sat, 20 Oct 2018 17:09:48 +0200
Updated lots of doxygen comments
0 | 1 | #ifndef _TASK_SDCARD_H |
2 | #define _TASK_SDCARD_H | |
3 | ||
4 | /** | |
5 | * @file task_sdcard.h | |
6 | * @brief The interface to the FreeRTOS SD/MMC card task. | |
7 | */ | |
8 | ||
9 | ||
1
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
10 | /** |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
11 | * @brief Annotation types for the log graph. |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
12 | */ |
0 | 13 | typedef enum |
14 | { | |
15 | ANNOTATION_STAGE = 0, ///< Annotate stage event | |
16 | ANNOTATION_EVENT, ///< Annotate an event | |
17 | ANNOTATION_SYSTEM, ///< Annotate a system event. | |
18 | } ANNOTATION_TYPES; | |
19 | ||
20 | /** | |
21 | * @brief Structure containing the information of the SD cards task. | |
22 | */ | |
23 | typedef struct { | |
24 | bool host_ok; ///< SPI host is Ok. | |
25 | bool card_present; ///< If card is present in the slot. | |
26 | char logfile[32]; ///< Current logfile name. | |
27 | } SDCARD_State; | |
28 | ||
29 | /** | |
30 | * @brief JSON log data | |
31 | */ | |
32 | typedef struct { | |
33 | char time[9]; ///< Time in the brew. | |
34 | float mlt_sp; ///< MLT setpoint. | |
35 | float mlt_pv; ///< MLT temperature. | |
36 | int mlt_power; ///< MLT power in % | |
37 | int mlt_tempreached; ///< MLT temperature reached (0 or 1). | |
38 | int pump_run; ///< Pump run (0 or 1). | |
39 | float hlt_sp; ///< HLT setpoint. | |
40 | float hlt_pv; ///< HLT temperature. | |
41 | int hlt_power; ///< HLT power in %. | |
42 | char event[64]; ///< Event message. | |
43 | } JSON_log; | |
44 | ||
45 | /** | |
46 | * @brief Begin a new logfile. The logfile is created and written to on | |
47 | * the spiffs filesystem. | |
48 | * @param t The time in seconds since the Epoch, to create the filename. | |
49 | */ | |
50 | void log_begin(time_t t); | |
51 | ||
52 | /** | |
53 | * @brief Close an open logfile. The logfile is moved to the SD card if | |
54 | * the card is present and mounted. Then, the temporary logfile | |
55 | * is removed. | |
56 | */ | |
57 | void log_close(void); | |
58 | ||
59 | /** | |
60 | * @brief Clean logfile directory /spiffs/log/ | |
61 | */ | |
62 | void log_clean(void); | |
63 | ||
64 | /** | |
65 | * @brief Log to JSON logfile. | |
66 | */ | |
67 | void log_json(void); | |
68 | ||
69 | /** | |
70 | * @brief Log annotations for the chart. These are stored in a temporary | |
71 | * file and later when the logfile is closed they are merged in | |
72 | * the main json logfile. | |
73 | * @param annotation_type The type of annotation, stage/event/system. | |
74 | * @param label The label text that will be seen in the chart. | |
75 | */ | |
76 | void log_annotation(int annotation_type, char *label); | |
77 | ||
78 | /** | |
1
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
79 | * @brief Copy one file. |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
80 | * @param ff The from filename |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
81 | * @param tf The to filename |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
82 | * @return 0 if success. |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
83 | */ |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
84 | int FileCopy(char *ff, char *tf); |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
85 | |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
86 | /** |
0 | 87 | * @brief FreeRTOS sd card task. |
88 | */ | |
89 | void task_sdcard(void *); | |
90 | ||
91 | #endif |