Skip to content

Commit

Permalink
Merge pull request #818 from MartinMueller2003/main
Browse files Browse the repository at this point in the history
Fixed collision between primary and secondary inputs.
  • Loading branch information
forkineye authored Dec 30, 2024
2 parents 441931e + acf1ea2 commit 26550c0
Show file tree
Hide file tree
Showing 37 changed files with 392 additions and 154 deletions.
26 changes: 23 additions & 3 deletions html/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,19 +230,39 @@ $(function () {
}

function completeHandler(event) {
console.info("Transfer Complete");
// console.info("event: '" + event + "'");
// console.info("event.target.response: '" + event.target.response + "'");
// console.info("event.target.responseText: '" + event.target.responseText + "'");
// console.info("event.target.status : '" + event.target.status + "'");
// console.info("event.target.statusText : '" + event.target.statusText + "'");

// _("status").innerHTML = event.target.responseText;
_("EfuProgressBar").value = 0; //will clear progress bar after successful upload
showReboot();
$("#EfuProgressBar").addClass("hidden");

if(event.target.status === 200)
{
alert("Firmware Upload SUCCESS!");
showReboot();
}
else
{
alert("Firmware Upload FAILED!\n" + event.target.response);
showReboot();
}
}

function errorHandler(event) {
console.error("Transfer Error");
// _("status").innerHTML = "Upload Failed";
$("#EfuProgressBar").addClass("hidden");
alert("Firmware Upload FAILED!");
}

function abortHandler(event) {
console.error("Transfer Abort");
// _("status").innerHTML = "Upload Aborted";
$("#EfuProgressBar").addClass("hidden");
alert("Firmware Upload FAILED!");
}
});
}));
Expand Down
22 changes: 14 additions & 8 deletions include/EFUpdate.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* EFUpdate.h
*
* Project: ESPixelStick - An ESP8266 / ESP32 and E1.31 based pixel driver
* Copyright (c) 2016, 2022 Shelby Merrick
* Copyright (c) 2016, 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 @@ -34,9 +34,10 @@ class EFUpdate {
void begin();
bool process(uint8_t *data, uint32_t len);
bool hasError();
uint8_t getError();
uint8_t getError(String & msg);
bool end();
void GetDriverName(String & name) {name = String(F("EFUPD"));}
void GetDriverName(String & name) {name = String(F("EFUPD"));}
bool UpdateIsInProgress() {return _state != State::IDLE;}

private:
/* Record types */
Expand All @@ -52,7 +53,8 @@ class EFUpdate {
HEADER,
RECORD,
DATA,
FAIL
FAIL,
IDLE
};

/* EFU Header */
Expand All @@ -75,12 +77,16 @@ class EFUpdate {
uint8_t raw[6];
} efurecord_t;

State _state = State::FAIL;
uint32_t _loc = 0;
State _state = State::IDLE;
uint32_t _loc = 0;
efuheader_t _header;
efurecord_t _record;
uint32_t _maxSketchSpace;
uint8_t _error;
uint32_t _maxSketchSpace = 0;
uint8_t _error = EFUPDATE_ERROR_OK;
String _errorMsg;

void ConvertErrorToString();

};

#endif /* EFUPDATE_H_ */
4 changes: 2 additions & 2 deletions include/input/InputAlexa.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* InputAlexa.h
*
* 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 @@ -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 (); ///< Call from loop(), renders Input data
void Process (bool StayDark);
void GetDriverName (String& sDriverName) { sDriverName = "Alexa"; } ///< get the name for the instantiated driver
void SetBufferInfo (uint32_t BufferSize);

Expand Down
2 changes: 1 addition & 1 deletion include/input/InputArtnet.hpp
Original file line number Diff line number Diff line change
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 () {} ///< Call from loop(), renders Input data
virtual void Process (bool StayDark) {} ///< Call from loop(), renders Input data

};
2 changes: 1 addition & 1 deletion include/input/InputCommon.hpp
Original file line number Diff line number Diff line change
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 () = 0; ///< Call from loop(), renders Input data
virtual void Process (bool StayDark) = 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 Down
4 changes: 2 additions & 2 deletions include/input/InputDDP.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* InputDDP.h
*
* Project: InputDDP - Asynchronous DDP library for Arduino ESP8266 and ESP32
* Copyright (c) 2019, 2022 Daniel Kulp, Shelby Merrick
* Copyright (c) 2019, 2025 Daniel Kulp, Shelby Merrick
*
* 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
Expand Down 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 (); ///< Call from loop(), renders Input data
void Process (bool StayDark); ///< 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
4 changes: 2 additions & 2 deletions include/input/InputDisabled.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* InputDisabled.h - Do Nothing input driver
*
* Project: ESPixelStick - An ESP8266 / ESP32 and E1.31 based pixel driver
* Copyright (c) 2015, 2022 Shelby Merrick
* Copyright (c) 2015, 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 @@ -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 (); ///< Call from loop(), Process Input data
void Process (bool StayDark);
void GetDriverName (String& sDriverName) { sDriverName = "Disabled"; } ///< get the name for the instantiated driver
void SetBufferInfo (uint32_t BufferSize) {}

Expand Down
4 changes: 2 additions & 2 deletions include/input/InputE131.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* E131Input.h - Code to wrap ESPAsyncE131 for input
*
* 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 @@ -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 (); ///< Call from loop(), renders Input data
void Process (bool StayDark);
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
5 changes: 3 additions & 2 deletions include/input/InputEffectEngine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* InputEffectEngine.cpp - Input Management 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 @@ -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 (); ///< Call from loop(), renders Input data
void Process (bool StayDark);
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 Expand Up @@ -145,6 +145,7 @@ class c_InputEffectEngine : public c_InputCommon
float EffectBrightness = 1.0; /* Externally controlled effect brightness [0, 255] */
CRGB EffectColor = { 183, 0, 255 }; /* Externally controlled effect color */
bool StayDark = false;
bool Disabled = false;

uint32_t effectMarqueePixelAdvanceCount = 1;
uint32_t effectMarqueePixelLocation = 0;
Expand Down
5 changes: 3 additions & 2 deletions include/input/InputFPPRemote.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* InputFPPRemote.h
*
* 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 @@ -38,7 +38,7 @@ 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 (); ///< Call from loop(), renders Input data
void Process (bool StayDark);
void TaskProcess (); ///< 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);
Expand All @@ -54,6 +54,7 @@ class c_InputFPPRemote : public c_InputCommon

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

private:

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

Expand All @@ -48,7 +48,7 @@ class c_InputFPPRemotePlayEffect : public c_InputFPPRemotePlayItem

fsm_PlayEffect_state* pCurrentFsmState = nullptr;
FastTimer PlayEffectTimer;

c_InputEffectEngine EffectsEngine;

}; // c_InputFPPRemotePlayEffect
8 changes: 4 additions & 4 deletions include/input/InputFPPRemotePlayEffectFsm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* InputFPPRemotePlayEffectFsm.hpp
*
* 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 @@ -35,7 +35,7 @@ class fsm_PlayEffect_state
fsm_PlayEffect_state() {}
virtual ~fsm_PlayEffect_state() {}

virtual bool Poll () = 0;
virtual bool Poll (bool StayDark) = 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 ();
virtual bool Poll (bool StayDark);
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 ();
virtual bool Poll (bool StayDark);
virtual void Init (c_InputFPPRemotePlayEffect* Parent);
virtual void GetStateName (String & sName) { sName = CN_Effect; }
virtual void Start (String & FileName, float SecondsElapsed);
Expand Down
14 changes: 7 additions & 7 deletions include/input/InputFPPRemotePlayFile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* InputFPPRemotePlayFile.hpp
*
* 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 @@ -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 bool Poll ();
virtual bool Poll (bool StayDark);
virtual void GetStatus (JsonObject & jsonStatus);
virtual bool IsIdle () { return (pCurrentFsmState == &fsm_PlayFile_state_Idle_imp); }

Expand Down Expand Up @@ -73,11 +73,11 @@ class c_InputFPPRemotePlayFile : public c_InputFPPRemotePlayItem

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

} FrameControl;

Expand Down
14 changes: 7 additions & 7 deletions include/input/InputFPPRemotePlayFileFsm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* InputFPPRemotePlayFileFsm.hpp
*
* 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 fsm_PlayFile_state
fsm_PlayFile_state() {}
virtual ~fsm_PlayFile_state() {}

virtual bool Poll () = 0;
virtual bool Poll (bool StayDark) = 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;
Expand All @@ -57,7 +57,7 @@ class fsm_PlayFile_state_Idle : public fsm_PlayFile_state
fsm_PlayFile_state_Idle() {}
virtual ~fsm_PlayFile_state_Idle() {}

virtual bool Poll ();
virtual bool Poll (bool StayDark);
virtual void Init (c_InputFPPRemotePlayFile* Parent);
virtual void GetStateName (String & sName) { sName = CN_Idle; }
virtual void Start (String & FileName, float SecondsElapsed, uint32_t RemainingPlayCount);
Expand All @@ -74,7 +74,7 @@ class fsm_PlayFile_state_Starting : public fsm_PlayFile_state
fsm_PlayFile_state_Starting() {}
virtual ~fsm_PlayFile_state_Starting() {}

virtual bool Poll ();
virtual bool Poll (bool StayDark);
virtual void Init (c_InputFPPRemotePlayFile* Parent);
virtual void GetStateName (String& sName) { sName = F ("Starting"); }
virtual void Start (String& FileName, float SecondsElapsed, uint32_t RemainingPlayCount);
Expand All @@ -91,7 +91,7 @@ class fsm_PlayFile_state_PlayingFile : public fsm_PlayFile_state
fsm_PlayFile_state_PlayingFile() {}
virtual ~fsm_PlayFile_state_PlayingFile() {}

virtual bool Poll ();
virtual bool Poll (bool StayDark);
virtual void Init (c_InputFPPRemotePlayFile* Parent);
virtual void GetStateName (String & sName) { sName = CN_File; }
virtual void Start (String & FileName, float SecondsElapsed, uint32_t RemainingPlayCount);
Expand All @@ -116,7 +116,7 @@ class fsm_PlayFile_state_Stopping : public fsm_PlayFile_state
fsm_PlayFile_state_Stopping() {}
virtual ~fsm_PlayFile_state_Stopping() {}

virtual bool Poll ();
virtual bool Poll (bool StayDark);
virtual void Init (c_InputFPPRemotePlayFile* Parent);
virtual void GetStateName (String& sName) { sName = F("Stopping"); }
virtual void Start (String& FileName, float SecondsElapsed, uint32_t RemainingPlayCount);
Expand All @@ -138,7 +138,7 @@ class fsm_PlayFile_state_Error : public fsm_PlayFile_state
fsm_PlayFile_state_Error() {}
virtual ~fsm_PlayFile_state_Error() {}

virtual bool Poll ();
virtual bool Poll (bool StayDark);
virtual void Init (c_InputFPPRemotePlayFile* Parent);
virtual void GetStateName (String& sName) { sName = F ("Error"); }
virtual void Start (String& FileName, float SecondsElapsed, uint32_t RemainingPlayCount);
Expand Down
Loading

0 comments on commit 26550c0

Please sign in to comment.