From 1ea83933f62ad45b261d8f711ef5cacf3e4f289c Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 24 Oct 2023 17:41:42 -0400 Subject: [PATCH 01/13] Set proper default value --- ESPixelStick/src/input/InputFPPRemote.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ESPixelStick/src/input/InputFPPRemote.h b/ESPixelStick/src/input/InputFPPRemote.h index 849af389b..623568b3d 100644 --- a/ESPixelStick/src/input/InputFPPRemote.h +++ b/ESPixelStick/src/input/InputFPPRemote.h @@ -69,7 +69,7 @@ class c_InputFPPRemote : public c_InputCommon int32_t SyncOffsetMS = 0; bool SendFppSync = false; - String FileBeingPlayed; + String FileBeingPlayed = No_LocalFileToPlay; # define JSON_NAME_FILE_TO_PLAY CN_fseqfilename From 585157ac36852e2b1f0492a8bf3ea70c873350db Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 24 Oct 2023 17:44:13 -0400 Subject: [PATCH 02/13] Removed un needed clear of file name --- ESPixelStick/src/input/InputFPPRemote.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/ESPixelStick/src/input/InputFPPRemote.cpp b/ESPixelStick/src/input/InputFPPRemote.cpp index 2a8323e15..9225dfd70 100644 --- a/ESPixelStick/src/input/InputFPPRemote.cpp +++ b/ESPixelStick/src/input/InputFPPRemote.cpp @@ -302,9 +302,6 @@ void c_InputFPPRemote::StopPlaying () delete pInputFPPRemotePlayItem; pInputFPPRemotePlayItem = nullptr; } - - FileBeingPlayed = ""; - } while (false); // DEBUG_END; @@ -320,14 +317,14 @@ void c_InputFPPRemote::StartPlaying (String& FileName) { // DEBUG_V (String ("FileName: '") + FileName + "'"); if ((0 == FileName.length ()) || - (FileName == String ("null"))) + (FileName.equals("null"))) { // DEBUG_V ("No file to play"); StopPlaying (); break; } - if (FileName == No_LocalFileToPlay) + if (FileName.equals(No_LocalFileToPlay)) { StartPlayingRemoteFile (FileName); } @@ -466,7 +463,7 @@ bool c_InputFPPRemote::PlayingRemoteFile () break; } - if (FileBeingPlayed != No_LocalFileToPlay) + if (!FileBeingPlayed.equals(No_LocalFileToPlay)) { break; } From 6aebcf0a65371afa4cfcbd9802534344b6671474 Mon Sep 17 00:00:00 2001 From: Martin Date: Sun, 29 Oct 2023 11:34:53 -0400 Subject: [PATCH 03/13] Updated debug info --- ESPixelStick/src/WebMgr.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/ESPixelStick/src/WebMgr.cpp b/ESPixelStick/src/WebMgr.cpp index 7feb0c512..875c6f065 100644 --- a/ESPixelStick/src/WebMgr.cpp +++ b/ESPixelStick/src/WebMgr.cpp @@ -622,24 +622,22 @@ void c_WebMgr::ProcessXJRequest (AsyncWebServerRequest* client) system[F ("SDinstalled")] = FileMgr.SdCardIsInstalled (); system[F ("DiscardedRxData")] = DiscardedRxData; - // DEBUG_V (""); - // Ask WiFi Stats + // DEBUG_V ("NetworkMgr.GetStatus"); NetworkMgr.GetStatus (system); - // DEBUG_V (""); + // DEBUG_V ("FPPDiscovery.GetStatus"); FPPDiscovery.GetStatus (system); - // DEBUG_V (""); + // DEBUG_V ("InputMgr.GetStatus"); // Ask Input Stats InputMgr.GetStatus (status); - // DEBUG_V (""); // Ask Output Stats + // DEBUG_V ("OutputMgr.GetStatus"); OutputMgr.GetStatus (status); - // DEBUG_V (""); - // Get File Manager Stats + // DEBUG_V ("FileMgr.GetStatus"); FileMgr.GetStatus (system); // DEBUG_V (""); From e705eab1852c04aca74c6c5816d0854be62fe7f4 Mon Sep 17 00:00:00 2001 From: Martin Date: Sun, 29 Oct 2023 11:38:51 -0400 Subject: [PATCH 04/13] Added controlled delete for pointer objects --- ESPixelStick/src/input/InputFPPRemote.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/ESPixelStick/src/input/InputFPPRemote.cpp b/ESPixelStick/src/input/InputFPPRemote.cpp index 9225dfd70..70c9cfa5c 100644 --- a/ESPixelStick/src/input/InputFPPRemote.cpp +++ b/ESPixelStick/src/input/InputFPPRemote.cpp @@ -197,8 +197,8 @@ void c_InputFPPRemote::Process () } else if (PlayingRemoteFile ()) { - // DEBUG_V ("PlayingRemoteFile"); - FPPDiscovery.ReadNextFrame (); + // DEBUG_V ("Remote File Play"); + pInputFPPRemotePlayItem->Poll (); } else if (PlayingFile ()) { @@ -291,6 +291,7 @@ void c_InputFPPRemote::StopPlaying () if(PlayingFile()) { + // DEBUG_V(String("pInputFPPRemotePlayItem: ") = String(uint32_t(pInputFPPRemotePlayItem), HEX)); pInputFPPRemotePlayItem->Stop (); while (!pInputFPPRemotePlayItem->IsIdle ()) @@ -355,6 +356,11 @@ void c_InputFPPRemote::StartPlayingLocalFile (String& FileName) if (String(CN_Dotpl) == Last_pl_Text) { // DEBUG_V ("Start Playlist"); + if(pInputFPPRemotePlayItem) + { + delete pInputFPPRemotePlayItem; + pInputFPPRemotePlayItem = nullptr; + } pInputFPPRemotePlayItem = new c_InputFPPRemotePlayList (GetInputChannelId ()); StatusType = F ("PlayList"); } @@ -370,6 +376,11 @@ void c_InputFPPRemote::StartPlayingLocalFile (String& FileName) break; } + if(pInputFPPRemotePlayItem) + { + delete pInputFPPRemotePlayItem; + pInputFPPRemotePlayItem = nullptr; + } // DEBUG_V ("Start Local FSEQ file player"); pInputFPPRemotePlayItem = new c_InputFPPRemotePlayFile (GetInputChannelId ()); StatusType = CN_File; @@ -404,6 +415,11 @@ void c_InputFPPRemote::StartPlayingRemoteFile (String& FileName) StopPlaying (); // DEBUG_V ("Instantiate an FSEQ file player"); + if(pInputFPPRemotePlayItem) + { + delete pInputFPPRemotePlayItem; + pInputFPPRemotePlayItem = nullptr; + } pInputFPPRemotePlayItem = new c_InputFPPRemotePlayFile (GetInputChannelId ()); pInputFPPRemotePlayItem->SetSyncOffsetMS (SyncOffsetMS); pInputFPPRemotePlayItem->SetSendFppSync (SendFppSync); From c72c5a73ba6829168d6bc9208924e19e998ccd45 Mon Sep 17 00:00:00 2001 From: Martin Date: Sun, 29 Oct 2023 11:57:31 -0400 Subject: [PATCH 05/13] Moved check macro to a function --- ESPixelStick/src/service/FPPDiscovery.h | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/ESPixelStick/src/service/FPPDiscovery.h b/ESPixelStick/src/service/FPPDiscovery.h index 532d07d61..fe53a196c 100644 --- a/ESPixelStick/src/service/FPPDiscovery.h +++ b/ESPixelStick/src/service/FPPDiscovery.h @@ -43,14 +43,7 @@ class c_FPPDiscovery void ProcessReceivedUdpPacket (AsyncUDPPacket _packet); void ProcessSyncPacket (uint8_t action, String filename, float seconds_elapsed); void ProcessBlankPacket (); - bool PlayingFile () - { - if (InputFPPRemotePlayFile) - { - return !InputFPPRemotePlayFile->IsIdle (); - } - return false; - } + bool PlayingFile (); bool inFileUpload = false; bool hasBeenInitialized = false; @@ -110,7 +103,6 @@ class c_FPPDiscovery 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); void ProcessBody (AsyncWebServerRequest* request, uint8_t* data, uint32_t len, uint32_t index, uint32_t total); - void ReadNextFrame (); void sendPingPacket (IPAddress destination = IPAddress(255, 255, 255, 255)); void PlayFile (String & FileToPlay); void Enable (void); From cee69a27e2ec483276fbe9b19b350005525555d0 Mon Sep 17 00:00:00 2001 From: Martin Date: Sun, 29 Oct 2023 12:01:49 -0400 Subject: [PATCH 06/13] Moved macro to a function Removed unused function --- ESPixelStick/src/service/FPPDiscovery.cpp | 37 +++++++++++++---------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/ESPixelStick/src/service/FPPDiscovery.cpp b/ESPixelStick/src/service/FPPDiscovery.cpp index cdefaac33..558d00526 100644 --- a/ESPixelStick/src/service/FPPDiscovery.cpp +++ b/ESPixelStick/src/service/FPPDiscovery.cpp @@ -163,19 +163,6 @@ void c_FPPDiscovery::GetStatus (JsonObject & jsonStatus) // DEBUG_END; } // GetStatus -//----------------------------------------------------------------------------- -void c_FPPDiscovery::ReadNextFrame () -{ - // DEBUG_START; - - if (InputFPPRemotePlayFile) - { - InputFPPRemotePlayFile->Poll (); - } - - // DEBUG_END; -} // ReadNextFrame - //----------------------------------------------------------------------------- void c_FPPDiscovery::ProcessReceivedUdpPacket (AsyncUDPPacket UDPpacket) { @@ -414,6 +401,16 @@ void c_FPPDiscovery::ProcessBlankPacket () // DEBUG_END; } // ProcessBlankPacket +//----------------------------------------------------------------------------- +bool c_FPPDiscovery::PlayingFile () +{ + if (InputFPPRemotePlayFile) + { + return !InputFPPRemotePlayFile->IsIdle (); + } + return false; +} // PlayingFile + //----------------------------------------------------------------------------- void c_FPPDiscovery::sendPingPacket (IPAddress destination) { @@ -623,7 +620,7 @@ void c_FPPDiscovery::BuildFseqResponse (String fname, c_FileMgr::FileId fseq, St //----------------------------------------------------------------------------- void c_FPPDiscovery::ProcessGET (AsyncWebServerRequest* request) { - // DEBUG_START; + DEBUG_START; printReq(request, false); do // once @@ -695,7 +692,7 @@ void c_FPPDiscovery::ProcessGET (AsyncWebServerRequest* request) } while (false); // do once - // DEBUG_END; + DEBUG_END; } // ProcessGET @@ -887,6 +884,7 @@ void c_FPPDiscovery::GetSysInfoJSON (JsonObject & jsonResponse) void c_FPPDiscovery::GetStatusJSON (JsonObject & JsonData, bool adv) { + DEBUG_START; JsonObject JsonDataMqtt = JsonData.createNestedObject(F ("MQTT")); JsonDataMqtt[F ("configured")] = false; @@ -900,6 +898,8 @@ void c_FPPDiscovery::GetStatusJSON (JsonObject & JsonData, bool adv) JsonDataCurrentPlaylist[CN_playlist] = ""; JsonDataCurrentPlaylist[CN_type] = ""; + DEBUG_V(); + JsonData[F ("volume")] = 70; JsonData[F ("media_filename")] = ""; JsonData[F ("fppd")] = F ("running"); @@ -932,8 +932,10 @@ void c_FPPDiscovery::GetStatusJSON (JsonObject & JsonData, bool adv) } else { + DEBUG_V(); if (InputFPPRemotePlayFile) { + DEBUG_V(); InputFPPRemotePlayFile->GetStatus (JsonData); } JsonData[CN_status] = 1; @@ -942,13 +944,16 @@ void c_FPPDiscovery::GetStatusJSON (JsonObject & JsonData, bool adv) JsonData[CN_mode] = 8; JsonData[CN_mode_name] = CN_remote; } + DEBUG_V(); if (adv) { + DEBUG_V(); JsonObject JsonDataAdvancedView = JsonData.createNestedObject (F ("advancedView")); GetSysInfoJSON (JsonDataAdvancedView); + DEBUG_V(); } - + DEBUG_END; } //----------------------------------------------------------------------------- From f95a0e434fb7411382e5dd06782327b1cf5765e3 Mon Sep 17 00:00:00 2001 From: Martin Date: Sun, 29 Oct 2023 13:53:55 -0400 Subject: [PATCH 07/13] Minor tweak for stop function --- ESPixelStick/src/input/InputFPPRemotePlayFile.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ESPixelStick/src/input/InputFPPRemotePlayFile.cpp b/ESPixelStick/src/input/InputFPPRemotePlayFile.cpp index 4e53908da..0f7a2c7a1 100644 --- a/ESPixelStick/src/input/InputFPPRemotePlayFile.cpp +++ b/ESPixelStick/src/input/InputFPPRemotePlayFile.cpp @@ -152,12 +152,12 @@ void c_InputFPPRemotePlayFile::Poll () { // xDEBUG_START; - // TimerPoll (); - pCurrentFsmState->Poll (); - // Show that we have received a poll PollDetectionCounter = 0; + // TimerPoll (); + pCurrentFsmState->Poll (); + // xDEBUG_END; } // Poll From 9b9a697e60aef5db482cb72ac3f0a72de62dfe6f Mon Sep 17 00:00:00 2001 From: Martin Date: Sun, 29 Oct 2023 13:55:57 -0400 Subject: [PATCH 08/13] Moved stopp changes to the stop poll call. --- .../src/input/InputFPPRemotePlayFileFsm.cpp | 58 ++++++++++--------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/ESPixelStick/src/input/InputFPPRemotePlayFileFsm.cpp b/ESPixelStick/src/input/InputFPPRemotePlayFileFsm.cpp index c735dd531..aff7807d0 100644 --- a/ESPixelStick/src/input/InputFPPRemotePlayFileFsm.cpp +++ b/ESPixelStick/src/input/InputFPPRemotePlayFileFsm.cpp @@ -27,6 +27,8 @@ void fsm_PlayFile_state_Idle::Poll () { // DEBUG_START; + // DEBUG_V("fsm_PlayFile_state_Idle::Poll"); + // do nothing // DEBUG_END; @@ -45,7 +47,7 @@ IRAM_ATTR void fsm_PlayFile_state_Idle::TimerPoll () void fsm_PlayFile_state_Idle::Init (c_InputFPPRemotePlayFile* Parent) { // DEBUG_START; - // DEBUG_V("State:Idle"); + // DEBUG_V("fsm_PlayFile_state_Idle::Init"); // DEBUG_V (String (" Parent: 0x") + String ((uint32_t)Parent, HEX)); p_Parent = Parent; @@ -60,7 +62,7 @@ void fsm_PlayFile_state_Idle::Init (c_InputFPPRemotePlayFile* Parent) void fsm_PlayFile_state_Idle::Start (String& FileName, float ElapsedSeconds, uint32_t RemainingPlayCount) { // DEBUG_START; - // DEBUG_V("State:Idle"); + // DEBUG_V("fsm_PlayFile_state_Idle::Start"); // DEBUG_V (String ("FileName: ") + FileName); @@ -82,7 +84,7 @@ void fsm_PlayFile_state_Idle::Start (String& FileName, float ElapsedSeconds, uin void fsm_PlayFile_state_Idle::Stop (void) { // DEBUG_START; - // DEBUG_V("State:Idle"); + // DEBUG_V("fsm_PlayFile_state_Idle::Stop"); // Do nothing @@ -130,7 +132,7 @@ IRAM_ATTR void fsm_PlayFile_state_Starting::TimerPoll () void fsm_PlayFile_state_Starting::Init (c_InputFPPRemotePlayFile* Parent) { // DEBUG_START; - // DEBUG_V("State:Starting"); + // DEBUG_V("fsm_PlayFile_state_Starting::Init"); p_Parent = Parent; Parent->pCurrentFsmState = &(Parent->fsm_PlayFile_state_Starting_imp); @@ -148,7 +150,7 @@ void fsm_PlayFile_state_Starting::Init (c_InputFPPRemotePlayFile* Parent) void fsm_PlayFile_state_Starting::Start (String& FileName, float ElapsedSeconds, uint32_t RemainingPlayCount) { // DEBUG_START; - // DEBUG_V("State:Starting"); + // DEBUG_V("fsm_PlayFile_state_Starting::Start"); // DEBUG_V (String ("FileName: ") + FileName); p_Parent->PlayItemName = FileName; @@ -164,7 +166,7 @@ void fsm_PlayFile_state_Starting::Start (String& FileName, float ElapsedSeconds, void fsm_PlayFile_state_Starting::Stop (void) { // DEBUG_START; - // DEBUG_V("State:Starting"); + // DEBUG_V("fsm_PlayFile_state_Starting::Stop"); p_Parent->RemainingPlayCount = 0; p_Parent->fsm_PlayFile_state_Idle_imp.Init (p_Parent); @@ -220,7 +222,7 @@ void fsm_PlayFile_state_PlayingFile::Poll () break; } } - + // DEBUG_V(); InputMgr.RestartBlankTimer (p_Parent->GetInputChannelId ()); } while (false); @@ -313,7 +315,7 @@ IRAM_ATTR void fsm_PlayFile_state_PlayingFile::TimerPoll () void fsm_PlayFile_state_PlayingFile::Init (c_InputFPPRemotePlayFile* Parent) { // DEBUG_START; - // DEBUG_V("State:PlayingFile"); + // DEBUG_V("fsm_PlayFile_state_PlayingFile::Init"); p_Parent = Parent; @@ -359,7 +361,7 @@ void fsm_PlayFile_state_PlayingFile::Init (c_InputFPPRemotePlayFile* Parent) void fsm_PlayFile_state_PlayingFile::Start (String& FileName, float ElapsedSeconds, uint32_t PlayCount) { // DEBUG_START; - // DEBUG_V("State:PlayingFile"); + // DEBUG_V("fsm_PlayFile_state_PlayingFile::Start"); // DEBUG_V (String (" FileName: ") + FileName); // DEBUG_V (String (" LastPlayedFrameId: ") + String (p_Parent->LastPlayedFrameId)); @@ -377,7 +379,7 @@ void fsm_PlayFile_state_PlayingFile::Start (String& FileName, float ElapsedSecon void fsm_PlayFile_state_PlayingFile::Stop (void) { // DEBUG_START; - // DEBUG_V("State:PlayingFile"); + // DEBUG_V("fsm_PlayFile_state_PlayingFile::Stop"); // DEBUG_V (String (F ("Stop Playing:: FileName: '")) + p_Parent->PlayItemName + "'"); // DEBUG_V (String (" LastPlayedFrameId: ") + String (p_Parent->LastPlayedFrameId)); @@ -463,12 +465,24 @@ void fsm_PlayFile_state_Stopping::Poll () { // DEBUG_START; + // DEBUG_V("fsm_PlayFile_state_Stopping::Poll"); // DEBUG_V (String ("FileHandleForFileBeingPlayed: ") + String (p_Parent->FileHandleForFileBeingPlayed)); FileMgr.CloseSdFile (p_Parent->FileHandleForFileBeingPlayed); p_Parent->FileHandleForFileBeingPlayed = c_FileMgr::INVALID_FILE_HANDLE; p_Parent->fsm_PlayFile_state_Idle_imp.Init (p_Parent); + StartingElapsedTime = 0.0; + PlayCount = 0; + + p_Parent->SyncControl.LastRcvdElapsedSeconds = 0; + p_Parent->FrameControl.ElapsedPlayTimeMS = 0; + + if(p_Parent->SendFppSync) + { + FPPDiscovery.GenerateFppSyncMsg(SYNC_PKT_STOP, emptyString, 0, float(0.0)); + } + if (!FileName.equals(emptyString)) { // DEBUG_V ("Restarting File"); @@ -490,23 +504,11 @@ IRAM_ATTR void fsm_PlayFile_state_Stopping::TimerPoll () void fsm_PlayFile_state_Stopping::Init (c_InputFPPRemotePlayFile* Parent) { // DEBUG_START; - // DEBUG_V("State:Stopping"); - - FileName = ""; - StartingElapsedTime = 0.0; - PlayCount = 0; + // DEBUG_V("fsm_PlayFile_state_Stopping::Init"); p_Parent = Parent; Parent->pCurrentFsmState = &(Parent->fsm_PlayFile_state_Stopping_imp); - p_Parent->SyncControl.LastRcvdElapsedSeconds = 0; - p_Parent->FrameControl.ElapsedPlayTimeMS = 0; - - if(p_Parent->SendFppSync) - { - FPPDiscovery.GenerateFppSyncMsg(SYNC_PKT_STOP, emptyString, 0, float(0.0)); - } - // DEBUG_END; } // fsm_PlayFile_state_Stopping::Init @@ -515,7 +517,7 @@ void fsm_PlayFile_state_Stopping::Init (c_InputFPPRemotePlayFile* Parent) void fsm_PlayFile_state_Stopping::Start (String& _FileName, float ElapsedTime, uint32_t _PlayCount) { // DEBUG_START; - // DEBUG_V("State:Stopping"); + // DEBUG_V("fsm_PlayFile_state_Stopping::Start"); FileName = _FileName; StartingElapsedTime = ElapsedTime; @@ -529,7 +531,7 @@ void fsm_PlayFile_state_Stopping::Start (String& _FileName, float ElapsedTime, u void fsm_PlayFile_state_Stopping::Stop (void) { // DEBUG_START; - // DEBUG_V("State:Stopping"); + // DEBUG_V("fsm_PlayFile_state_Stopping::Stop"); // DEBUG_END; @@ -579,7 +581,7 @@ IRAM_ATTR void fsm_PlayFile_state_Error::TimerPoll () void fsm_PlayFile_state_Error::Init (c_InputFPPRemotePlayFile* Parent) { // DEBUG_START; - // DEBUG_V("State:Error"); + // DEBUG_V("fsm_PlayFile_state_Error::Init"); p_Parent = Parent; Parent->pCurrentFsmState = &(Parent->fsm_PlayFile_state_Error_imp); @@ -596,7 +598,7 @@ void fsm_PlayFile_state_Error::Init (c_InputFPPRemotePlayFile* Parent) void fsm_PlayFile_state_Error::Start (String& FileName, float ElapsedSeconds, uint32_t PlayCount) { // DEBUG_START; - // DEBUG_V("State:Error"); + // DEBUG_V("fsm_PlayFile_state_Error::Start"); if (FileName != p_Parent->GetFileName ()) { @@ -611,7 +613,7 @@ void fsm_PlayFile_state_Error::Start (String& FileName, float ElapsedSeconds, ui void fsm_PlayFile_state_Error::Stop (void) { // DEBUG_START; - // DEBUG_V("State:Error"); + // DEBUG_V("fsm_PlayFile_state_Error::Stop"); p_Parent->fsm_PlayFile_state_Idle_imp.Init (p_Parent); From e94054981f533a4fbc7795bce313bb16c34ec150 Mon Sep 17 00:00:00 2001 From: Martin Date: Sun, 29 Oct 2023 15:12:40 -0400 Subject: [PATCH 09/13] Modified dtop to wait until idle. --- ESPixelStick/src/service/FPPDiscovery.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ESPixelStick/src/service/FPPDiscovery.cpp b/ESPixelStick/src/service/FPPDiscovery.cpp index 558d00526..ad41c3f6e 100644 --- a/ESPixelStick/src/service/FPPDiscovery.cpp +++ b/ESPixelStick/src/service/FPPDiscovery.cpp @@ -1092,6 +1092,7 @@ void c_FPPDiscovery::StartPlaying (String & FileName, float SecondsElapsed) } // StartPlaying //----------------------------------------------------------------------------- +// Wait for idle. void c_FPPDiscovery::StopPlaying () { // DEBUG_START; @@ -1099,7 +1100,11 @@ void c_FPPDiscovery::StopPlaying () // logcon (String (F ("FPPDiscovery::StopPlaying '")) + InputFPPRemotePlayFile.GetFileName() + "'"); if (InputFPPRemotePlayFile) { - InputFPPRemotePlayFile->Stop (); + while(!InputFPPRemotePlayFile->IsIdle()) + { + InputFPPRemotePlayFile->Stop (); + delay(10); + } } // DEBUG_V (""); From b551dd18db71a6ba6965f51d3cd58c66665d0dfa Mon Sep 17 00:00:00 2001 From: Martin Date: Sun, 29 Oct 2023 15:15:38 -0400 Subject: [PATCH 10/13] Added code to fix bad file handle issue. --- .../src/input/InputFPPRemotePlayFileFsm.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/ESPixelStick/src/input/InputFPPRemotePlayFileFsm.cpp b/ESPixelStick/src/input/InputFPPRemotePlayFileFsm.cpp index aff7807d0..9f0358ab3 100644 --- a/ESPixelStick/src/input/InputFPPRemotePlayFileFsm.cpp +++ b/ESPixelStick/src/input/InputFPPRemotePlayFileFsm.cpp @@ -199,6 +199,12 @@ void fsm_PlayFile_state_PlayingFile::Poll () do // once { + if(0 == p_Parent->FileHandleForFileBeingPlayed) + { + // DEBUG_V("Bad FileHandleForFileBeingPlayed"); + Stop(); + break; + } // DEBUG_V (String ("LastPlayedFrameId: ") + String (LastPlayedFrameId)); // have we reached the end of the file? if (p_Parent->FrameControl.TotalNumberOfFramesInSequence <= LastPlayedFrameId) @@ -238,6 +244,13 @@ IRAM_ATTR void fsm_PlayFile_state_PlayingFile::TimerPoll () do // once { + if(0 == p_Parent->FileHandleForFileBeingPlayed) + { + // DEBUG_V("Bad FileHandleForFileBeingPlayed"); + Stop(); + break; + } + uint32_t CurrentFrame = p_Parent->CalculateFrameId (p_Parent->FrameControl.ElapsedPlayTimeMS, p_Parent->GetSyncOffsetMS ()); // xDEBUG_V (String ("TotalNumberOfFramesInSequence: ") + String (p_Parent->TotalNumberOfFramesInSequence)); @@ -548,7 +561,6 @@ bool fsm_PlayFile_state_Stopping::Sync (String&, float) } // fsm_PlayFile_state_Stopping::Sync - //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- From afc0d7d0828dec62d424c45846e1a4711804218e Mon Sep 17 00:00:00 2001 From: Martin Date: Sun, 29 Oct 2023 15:18:01 -0400 Subject: [PATCH 11/13] Removed code that caused a poll to get triggered while in a higher priority task. Caused a crash --- ESPixelStick/src/input/InputFPPRemotePlayFile.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/ESPixelStick/src/input/InputFPPRemotePlayFile.cpp b/ESPixelStick/src/input/InputFPPRemotePlayFile.cpp index 0f7a2c7a1..c0a361cc4 100644 --- a/ESPixelStick/src/input/InputFPPRemotePlayFile.cpp +++ b/ESPixelStick/src/input/InputFPPRemotePlayFile.cpp @@ -121,12 +121,7 @@ void c_InputFPPRemotePlayFile::Stop () { // DEBUG_START; - while (pCurrentFsmState != &fsm_PlayFile_state_Idle_imp) - { - pCurrentFsmState->Stop (); - pCurrentFsmState->Poll (); - pCurrentFsmState->TimerPoll (); - } + pCurrentFsmState->Stop (); // DEBUG_END; } // Stop From a2d10833f9d27853c7f82a95190216a3aab3f03c Mon Sep 17 00:00:00 2001 From: Martin Date: Sun, 29 Oct 2023 16:22:55 -0400 Subject: [PATCH 12/13] Changed string compare to conform to latest best practice --- ESPixelStick/src/service/FPPDiscovery.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ESPixelStick/src/service/FPPDiscovery.cpp b/ESPixelStick/src/service/FPPDiscovery.cpp index ad41c3f6e..aeaa38a0c 100644 --- a/ESPixelStick/src/service/FPPDiscovery.cpp +++ b/ESPixelStick/src/service/FPPDiscovery.cpp @@ -978,7 +978,7 @@ void c_FPPDiscovery::ProcessFPPJson (AsyncWebServerRequest* request) String command = request->getParam (ulrCommand)->value (); // DEBUG_V (String ("command: ") + command); - if (command == F ("getFPPstatus")) + if (command.equals(F ("getFPPstatus"))) { String adv = CN_false; if (request->hasParam (CN_advancedView)) @@ -996,7 +996,7 @@ void c_FPPDiscovery::ProcessFPPJson (AsyncWebServerRequest* request) break; } - if (command == F ("getSysInfo")) + if (command.equals(F ("getSysInfo"))) { GetSysInfoJSON (JsonData); @@ -1008,7 +1008,7 @@ void c_FPPDiscovery::ProcessFPPJson (AsyncWebServerRequest* request) break; } - if (command == F ("getHostNameInfo")) + if (command.equals(("getHostNameInfo"))) { String Hostname; NetworkMgr.GetHostname (Hostname); @@ -1024,7 +1024,7 @@ void c_FPPDiscovery::ProcessFPPJson (AsyncWebServerRequest* request) break; } - if (command == F ("getChannelOutputs")) + if (command.equals(F ("getChannelOutputs"))) { if (request->hasParam (CN_file)) { From 5d88be16db4b5cac79b26dfa5cf6c72add7bdda4 Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 31 Oct 2023 06:11:41 -0400 Subject: [PATCH 13/13] Resuced turnaround time at end of file. --- ESPixelStick/src/input/InputFPPRemote.cpp | 19 ++++++++++++++++-- ESPixelStick/src/input/InputFPPRemote.h | 1 + .../src/input/InputFPPRemotePlayEffect.cpp | 4 ++-- .../src/input/InputFPPRemotePlayEffect.hpp | 2 +- .../src/input/InputFPPRemotePlayEffectFsm.cpp | 8 +++++--- .../src/input/InputFPPRemotePlayEffectFsm.hpp | 6 +++--- .../src/input/InputFPPRemotePlayFile.cpp | 4 ++-- .../src/input/InputFPPRemotePlayFile.hpp | 2 +- .../src/input/InputFPPRemotePlayFileFsm.cpp | 18 ++++++++++++----- .../src/input/InputFPPRemotePlayFileFsm.hpp | 12 +++++------ .../src/input/InputFPPRemotePlayItem.hpp | 2 +- .../src/input/InputFPPRemotePlayList.cpp | 4 ++-- .../src/input/InputFPPRemotePlayList.hpp | 2 +- .../src/input/InputFPPRemotePlayListFsm.cpp | 19 +++++++++++------- .../src/input/InputFPPRemotePlayListFsm.hpp | 12 +++++------ ESPixelStick/src/service/FPPDiscovery.cpp | 20 +++++++++---------- 16 files changed, 83 insertions(+), 52 deletions(-) diff --git a/ESPixelStick/src/input/InputFPPRemote.cpp b/ESPixelStick/src/input/InputFPPRemote.cpp index 70c9cfa5c..de2ed3a68 100644 --- a/ESPixelStick/src/input/InputFPPRemote.cpp +++ b/ESPixelStick/src/input/InputFPPRemote.cpp @@ -198,12 +198,12 @@ void c_InputFPPRemote::Process () else if (PlayingRemoteFile ()) { // DEBUG_V ("Remote File Play"); - pInputFPPRemotePlayItem->Poll (); + while(Poll ()) {} } else if (PlayingFile ()) { // DEBUG_V ("Local File Play"); - pInputFPPRemotePlayItem->Poll (); + while(Poll ()) {} if (pInputFPPRemotePlayItem->IsIdle ()) { @@ -216,6 +216,21 @@ void c_InputFPPRemote::Process () } // process +//----------------------------------------------------------------------------- +bool c_InputFPPRemote::Poll () +{ + // DEBUG_START; + bool Response = false; + if(pInputFPPRemotePlayItem) + { + Response = pInputFPPRemotePlayItem->Poll (); + } + + // DEBUG_END; + return Response; + +} // Poll + //----------------------------------------------------------------------------- void c_InputFPPRemote::ProcessButtonActions(c_ExternalInput::InputValue_t value) { diff --git a/ESPixelStick/src/input/InputFPPRemote.h b/ESPixelStick/src/input/InputFPPRemote.h index 623568b3d..df2a177b3 100644 --- a/ESPixelStick/src/input/InputFPPRemote.h +++ b/ESPixelStick/src/input/InputFPPRemote.h @@ -63,6 +63,7 @@ class c_InputFPPRemote : public c_InputCommon bool PlayingFile (); bool PlayingRemoteFile (); void PlayNextFile (); + bool Poll (); void load (); ///< Load configuration from File System void save (); ///< Save configuration to File System diff --git a/ESPixelStick/src/input/InputFPPRemotePlayEffect.cpp b/ESPixelStick/src/input/InputFPPRemotePlayEffect.cpp index 0520a8f50..f13bfb8db 100644 --- a/ESPixelStick/src/input/InputFPPRemotePlayEffect.cpp +++ b/ESPixelStick/src/input/InputFPPRemotePlayEffect.cpp @@ -82,11 +82,11 @@ void c_InputFPPRemotePlayEffect::Sync (String& FileName, float SecondsElapsed) } // Sync //----------------------------------------------------------------------------- -void c_InputFPPRemotePlayEffect::Poll () +bool c_InputFPPRemotePlayEffect::Poll () { // DEBUG_START; - pCurrentFsmState->Poll (); + return pCurrentFsmState->Poll (); // DEBUG_END; diff --git a/ESPixelStick/src/input/InputFPPRemotePlayEffect.hpp b/ESPixelStick/src/input/InputFPPRemotePlayEffect.hpp index b7404b692..4b733b293 100644 --- a/ESPixelStick/src/input/InputFPPRemotePlayEffect.hpp +++ b/ESPixelStick/src/input/InputFPPRemotePlayEffect.hpp @@ -33,7 +33,7 @@ class c_InputFPPRemotePlayEffect : public c_InputFPPRemotePlayItem virtual void Start (String & FileName, float duration, uint32_t PlayCount); virtual void Stop (); virtual void Sync (String & FileName, float SecondsElapsed); - virtual void Poll (); + virtual bool Poll (); virtual void GetStatus (JsonObject & jsonStatus); virtual bool IsIdle () { return (pCurrentFsmState == &fsm_PlayEffect_state_Idle_imp); } diff --git a/ESPixelStick/src/input/InputFPPRemotePlayEffectFsm.cpp b/ESPixelStick/src/input/InputFPPRemotePlayEffectFsm.cpp index 7194a7f60..66f980df0 100644 --- a/ESPixelStick/src/input/InputFPPRemotePlayEffectFsm.cpp +++ b/ESPixelStick/src/input/InputFPPRemotePlayEffectFsm.cpp @@ -23,14 +23,15 @@ #include "../utility/SaferStringConversion.hpp" //----------------------------------------------------------------------------- -void fsm_PlayEffect_state_Idle::Poll () +bool fsm_PlayEffect_state_Idle::Poll () { // DEBUG_START; // do nothing // DEBUG_END; - + return false; + } // fsm_PlayEffect_state_Idle::Poll //----------------------------------------------------------------------------- @@ -117,7 +118,7 @@ void fsm_PlayEffect_state_Idle::GetStatus (JsonObject& jsonStatus) //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void fsm_PlayEffect_state_PlayingEffect::Poll () +bool fsm_PlayEffect_state_PlayingEffect::Poll () { // DEBUG_START; @@ -131,6 +132,7 @@ void fsm_PlayEffect_state_PlayingEffect::Poll () } // DEBUG_END; + return false; } // fsm_PlayEffect_state_PlayingEffect::Poll diff --git a/ESPixelStick/src/input/InputFPPRemotePlayEffectFsm.hpp b/ESPixelStick/src/input/InputFPPRemotePlayEffectFsm.hpp index 41a812af4..df52201cc 100644 --- a/ESPixelStick/src/input/InputFPPRemotePlayEffectFsm.hpp +++ b/ESPixelStick/src/input/InputFPPRemotePlayEffectFsm.hpp @@ -35,7 +35,7 @@ class fsm_PlayEffect_state fsm_PlayEffect_state() {} virtual ~fsm_PlayEffect_state() {} - virtual void Poll () = 0; + virtual bool Poll () = 0; virtual void Init (c_InputFPPRemotePlayEffect * Parent) = 0; virtual void GetStateName (String & sName) = 0; virtual void Start (String & FileName, float SecondsElapsed) = 0; @@ -56,7 +56,7 @@ class fsm_PlayEffect_state_Idle : public fsm_PlayEffect_state fsm_PlayEffect_state_Idle() {} virtual ~fsm_PlayEffect_state_Idle() {} - virtual void Poll (); + virtual bool Poll (); virtual void Init (c_InputFPPRemotePlayEffect* Parent); virtual void GetStateName (String & sName) { sName = CN_Idle; } virtual void Start (String & FileName, float SecondsElapsed); @@ -73,7 +73,7 @@ class fsm_PlayEffect_state_PlayingEffect : public fsm_PlayEffect_state fsm_PlayEffect_state_PlayingEffect() {} virtual ~fsm_PlayEffect_state_PlayingEffect() {} - virtual void Poll (); + virtual bool Poll (); virtual void Init (c_InputFPPRemotePlayEffect* Parent); virtual void GetStateName (String & sName) { sName = CN_Effect; } virtual void Start (String & FileName, float SecondsElapsed); diff --git a/ESPixelStick/src/input/InputFPPRemotePlayFile.cpp b/ESPixelStick/src/input/InputFPPRemotePlayFile.cpp index c0a361cc4..f78a72eb8 100644 --- a/ESPixelStick/src/input/InputFPPRemotePlayFile.cpp +++ b/ESPixelStick/src/input/InputFPPRemotePlayFile.cpp @@ -143,7 +143,7 @@ void c_InputFPPRemotePlayFile::Sync (String & FileName, float SecondsElapsed) } // Sync //----------------------------------------------------------------------------- -void c_InputFPPRemotePlayFile::Poll () +bool c_InputFPPRemotePlayFile::Poll () { // xDEBUG_START; @@ -151,7 +151,7 @@ void c_InputFPPRemotePlayFile::Poll () PollDetectionCounter = 0; // TimerPoll (); - pCurrentFsmState->Poll (); + return pCurrentFsmState->Poll (); // xDEBUG_END; diff --git a/ESPixelStick/src/input/InputFPPRemotePlayFile.hpp b/ESPixelStick/src/input/InputFPPRemotePlayFile.hpp index 98a41a70d..76cd78e4b 100644 --- a/ESPixelStick/src/input/InputFPPRemotePlayFile.hpp +++ b/ESPixelStick/src/input/InputFPPRemotePlayFile.hpp @@ -39,7 +39,7 @@ class c_InputFPPRemotePlayFile : public c_InputFPPRemotePlayItem virtual void Start (String & FileName, float SecondsElapsed, uint32_t RemainingPlayCount); virtual void Stop (); virtual void Sync (String& FileName, float SecondsElapsed); - virtual void Poll (); + virtual bool Poll (); virtual void GetStatus (JsonObject & jsonStatus); virtual bool IsIdle () { return (pCurrentFsmState == &fsm_PlayFile_state_Idle_imp); } diff --git a/ESPixelStick/src/input/InputFPPRemotePlayFileFsm.cpp b/ESPixelStick/src/input/InputFPPRemotePlayFileFsm.cpp index 9f0358ab3..284963f14 100644 --- a/ESPixelStick/src/input/InputFPPRemotePlayFileFsm.cpp +++ b/ESPixelStick/src/input/InputFPPRemotePlayFileFsm.cpp @@ -23,7 +23,7 @@ #include "src/service/FPPDiscovery.h" //----------------------------------------------------------------------------- -void fsm_PlayFile_state_Idle::Poll () +bool fsm_PlayFile_state_Idle::Poll () { // DEBUG_START; @@ -32,6 +32,7 @@ void fsm_PlayFile_state_Idle::Poll () // do nothing // DEBUG_END; + return false; } // fsm_PlayFile_state_Idle::Poll @@ -109,7 +110,7 @@ bool fsm_PlayFile_state_Idle::Sync (String& FileName, float ElapsedSeconds) //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void fsm_PlayFile_state_Starting::Poll () +bool fsm_PlayFile_state_Starting::Poll () { // DEBUG_START; @@ -118,6 +119,7 @@ void fsm_PlayFile_state_Starting::Poll () // DEBUG_V (String ("TotalNumberOfFramesInSequence: ") + String (p_Parent->FrameControl.TotalNumberOfFramesInSequence)); // DEBUG_END; + return true; } // fsm_PlayFile_state_Starting::Poll @@ -193,10 +195,12 @@ bool fsm_PlayFile_state_Starting::Sync (String& FileName, float ElapsedSeconds) //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void fsm_PlayFile_state_PlayingFile::Poll () +bool fsm_PlayFile_state_PlayingFile::Poll () { // xDEBUG_START; + bool Response = false; + do // once { if(0 == p_Parent->FileHandleForFileBeingPlayed) @@ -225,6 +229,7 @@ void fsm_PlayFile_state_PlayingFile::Poll () // DEBUG_V (String ("TotalNumberOfFramesInSequence: ") + String (p_Parent->TotalNumberOfFramesInSequence)); // DEBUG_V (String (" Done Playing:: FileName: '") + p_Parent->GetFileName () + "'"); p_Parent->Stop (); + Response = true; break; } } @@ -234,6 +239,7 @@ void fsm_PlayFile_state_PlayingFile::Poll () } while (false); // xDEBUG_END; + return Response; } // fsm_PlayFile_state_PlayingFile::Poll @@ -474,7 +480,7 @@ bool fsm_PlayFile_state_PlayingFile::Sync (String& FileName, float ElapsedSecond //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void fsm_PlayFile_state_Stopping::Poll () +bool fsm_PlayFile_state_Stopping::Poll () { // DEBUG_START; @@ -503,6 +509,7 @@ void fsm_PlayFile_state_Stopping::Poll () } // DEBUG_END; + return true; } // fsm_PlayFile_state_Stopping::Poll @@ -564,7 +571,7 @@ bool fsm_PlayFile_state_Stopping::Sync (String&, float) //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void fsm_PlayFile_state_Error::Poll () +bool fsm_PlayFile_state_Error::Poll () { // xDEBUG_START; @@ -573,6 +580,7 @@ void fsm_PlayFile_state_Error::Poll () p_Parent->FrameControl.TotalNumberOfFramesInSequence = 0; // xDEBUG_END; + return false; } // fsm_PlayFile_state_Error::Poll diff --git a/ESPixelStick/src/input/InputFPPRemotePlayFileFsm.hpp b/ESPixelStick/src/input/InputFPPRemotePlayFileFsm.hpp index 85e4dc1c8..ecf013f37 100644 --- a/ESPixelStick/src/input/InputFPPRemotePlayFileFsm.hpp +++ b/ESPixelStick/src/input/InputFPPRemotePlayFileFsm.hpp @@ -36,7 +36,7 @@ class fsm_PlayFile_state fsm_PlayFile_state() {} virtual ~fsm_PlayFile_state() {} - virtual void Poll () = 0; + virtual bool Poll () = 0; virtual void Init (c_InputFPPRemotePlayFile * Parent) = 0; virtual void GetStateName (String & sName) = 0; virtual void Start (String & FileName, float SecondsElapsed, uint32_t RemainingPlayCount) = 0; @@ -57,7 +57,7 @@ class fsm_PlayFile_state_Idle : public fsm_PlayFile_state fsm_PlayFile_state_Idle() {} virtual ~fsm_PlayFile_state_Idle() {} - virtual void Poll (); + virtual bool Poll (); virtual void Init (c_InputFPPRemotePlayFile* Parent); virtual void GetStateName (String & sName) { sName = CN_Idle; } virtual void Start (String & FileName, float SecondsElapsed, uint32_t RemainingPlayCount); @@ -74,7 +74,7 @@ class fsm_PlayFile_state_Starting : public fsm_PlayFile_state fsm_PlayFile_state_Starting() {} virtual ~fsm_PlayFile_state_Starting() {} - virtual void Poll (); + virtual bool Poll (); virtual void Init (c_InputFPPRemotePlayFile* Parent); virtual void GetStateName (String& sName) { sName = F ("Starting"); } virtual void Start (String& FileName, float SecondsElapsed, uint32_t RemainingPlayCount); @@ -91,7 +91,7 @@ class fsm_PlayFile_state_PlayingFile : public fsm_PlayFile_state fsm_PlayFile_state_PlayingFile() {} virtual ~fsm_PlayFile_state_PlayingFile() {} - virtual void Poll (); + virtual bool Poll (); virtual void Init (c_InputFPPRemotePlayFile* Parent); virtual void GetStateName (String & sName) { sName = CN_File; } virtual void Start (String & FileName, float SecondsElapsed, uint32_t RemainingPlayCount); @@ -116,7 +116,7 @@ class fsm_PlayFile_state_Stopping : public fsm_PlayFile_state fsm_PlayFile_state_Stopping() {} virtual ~fsm_PlayFile_state_Stopping() {} - virtual void Poll (); + virtual bool Poll (); virtual void Init (c_InputFPPRemotePlayFile* Parent); virtual void GetStateName (String& sName) { sName = F("Stopping"); } virtual void Start (String& FileName, float SecondsElapsed, uint32_t RemainingPlayCount); @@ -138,7 +138,7 @@ class fsm_PlayFile_state_Error : public fsm_PlayFile_state fsm_PlayFile_state_Error() {} virtual ~fsm_PlayFile_state_Error() {} - virtual void Poll (); + virtual bool Poll (); virtual void Init (c_InputFPPRemotePlayFile* Parent); virtual void GetStateName (String& sName) { sName = F ("Error"); } virtual void Start (String& FileName, float SecondsElapsed, uint32_t RemainingPlayCount); diff --git a/ESPixelStick/src/input/InputFPPRemotePlayItem.hpp b/ESPixelStick/src/input/InputFPPRemotePlayItem.hpp index dbe6abf42..bcfcbd8e5 100644 --- a/ESPixelStick/src/input/InputFPPRemotePlayItem.hpp +++ b/ESPixelStick/src/input/InputFPPRemotePlayItem.hpp @@ -28,7 +28,7 @@ class c_InputFPPRemotePlayItem c_InputFPPRemotePlayItem (c_InputMgr::e_InputChannelIds InputChannelId); virtual ~c_InputFPPRemotePlayItem (); - virtual void Poll () = 0; + virtual bool Poll () = 0; virtual void Start (String & FileName, float SecondsElapsed, uint32_t RemainingPlayCount) = 0; virtual void Stop () = 0; virtual void Sync (String & FileName, float SecondsElapsed) = 0; diff --git a/ESPixelStick/src/input/InputFPPRemotePlayList.cpp b/ESPixelStick/src/input/InputFPPRemotePlayList.cpp index fe70bb794..950d080cb 100644 --- a/ESPixelStick/src/input/InputFPPRemotePlayList.cpp +++ b/ESPixelStick/src/input/InputFPPRemotePlayList.cpp @@ -77,11 +77,11 @@ void c_InputFPPRemotePlayList::Sync (String & FileName, float ElapsedSeconds) } // Sync //----------------------------------------------------------------------------- -void c_InputFPPRemotePlayList::Poll () +bool c_InputFPPRemotePlayList::Poll () { // DEBUG_START; - pCurrentFsmState->Poll (); + return pCurrentFsmState->Poll (); // DEBUG_END; diff --git a/ESPixelStick/src/input/InputFPPRemotePlayList.hpp b/ESPixelStick/src/input/InputFPPRemotePlayList.hpp index b260efb7d..deb87f01b 100644 --- a/ESPixelStick/src/input/InputFPPRemotePlayList.hpp +++ b/ESPixelStick/src/input/InputFPPRemotePlayList.hpp @@ -34,7 +34,7 @@ class c_InputFPPRemotePlayList : public c_InputFPPRemotePlayItem virtual void Start (String & FileName, float SecondsElapsed, uint32_t PlayCount); virtual void Stop (); virtual void Sync (String & FileName, float SecondsElapsed); - virtual void Poll (); + virtual bool Poll (); virtual void GetStatus (JsonObject & jsonStatus); virtual bool IsIdle () { return (pCurrentFsmState == &fsm_PlayList_state_Idle_imp); } diff --git a/ESPixelStick/src/input/InputFPPRemotePlayListFsm.cpp b/ESPixelStick/src/input/InputFPPRemotePlayListFsm.cpp index 19dfa10d4..779dd614e 100644 --- a/ESPixelStick/src/input/InputFPPRemotePlayListFsm.cpp +++ b/ESPixelStick/src/input/InputFPPRemotePlayListFsm.cpp @@ -25,14 +25,15 @@ #include "InputFPPRemotePlayEffect.hpp" //----------------------------------------------------------------------------- -void fsm_PlayList_state_WaitForStart::Poll () +bool fsm_PlayList_state_WaitForStart::Poll () { // DEBUG_START; // do nothing // DEBUG_END; - + return false; + } // fsm_PlayList_state_Idle::Poll //----------------------------------------------------------------------------- @@ -93,13 +94,14 @@ void fsm_PlayList_state_WaitForStart::GetStatus (JsonObject& jsonStatus) //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void fsm_PlayList_state_Idle::Poll () +bool fsm_PlayList_state_Idle::Poll () { // DEBUG_START; pInputFPPRemotePlayList->ProcessPlayListEntry (); // DEBUG_END; + return false; } // fsm_PlayList_state_Idle::Poll @@ -151,11 +153,11 @@ void fsm_PlayList_state_Idle::GetStatus (JsonObject& jsonStatus) //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void fsm_PlayList_state_PlayingFile::Poll () +bool fsm_PlayList_state_PlayingFile::Poll () { // DEBUG_START; - pInputFPPRemotePlayList->pInputFPPRemotePlayItem->Poll (); + bool Response = pInputFPPRemotePlayList->pInputFPPRemotePlayItem->Poll (); if (pInputFPPRemotePlayList->pInputFPPRemotePlayItem->IsIdle ()) { @@ -164,6 +166,7 @@ void fsm_PlayList_state_PlayingFile::Poll () } // DEBUG_END; + return Response; } // fsm_PlayList_state_PlayingFile::Poll @@ -227,7 +230,7 @@ void fsm_PlayList_state_PlayingFile::GetStatus (JsonObject& jsonStatus) //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void fsm_PlayList_state_PlayingEffect::Poll () +bool fsm_PlayList_state_PlayingEffect::Poll () { // DEBUG_START; @@ -240,6 +243,7 @@ void fsm_PlayList_state_PlayingEffect::Poll () } // DEBUG_END; + return false; } // fsm_PlayList_state_PlayingEffect::Poll @@ -305,7 +309,7 @@ void fsm_PlayList_state_PlayingEffect::GetStatus (JsonObject& jsonStatus) //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void fsm_PlayList_state_Paused::Poll () +bool fsm_PlayList_state_Paused::Poll () { // DEBUG_START; @@ -315,6 +319,7 @@ void fsm_PlayList_state_Paused::Poll () } // DEBUG_END; + return false; } // fsm_PlayList_state_Paused::Poll diff --git a/ESPixelStick/src/input/InputFPPRemotePlayListFsm.hpp b/ESPixelStick/src/input/InputFPPRemotePlayListFsm.hpp index a266cba74..36d01bfac 100644 --- a/ESPixelStick/src/input/InputFPPRemotePlayListFsm.hpp +++ b/ESPixelStick/src/input/InputFPPRemotePlayListFsm.hpp @@ -35,7 +35,7 @@ class fsm_PlayList_state fsm_PlayList_state() {} virtual ~fsm_PlayList_state() {} - virtual void Poll () = 0; + virtual bool Poll () = 0; virtual void Init (c_InputFPPRemotePlayList * Parent) = 0; virtual void GetStateName (String & sName) = 0; virtual void Start (String & FileName, float SecondsElapsed, uint32_t PlayCount) = 0; @@ -56,7 +56,7 @@ class fsm_PlayList_state_WaitForStart : public fsm_PlayList_state fsm_PlayList_state_WaitForStart() {} virtual ~fsm_PlayList_state_WaitForStart() {} - virtual void Poll (); + virtual bool Poll (); virtual void Init (c_InputFPPRemotePlayList* Parent); virtual void GetStateName (String & sName) { sName = CN_Idle; } virtual void Start (String & FileName, float SecondsElapsed, uint32_t PlayCount); @@ -72,7 +72,7 @@ class fsm_PlayList_state_Idle : public fsm_PlayList_state fsm_PlayList_state_Idle() {} virtual ~fsm_PlayList_state_Idle() {} - virtual void Poll (); + virtual bool Poll (); virtual void Init (c_InputFPPRemotePlayList* Parent); virtual void GetStateName (String & sName) { sName = CN_Idle; } virtual void Start (String & FileName, float SecondsElapsed, uint32_t PlayCount); @@ -88,7 +88,7 @@ class fsm_PlayList_state_PlayingFile : public fsm_PlayList_state fsm_PlayList_state_PlayingFile() {} virtual ~fsm_PlayList_state_PlayingFile() {} - virtual void Poll (); + virtual bool Poll (); virtual void Init (c_InputFPPRemotePlayList* Parent); virtual void GetStateName (String & sName) { sName = CN_File; } virtual void Start (String & FileName, float SecondsElapsed, uint32_t PlayCount); @@ -104,7 +104,7 @@ class fsm_PlayList_state_PlayingEffect : public fsm_PlayList_state fsm_PlayList_state_PlayingEffect() {} virtual ~fsm_PlayList_state_PlayingEffect() {} - virtual void Poll (); + virtual bool Poll (); virtual void Init (c_InputFPPRemotePlayList* Parent); virtual void GetStateName (String & sName) { sName = CN_Effect; } virtual void Start (String & FileName, float SecondsElapsed, uint32_t PlayCount); @@ -120,7 +120,7 @@ class fsm_PlayList_state_Paused : public fsm_PlayList_state fsm_PlayList_state_Paused() {} virtual ~fsm_PlayList_state_Paused() {} - virtual void Poll (); + virtual bool Poll (); virtual void Init (c_InputFPPRemotePlayList* Parent); virtual void GetStateName (String & sName) { sName = CN_Paused; } virtual void Start (String & FileName, float SecondsElapsed, uint32_t PlayCount); diff --git a/ESPixelStick/src/service/FPPDiscovery.cpp b/ESPixelStick/src/service/FPPDiscovery.cpp index aeaa38a0c..c22c0ac98 100644 --- a/ESPixelStick/src/service/FPPDiscovery.cpp +++ b/ESPixelStick/src/service/FPPDiscovery.cpp @@ -620,7 +620,7 @@ void c_FPPDiscovery::BuildFseqResponse (String fname, c_FileMgr::FileId fseq, St //----------------------------------------------------------------------------- void c_FPPDiscovery::ProcessGET (AsyncWebServerRequest* request) { - DEBUG_START; + // DEBUG_START; printReq(request, false); do // once @@ -692,7 +692,7 @@ void c_FPPDiscovery::ProcessGET (AsyncWebServerRequest* request) } while (false); // do once - DEBUG_END; + // DEBUG_END; } // ProcessGET @@ -884,7 +884,7 @@ void c_FPPDiscovery::GetSysInfoJSON (JsonObject & jsonResponse) void c_FPPDiscovery::GetStatusJSON (JsonObject & JsonData, bool adv) { - DEBUG_START; + // DEBUG_START; JsonObject JsonDataMqtt = JsonData.createNestedObject(F ("MQTT")); JsonDataMqtt[F ("configured")] = false; @@ -898,7 +898,7 @@ void c_FPPDiscovery::GetStatusJSON (JsonObject & JsonData, bool adv) JsonDataCurrentPlaylist[CN_playlist] = ""; JsonDataCurrentPlaylist[CN_type] = ""; - DEBUG_V(); + // DEBUG_V(); JsonData[F ("volume")] = 70; JsonData[F ("media_filename")] = ""; @@ -932,10 +932,10 @@ void c_FPPDiscovery::GetStatusJSON (JsonObject & JsonData, bool adv) } else { - DEBUG_V(); + // DEBUG_V(); if (InputFPPRemotePlayFile) { - DEBUG_V(); + // DEBUG_V(); InputFPPRemotePlayFile->GetStatus (JsonData); } JsonData[CN_status] = 1; @@ -944,16 +944,16 @@ void c_FPPDiscovery::GetStatusJSON (JsonObject & JsonData, bool adv) JsonData[CN_mode] = 8; JsonData[CN_mode_name] = CN_remote; } - DEBUG_V(); + // DEBUG_V(); if (adv) { - DEBUG_V(); + // DEBUG_V(); JsonObject JsonDataAdvancedView = JsonData.createNestedObject (F ("advancedView")); GetSysInfoJSON (JsonDataAdvancedView); - DEBUG_V(); + // DEBUG_V(); } - DEBUG_END; + // DEBUG_END; } //-----------------------------------------------------------------------------