This commit is contained in:
e2002
2025-01-15 18:02:10 +03:00
parent 98c005d5e0
commit e4175e8a8e
10 changed files with 69 additions and 40 deletions

View File

@@ -32,7 +32,7 @@ extern "C" {
//If core is not defined, then we are running in Arduino or PIO
#ifndef CONFIG_ASYNC_TCP_RUNNING_CORE
#define CONFIG_ASYNC_TCP_RUNNING_CORE 1 //any available core (-1)
#define CONFIG_ASYNC_TCP_RUNNING_CORE 0 //any available core (-1)
#endif
#ifndef CONFIG_ASYNC_TCP_USE_WDT
@@ -43,7 +43,7 @@ extern "C" {
#define XTASK_MEM_SIZE 6144 // 8192 / 2
#endif
#ifndef XTASK_PRIOTITY
#define XTASK_PRIOTITY 3 //3
#define XTASK_PRIOTITY 5 //3
#endif
#ifndef ATCP_TASK_DELAY
#define ATCP_TASK_DELAY 2

View File

@@ -534,8 +534,14 @@ void Display::_time(bool redraw) {
config.setBrightness();
}
#endif
if(config.isScreensaver && network.timeinfo.tm_sec % 60 == 0)
_clock.moveTo({clockConf.left, static_cast<uint16_t>(random(TFT_FRAMEWDT+clockConf.textsize, (dsp.height()-dsp.plItemHeight-TFT_FRAMEWDT*2))), 0});
if(config.isScreensaver && network.timeinfo.tm_sec % 60 == 0){
#ifdef GXCLOCKFONT
uint16_t ft=static_cast<uint16_t>(random(TFT_FRAMEWDT, (dsp.height()-dsp.plItemHeight-TFT_FRAMEWDT*2-clockConf.textsize)));
#else
uint16_t ft=static_cast<uint16_t>(random(TFT_FRAMEWDT+clockConf.textsize, (dsp.height()-dsp.plItemHeight-TFT_FRAMEWDT*2)));
#endif
_clock.moveTo({clockConf.left, ft, 0});
}
_clock.draw();
/*#ifdef USE_NEXTION
nextion.printClock(network.timeinfo);

View File

@@ -1,7 +1,7 @@
#ifndef options_h
#define options_h
#define YOVERSION "0.9.412"
#define YOVERSION "0.9.420"
/*******************************************************
DO NOT EDIT THIS FILE.

View File

@@ -60,41 +60,50 @@ bool SDManager::_endsWith (const char* base, const char* str) {
return (strncmp(p, str, slen) == 0);
}
void SDManager::listSD(File &plSDfile, File &plSDindex, const char * dirname, uint8_t levels){
File root = sdman.open(dirname);
if(!root){
Serial.println("##[ERROR]#\tFailed to open directory");
return;
}
if(!root.isDirectory()){
Serial.println("##[ERROR]#\tNot a directory");
return;
}
File file = root.openNextFile();
uint32_t pos = 0;
while(file){
vTaskDelay(2);
bool fid = file.isDirectory();
const char * fp = file.path();
const char * fn = file.name();
if(fid){
if(levels && !_checkNoMedia(fp)){
listSD(plSDfile, plSDindex, fp, levels -1);
}
} else {
if(_endsWith(strlwr((char*)fn), ".mp3") || _endsWith(fn, ".m4a") || _endsWith(fn, ".aac") || _endsWith(fn, ".wav") || _endsWith(fn, ".flac")){
pos = plSDfile.position();
plSDfile.print(fn); plSDfile.print("\t"); plSDfile.print(fp); plSDfile.print("\t"); plSDfile.println(0);
plSDindex.write((uint8_t *) &pos, 4);
Serial.print(".");
if(display.mode()==SDCHANGE) display.putRequest(SDFILEINDEX, _sdFCount+1);
_sdFCount++;
if(_sdFCount%64==0) Serial.println();
}
void SDManager::listSD(File &plSDfile, File &plSDindex, const char* dirname, uint8_t levels) {
File root = sdman.open(dirname);
if (!root) {
Serial.println("##[ERROR]#\tFailed to open directory");
return;
}
if(file) file.close(); file = root.openNextFile();
}
if(root) root.close();
if (!root.isDirectory()) {
Serial.println("##[ERROR]#\tNot a directory");
return;
}
uint32_t pos = 0;
char* filePath;
while (true) {
vTaskDelay(2);
bool isDir;
String fileName = root.getNextFileName(&isDir);
if (fileName.isEmpty()) break;
filePath = (char*)malloc(fileName.length() + 1);
if (filePath == NULL) {
Serial.println("Memory allocation failed");
break;
}
strcpy(filePath, fileName.c_str());
const char* fn = strrchr(filePath, '/') + 1;
if (isDir) {
if (levels && !_checkNoMedia(filePath)) {
listSD(plSDfile, plSDindex, filePath, levels - 1);
}
} else {
if (_endsWith(strlwr((char*)fn), ".mp3") || _endsWith(fn, ".m4a") || _endsWith(fn, ".aac") ||
_endsWith(fn, ".wav") || _endsWith(fn, ".flac")) {
pos = plSDfile.position();
plSDfile.printf("%s\t%s\t0\n", fn, filePath);
plSDindex.write((uint8_t*)&pos, 4);
Serial.print(".");
if(display.mode()==SDCHANGE) display.putRequest(SDFILEINDEX, _sdFCount+1);
_sdFCount++;
if (_sdFCount % 64 == 0) Serial.println();
}
}
free(filePath);
}
root.close();
}
void SDManager::indexSDPlaylist() {

View File

@@ -65,7 +65,7 @@ void DspCore::drawPlaylist(uint16_t currentItem) {
clear();
config.fillPlMenu(currentItem - plCurrentPos, plTtemsCount);
setCursor(0,1);
write(byte(126));
write(uint8_t(126));
}
void DspCore::clearDsp(bool black) {

View File

@@ -11,6 +11,7 @@
#define CHARHEIGHT 8
#define DSP_OLED
#define GXCLOCKFONT
typedef GFXcanvas1 Canvas;
#include "widgets/widgets.h"

View File

@@ -11,6 +11,7 @@
#define CHARHEIGHT 8
#define DSP_OLED
#define GXCLOCKFONT
typedef GFXcanvas1 Canvas;
#include "widgets/widgets.h"

View File

@@ -11,6 +11,7 @@
#define CHARHEIGHT 8
#define DSP_OLED
#define GXCLOCKFONT
typedef GFXcanvas1 Canvas;
#include "widgets/widgets.h"

View File

@@ -11,6 +11,7 @@
#define CHARHEIGHT 8
#define DSP_OLED
#define GXCLOCKFONT
typedef GFXcanvas1 Canvas;
#include "widgets/widgets.h"