Skip to content

Commit

Permalink
Merge pull request #391 from MartinMueller2003/main
Browse files Browse the repository at this point in the history
Made FPP Remote a secondary input operation to allow E1.31 or DDP to be used at the same time.
  • Loading branch information
forkineye committed Oct 13, 2021
2 parents 9a40e9d + b599bf6 commit 5f9262f
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 7 deletions.
2 changes: 1 addition & 1 deletion ESPixelStick/src/FileMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ void c_FileMgr::GetListOfSdFiles (String & Response)
{
// DEBUG_START;

DynamicJsonDocument ResponseJsonDoc (2048);
DynamicJsonDocument ResponseJsonDoc (3 * 1024);

do // once
{
Expand Down
12 changes: 12 additions & 0 deletions ESPixelStick/src/WebMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,18 @@ void c_WebMgr::init ()
}
);

webServer.on ("/download", HTTP_GET, [](AsyncWebServerRequest* request)
{
// DEBUG_V (String ("url: ") + String (request->url ()));
String filename = request->url ().substring (String ("/download").length ());
// DEBUG_V (String ("filename: ") + String (filename));

AsyncWebServerResponse* response = new AsyncFileResponse (SDFS, filename, "application/octet-stream", true);
request->send (response);

// DEBUG_V ("Send File Done");
});

webServer.onNotFound ([this](AsyncWebServerRequest* request)
{
// DEBUG_V ("onNotFound");
Expand Down
29 changes: 24 additions & 5 deletions ESPixelStick/src/input/InputFPPRemote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,12 @@ void c_InputFPPRemote::GetStatus (JsonObject & jsonStatus)
void c_InputFPPRemote::Process ()
{
// DEBUG_START;

if (PlayingFile ())
if (!IsInputChannelActive)
{
// dont do anything if the channel is not active
StopPlaying ();
}
else if (PlayingFile ())
{
pInputFPPRemotePlayItem->Poll (InputDataBuffer, InputDataBufferSize);

Expand Down Expand Up @@ -161,13 +165,28 @@ bool c_InputFPPRemote::SetConfig (JsonObject & jsonConfig)
void c_InputFPPRemote::StopPlaying ()
{
// DEBUG_START;

if (PlayingFile ())
do // once
{
if (!PlayingFile ())
{
// DEBUG_ ("Not currently playing a file");
break;
}

// DEBUG_ ();

pInputFPPRemotePlayItem->Stop ();

while (!pInputFPPRemotePlayItem->IsIdle ())
{
pInputFPPRemotePlayItem->Poll (InputDataBuffer, InputDataBufferSize);
pInputFPPRemotePlayItem->Stop ();
}

delete pInputFPPRemotePlayItem;
pInputFPPRemotePlayItem = nullptr;
}

} while (false);

// DEBUG_END;

Expand Down
2 changes: 1 addition & 1 deletion ESPixelStick/src/input/InputMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ static const InputTypeXlateMap_t InputTypeXlateMap[c_InputMgr::e_InputType::Inpu
{
{c_InputMgr::e_InputType::InputType_E1_31, "E1.31", c_InputMgr::e_InputChannelIds::InputPrimaryChannelId},
{c_InputMgr::e_InputType::InputType_DDP, "DDP", c_InputMgr::e_InputChannelIds::InputPrimaryChannelId},
{c_InputMgr::e_InputType::InputType_FPP, "FPP Remote", c_InputMgr::e_InputChannelIds::InputPrimaryChannelId},
{c_InputMgr::e_InputType::InputType_FPP, "FPP Remote", c_InputMgr::e_InputChannelIds::InputSecondaryChannelId},
{c_InputMgr::e_InputType::InputType_Artnet, "Artnet", c_InputMgr::e_InputChannelIds::InputPrimaryChannelId},
{c_InputMgr::e_InputType::InputType_Effects, "Effects", c_InputMgr::e_InputChannelIds::InputSecondaryChannelId},
{c_InputMgr::e_InputType::InputType_MQTT, "MQTT", c_InputMgr::e_InputChannelIds::InputSecondaryChannelId},
Expand Down

0 comments on commit 5f9262f

Please sign in to comment.