Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stabilize xLights data transfers #804

Merged
merged 19 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
f64c8df
Made an error message easier to understand
MartinMueller2003 Nov 29, 2024
41bb590
Added protection against spurious Watchdog timeouts while processing …
MartinMueller2003 Nov 29, 2024
bc75b47
Fixed a bug in the debug output.
MartinMueller2003 Nov 29, 2024
fa6c2d7
Enhanced the sync code to only slide the frame count forward or back …
MartinMueller2003 Nov 29, 2024
47c5413
Added support for ignoring messages created by latest xLights that ar…
MartinMueller2003 Dec 4, 2024
c03df2a
Changes to make the transfer of files from xLights more stable.
MartinMueller2003 Dec 4, 2024
5478026
Change to silently ignore unsopported requests from xLights.
MartinMueller2003 Dec 4, 2024
4555f85
change timing to try to eliminate flicker in some DIG Quad systems.
MartinMueller2003 Dec 4, 2024
e17d9d2
Remove function not supported by ESP8266
MartinMueller2003 Dec 4, 2024
80c6eca
Added some WDT management for long running tasks.
MartinMueller2003 Dec 6, 2024
0ea7a6c
Added comments
MartinMueller2003 Dec 7, 2024
c1f5d35
Updated a comment
MartinMueller2003 Dec 7, 2024
a4ca294
added wdt call
MartinMueller2003 Dec 7, 2024
92df174
Implicit parm is now explicit
MartinMueller2003 Dec 7, 2024
a4ce94f
Implicit parm is now explicit
MartinMueller2003 Dec 7, 2024
2f93c15
Implicit parm is now explicit
MartinMueller2003 Dec 7, 2024
0d18409
Added protection against multiple concurrent accesses to the SD card.
MartinMueller2003 Dec 7, 2024
569835d
Added a debug message.
MartinMueller2003 Dec 7, 2024
55a18fb
Added code to not increment sequence error if the packet sequence num…
MartinMueller2003 Dec 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 20 additions & 18 deletions include/FileMgr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,24 +81,22 @@ class c_FileMgr

bool SdCardIsInstalled () { return SdCardInstalled; }
FileId CreateSdFileHandle ();
void DeleteSdFile (const String & FileName);
void SaveSdFile (const String & FileName, String & FileData);
void SaveSdFile (const String & FileName, JsonVariant & FileData);
bool OpenSdFile (const String & FileName, FileMode Mode, FileId & FileHandle, int FileListIndex = -1);
size_t ReadSdFile (const FileId & FileHandle, byte * FileData, size_t NumBytesToRead);
size_t ReadSdFile (const FileId & FileHandle, byte * FileData, size_t NumBytesToRead, size_t StartingPosition);
bool ReadSdFile (const String & FileName, String & FileData);
bool ReadSdFile (const String & FileName, JsonDocument & FileData);
size_t WriteSdFileBuf (const FileId & FileHandle, byte * FileData, size_t NumBytesToWrite);
size_t WriteSdFile (const FileId & FileHandle, byte * FileData, size_t NumBytesToWrite);
size_t WriteSdFile (const FileId & FileHandle, byte * FileData, size_t NumBytesToWrite, size_t StartingPosition);
void CloseSdFile (FileId & FileHandle);
void GetListOfSdFiles (std::vector<String> & Response);
uint64_t GetSdFileSize (const String & FileName);
uint64_t GetSdFileSize (const FileId & FileHandle);
void BuildFseqList ();
void ResumeSdFile (const FileId & FileHandle);
void PauseSdFile (const FileId & FileHandle);
void DeleteSdFile (const String & FileName, bool LockStatus = false);
void SaveSdFile (const String & FileName, String & FileData, bool LockStatus = false);
void SaveSdFile (const String & FileName, JsonVariant & FileData, bool LockStatus = false);
bool OpenSdFile (const String & FileName, FileMode Mode, FileId & FileHandle, int FileListIndex, bool LockStatus = false);
size_t ReadSdFile (const FileId & FileHandle, byte * FileData, size_t NumBytesToRead, bool LockStatus = false);
size_t ReadSdFile (const FileId & FileHandle, byte * FileData, size_t NumBytesToRead, size_t StartingPosition, bool LockStatus = false);
bool ReadSdFile (const String & FileName, String & FileData, bool LockStatus = false);
bool ReadSdFile (const String & FileName, JsonDocument & FileData, bool LockStatus = false);
size_t WriteSdFileBuf (const FileId & FileHandle, byte * FileData, size_t NumBytesToWrite, bool LockStatus = false);
size_t WriteSdFile (const FileId & FileHandle, byte * FileData, size_t NumBytesToWrite, bool LockStatus = false);
size_t WriteSdFile (const FileId & FileHandle, byte * FileData, size_t NumBytesToWrite, size_t StartingPosition, bool LockStatus = false);
void CloseSdFile (FileId & FileHandle, bool LockStatus = false);
void GetListOfSdFiles (std::vector<String> & Response, bool LockStatus = false);
uint64_t GetSdFileSize (const String & FileName, bool LockStatus = false);
uint64_t GetSdFileSize (const FileId & FileHandle, bool LockStatus = false);
void BuildFseqList (bool LockStatus = false);

void GetDriverName (String& Name) { Name = "FileMgr"; }
void NetworkStateChanged (bool NewState);
Expand All @@ -115,6 +113,8 @@ class c_FileMgr
void SetSpiIoPins ();
void SetSdSpeed ();
void ResetSdCard ();
void LockSd(bool ExistingLockStatus);
void UnLockSd(bool ExistingLockStatus);

# define SD_CARD_CLK_MHZ SD_SCK_MHZ(37) // 50 MHz SPI clock
#ifndef MaxSdTransSpeedMHz
Expand Down Expand Up @@ -240,6 +240,8 @@ public: struct __attribute__((__packed__, aligned(4))) CSD {
uint32_t LastFileSent = 0;
uint32_t expectedIndex = 0;

bool SdAccessSemaphore = false;

protected:

}; // c_FileMgr
Expand Down
14 changes: 9 additions & 5 deletions include/output/OutputWS2811.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* OutputWS2811.h - WS2811 driver code for ESPixelStick
*
* Project: ESPixelStick - An ESP8266 / ESP32 and E1.31 based pixel driver
* Copyright (c) 2015, 2022 Shelby Merrick
* Copyright (c) 2015, 2024 Shelby Merrick
* http://www.forkineye.com
*
* This program is provided free for you to use in any way that you wish,
Expand Down Expand Up @@ -52,10 +52,14 @@ class c_OutputWS2811 : public c_OutputPixel
#define WS2811_PIXEL_NS_BIT_TOTAL ( (1.0 / WS2811_PIXEL_DATA_RATE) * NanoSecondsInASecond)
#ifdef ARDUINO_ARCH_ESP32
// values have been adjusted to work with seed pixels.
#define WS2811_PIXEL_NS_BIT_0_HIGH 312.0 // = 312 on logic analyzer 220ns - 380ns per datasheet
#define WS2811_PIXEL_NS_BIT_0_LOW 945.0 // = 937 on logic analyzer 580ns - 1.6us per datasheet
#define WS2811_PIXEL_NS_BIT_1_HIGH 975.0 // = 937 on logic analyzer 580ns - 1.6us per datasheet
#define WS2811_PIXEL_NS_BIT_1_LOW 300.0 // = 312 on logic analyzer 220ns - 380ns per datasheet
// #define WS2811_PIXEL_NS_BIT_0_HIGH 312.0 // = 312 on logic analyzer 220ns - 380ns per datasheet
// #define WS2811_PIXEL_NS_BIT_0_LOW 945.0 // = 937 on logic analyzer 580ns - 1.6us per datasheet
// #define WS2811_PIXEL_NS_BIT_1_HIGH 975.0 // = 937 on logic analyzer 580ns - 1.6us per datasheet
// #define WS2811_PIXEL_NS_BIT_1_LOW 300.0 // = 312 on logic analyzer 220ns - 380ns per datasheet
#define WS2811_PIXEL_NS_BIT_0_HIGH 300.0 // 220ns - 380ns per datasheet
#define WS2811_PIXEL_NS_BIT_0_LOW (WS2811_PIXEL_NS_BIT_TOTAL - WS2811_PIXEL_NS_BIT_0_HIGH)
#define WS2811_PIXEL_NS_BIT_1_HIGH WS2811_PIXEL_NS_BIT_0_LOW
#define WS2811_PIXEL_NS_BIT_1_LOW WS2811_PIXEL_NS_BIT_0_HIGH
#else
#define WS2811_PIXEL_NS_BIT_0_HIGH 312.0 // 220ns - 380ns per datasheet
#define WS2811_PIXEL_NS_BIT_0_LOW (WS2811_PIXEL_NS_BIT_TOTAL - WS2811_PIXEL_NS_BIT_0_HIGH)
Expand Down
2 changes: 2 additions & 0 deletions include/service/FPPDiscovery.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class c_FPPDiscovery
struct SystemDebugStats_t
{
uint32_t ProcessFPPJson = 0;
uint32_t ProcessFPPDJson = 0;
uint32_t CmdGetFPPstatus = 0;
uint32_t CmdGetSysInfoJSON = 0;
uint32_t CmdGetHostname = 0;
Expand All @@ -114,6 +115,7 @@ SystemDebugStats_t SystemDebugStats;
void begin ();

void ProcessFPPJson (AsyncWebServerRequest* request);
void ProcessFPPDJson (AsyncWebServerRequest* request);
void ProcessGET (AsyncWebServerRequest* request);
void ProcessPOST (AsyncWebServerRequest* request);
void ProcessFile (AsyncWebServerRequest* request, String filename, uint32_t index, uint8_t* data, uint32_t len, bool final, uint32_t contentLength = 0);
Expand Down
Loading
Loading