|
1 | 1 | // created: 10.Feb.2022 |
2 | | -// updated: 23.Sep.2023 |
| 2 | +// updated: 08.Oct.2023 |
3 | 3 |
|
4 | 4 | #pragma once |
5 | 5 | #pragma GCC optimize("Os") // optimize for code size |
6 | 6 |
|
7 | 7 | #define _SSID "mySSID" // Your WiFi credentials here |
8 | 8 | #define _PW "myWiFiPassword" |
9 | 9 | #define DECODER 1 // (0)VS1053 , (1)MAX98357A PCM5102A... (2)AC101 (3)ES8388 (4)WM8978 |
10 | | -#define TFT_CONTROLLER 5 // (0)ILI9341, (1)HX8347D, (2)ILI9486a, (3)ILI9486b, (4)ILI9488, (5)ST7796, (6)ST7796RPI |
| 10 | +#define TFT_CONTROLLER 0 // (0)ILI9341, (1)HX8347D, (2)ILI9486a, (3)ILI9486b, (4)ILI9488, (5)ST7796, (6)ST7796RPI |
11 | 11 | #define DISPLAY_INVERSION 0 // (0) off (1) on |
12 | 12 | #define TFT_ROTATION 1 // 1 or 3 (landscape) |
13 | | -#define TFT_FREQUENCY 80000000 // 27000000, 40000000, 80000000 |
14 | | -#define TP_VERSION 5 // (0)ILI9341, (1)ILI9341RPI, (2)HX8347D, (3)ILI9486, (4)ILI9488, (5)ST7796, (3)ST7796RPI |
15 | | -#define TP_ROTATION 1 // 1 or 3 (landscape) |
| 13 | +#define TFT_FREQUENCY 80000000 // 80000000, 40000000, 27000000, 20000000, 10000000 |
| 14 | +#define TP_VERSION 0 // (0)ILI9341, (1)ILI9341RPI, (2)HX8347D, (3)ILI9486, (4)ILI9488, (5)ST7796, (3)ST7796RPI |
| 15 | +#define TP_ROTATION 3 // 1 or 3 (landscape) |
16 | 16 | #define AUDIOTASK_CORE 1 // 0 or 1 |
17 | 17 | #define AUDIOTASK_PRIO 2 // 0 ... 24 Priority of the Task (0...configMAX_PRIORITIES -1) |
18 | | -#define SDMMC_FREQUENCY 80000000 // 40000000, 2000000, 10000000, not every SD Card will run at 40MHz |
| 18 | +#define SDMMC_FREQUENCY 80000000 // 80000000, 40000000, 27000000, 20000000, 10000000 not every SD Card will run at 80MHz |
19 | 19 | #define FTP_USERNAME "esp32" // user and pw in FTP Client |
20 | 20 | #define FTP_PASSWORD "esp32" |
21 | 21 | #define CONN_TIMEOUT 500 // unencrypted connection timeout in ms (http://...) |
|
29 | 29 | #include <SPI.h> |
30 | 30 | #include <SD_MMC.h> |
31 | 31 | #include <FS.h> |
| 32 | +#include <FFat.h> |
32 | 33 | #include <Wire.h> |
33 | 34 | #include <ESPmDNS.h> |
34 | 35 | #include <WiFiClient.h> |
|
142 | 143 | /**********************************************************************************************************************/ |
143 | 144 |
|
144 | 145 | // //prototypes (main.cpp) |
145 | | -boolean defaultsettings(); |
146 | | -boolean saveStationsToNVS(); |
147 | | -boolean saveDefaultIRbuttonsToNVS(); |
148 | | -void saveIRbuttonsToNVS(); |
149 | | -void loadIRbuttonsFromNVS(); |
150 | | -void updateSettings(); |
151 | | -void urldecode(char *str); |
152 | | -const char* SD_stringifyDirContent(String path); |
153 | | -void setTFTbrightness(uint8_t duty); |
154 | | -void showHeadlineVolume(); |
155 | | -void showHeadlineTime(bool complete = true); |
156 | | -void showHeadlineItem(uint8_t idx); |
157 | | -void showFooterIPaddr(); |
158 | | -void showFooterStaNr(); |
159 | | -void showFooterRSSI(boolean show = false); |
160 | | -void fall_asleep(); |
161 | | -void wake_up(); |
162 | | -void setRTC(const char* TZString); |
163 | | -void vector_clear_and_shrink(vector<char*>&vec); |
164 | | -void dlna_items_vector_clear_ans_shrink(); |
165 | | -void updateSleepTime(boolean noDecrement = false); |
166 | | -void showVolumeBar(); |
167 | | -void showBrightnessBar(); |
168 | | -void showFooter(); |
169 | | -void display_info(const char *str, int32_t xPos, int32_t yPos, uint16_t color, uint16_t margin_l, uint16_t margin_r, uint16_t winWidth, uint16_t winHeight); |
170 | | -void showStreamTitle(const char* streamTitle); |
171 | | -void showVUmeter(); |
172 | | -void updateVUmeter(); |
173 | | -void showLogoAndStationName(); |
174 | | -void showStationName(String sn); |
175 | | -void showStationLogo(String ln); |
176 | | -void showFileLogo(uint8_t state); |
177 | | -void showFileName(const char* fname); |
178 | | -void showFileNumber(); |
179 | | -void showStationsList(uint16_t staListNr); |
180 | | -void display_time(boolean showall = false); |
181 | | -void display_alarmDays(uint8_t ad, boolean showall=false); |
182 | | -void display_alarmtime(int8_t xy = 0, int8_t ud = 0, boolean showall = false); |
183 | | -void display_sleeptime(int8_t ud = 0); |
184 | | -boolean drawImage(const char* path, uint16_t posX, uint16_t posY, uint16_t maxWidth = 0 , uint16_t maxHeigth = 0); |
185 | | -bool SD_listDir(const char* path, boolean audioFilesOnly, boolean withoutDirs); |
186 | | -boolean isAudio(File file); |
187 | | -boolean isPlaylist(File file); |
188 | | -bool connectToWiFi(); |
189 | | -void openAccessPoint(); |
190 | | -const char* byte_to_binary(int8_t x); |
191 | | -uint32_t simpleHash(const char* str); |
192 | | -void trim(char *s); |
193 | | -bool startsWith (const char* base, const char* str); |
194 | | -bool endsWith (const char* base, const char* str); |
195 | | -int32_t indexOf (const char* base, const char* str, int32_t startIndex); |
196 | | -int32_t lastIndexOf(const char* haystack, const char needle); |
197 | | -boolean strCompare(char* str1, char* str2); |
198 | | -boolean strCompare(const char* str1, char* str2); |
199 | | -char* ps_strdup(const char* str); |
200 | | -int16_t strlenUTF8(const char* str); |
201 | | -int32_t map_l(int32_t x, int32_t in_min, int32_t in_max, int32_t out_min, int32_t out_max); |
202 | | -void SerialPrintflnCut(const char* item, const char* color, const char* str); |
203 | | -const char* scaleImage(const char* path); |
204 | | -void setVolume(uint8_t vol); |
| 146 | +boolean defaultsettings(); |
| 147 | +boolean saveStationsToNVS(); |
| 148 | +boolean saveDefaultIRbuttonsToNVS(); |
| 149 | +void saveIRbuttonsToNVS(); |
| 150 | +void loadIRbuttonsFromNVS(); |
| 151 | +void updateSettings(); |
| 152 | +void urldecode(char* str); |
| 153 | +const char* SD_stringifyDirContent(String path); |
| 154 | +void setTFTbrightness(uint8_t duty); |
| 155 | +void showHeadlineVolume(); |
| 156 | +void showHeadlineTime(bool complete = true); |
| 157 | +void showHeadlineItem(uint8_t idx); |
| 158 | +void showFooterIPaddr(); |
| 159 | +void showFooterStaNr(); |
| 160 | +void showFooterRSSI(boolean show = false); |
| 161 | +void fall_asleep(); |
| 162 | +void wake_up(); |
| 163 | +void setRTC(const char* TZString); |
| 164 | +void vector_clear_and_shrink(vector<char*>& vec); |
| 165 | +void dlna_items_vector_clear_ans_shrink(); |
| 166 | +boolean copySDtoFFat(const char* path); |
| 167 | +void updateSleepTime(boolean noDecrement = false); |
| 168 | +void showVolumeBar(); |
| 169 | +void showBrightnessBar(); |
| 170 | +void showFooter(); |
| 171 | +void display_info(const char* str, int32_t xPos, int32_t yPos, uint16_t color, uint16_t margin_l, uint16_t margin_r, uint16_t winWidth, uint16_t winHeight); |
| 172 | +void showStreamTitle(const char* streamTitle); |
| 173 | +void showVUmeter(); |
| 174 | +void updateVUmeter(); |
| 175 | +void showLogoAndStationName(); |
| 176 | +void showStationName(String sn); |
| 177 | +void showStationLogo(String ln); |
| 178 | +void showFileLogo(uint8_t state); |
| 179 | +void showFileName(const char* fname); |
| 180 | +void showFileNumber(); |
| 181 | +void showStationsList(uint16_t staListNr); |
| 182 | +void display_time(boolean showall = false); |
| 183 | +void display_alarmDays(uint8_t ad, boolean showall = false); |
| 184 | +void display_alarmtime(int8_t xy = 0, int8_t ud = 0, boolean showall = false); |
| 185 | +void display_sleeptime(int8_t ud = 0); |
| 186 | +boolean drawImage(const char* path, uint16_t posX, uint16_t posY, uint16_t maxWidth = 0, uint16_t maxHeigth = 0); |
| 187 | +bool SD_listDir(const char* path, boolean audioFilesOnly, boolean withoutDirs); |
| 188 | +boolean isAudio(File file); |
| 189 | +boolean isPlaylist(File file); |
| 190 | +bool connectToWiFi(); |
| 191 | +void openAccessPoint(); |
| 192 | +const char* byte_to_binary(int8_t x); |
| 193 | +uint32_t simpleHash(const char* str); |
| 194 | +void trim(char* s); |
| 195 | +bool startsWith(const char* base, const char* str); |
| 196 | +bool endsWith(const char* base, const char* str); |
| 197 | +int32_t indexOf(const char* base, const char* str, int32_t startIndex); |
| 198 | +int32_t lastIndexOf(const char* haystack, const char needle); |
| 199 | +boolean strCompare(char* str1, char* str2); |
| 200 | +boolean strCompare(const char* str1, char* str2); |
| 201 | +char* x_ps_strdup(const char* str); |
| 202 | +int16_t strlenUTF8(const char* str); |
| 203 | +int32_t map_l(int32_t x, int32_t in_min, int32_t in_max, int32_t out_min, int32_t out_max); |
| 204 | +void SerialPrintflnCut(const char* item, const char* color, const char* str); |
| 205 | +const char* scaleImage(const char* path); |
| 206 | +void setVolume(uint8_t vol); |
205 | 207 | inline uint8_t getvolume(); |
206 | | -uint8_t downvolume(); |
207 | | -uint8_t upvolume(); |
208 | | -void setStation(uint16_t sta); |
209 | | -void nextStation(); |
210 | | -void prevStation(); |
211 | | -void StationsItems(); |
212 | | -void setStationViaURL(const char* url); |
213 | | -void changeBtn_pressed(uint8_t btnNr); |
214 | | -void changeBtn_released(uint8_t btnNr); |
215 | | -void savefile(const char* fileName, uint32_t contentLength); |
216 | | -String setTone(); |
217 | | -String setI2STone(); |
218 | | -void SD_playFile(const char* path, uint32_t resumeFilePos = 0, bool showFN = true); |
219 | | -void SD_playFolder(const char* folderPath, bool showFN); |
220 | | -bool SD_rename(const char* src , const char* dest); |
221 | | -bool SD_newFolder(const char* folderPathName); |
222 | | -bool SD_delete(const char* itemPath); |
223 | | -void processPlaylist(boolean first = false); |
224 | | -void changeState(int32_t state); |
225 | | -void connecttohost(const char* host); |
226 | | -void connecttoFS(const char* filename, uint32_t resumeFilePos = 0); |
227 | | -void stopSong(); |
| 208 | +uint8_t downvolume(); |
| 209 | +uint8_t upvolume(); |
| 210 | +void setStation(uint16_t sta); |
| 211 | +void nextStation(); |
| 212 | +void prevStation(); |
| 213 | +void StationsItems(); |
| 214 | +void setStationViaURL(const char* url); |
| 215 | +void changeBtn_pressed(uint8_t btnNr); |
| 216 | +void changeBtn_released(uint8_t btnNr); |
| 217 | +void savefile(const char* fileName, uint32_t contentLength); |
| 218 | +String setTone(); |
| 219 | +String setI2STone(); |
| 220 | +void SD_playFile(const char* path, uint32_t resumeFilePos = 0, bool showFN = true); |
| 221 | +void SD_playFolder(const char* folderPath, bool showFN); |
| 222 | +bool SD_rename(const char* src, const char* dest); |
| 223 | +bool SD_newFolder(const char* folderPathName); |
| 224 | +bool SD_delete(const char* itemPath); |
| 225 | +void processPlaylist(boolean first = false); |
| 226 | +void changeState(int32_t state); |
| 227 | +void connecttohost(const char* host); |
| 228 | +void connecttoFS(const char* filename, uint32_t resumeFilePos = 0); |
| 229 | +void stopSong(); |
228 | 230 | void IRAM_ATTR headphoneDetect(); |
229 | | -int32_t DLNA_setCurrentServer(String serverName); |
230 | | -void DLNA_showServer(); |
231 | | -void DLNA_browseServer(String objectId, uint8_t level); |
232 | | -void DLNA_getFileItems(String uri); |
233 | | -void DLNA_showContent(String objectId, uint8_t level); |
234 | | -void showDlnaItemsList(uint8_t level, uint16_t itemNr); |
| 231 | +int32_t DLNA_setCurrentServer(String serverName); |
| 232 | +void DLNA_showServer(); |
| 233 | +void DLNA_browseServer(String objectId, uint8_t level); |
| 234 | +void DLNA_getFileItems(String uri); |
| 235 | +void DLNA_showContent(String objectId, uint8_t level); |
| 236 | +void showDlnaItemsList(uint8_t level, uint16_t itemNr); |
235 | 237 |
|
236 | 238 | //prototypes (audiotask.cpp) |
237 | 239 | void audioInit(); |
|
0 commit comments