Wed, 19 May 2021 17:21:33 +0200
Version 0.3.14. Log brewing essentials at brew start.
0 | 1 | /** |
2 | * @file files.c | |
3 | * @brief Files management. | |
4 | */ | |
5 | ||
6 | #include "config.h" | |
7 | ||
8 | ||
9 | extern sButton Buttons[MAXBUTTONS]; | |
10 | extern int Main_Screen; | |
11 | ||
2
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
12 | static const char *TAG = "files"; |
0 | 13 | |
14 | ||
1
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
15 | /** |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
16 | * @brief Show files directory |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
17 | * @param path The path from which to list |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
18 | */ |
0 | 19 | void Files_Dir(char *path) |
20 | { | |
56
756d1a63d129
Adjusted more strings for new compiler warnings. There should now be no buffer overflows in the app. Changed the date display on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
21 | char filename[272], tmp[42]; |
0 | 22 | uint16_t y = 28; |
23 | DIR *dir; | |
24 | struct dirent *de; | |
25 | struct stat st; | |
26 | ||
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:
56
diff
changeset
|
27 | EditerTop(path); |
0 | 28 | _fg = TFT_WHITE; |
29 | TFT_setFont(DEFAULT_FONT, NULL); | |
30 | ||
31 | if ((dir = opendir(path))) { | |
32 | de = readdir(dir); | |
33 | while (de) { | |
34 | TFT_print(de->d_name, 2, y); | |
35 | sprintf(filename, "%s/%s", path, de->d_name); | |
36 | if (stat(filename, &st) == 0) { | |
37 | sprintf(tmp, "%ld", st.st_size); | |
38 | TFT_print(tmp, RIGHT, y); | |
39 | } | |
40 | de = readdir(dir); | |
41 | y += 16; | |
42 | } | |
43 | closedir(dir); | |
44 | } | |
45 | ||
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
3
diff
changeset
|
46 | Buttons_Add(130, 200, 60, 40, (char *)"Ok", 0); |
0 | 47 | Buttons[0].dark = true; |
48 | Buttons_Show(); | |
49 | ||
50 | while (true) { | |
51 | if (Buttons_Scan() == 0) { | |
52 | Buttons_Clear(); | |
53 | return; | |
54 | } | |
55 | vTaskDelay(50 / portTICK_PERIOD_MS); | |
56 | } | |
57 | } | |
58 | ||
59 | ||
60 | ||
2
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
61 | /** |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
62 | * @brief File copier. |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
63 | * @param fdir From directory |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
64 | * @param tdir To directory |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
65 | * @param fn Filename |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
66 | */ |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
67 | void FCopy(char *fdir, char *tdir, char *filename) |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
68 | { |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
69 | char fn[33], tn[33], msg[33]; |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
70 | int rc; |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
71 | |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
72 | snprintf(msg, 32, "Copy %s\r\n", filename); |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
73 | TFT_print(msg, 0, LASTY); |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
74 | snprintf(fn, 32, "%s%s", fdir, filename); |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
75 | snprintf(tn, 32, "%s%s", tdir, filename); |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
76 | rc = FileCopy(fn, tn); |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
77 | ESP_LOGI(TAG, "Copy %s to %s rc=%d", fn, tn, rc); |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
78 | } |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
79 | |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
80 | |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
81 | |
0 | 82 | /* |
83 | * Files init function, only runs once a new screen is entered. | |
84 | */ | |
85 | void Files_Init(void) | |
86 | { | |
2
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
87 | bool _loop; |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
88 | DIR *dir; |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
89 | |
0 | 90 | switch (Main_Screen) { |
91 | case MAIN_TOOLS_FILES: | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
3
diff
changeset
|
92 | TopMessage((char *)"Bestanden menu"); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
3
diff
changeset
|
93 | Buttons_Add( 20, 40,120, 40, (char *)"Restore", 0); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
3
diff
changeset
|
94 | Buttons_Add(180, 40,120, 40, (char *)"Backup", 1); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
3
diff
changeset
|
95 | Buttons_Add( 20,120,120, 40, (char *)"Directory", 2); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
3
diff
changeset
|
96 | Buttons_Add(130, 200, 60, 40, (char *)"Ok", 3); |
3 | 97 | Buttons[3].dark = true; |
2
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
98 | Buttons_Show(); |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
99 | break; |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
100 | |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
101 | case MAIN_TOOLS_FILES_DIR: |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
102 | break; |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
103 | |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
104 | case MAIN_TOOLS_FILES_RESTORE: |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
105 | case MAIN_TOOLS_FILES_BACKUP: |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
106 | if (Main_Screen == MAIN_TOOLS_FILES_RESTORE) |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
3
diff
changeset
|
107 | TopMessage((char *)"Restore database"); |
2
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
108 | else |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
3
diff
changeset
|
109 | TopMessage((char *)"Backup database"); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
3
diff
changeset
|
110 | Buttons_Add( 40, 100, 80, 40, (char *)"Start", 0); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
3
diff
changeset
|
111 | Buttons_Add(200, 100, 80, 40, (char *)"Stop", 1); |
2
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
112 | Buttons[1].dark = true; |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
113 | Buttons_Show(); |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
114 | SoundPlay(SOUND_Prompt); |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
115 | _loop = true; |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
116 | while (_loop) { |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
117 | switch (Buttons_Scan()) { |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
118 | case 0: |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
119 | _loop = false; |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
120 | break; |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
121 | case 1: |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
122 | _loop = false; |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
123 | Main_Screen = MAIN_TOOLS_FILES; |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
124 | break; |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
125 | default: |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
126 | break; |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
127 | } |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
128 | vTaskDelay(50 / portTICK_PERIOD_MS); |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
129 | } |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
130 | Buttons_Clear(); |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
131 | if (Main_Screen == MAIN_TOOLS_FILES) |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
132 | break; |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
133 | |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
134 | _fg = TFT_YELLOW; |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
135 | TFT_setFont(DEJAVU24_FONT, NULL); |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
136 | if (Main_Screen == MAIN_TOOLS_FILES_RESTORE) { |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
137 | ESP_LOGI(TAG, "Restore database"); |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
138 | TFT_setFont(DEJAVU18_FONT, NULL); |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
3
diff
changeset
|
139 | TFT_print((char *)"Backup:\r\n", 0, 30); |
2
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
140 | _fg = TFT_CYAN; |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
3
diff
changeset
|
141 | FCopy((char *)"/sdcard/etc/", (char *)"/spiffs/etc/", (char *)"config.conf"); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
3
diff
changeset
|
142 | FCopy((char *)"/sdcard/etc/", (char *)"/spiffs/etc/", (char *)"recipe.conf"); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
3
diff
changeset
|
143 | FCopy((char *)"/sdcard/etc/", (char *)"/spiffs/etc/", (char *)"equipments.conf"); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
3
diff
changeset
|
144 | FCopy((char *)"/sdcard/etc/", (char *)"/spiffs/etc/", (char *)"stations.conf"); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
3
diff
changeset
|
145 | FCopy((char *)"/sdcard/etc/", (char *)"/spiffs/etc/", (char *)"runtime.conf"); |
2
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
146 | _fg = TFT_YELLOW; |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
147 | TFT_setFont(DEJAVU24_FONT, NULL); |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
3
diff
changeset
|
148 | TFT_print((char *)"Restore gereed, reset!", CENTER, LASTY + 12); |
2
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
149 | vTaskDelay(2000 / portTICK_PERIOD_MS); |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
150 | esp_restart(); |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
151 | } else { |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
152 | dir = opendir("/sdcard/etc"); |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
153 | if (dir == NULL) { |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
154 | mkdir("/sdcard/etc", 0755); |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
155 | dir = opendir("/sdcard/etc"); |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
156 | } |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
157 | if (dir == NULL) { |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
3
diff
changeset
|
158 | TFT_print((char *)"SD kaart fout", CENTER, CENTER); |
2
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
159 | } else { |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
160 | closedir(dir); |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
161 | ESP_LOGI(TAG, "Backup database"); |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
162 | TFT_setFont(DEJAVU18_FONT, NULL); |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
3
diff
changeset
|
163 | TFT_print((char *)"Backup:\r\n", 0, 30); |
2
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
164 | _fg = TFT_CYAN; |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
3
diff
changeset
|
165 | FCopy((char *)"/spiffs/etc/", (char *)"/sdcard/etc/", (char *)"config.conf"); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
3
diff
changeset
|
166 | FCopy((char *)"/spiffs/etc/", (char *)"/sdcard/etc/", (char *)"recipe.conf"); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
3
diff
changeset
|
167 | FCopy((char *)"/spiffs/etc/", (char *)"/sdcard/etc/", (char *)"equipments.conf"); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
3
diff
changeset
|
168 | FCopy((char *)"/spiffs/etc/", (char *)"/sdcard/etc/", (char *)"stations.conf"); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
3
diff
changeset
|
169 | FCopy((char *)"/spiffs/etc/", (char *)"/sdcard/etc/", (char *)"runtime.conf"); |
2
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
170 | _fg = TFT_YELLOW; |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
171 | TFT_setFont(DEJAVU24_FONT, NULL); |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
3
diff
changeset
|
172 | TFT_print((char *)"Backup gereed.", CENTER, LASTY + 12); |
2
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
173 | } |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
174 | } |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
175 | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
3
diff
changeset
|
176 | Buttons_Add(130, 200, 60, 40, (char *)"Ok", 0); |
2
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
177 | Buttons[0].dark = true; |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
178 | Buttons_Show(); |
0 | 179 | break; |
180 | ||
181 | default: break; | |
182 | } | |
183 | } | |
184 | ||
185 | ||
186 | ||
187 | /* | |
188 | * Recipes management loop, non-blocking. | |
189 | */ | |
190 | void Files_Loop(void) | |
191 | { | |
192 | switch (Main_Screen) { | |
193 | ||
194 | case MAIN_TOOLS_FILES: | |
2
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
195 | switch (Buttons_Scan()) { |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
196 | case 0: Main_Screen = MAIN_TOOLS_FILES_RESTORE; |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
197 | break; |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
198 | |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
199 | case 1: Main_Screen = MAIN_TOOLS_FILES_BACKUP; |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
200 | break; |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
201 | |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
202 | case 2: Main_Screen = MAIN_TOOLS_FILES_DIR; |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
203 | break; |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
204 | |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
205 | case 3: Main_Screen = MAIN_TOOLS; |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
206 | break; |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
207 | } |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
208 | break; |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
209 | |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
210 | case MAIN_TOOLS_FILES_DIR: |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
3
diff
changeset
|
211 | Files_Dir((char *)"/sdcard/recipe"); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
3
diff
changeset
|
212 | Files_Dir((char *)"/sdcard/w/log"); |
2
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
213 | Main_Screen = MAIN_TOOLS_FILES; |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
214 | break; |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
215 | |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
216 | case MAIN_TOOLS_FILES_RESTORE: |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
217 | case MAIN_TOOLS_FILES_BACKUP: |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
218 | if (Buttons_Scan() == 0) |
7a03d81c0e0d
Added database backup and restore.
Michiel Broek <mbroek@mbse.eu>
parents:
1
diff
changeset
|
219 | Main_Screen = MAIN_TOOLS_FILES; |
0 | 220 | break; |
221 | ||
222 | default: break; | |
223 | } | |
224 | } | |
225 | ||
226 |