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

Added new button support and Marquee effect #635

Merged
merged 25 commits into from
Jun 5, 2023
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f1e681b
Fixed warnings on float calculation
MartinMueller2003 May 17, 2023
36899ff
Refactoring for clarity
MartinMueller2003 May 17, 2023
4f0ab21
Removed input trigger settings
MartinMueller2003 May 17, 2023
83f6b94
Added ecb_channel selector
MartinMueller2003 May 17, 2023
10e16c7
Adjusted trigger event settings
MartinMueller2003 May 17, 2023
473eeea
Added virtual function to handle button events.
MartinMueller2003 May 17, 2023
3f71dea
Made button processing distributed.
MartinMueller2003 May 17, 2023
0291173
Added stub for button processing
MartinMueller2003 May 17, 2023
6fe9036
Fixed detection FSM
MartinMueller2003 May 18, 2023
548f2bb
Got ECB working
MartinMueller2003 May 18, 2023
15bee93
Made process button actions public.
MartinMueller2003 May 20, 2023
4cf0cf2
Updated for latest API with external Input
MartinMueller2003 May 20, 2023
7393c94
Converted to an event driven API towards the input manager
MartinMueller2003 May 20, 2023
4601dc3
Updated for latest API with external Input
MartinMueller2003 May 20, 2023
4ee0dd9
Merge branch 'main' of https://github.com/MartinMueller2003/ESPixelStick
MartinMueller2003 May 20, 2023
eaf9673
Build a vector list of the files on the SD card.
MartinMueller2003 May 23, 2023
ffc7f6b
Added support for cycleing through fseq files in response to a button…
MartinMueller2003 May 23, 2023
a90cd52
Upgraded to Arduion ESP version 2.0.9
MartinMueller2003 May 23, 2023
66b509f
Moved ECB to a common space since it is shared by input modes.
MartinMueller2003 May 23, 2023
fa19731
Fixed a tooling error.
MartinMueller2003 May 23, 2023
3c7cac1
Removed trigger channel from conifiguration
MartinMueller2003 May 24, 2023
8d2eda7
Added flash min intensity levels
MartinMueller2003 May 25, 2023
86f5aac
Increased the button debounce count
MartinMueller2003 May 25, 2023
5c88d33
Fixed a build warning
MartinMueller2003 May 25, 2023
f409aaf
Added information about additional platform support.
MartinMueller2003 May 25, 2023
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
Prev Previous commit
Next Next commit
Added support for cycleing through fseq files in response to a button…
… press.
  • Loading branch information
MartinMueller2003 committed May 23, 2023
commit ffc7f6b792b29e627a551cffc05913224854c558
105 changes: 101 additions & 4 deletions ESPixelStick/src/input/InputFPPRemote.cpp
Original file line number Diff line number Diff line change
@@ -109,11 +109,87 @@ void c_InputFPPRemote::GetStatus (JsonObject& jsonStatus)

} // GetStatus

//-----------------------------------------------------------------------------
void c_InputFPPRemote::PlayNextFile ()
{
// DEBUG_START;
do // once
{
std::vector<String> ListOfFiles;
FileMgr.GetListOfSdFiles(ListOfFiles);
ListOfFiles.shrink_to_fit();
// DEBUG_V(String("Num Files Found: ") + String(ListOfFiles.size()));

if(0 == ListOfFiles.size())
{
// no files. Dont continue
break;
}

// DEBUG_V(String("File Being Played: '") + FileBeingPlayed + "'");
// find the current file
std::vector<String>::iterator FileIterator = ListOfFiles.end();
std::vector<String>::iterator CurrentFileInList = ListOfFiles.begin();
while (CurrentFileInList != ListOfFiles.end())
{
// DEBUG_V(String("CurrentFileInList: '") + *CurrentFileInList + "'");

if((*CurrentFileInList).equals(FileBeingPlayed))
{
// DEBUG_V("Found File");
FileIterator = ++CurrentFileInList;
break;
}
++CurrentFileInList;
}

// DEBUG_V("now find the next file");
do
{
// did we wrap?
if(ListOfFiles.end() == CurrentFileInList)
{
// DEBUG_V("Handle wrap");
CurrentFileInList = ListOfFiles.begin();
}
// DEBUG_V(String("CurrentFileInList: '") + *CurrentFileInList + "'");

// is this a valid file?
if( (-1 != (*CurrentFileInList).indexOf(".fseq")) && (-1 != (*CurrentFileInList).indexOf(".pl")))
{
// DEBUG_V("try the next file");
// get the next file
++CurrentFileInList;

continue;
}

// DEBUG_V(String("CurrentFileInList: '") + *CurrentFileInList + "'");

// did we come all the way around?
if((*CurrentFileInList).equals(FileBeingPlayed))
{
// DEBUG_V("no other file to play. Keep playing it.");
break;
}

// DEBUG_V(String("Succes - we have found a new file to play: '") + *CurrentFileInList + "'");
StopPlaying();
StartPlaying(*CurrentFileInList);
break;
} while (FileIterator != CurrentFileInList);

} while(false);

// DEBUG_END;

} // PlayNextFile

//-----------------------------------------------------------------------------
void c_InputFPPRemote::Process ()
{
// DEBUG_START;
if (!IsInputChannelActive)
if (!IsInputChannelActive || StayDark)
{
// DEBUG_V ("dont do anything if the channel is not active");
StopPlaying ();
@@ -134,14 +210,35 @@ void c_InputFPPRemote::Process ()
StartPlaying (FileBeingPlayed);
}
}
else
{
}

// DEBUG_END;

} // process

//-----------------------------------------------------------------------------
void c_InputFPPRemote::ProcessButtonActions(c_ExternalInput::InputValue_t value)
{
// DEBUG_START;

if(c_ExternalInput::InputValue_t::longOn == value)
{
// DEBUG_V("flip the dark flag");
StayDark = !StayDark;
// DEBUG_V(String("StayDark: ") + String(StayDark));
}
else if(c_ExternalInput::InputValue_t::shortOn == value)
{
// DEBUG_V("Are we playing a local file?");
PlayNextFile();
}
else if(c_ExternalInput::InputValue_t::off == value)
{
// DEBUG_V("Got input Off notification");
}

// DEBUG_END;
} // ProcessButtonActions

//-----------------------------------------------------------------------------
void c_InputFPPRemote::SetBufferInfo (uint32_t BufferSize)
{
9 changes: 7 additions & 2 deletions ESPixelStick/src/input/InputFPPRemote.h
Original file line number Diff line number Diff line change
@@ -41,13 +41,17 @@ class c_InputFPPRemote : public c_InputCommon
void Process (); ///< Call from loop(), renders Input data
void GetDriverName (String& sDriverName) { sDriverName = "FPP Remote"; } ///< get the name for the instantiated driver
void SetBufferInfo (uint32_t BufferSize);
void ProcessButtonActions(c_ExternalInput::InputValue_t value);

protected:
c_InputFPPRemotePlayItem * pInputFPPRemotePlayItem = nullptr;
String StatusType;
# define No_LocalFileToPlay "..."

c_InputFPPRemotePlayItem * pInputFPPRemotePlayItem = nullptr;
int32_t GetSyncOffsetMS () { return SyncOffsetMS; }

String StatusType;
bool StayDark = false;

private:

void validateConfiguration ();
@@ -57,6 +61,7 @@ class c_InputFPPRemote : public c_InputCommon
void StopPlaying ();
bool PlayingFile ();
bool PlayingRemoteFile ();
void PlayNextFile ();

void load (); ///< Load configuration from File System
void save (); ///< Save configuration to File System