Skip to content

Commit

Permalink
Merge pull request #821 from MartinMueller2003/main
Browse files Browse the repository at this point in the history
Fixed crash when uploading via FPP Connect and FPP Remote mode is enabled. Updates for Arduino 7.3.0
  • Loading branch information
forkineye authored Jan 8, 2025
2 parents 26550c0 + 59cea1d commit 740b1f8
Show file tree
Hide file tree
Showing 63 changed files with 1,207 additions and 1,278 deletions.
10 changes: 3 additions & 7 deletions html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@
</tr>
<tr class>
<td width="50%">Last Error: </td>
<td><span id="fppremotelasterror"></span></td>
<td><span id="fppremoteFilePlayerlasterror"></span></td>
</tr>
</table>
</fieldset>
Expand All @@ -279,7 +279,7 @@
</tr>
<tr class>
<td width="50%">Last Error: </td>
<td><span id="fppremotelasterror"></span></td>
<td><span id="xfppremotelasterror"></span></td>
</tr>
</table>
</fieldset>
Expand All @@ -302,7 +302,7 @@
</tr>
<tr class>
<td width="50%">Last Error: </td>
<td><span id="fppremotelasterror"></span></td>
<td><span id="localFilePlayerlasterror"></span></td>
</tr>
</table>
</fieldset>
Expand Down Expand Up @@ -330,10 +330,6 @@
<td width="50%">Time Remaining: </td>
<td><span id="PausedTimeRemaining"></span></td>
</tr>
<tr class>
<td width="50%">Last Error: </td>
<td><span id="fppremotelasterror"></span></td>
</tr>
</table>
</fieldset>
</div>
Expand Down
3 changes: 2 additions & 1 deletion html/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -2213,7 +2213,7 @@ function ProcessReceivedJsonStatusMessage(JsonStat) {
$('#fppremoteFilePlayerFilename').text(FPPDstatus.current_sequence);
$('#fppremoteFilePlayerTimeElapsed').text(FPPDstatus.time_elapsed);
$('#fppremoteFilePlayerTimeRemaining').text(FPPDstatus.time_remaining);
$('#fppremotelasterror').text(FPPDstatus.errors);
$('#fppremoteFilePlayerlasterror').text(FPPDstatus.errors);
}
else {
$('#FPPRemoteStatus').addClass("hidden")
Expand All @@ -2226,6 +2226,7 @@ function ProcessReceivedJsonStatusMessage(JsonStat) {
$('#localFilePlayerFilename').text(FilePlayerStatus.current_sequence);
$('#localFilePlayerTimeElapsed').text(FilePlayerStatus.time_elapsed);
$('#localFilePlayerTimeRemaining').text(FilePlayerStatus.time_remaining);
$('#localFilePlayerlasterror').text(FilePlayerStatus.errors);
}
else {
$('#LocalFilePlayerStatus').addClass("hidden");
Expand Down
1 change: 1 addition & 0 deletions include/ConstNames.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ extern const CN_PROGMEM char CN_Effect [];
extern const CN_PROGMEM char CN_effects [];
extern const CN_PROGMEM char CN_en [];
extern const CN_PROGMEM char CN_enabled [];
extern const CN_PROGMEM char CN_entry [];
extern const CN_PROGMEM char CN_errors [];
extern const CN_PROGMEM char CN_ESP32 [];
extern const CN_PROGMEM char CN_ESP8266 [];
Expand Down
10 changes: 6 additions & 4 deletions include/ESPixelStick.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ bool setFromJSON (T& OutValue, JsonObject & Json, N Name)
{
bool HasBeenModified = false;

if (Json[Name].template is<T>())
if (Json[(char*)Name].template is<T>())
{
T temp = Json[Name];
T temp = Json[(char*)Name];
if (temp != OutValue)
{
OutValue = temp;
Expand All @@ -115,9 +115,9 @@ bool setFromJSON (T& OutValue, JsonVariant & Json, N Name)
{
bool HasBeenModified = false;

if (Json[Name].template is<T>())
if (Json[(char*)Name].template is<T>())
{
T temp = Json[Name];
T temp = Json[(char*)Name];
if (temp != OutValue)
{
OutValue = temp;
Expand All @@ -133,6 +133,8 @@ bool setFromJSON (T& OutValue, JsonVariant & Json, N Name)
return HasBeenModified;
};

#define JsonWrite(j, n, v) (j)[(char*)(n)] = (v)

#define logcon(msg) \
{ \
String DN; \
Expand Down
2 changes: 1 addition & 1 deletion include/input/InputAlexa.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class c_InputAlexa : public c_InputCommon
bool SetConfig (JsonObject& jsonConfig); ///< Set a new config in the driver
void GetConfig (JsonObject& jsonConfig); ///< Get the current config used by the driver
void GetStatus (JsonObject& jsonStatus);
void Process (bool StayDark);
void Process ();
void GetDriverName (String& sDriverName) { sDriverName = "Alexa"; } ///< get the name for the instantiated driver
void SetBufferInfo (uint32_t BufferSize);

Expand Down
4 changes: 2 additions & 2 deletions include/input/InputArtnet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* ArtnetInput.h - Code to wrap ESPAsyncArtnet for input
*
* Project: ESPixelStick - An ESP8266 / ESP32 and Artnet based pixel driver
* Copyright (c) 2021, 2022 Shelby Merrick
* Copyright (c) 2021, 2025 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 @@ -79,6 +79,6 @@ class c_InputArtnet : public c_InputCommon
void SetBufferInfo (uint32_t BufferSize);
void NetworkStateChanged (bool IsConnected); // used by poorly designed rx functions
bool isShutDownRebootNeeded () { return HasBeenInitialized; }
virtual void Process (bool StayDark) {} ///< Call from loop(), renders Input data
virtual void Process () {} ///< Call from loop(), renders Input data

};
6 changes: 3 additions & 3 deletions include/input/InputCommon.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* InputCommon.hpp - Input base class
*
* Project: ESPixelStick - An ESP8266 / ESP32 and E1.31 based pixel driver
* Copyright (c) 2021, 2022 Shelby Merrick
* Copyright (c) 2021, 2025 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 @@ -36,7 +36,7 @@ class c_InputCommon
virtual bool SetConfig (ArduinoJson::JsonObject & jsonConfig) = 0; ///< Set a new config in the driver
virtual void GetConfig (ArduinoJson::JsonObject & jsonConfig) = 0; ///< Get the current config used by the driver
virtual void GetStatus (JsonObject & jsonStatus) = 0;
virtual void Process (bool StayDark) = 0; ///< Call from loop(), renders Input data
virtual void Process (void) = 0; ///< Call from loop(), renders Input data
virtual void GetDriverName (String & sDriverName) = 0; ///< get the name for the instantiated driver
virtual void SetBufferInfo (uint32_t BufferSize) = 0;
virtual void SetOperationalState (bool ActiveFlag) { IsInputChannelActive = ActiveFlag; }
Expand All @@ -49,7 +49,7 @@ class c_InputCommon

protected:
bool HasBeenInitialized = false;
uint32_t InputDataBufferSize = 0;
uint32_t InputDataBufferSize = 0;
bool IsInputChannelActive = true;
c_InputMgr::e_InputChannelIds InputChannelId = c_InputMgr::e_InputChannelIds::InputChannelId_ALL;
c_InputMgr::e_InputType ChannelType = c_InputMgr::e_InputType::InputType_Disabled;
Expand Down
2 changes: 1 addition & 1 deletion include/input/InputDDP.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class c_InputDDP : public c_InputCommon
bool SetConfig (JsonObject& jsonConfig); ///< Set a new config in the driver
void GetConfig (JsonObject& jsonConfig); ///< Get the current config used by the driver
void GetStatus (JsonObject& jsonStatus);
void Process (bool StayDark); ///< Call from loop(), renders Input data
void Process (); ///< Call from loop(), renders Input data
void GetDriverName (String& sDriverName) { sDriverName = "DDP"; } ///< get the name for the instantiated driver
void SetBufferInfo (uint32_t BufferSize);
bool isShutDownRebootNeeded () { return HasBeenInitialized; }
Expand Down
2 changes: 1 addition & 1 deletion include/input/InputDisabled.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class c_InputDisabled : public c_InputCommon
bool SetConfig (JsonObject & jsonConfig); ///< Set a new config in the driver
void GetConfig (JsonObject & jsonConfig); ///< Get the current config used by the driver
void GetStatus (JsonObject & jsonStatus);
void Process (bool StayDark);
void Process ();
void GetDriverName (String& sDriverName) { sDriverName = "Disabled"; } ///< get the name for the instantiated driver
void SetBufferInfo (uint32_t BufferSize) {}

Expand Down
2 changes: 1 addition & 1 deletion include/input/InputE131.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class c_InputE131 : public c_InputCommon
bool SetConfig (JsonObject & jsonConfig); ///< Set a new config in the driver
void GetConfig (JsonObject & jsonConfig); ///< Get the current config used by the driver
void GetStatus (JsonObject & jsonStatus);
void Process (bool StayDark);
void Process ();
void GetDriverName (String & sDriverName) { sDriverName = "E1.31"; } ///< get the name for the instantiated driver
void SetBufferInfo (uint32_t BufferSize);
void NetworkStateChanged (bool IsConnected); // used by poorly designed rx functions
Expand Down
2 changes: 1 addition & 1 deletion include/input/InputEffectEngine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class c_InputEffectEngine : public c_InputCommon
void GetMqttConfig (MQTTConfiguration_s& mqttConfig); ///< Get the current config used by the driver
void GetMqttEffectList (JsonObject& jsonConfig); ///< Get the current config used by the driver
void GetStatus (JsonObject& jsonStatus);
void Process (bool StayDark);
void Process ();
void Poll (); ///< Call from loop(), renders Input data
void GetDriverName (String & sDriverName) { sDriverName = "Effects"; } ///< get the name for the instantiated driver
void SetBufferInfo (uint32_t BufferSize);
Expand Down
9 changes: 3 additions & 6 deletions include/input/InputFPPRemote.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,20 @@ class c_InputFPPRemote : public c_InputCommon
bool SetConfig (JsonObject& jsonConfig); ///< Set a new config in the driver
void GetConfig (JsonObject& jsonConfig); ///< Get the current config used by the driver
void GetStatus (JsonObject& jsonStatus);
void Process (bool StayDark);
void TaskProcess (); ///< Call from loop(), renders Input data
void Process ();
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);
void SetOperationalState (bool ActiveFlag);

protected:
# define No_LocalFileToPlay "..."
# define FPP_REMOTE_TASK_PRIORITY 5

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

String StatusType;
bool StayDark = false;
bool Disabled = false;

private:

Expand Down
2 changes: 1 addition & 1 deletion include/input/InputFPPRemotePlayEffect.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 bool Poll (bool StayDark);
virtual bool Poll ();
virtual void GetStatus (JsonObject & jsonStatus);
virtual bool IsIdle () { return (pCurrentFsmState == &fsm_PlayEffect_state_Idle_imp); }

Expand Down
6 changes: 3 additions & 3 deletions include/input/InputFPPRemotePlayEffectFsm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class fsm_PlayEffect_state
fsm_PlayEffect_state() {}
virtual ~fsm_PlayEffect_state() {}

virtual bool Poll (bool StayDark) = 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;
Expand All @@ -56,7 +56,7 @@ class fsm_PlayEffect_state_Idle : public fsm_PlayEffect_state
fsm_PlayEffect_state_Idle() {}
virtual ~fsm_PlayEffect_state_Idle() {}

virtual bool Poll (bool StayDark);
virtual bool Poll ();
virtual void Init (c_InputFPPRemotePlayEffect* Parent);
virtual void GetStateName (String & sName) { sName = CN_Idle; }
virtual void Start (String & FileName, float SecondsElapsed);
Expand All @@ -73,7 +73,7 @@ class fsm_PlayEffect_state_PlayingEffect : public fsm_PlayEffect_state
fsm_PlayEffect_state_PlayingEffect() {}
virtual ~fsm_PlayEffect_state_PlayingEffect() {}

virtual bool Poll (bool StayDark);
virtual bool Poll ();
virtual void Init (c_InputFPPRemotePlayEffect* Parent);
virtual void GetStateName (String & sName) { sName = CN_Effect; }
virtual void Start (String & FileName, float SecondsElapsed);
Expand Down
30 changes: 3 additions & 27 deletions include/input/InputFPPRemotePlayFile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,11 @@
#include "InputFPPRemotePlayItem.hpp"
#include "InputFPPRemotePlayFileFsm.hpp"
#include "service/fseq.h"
#include <Ticker.h>

#ifdef ARDUINO_ARCH_ESP32
#include <esp_task.h>
#endif // def ARDUINO_ARCH_ESP32


class c_InputFPPRemotePlayFile : public c_InputFPPRemotePlayItem
{
public:
Expand All @@ -39,11 +37,10 @@ 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 bool Poll (bool StayDark);
virtual bool Poll ();
virtual void GetStatus (JsonObject & jsonStatus);
virtual bool IsIdle () { return (pCurrentFsmState == &fsm_PlayFile_state_Idle_imp); }

void TimerPoll ();
#ifdef ARDUINO_ARCH_ESP32
TaskHandle_t GetTaskHandle () { return TimerPollTaskHandle; }
volatile bool TimerPollInProgress = false;
Expand All @@ -52,7 +49,7 @@ class c_InputFPPRemotePlayFile : public c_InputFPPRemotePlayItem
private:
#define ELAPSED_PLAY_TIMER_INTERVAL_MS 10

void ClearFileInfo ();
void ClearFileInfo ();

friend class fsm_PlayFile_state_Idle;
friend class fsm_PlayFile_state_Starting;
Expand All @@ -69,43 +66,22 @@ class c_InputFPPRemotePlayFile : public c_InputFPPRemotePlayItem

fsm_PlayFile_state * pCurrentFsmState = &fsm_PlayFile_state_Idle_imp;

c_FileMgr::FileId FileHandleForFileBeingPlayed = c_FileMgr::INVALID_FILE_HANDLE;

struct FrameControl_t
{
uint32_t DataOffset = 0;
uint32_t ChannelsPerFrame = 0;
uint32_t FrameStepTimeMS = 1;
uint32_t TotalNumberOfFramesInSequence = 0;
uint32_t ElapsedPlayTimeMS = 0;

} FrameControl;

struct SyncControl_t
{
uint32_t SyncCount = 0;
uint32_t SyncAdjustmentCount = 0;
float LastRcvdElapsedSeconds = 0.0;
} SyncControl;

# define FPP_TICKER_PERIOD_MS 25
// # define FPP_TICKER_PERIOD_MS 1000
Ticker MsTicker;
uint32_t LastIsrTimeStampMS = 0;
uint32_t PlayedFileCount = 0;

// Logic to detect if polls have stopped coming in.
// This is part of the blanking logic.
int PollDetectionCounter = 0;
static const int PollDetectionCounterLimit = 5;

#define MAX_NUM_SPARSE_RANGES 5
FSEQParsedRangeEntry SparseRanges[MAX_NUM_SPARSE_RANGES];

void UpdateElapsedPlayTimeMS ();
uint32_t CalculateFrameId (uint32_t ElapsedMS, int32_t SyncOffsetMS);
bool ParseFseqFile ();
uint32_t ReadFile(uint32_t DestinationIntensityId, uint32_t NumBytesToRead, uint32_t FileOffset);
uint32_t ReadFile(uint32_t DestinationIntensityId, uint32_t NumBytesToRead, uint32_t FileOffset);

String LastFailedPlayStatusMsg;

Expand Down
Loading

0 comments on commit 740b1f8

Please sign in to comment.