From c666f136d272143ad63ddf5fcd4f8433ba688132 Mon Sep 17 00:00:00 2001 From: Martin Mueller Date: Mon, 15 Nov 2021 11:21:15 -0500 Subject: [PATCH 1/7] Added ability to enable MISO internal pullup at compile time. Definitions are in the GPIO Defs files. --- ESPixelStick/src/FileMgr.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ESPixelStick/src/FileMgr.cpp b/ESPixelStick/src/FileMgr.cpp index 5a4d90913..690a58660 100644 --- a/ESPixelStick/src/FileMgr.cpp +++ b/ESPixelStick/src/FileMgr.cpp @@ -137,6 +137,10 @@ void c_FileMgr::SetSpiIoPins () SD.end (); } +#ifdef USE_MISO_PULLUP + pinMode (miso_pin, INPUT_PULLUP); // on some hardware MISO is missing required pull-up resistor, use internal pull-up. +#endif // def USE_MISO_PULLUP + #ifdef ARDUINO_ARCH_ESP32 SPI.begin (clk_pin, miso_pin, mosi_pin, cs_pin); if (!SD.begin (cs_pin)) From f0ffb3ed3039b02e73b9517c81c1cbe0f4a2ac59 Mon Sep 17 00:00:00 2001 From: Martin Mueller Date: Mon, 15 Nov 2021 11:22:22 -0500 Subject: [PATCH 2/7] Split GPIO_Defs into platform specific files to keep it from getting too complex --- ESPixelStick/src/GPIO_Defs.hpp | 54 ++++--------------- ESPixelStick/src/GPIO_Defs_ESP32_CAM.hpp | 32 +++++++++++ ESPixelStick/src/GPIO_Defs_ESP32_TTGO_T8.hpp | 35 ++++++++++++ ESPixelStick/src/GPIO_Defs_ESP32_generic.hpp | 41 ++++++++++++++ .../src/GPIO_Defs_ESP8266_Generic.hpp | 28 ++++++++++ 5 files changed, 145 insertions(+), 45 deletions(-) create mode 100644 ESPixelStick/src/GPIO_Defs_ESP32_CAM.hpp create mode 100644 ESPixelStick/src/GPIO_Defs_ESP32_TTGO_T8.hpp create mode 100644 ESPixelStick/src/GPIO_Defs_ESP32_generic.hpp create mode 100644 ESPixelStick/src/GPIO_Defs_ESP8266_Generic.hpp diff --git a/ESPixelStick/src/GPIO_Defs.hpp b/ESPixelStick/src/GPIO_Defs.hpp index 5e40b32bb..62d77f94d 100644 --- a/ESPixelStick/src/GPIO_Defs.hpp +++ b/ESPixelStick/src/GPIO_Defs.hpp @@ -74,51 +74,15 @@ typedef enum // Platform specific GPIO definitions -#if defined(ARDUINO_ARCH_ESP8266) -//Output Manager -#define DEFAULT_UART_1_GPIO gpio_num_t::GPIO_NUM_2 - -// File Manager -#define SD_CARD_MISO_PIN gpio_num_t::GPIO_NUM_12 -#define SD_CARD_MOSI_PIN gpio_num_t::GPIO_NUM_13 -#define SD_CARD_CLK_PIN gpio_num_t::GPIO_NUM_14 -#define SD_CARD_CS_PIN gpio_num_t::GPIO_NUM_15 - -#elif defined(ESP32_CAM) -//Output Manager -#define DEFAULT_UART_1_GPIO gpio_num_t::GPIO_NUM_0 -#define DEFAULT_UART_2_GPIO gpio_num_t::GPIO_NUM_1 -#define DEFAULT_RMT_0_GPIO gpio_num_t::GPIO_NUM_3 -#define DEFAULT_RMT_1_GPIO gpio_num_t::GPIO_NUM_16 -#define LED_GPIO gpio_num_t::GPIO_NUM_4 - -// File Manager -#define SD_CARD_MISO_PIN gpio_num_t::GPIO_NUM_2 -#define SD_CARD_MOSI_PIN gpio_num_t::GPIO_NUM_15 -#define SD_CARD_CLK_PIN gpio_num_t::GPIO_NUM_14 -#define SD_CARD_CS_PIN gpio_num_t::GPIO_NUM_13 +#if defined(ESP32_CAM) +# include "GPIO_Defs_ESP32_CAM.hpp" +#elif defined (ESP32_TTGO_T8) +# include "GPIO_Defs_ESP32_TTG_T8.hpp" +#elif defined(ARDUINO_ARCH_ESP8266) +# include "GPIO_Defs_ESP8266_Generic.hpp" #elif defined(ARDUINO_ARCH_ESP32) -//Output Manager -#define DEFAULT_UART_1_GPIO gpio_num_t::GPIO_NUM_2 -#define DEFAULT_UART_2_GPIO gpio_num_t::GPIO_NUM_13 -#define DEFAULT_RMT_0_GPIO gpio_num_t::GPIO_NUM_12 -#define DEFAULT_RMT_1_GPIO gpio_num_t::GPIO_NUM_14 -#define DEFAULT_RMT_2_GPIO gpio_num_t::GPIO_NUM_32 -#define DEFAULT_RMT_3_GPIO gpio_num_t::GPIO_NUM_33 -// #define DEFAULT_RMT_4_GPIO gpio_num_t::GPIO_NUM_ -// #define DEFAULT_RMT_5_GPIO gpio_num_t::GPIO_NUM_ -// #define DEFAULT_RMT_6_GPIO gpio_num_t::GPIO_NUM_ -// #define DEFAULT_RMT_7_GPIO gpio_num_t::GPIO_NUM_ - -// SPI Output -#define DEFAULT_SPI_DATA_GPIO gpio_num_t::GPIO_NUM_15 -#define DEFAULT_SPI_CLOCK_GPIO gpio_num_t::GPIO_NUM_25 - -// File Manager -#define SD_CARD_MISO_PIN gpio_num_t::GPIO_NUM_19 -#define SD_CARD_MOSI_PIN gpio_num_t::GPIO_NUM_23 -#define SD_CARD_CLK_PIN gpio_num_t::GPIO_NUM_18 -#define SD_CARD_CS_PIN gpio_num_t::GPIO_NUM_4 - +# include "GPIO_Defs_ESP32_generic.hpp" +#else +# error "No valid platform definition" #endif // ndef platform specific GPIO definitions diff --git a/ESPixelStick/src/GPIO_Defs_ESP32_CAM.hpp b/ESPixelStick/src/GPIO_Defs_ESP32_CAM.hpp new file mode 100644 index 000000000..644493e99 --- /dev/null +++ b/ESPixelStick/src/GPIO_Defs_ESP32_CAM.hpp @@ -0,0 +1,32 @@ +#pragma once +/* +* GPIO_Defs_ESP32_CAM.hpp - Output Management class +* +* Project: ESPixelStick - An ESP8266 / ESP32 and E1.31 based pixel driver +* Copyright (c) 2021 Shelby Merrick +* http://www.forkineye.com +* +* This program is provided free for you to use in any way that you wish, +* subject to the laws and regulations where you are using it. Due diligence +* is strongly suggested before using this code. Please give credit where due. +* +* The Author makes no warranty of any kind, express or implied, with regard +* to this program or the documentation contained in this document. The +* Author shall not be liable in any event for incidental or consequential +* damages in connection with, or arising out of, the furnishing, performance +* or use of these programs. +* +*/ + +//Output Manager +#define DEFAULT_UART_1_GPIO gpio_num_t::GPIO_NUM_0 +#define DEFAULT_UART_2_GPIO gpio_num_t::GPIO_NUM_1 +#define DEFAULT_RMT_0_GPIO gpio_num_t::GPIO_NUM_3 +#define DEFAULT_RMT_1_GPIO gpio_num_t::GPIO_NUM_16 +#define LED_GPIO gpio_num_t::GPIO_NUM_4 + +// File Manager +#define SD_CARD_MISO_PIN gpio_num_t::GPIO_NUM_2 +#define SD_CARD_MOSI_PIN gpio_num_t::GPIO_NUM_15 +#define SD_CARD_CLK_PIN gpio_num_t::GPIO_NUM_14 +#define SD_CARD_CS_PIN gpio_num_t::GPIO_NUM_13 diff --git a/ESPixelStick/src/GPIO_Defs_ESP32_TTGO_T8.hpp b/ESPixelStick/src/GPIO_Defs_ESP32_TTGO_T8.hpp new file mode 100644 index 000000000..15dc46743 --- /dev/null +++ b/ESPixelStick/src/GPIO_Defs_ESP32_TTGO_T8.hpp @@ -0,0 +1,35 @@ +#pragma once +/* +* GPIO_Defs_ESP32_TTGO_T8.hpp - Output Management class +* +* Project: ESPixelStick - An ESP8266 / ESP32 and E1.31 based pixel driver +* Copyright (c) 2021 Shelby Merrick +* http://www.forkineye.com +* +* This program is provided free for you to use in any way that you wish, +* subject to the laws and regulations where you are using it. Due diligence +* is strongly suggested before using this code. Please give credit where due. +* +* The Author makes no warranty of any kind, express or implied, with regard +* to this program or the documentation contained in this document. The +* Author shall not be liable in any event for incidental or consequential +* damages in connection with, or arising out of, the furnishing, performance +* or use of these programs. +* +*/ + +//Output Manager +#define DEFAULT_UART_1_GPIO gpio_num_t::GPIO_NUM_0 +#define DEFAULT_UART_2_GPIO gpio_num_t::GPIO_NUM_4 +#define DEFAULT_RMT_0_GPIO gpio_num_t::GPIO_NUM_25 +#define DEFAULT_RMT_1_GPIO gpio_num_t::GPIO_NUM_26 +#define DEFAULT_RMT_2_GPIO gpio_num_t::GPIO_NUM_27 +#define DEFAULT_RMT_3_GPIO gpio_num_t::GPIO_NUM_14 +#define LED_SDA gpio_num_t::GPIO_NUM_21 // Green LED and SDA. Will light-up if PCA9865 is used. + +// File Manager +#define SD_CARD_MISO_PIN gpio_num_t::GPIO_NUM_2 +#define SD_CARD_MOSI_PIN gpio_num_t::GPIO_NUM_15 +#define SD_CARD_CLK_PIN gpio_num_t::GPIO_NUM_14 +#define SD_CARD_CS_PIN gpio_num_t::GPIO_NUM_13 +#define USE_MISO_PULLUP diff --git a/ESPixelStick/src/GPIO_Defs_ESP32_generic.hpp b/ESPixelStick/src/GPIO_Defs_ESP32_generic.hpp new file mode 100644 index 000000000..4139ed8ce --- /dev/null +++ b/ESPixelStick/src/GPIO_Defs_ESP32_generic.hpp @@ -0,0 +1,41 @@ +#pragma once +/* +* GPIO_Defs_ESP32_generic.hpp - Output Management class +* +* Project: ESPixelStick - An ESP8266 / ESP32 and E1.31 based pixel driver +* Copyright (c) 2021 Shelby Merrick +* http://www.forkineye.com +* +* This program is provided free for you to use in any way that you wish, +* subject to the laws and regulations where you are using it. Due diligence +* is strongly suggested before using this code. Please give credit where due. +* +* The Author makes no warranty of any kind, express or implied, with regard +* to this program or the documentation contained in this document. The +* Author shall not be liable in any event for incidental or consequential +* damages in connection with, or arising out of, the furnishing, performance +* or use of these programs. +* +*/ + +//Output Manager +#define DEFAULT_UART_1_GPIO gpio_num_t::GPIO_NUM_2 +#define DEFAULT_UART_2_GPIO gpio_num_t::GPIO_NUM_13 +#define DEFAULT_RMT_0_GPIO gpio_num_t::GPIO_NUM_12 +#define DEFAULT_RMT_1_GPIO gpio_num_t::GPIO_NUM_14 +#define DEFAULT_RMT_2_GPIO gpio_num_t::GPIO_NUM_32 +#define DEFAULT_RMT_3_GPIO gpio_num_t::GPIO_NUM_33 +// #define DEFAULT_RMT_4_GPIO gpio_num_t::GPIO_NUM_ +// #define DEFAULT_RMT_5_GPIO gpio_num_t::GPIO_NUM_ +// #define DEFAULT_RMT_6_GPIO gpio_num_t::GPIO_NUM_ +// #define DEFAULT_RMT_7_GPIO gpio_num_t::GPIO_NUM_ + +// SPI Output +#define DEFAULT_SPI_DATA_GPIO gpio_num_t::GPIO_NUM_15 +#define DEFAULT_SPI_CLOCK_GPIO gpio_num_t::GPIO_NUM_25 + +// File Manager +#define SD_CARD_MISO_PIN gpio_num_t::GPIO_NUM_19 +#define SD_CARD_MOSI_PIN gpio_num_t::GPIO_NUM_23 +#define SD_CARD_CLK_PIN gpio_num_t::GPIO_NUM_18 +#define SD_CARD_CS_PIN gpio_num_t::GPIO_NUM_4 diff --git a/ESPixelStick/src/GPIO_Defs_ESP8266_Generic.hpp b/ESPixelStick/src/GPIO_Defs_ESP8266_Generic.hpp new file mode 100644 index 000000000..dff468d4b --- /dev/null +++ b/ESPixelStick/src/GPIO_Defs_ESP8266_Generic.hpp @@ -0,0 +1,28 @@ +#pragma once +/* +* GPIO_Defs_ESP8266_Generic.hpp - Output Management class +* +* Project: ESPixelStick - An ESP8266 / ESP32 and E1.31 based pixel driver +* Copyright (c) 2021 Shelby Merrick +* http://www.forkineye.com +* +* This program is provided free for you to use in any way that you wish, +* subject to the laws and regulations where you are using it. Due diligence +* is strongly suggested before using this code. Please give credit where due. +* +* The Author makes no warranty of any kind, express or implied, with regard +* to this program or the documentation contained in this document. The +* Author shall not be liable in any event for incidental or consequential +* damages in connection with, or arising out of, the furnishing, performance +* or use of these programs. +* +*/ + +//Output Manager +#define DEFAULT_UART_1_GPIO gpio_num_t::GPIO_NUM_2 + +// File Manager +#define SD_CARD_MISO_PIN gpio_num_t::GPIO_NUM_12 +#define SD_CARD_MOSI_PIN gpio_num_t::GPIO_NUM_13 +#define SD_CARD_CLK_PIN gpio_num_t::GPIO_NUM_14 +#define SD_CARD_CS_PIN gpio_num_t::GPIO_NUM_15 From dbd89725716ad5edf716b7f7e9b024bb7c64da8c Mon Sep 17 00:00:00 2001 From: Martin Mueller Date: Mon, 15 Nov 2021 11:22:44 -0500 Subject: [PATCH 3/7] Added support for the TTGO platform --- platformio.ini | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/platformio.ini b/platformio.ini index a2e430868..10af80d6d 100644 --- a/platformio.ini +++ b/platformio.ini @@ -121,6 +121,15 @@ monitor_dtr = 0 build_flags = -DESP32_CAM +; ESP32 TTGO-T8 V1.x +[env:esp32_ttgo_t8] +extends = esp32git ; use until 2.0.0 core makes it into PlatformIO +board = wemos_d1_mini32 ; use until platformio adds TTGO-T8 +monitor_rts = 0 +monitor_dtr = 0 +build_flags = + -DESP32_TTGO_T8 + ; Generic Wemos D1 Mini 32 [env:d1_mini32] extends = esp32git ; use until 2.0.0 core makes it into PlatformIO From fd9ca97cd63079d5ff9d397a21985dc2f1a22507 Mon Sep 17 00:00:00 2001 From: Martin Mueller Date: Mon, 15 Nov 2021 15:23:48 -0500 Subject: [PATCH 4/7] Moved location of the pullup setup. SPI lib removes the setting. --- ESPixelStick/src/FileMgr.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ESPixelStick/src/FileMgr.cpp b/ESPixelStick/src/FileMgr.cpp index 690a58660..ce695f966 100644 --- a/ESPixelStick/src/FileMgr.cpp +++ b/ESPixelStick/src/FileMgr.cpp @@ -137,12 +137,12 @@ void c_FileMgr::SetSpiIoPins () SD.end (); } -#ifdef USE_MISO_PULLUP - pinMode (miso_pin, INPUT_PULLUP); // on some hardware MISO is missing required pull-up resistor, use internal pull-up. -#endif // def USE_MISO_PULLUP #ifdef ARDUINO_ARCH_ESP32 SPI.begin (clk_pin, miso_pin, mosi_pin, cs_pin); +#ifdef USE_MISO_PULLUP + pinMode (miso_pin, INPUT_PULLUP); // on some hardware MISO is missing required pull-up resistor, use internal pull-up. +#endif // def USE_MISO_PULLUP if (!SD.begin (cs_pin)) #else if (!SD.begin (SD_CARD_CS_PIN, SD_CARD_CLK_MHZ)) From 2115efc134a48646b55b844797d57e9a7ec06481 Mon Sep 17 00:00:00 2001 From: Martin Mueller Date: Tue, 16 Nov 2021 08:20:21 -0500 Subject: [PATCH 5/7] Fixed issue that increments time elapsed when no file is playing. --- ESPixelStick/src/input/InputFPPRemotePlayFileFsm.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ESPixelStick/src/input/InputFPPRemotePlayFileFsm.cpp b/ESPixelStick/src/input/InputFPPRemotePlayFileFsm.cpp index ad3ecce8a..d047aa055 100644 --- a/ESPixelStick/src/input/InputFPPRemotePlayFileFsm.cpp +++ b/ESPixelStick/src/input/InputFPPRemotePlayFileFsm.cpp @@ -35,7 +35,8 @@ void fsm_PlayFile_state_Idle::Poll () //----------------------------------------------------------------------------- IRAM_ATTR void fsm_PlayFile_state_Idle::TimerPoll () { - // nothing to do + p_Parent->FrameControl.ElapsedPlayTimeMS = 0; + p_Parent->FrameControl.TotalNumberOfFramesInSequence = 0; } // fsm_PlayFile_state_Idle::TimerPoll From 9b5bf8617e2977d96113787a1c463c0e42453914 Mon Sep 17 00:00:00 2001 From: Martin Mueller Date: Wed, 17 Nov 2021 11:00:16 -0500 Subject: [PATCH 6/7] Added check to see if SD card is installed before trying to play a file. --- ESPixelStick/src/input/InputFPPRemotePlayFile.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ESPixelStick/src/input/InputFPPRemotePlayFile.cpp b/ESPixelStick/src/input/InputFPPRemotePlayFile.cpp index 1ded8da57..a8e6a3801 100644 --- a/ESPixelStick/src/input/InputFPPRemotePlayFile.cpp +++ b/ESPixelStick/src/input/InputFPPRemotePlayFile.cpp @@ -60,8 +60,15 @@ c_InputFPPRemotePlayFile::~c_InputFPPRemotePlayFile () void c_InputFPPRemotePlayFile::Start (String & FileName, float SecondsElapsed, uint32_t PlayCount) { // DEBUG_START; - - pCurrentFsmState->Start (FileName, SecondsElapsed, PlayCount); + if (FileMgr.SdCardIsInstalled ()) + { + pCurrentFsmState->Start (FileName, SecondsElapsed, PlayCount); + } + else + { + DEBUG_V ("No SD Card installed. Ignore Start request"); + fsm_PlayFile_state_Idle_imp.Init (this); + } // DEBUG_END; } // Start From 98b0068be1b25ef7f2933cc9bdae155aa0471e80 Mon Sep 17 00:00:00 2001 From: Martin Mueller Date: Wed, 17 Nov 2021 11:01:31 -0500 Subject: [PATCH 7/7] Added an error state to handle missing or broken file issues. Resolves streaming error messages and WDT timeout do to console port busy. --- .../src/input/InputFPPRemotePlayFile.hpp | 2 + .../src/input/InputFPPRemotePlayFileFsm.cpp | 78 ++++++++++++++++++- .../src/input/InputFPPRemotePlayFileFsm.hpp | 16 ++++ 3 files changed, 94 insertions(+), 2 deletions(-) diff --git a/ESPixelStick/src/input/InputFPPRemotePlayFile.hpp b/ESPixelStick/src/input/InputFPPRemotePlayFile.hpp index 4d7d93c4e..0cf604b25 100644 --- a/ESPixelStick/src/input/InputFPPRemotePlayFile.hpp +++ b/ESPixelStick/src/input/InputFPPRemotePlayFile.hpp @@ -49,12 +49,14 @@ class c_InputFPPRemotePlayFile : public c_InputFPPRemotePlayItem friend class fsm_PlayFile_state_Starting; friend class fsm_PlayFile_state_PlayingFile; friend class fsm_PlayFile_state_Stopping; + friend class fsm_PlayFile_state_Error; friend class fsm_PlayFile_state; fsm_PlayFile_state_Idle fsm_PlayFile_state_Idle_imp; fsm_PlayFile_state_Starting fsm_PlayFile_state_Starting_imp; fsm_PlayFile_state_PlayingFile fsm_PlayFile_state_PlayingFile_imp; fsm_PlayFile_state_Stopping fsm_PlayFile_state_Stopping_imp; + fsm_PlayFile_state_Error fsm_PlayFile_state_Error_imp; fsm_PlayFile_state * pCurrentFsmState = &fsm_PlayFile_state_Idle_imp; diff --git a/ESPixelStick/src/input/InputFPPRemotePlayFileFsm.cpp b/ESPixelStick/src/input/InputFPPRemotePlayFileFsm.cpp index d047aa055..c99e2e938 100644 --- a/ESPixelStick/src/input/InputFPPRemotePlayFileFsm.cpp +++ b/ESPixelStick/src/input/InputFPPRemotePlayFileFsm.cpp @@ -66,7 +66,7 @@ void fsm_PlayFile_state_Idle::Start (String& FileName, float ElapsedSeconds, uin p_Parent->RemainingPlayCount = RemainingPlayCount; // DEBUG_V (String (" FileName: ") + p_Parent->PlayItemName); - // DEBUG_V (String (" StartingFrameId: ") + p_Parent->FrameControl.StartingFrameId); + // DEBUG_V (String (" ElapsedPlayTimeMS: ") + p_Parent->FrameControl.ElapsedPlayTimeMS); // DEBUG_V (String (" RemainingPlayCount: ") + p_Parent->RemainingPlayCount); p_Parent->fsm_PlayFile_state_Starting_imp.Init (p_Parent); @@ -315,9 +315,10 @@ void fsm_PlayFile_state_PlayingFile::Init (c_InputFPPRemotePlayFile* Parent) --p_Parent->RemainingPlayCount; // DEBUG_V (String ("RemainingPlayCount: ") + p_Parent->RemainingPlayCount); + if (!p_Parent->ParseFseqFile ()) { - p_Parent->fsm_PlayFile_state_Stopping_imp.Init (p_Parent); + p_Parent->fsm_PlayFile_state_Error_imp.Init (p_Parent); break; } @@ -515,3 +516,76 @@ bool fsm_PlayFile_state_Stopping::Sync (String&, float) return false; } // fsm_PlayFile_state_Stopping::Sync + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void fsm_PlayFile_state_Error::Poll () +{ + // xDEBUG_START; + + // xDEBUG_END; + +} // fsm_PlayFile_state_Error::Poll + +//----------------------------------------------------------------------------- +IRAM_ATTR void fsm_PlayFile_state_Error::TimerPoll () +{ + // xDEBUG_START; + // nothing to do + // xDEBUG_END; + +} // fsm_PlayFile_state_Error::TimerPoll + +//----------------------------------------------------------------------------- +void fsm_PlayFile_state_Error::Init (c_InputFPPRemotePlayFile* Parent) +{ + // DEBUG_START; + + p_Parent = Parent; + Parent->pCurrentFsmState = &(Parent->fsm_PlayFile_state_Error_imp); + + // DEBUG_END; + +} // fsm_PlayFile_state_Error::Init + +//----------------------------------------------------------------------------- +void fsm_PlayFile_state_Error::Start (String& FileName, float ElapsedSeconds, uint32_t PlayCount) +{ + // DEBUG_START; + + if (FileName != p_Parent->GetFileName ()) + { + p_Parent->fsm_PlayFile_state_Idle_imp.Start (FileName, ElapsedSeconds, PlayCount); + } + + // DEBUG_END + +} // fsm_PlayFile_state_Error::Start + +//----------------------------------------------------------------------------- +void fsm_PlayFile_state_Error::Stop (void) +{ + // DEBUG_START; + + p_Parent->fsm_PlayFile_state_Idle_imp.Init (p_Parent); + + // DEBUG_END; + +} // fsm_PlayFile_state_Error::Stop + +//----------------------------------------------------------------------------- +bool fsm_PlayFile_state_Error::Sync (String& FileName, float ElapsedSeconds) +{ + // DEBUG_START; + + if (FileName != p_Parent->GetFileName ()) + { + p_Parent->fsm_PlayFile_state_Idle_imp.Start (FileName, ElapsedSeconds, 1); + } + + // DEBUG_END; + return false; + +} // fsm_PlayFile_state_Error::Sync diff --git a/ESPixelStick/src/input/InputFPPRemotePlayFileFsm.hpp b/ESPixelStick/src/input/InputFPPRemotePlayFileFsm.hpp index 2ff5764f4..8404c5215 100644 --- a/ESPixelStick/src/input/InputFPPRemotePlayFileFsm.hpp +++ b/ESPixelStick/src/input/InputFPPRemotePlayFileFsm.hpp @@ -115,3 +115,19 @@ class fsm_PlayFile_state_Stopping : public fsm_PlayFile_state uint32_t PlayCount = 0; }; // fsm_PlayFile_state_Stopping + +/*****************************************************************************/ +class fsm_PlayFile_state_Error : public fsm_PlayFile_state +{ +public: + virtual void 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); + virtual void Stop (void); + virtual bool Sync (String& FileName, float SecondsElapsed); + virtual IRAM_ATTR void TimerPoll (); + +private: + +}; // fsm_PlayFile_state_Error