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

Stopped crashes on servo init #496

Merged
merged 34 commits into from
Apr 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
326fb64
Docs used to create pixel definitions.
MartinMueller2003 Mar 21, 2022
bf45563
Added ability to set intensity data width dynamically
MartinMueller2003 Mar 21, 2022
e66b7b9
Added UCS9803 pixel support
MartinMueller2003 Mar 21, 2022
c41f122
Merge branch 'main' of https://github.com/MartinMueller2003/ESPixelStick
MartinMueller2003 Mar 21, 2022
d71db3f
Added debug information
MartinMueller2003 Mar 23, 2022
c9d9054
Made all output types compile time options.
MartinMueller2003 Mar 23, 2022
b8bf552
Moved files to a new location
MartinMueller2003 Mar 23, 2022
0a877f4
Changes to support a single serail protocol without needing all three
MartinMueller2003 Mar 23, 2022
407d1e4
Moved definitions to a platform directory
MartinMueller2003 Mar 23, 2022
269afbc
Fix to prevent issues on Config Creation.
MartinMueller2003 Mar 25, 2022
848d58d
Set has been initialized flag
MartinMueller2003 Mar 25, 2022
e5118da
Added GDB capability in debugging
MartinMueller2003 Mar 25, 2022
d27ff78
Made relay selection more granular
MartinMueller2003 Mar 25, 2022
2410e82
Made relay selection more granular
MartinMueller2003 Mar 25, 2022
3b1692c
Added debug info
MartinMueller2003 Mar 25, 2022
a58e153
Turned off debug info
MartinMueller2003 Mar 25, 2022
0074e18
Added debug info
MartinMueller2003 Mar 25, 2022
1bab682
Cleaned up DMX compile flags.
MartinMueller2003 Mar 25, 2022
3f143a0
Made relay and serial support more granular
MartinMueller2003 Mar 25, 2022
fc26328
Turned off debugging
MartinMueller2003 Mar 25, 2022
227d61d
Updated output type controls
MartinMueller2003 Mar 25, 2022
1744034
Turned off debugging
MartinMueller2003 Mar 25, 2022
a11bd42
Turned off debug info
MartinMueller2003 Mar 25, 2022
7606b4b
Fixed path to ETH files.
MartinMueller2003 Mar 25, 2022
1e98891
Remove register keyword that is no longer supported by C++17
MartinMueller2003 Mar 25, 2022
f05bf72
Fixed undersized array issue
MartinMueller2003 Mar 25, 2022
768a368
Ewmoved no longer supported register keyword.
MartinMueller2003 Mar 25, 2022
c14ddbc
Fixed path to ETH file
MartinMueller2003 Mar 25, 2022
a2fda91
Resolved warnings in ESP8266 builds
MartinMueller2003 Mar 25, 2022
f4144b3
Changed driverid to an enum
MartinMueller2003 Mar 25, 2022
ed36c44
More changes for name normalization
MartinMueller2003 Mar 25, 2022
a38a312
More name consistency changes.
MartinMueller2003 Mar 26, 2022
2dcfa7f
Re-enabled GPIO Relay output support.
MartinMueller2003 Mar 26, 2022
49b37bc
Disabled lines that cause the system to crash when a new default conf…
MartinMueller2003 Mar 26, 2022
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
21 changes: 12 additions & 9 deletions ESPixelStick/ESPixelStick.ino
Original file line number Diff line number Diff line change
Expand Up @@ -146,24 +146,27 @@ void setup()

// Load configuration from the File System and set Hostname
loadConfig();
// DEBUG_V ("");

// Set up the output manager to start sending data to the serial ports
OutputMgr.Begin ();
// DEBUG_V ("");

// DEBUG_V(String("InputMgr Heap: ") + String(ESP.getFreeHeap()));
// connect the input processing to the output processing.
InputMgr.Begin (OutputMgr.GetBufferUsedSize ());
// DEBUG_V ("");
InputMgr.Begin (0);

NetworkMgr.Begin ();
// DEBUG_V ("");
// DEBUG_V(String("OutputMgr Heap: ") + String(ESP.getFreeHeap()));
// Set up the output manager to start sending data to the serial ports
OutputMgr.Begin();

// DEBUG_V(String("NetworkMgr Heap: ") + String(ESP.getFreeHeap()));
NetworkMgr.Begin();

// DEBUG_V(String("WebMgr Heap: ") + String(ESP.getFreeHeap()));
// Configure and start the web server
WebMgr.Begin(&config);

// DEBUG_V(String("FPPDiscovery Heap: ") + String(ESP.getFreeHeap()));
FPPDiscovery.begin ();

// DEBUG_V(String("Final Heap: ") + String(ESP.getFreeHeap()));

#ifdef ARDUINO_ARCH_ESP8266
// * ((volatile uint32_t*)0x60000900) &= ~(1); // Hardware WDT OFF
ESP.wdtEnable (2000); // 2 seconds
Expand Down
12 changes: 12 additions & 0 deletions ESPixelStick/src/FileMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,17 +381,29 @@ bool c_FileMgr::SaveConfigFile(const String &FileName, JsonDocument &FileData)
bool Response = false;

String CfgFileMessagePrefix = String(CN_Configuration_File_colon) + "'" + FileName + "' ";
// DEBUG_V(String("CfgFileMessagePrefix: ") + CfgFileMessagePrefix);

// serializeJson(FileData, LOG_PORT);
// DEBUG_V("");

// delay(100);
// DEBUG_V("");

fs::File file = LittleFS.open(FileName.c_str(), "w");
// DEBUG_V("");

if (!file)
{
logcon(String(CN_stars) + CfgFileMessagePrefix + String(F("Could not open file for writing..")) + CN_stars);
}
else
{
// DEBUG_V("");
file.seek(0, SeekSet);
// DEBUG_V("");

size_t NumBytesSaved = serializeJson(FileData, file);
// DEBUG_V("");

file.close();

Expand Down
35 changes: 16 additions & 19 deletions ESPixelStick/src/GPIO_Defs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,42 +72,39 @@ typedef enum
} uart_port_t;
#endif // def ARDUINO_ARCH_ESP8266

#define SUPPORT_OutputType_UCS1903
#define SUPPORT_OutputType_GS8208

// Platform specific GPIO definitions
#if defined (BOARD_ESP32_CAM)
# include "GPIO_Defs_ESP32_CAM.hpp"
# include "platformDefinitions/GPIO_Defs_ESP32_CAM.hpp"
#elif defined (BOARD_ESP32_D1_MINI_ETH)
# include "GPIO_Defs_ESP32_D1_MINI_ETH.hpp"
# include "platformDefinitions/GPIO_Defs_ESP32_D1_MINI_ETH.hpp"
#elif defined (BOARD_ESP32_D1_MINI)
# include "GPIO_Defs_ESP32_D1_MINI.hpp"
# include "platformDefinitions/GPIO_Defs_ESP32_D1_MINI.hpp"
#elif defined (BOARD_ESP32_LOLIN_D32_PRO_ETH)
# include "GPIO_Defs_ESP32_LoLin_D32_PRO_ETH.hpp"
# include "platformDefinitions/GPIO_Defs_ESP32_LoLin_D32_PRO_ETH.hpp"
#elif defined (BOARD_ESP32_LOLIN_D32_PRO)
# include "GPIO_Defs_ESP32_generic.hpp"
# include "platformDefinitions/GPIO_Defs_ESP32_generic.hpp"
#elif defined (BOARD_ESP32_MH_ET_LIVE_MiniKit)
# include "GPIO_Defs_ESP32_MH_ET_LIVE_MiniKit.hpp"
# include "platformDefinitions/GPIO_Defs_ESP32_MH_ET_LIVE_MiniKit.hpp"
#elif defined(BOARD_ESP32_QUINLED_QUAD_ETH)
# include "GPIO_Defs_ESP32_QUINLED_QUAD_ETH.hpp"
# include "platformDefinitions/GPIO_Defs_ESP32_QUINLED_QUAD_ETH.hpp"
#elif defined(BOARD_ESP32_QUINLED_QUAD)
# include "GPIO_Defs_ESP32_QUINLED_QUAD.hpp"
# include "platformDefinitions/GPIO_Defs_ESP32_QUINLED_QUAD.hpp"
#elif defined(BOARD_ESP32_QUINLED_UNO_ETH)
# include "GPIO_Defs_ESP32_QUINLED_UNO_ETH.hpp"
# include "platformDefinitions/GPIO_Defs_ESP32_QUINLED_UNO_ETH.hpp"
#elif defined(BOARD_ESP32_QUINLED_UNO)
# include "GPIO_Defs_ESP32_QUINLED_UNO.hpp"
# include "platformDefinitions/GPIO_Defs_ESP32_QUINLED_UNO.hpp"
#elif defined (BOARD_ESP32_TTGO_T8)
# include "GPIO_Defs_ESP32_TTGO_T8.hpp"
# include "platformDefinitions/GPIO_Defs_ESP32_TTGO_T8.hpp"
#elif defined (BOARD_ESP32_WT32ETH01)
# include "GPIO_Defs_ESP32_WT32ETH01.hpp"
# include "platformDefinitions/GPIO_Defs_ESP32_WT32ETH01.hpp"
#elif defined (BOARD_ESP01S)
# include "GPIO_Defs_ESP8266_ESP01S.hpp"
# include "platformDefinitions/GPIO_Defs_ESP8266_ESP01S.hpp"
#elif defined (BOARD_ESPS_V3)
# include "GPIO_Defs_ESP8266_ESPS_V3.hpp"
# include "platformDefinitions/GPIO_Defs_ESP8266_ESPS_V3.hpp"
#elif defined (ARDUINO_ARCH_ESP32)
# include "GPIO_Defs_ESP32_generic.hpp"
# include "platformDefinitions/GPIO_Defs_ESP32_generic.hpp"
#elif defined(ARDUINO_ARCH_ESP8266)
# include "GPIO_Defs_ESP8266_Generic.hpp"
# include "platformDefinitions/GPIO_Defs_ESP8266_Generic.hpp"
#else
# error "No valid platform definition"
#endif // ndef platform specific GPIO definitions
1 change: 1 addition & 0 deletions ESPixelStick/src/WebMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ void c_WebMgr::Begin (config_t* /* NewConfig */)
// DEBUG_V(String("WebJsonDoc->capacity: 0x") + String(WebJsonDoc->capacity(), HEX));

memset(pWebSocketFrameCollectionBuffer, 0x00, WebSocketFrameCollectionBufferSize + 1);
// DEBUG_V();

if (NetworkMgr.IsConnected())
{
Expand Down
2 changes: 1 addition & 1 deletion ESPixelStick/src/input/InputEffectEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ void c_InputEffectEngine::setPixel (uint16_t pixelId, CRGB color)

if ((true == IsInputChannelActive) && (pixelId < PixelCount))
{
uint8_t PixelBuffer[sizeof(CRGB)];
uint8_t PixelBuffer[sizeof(CRGB)+1];

// DEBUG_V(String("ChannelsPerPixel * pixelId: 0x") + String(uint(ChannelsPerPixel * pixelId), HEX));
// DEBUG_V (String ("EffectBrightness: ") + String (EffectBrightness));
Expand Down
14 changes: 10 additions & 4 deletions ESPixelStick/src/input/InputMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,13 @@ void c_InputMgr::CreateNewConfig ()
}

// create a place to save the config
DynamicJsonDocument JsonConfigDoc (IM_JSON_SIZE);
JsonObject JsonConfig = JsonConfigDoc.createNestedObject (CN_input_config);
// DEBUG_V(String("Heap: ") + String(ESP.getFreeHeap()));

DynamicJsonDocument JsonConfigDoc(IM_JSON_SIZE);
// DEBUG_V("");

JsonObject JsonConfig = JsonConfigDoc.createNestedObject(CN_input_config);
// DEBUG_V("");

JsonConfig[CN_cfgver] = CurrentConfigVersion;

Expand All @@ -263,10 +268,11 @@ void c_InputMgr::CreateNewConfig ()
InputTypeId < int (InputType_End);
++InputTypeId)
{
// DEBUG_V ("for each input channel");
// DEBUG_V(String("instantiate the Input type: ") + InputTypeId);
// DEBUG_V("for each input channel");
for (auto & CurrentInput : InputChannelDrivers)
{
// DEBUG_V (String("instantiate the Input type: ") + InputTypeId);
// DEBUG_V(String("DriverId: ") + CurrentInput.DriverId);
InstantiateNewInputChannel (e_InputChannelIds(CurrentInput.DriverId), e_InputType(InputTypeId), false);
}// end for each interface

Expand Down
4 changes: 2 additions & 2 deletions ESPixelStick/src/output/OutputAPA102.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

#include "../ESPixelStick.h"
#ifdef SUPPORT_OutputType_APA102
#if defined(SUPPORT_OutputType_APA102)

#include "OutputAPA102.hpp"

Expand Down Expand Up @@ -91,4 +91,4 @@ bool c_OutputAPA102::SetConfig (ArduinoJson::JsonObject& jsonConfig)

} // SetConfig

#endif // def SUPPORT_OutputType_APA102
#endif // defined(SUPPORT_OutputType_APA102)
4 changes: 2 additions & 2 deletions ESPixelStick/src/output/OutputAPA102.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*
*/
#include "../ESPixelStick.h"
#ifdef SUPPORT_OutputType_APA102
#if defined(SUPPORT_OutputType_APA102)

#include "OutputPixel.hpp"

Expand Down Expand Up @@ -58,4 +58,4 @@ class c_OutputAPA102 : public c_OutputPixel

}; // c_OutputAPA102

#endif // def SUPPORT_OutputType_APA102
#endif // defined(SUPPORT_OutputType_APA102) && defined(SUPPORT_SPI_OUTPUT)
2 changes: 1 addition & 1 deletion ESPixelStick/src/output/OutputAPA102Spi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@ void c_OutputAPA102Spi::Render ()

} // render

#endif // defined (SUPPORT_OutputType_APA102) && defined (SUPPORT_SPI_OUTPUT)
#endif // defined(SUPPORT_OutputType_APA102) && defined(SUPPORT_SPI_OUTPUT)
4 changes: 2 additions & 2 deletions ESPixelStick/src/output/OutputAPA102Spi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/

#include "../ESPixelStick.h"
#ifdef SUPPORT_OutputType_APA102
#if defined(SUPPORT_OutputType_APA102) && defined(SUPPORT_SPI_OUTPUT)

#include "OutputAPA102.hpp"
#include "OutputSpi.hpp"
Expand Down Expand Up @@ -51,4 +51,4 @@ class c_OutputAPA102Spi : public c_OutputAPA102

}; // c_OutputAPA102Spi

#endif // def SUPPORT_OutputType_APA102
#endif // defined(SUPPORT_OutputType_APA102) && defined(SUPPORT_SPI_OUTPUT)
16 changes: 11 additions & 5 deletions ESPixelStick/src/output/OutputCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,18 @@ c_OutputCommon::c_OutputCommon (c_OutputMgr::e_OutputChannelIds iOutputChannelId
c_OutputCommon::~c_OutputCommon ()
{
// DEBUG_START;
if (gpio_num_t (-1) == DataPin) { return; }

pinMode (DataPin, INPUT_PULLUP);
if(HasBeenInitialized)
{
if (gpio_num_t(-1) == DataPin)
{
return;
}
// DEBUG_V("Set Pin Mode");
pinMode(DataPin, INPUT_PULLUP);

// DEBUG_V ("");
TerminateUartOperation ();
// DEBUG_V ("Terminate UART");
TerminateUartOperation();
}
// DEBUG_END;
} // ~c_OutputMgr

Expand Down
53 changes: 32 additions & 21 deletions ESPixelStick/src/output/OutputGECE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
*/

#include "../ESPixelStick.h"

#if defined(SUPPORT_OutputType_GECE) && defined(SUPPORT_UART_OUTPUT)

#include "OutputGECE.hpp"
#include <HardwareSerial.h>
#ifdef ARDUINO_ARCH_ESP32
Expand Down Expand Up @@ -150,34 +153,37 @@ c_OutputGECE::~c_OutputGECE ()
{
// DEBUG_START;

GECE_OutputChanArray[OutputChannelId] = nullptr;

// clean up the timer ISR
bool foundActiveChannel = false;
for (auto currentChannel : GECE_OutputChanArray)
if(HasBeenInitialized)
{
// DEBUG_V (String ("currentChannel: ") + String (uint(currentChannel), HEX));
if (nullptr != currentChannel)
GECE_OutputChanArray[OutputChannelId] = nullptr;

// clean up the timer ISR
bool foundActiveChannel = false;
for (auto currentChannel : GECE_OutputChanArray)
{
// DEBUG_V ("foundActiveChannel");
foundActiveChannel = true;
// DEBUG_V (String ("currentChannel: ") + String (uint(currentChannel), HEX));
if (nullptr != currentChannel)
{
// DEBUG_V ("foundActiveChannel");
foundActiveChannel = true;
}
}
}

// DEBUG_V ();
// DEBUG_V ();

// have all of the GECE channels been killed?
if (!foundActiveChannel)
{
// DEBUG_V ("Detach Interrupts");
// have all of the GECE channels been killed?
if (!foundActiveChannel)
{
// DEBUG_V ("Detach Interrupts");
#ifdef ARDUINO_ARCH_ESP8266
timer1_detachInterrupt ();
timer1_detachInterrupt();
#elif defined(ARDUINO_ARCH_ESP32)
if (pHwTimer)
{
timerAlarmDisable (pHwTimer);
}
if (pHwTimer)
{
timerAlarmDisable(pHwTimer);
}
#endif
}
}

// DEBUG_END;
Expand Down Expand Up @@ -214,7 +220,7 @@ void c_OutputGECE::Begin ()

if (gpio_num_t (-1) == DataPin) { return; }

SetOutputBufferSize (pixel_count * GECE_NUM_INTENSITY_BYTES_PER_PIXEL);
SetOutputBufferSize(pixel_count * GECE_NUM_INTENSITY_BYTES_PER_PIXEL);

// DEBUG_V (String ("GECE_BAUDRATE: ") + String (GECE_BAUDRATE));

Expand Down Expand Up @@ -281,6 +287,9 @@ void c_OutputGECE::Begin ()
timerAlarmEnable (pHwTimer);

#endif

HasBeenInitialized = true;

// DEBUG_END;
} // begin

Expand Down Expand Up @@ -428,3 +437,5 @@ void c_OutputGECE::Render()
// DEBUG_END;

} // render

#endif // defined(SUPPORT_OutputType_GECE) && defined(SUPPORT_UART_OUTPUT)
3 changes: 3 additions & 0 deletions ESPixelStick/src/output/OutputGECE.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/

#include "OutputCommon.hpp"
#if defined(SUPPORT_OutputType_GECE) && defined(SUPPORT_UART_OUTPUT)

class c_OutputGECE: public c_OutputCommon
{
Expand Down Expand Up @@ -66,3 +67,5 @@ static inline uint32_t _getCycleCount (void) {
__asm__ __volatile__ ("rsr %0,ccount":"=a" (ccount));
return ccount;
}

#endif // defined(SUPPORT_OutputType_GECE) && defined(SUPPORT_UART_OUTPUT)
5 changes: 3 additions & 2 deletions ESPixelStick/src/output/OutputGS8208.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
*/

#include "../ESPixelStick.h"
#ifdef SUPPORT_OutputType_GS8208

#if defined(SUPPORT_OutputType_GS8208)

#include "OutputGS8208.hpp"

Expand Down Expand Up @@ -114,4 +115,4 @@ bool c_OutputGS8208::SetConfig (ArduinoJson::JsonObject& jsonConfig)

} // SetConfig

#endif // def SUPPORT_OutputType_GS8208
#endif // defined(SUPPORT_OutputType_GS8208)
6 changes: 2 additions & 4 deletions ESPixelStick/src/output/OutputGS8208Rmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
*/
#include "../ESPixelStick.h"

#ifdef SUPPORT_OutputType_GS8208
#ifdef SUPPORT_RMT_OUTPUT
#if defined(SUPPORT_OutputType_GS8208) && defined(SUPPORT_RMT_OUTPUT)

#include "OutputGS8208Rmt.hpp"

Expand Down Expand Up @@ -167,5 +166,4 @@ void c_OutputGS8208Rmt::Render ()

} // Render

#endif // def SUPPORT_RMT_OUTPUT
#endif // def SUPPORT_OutputType_GS8208
#endif // defined(SUPPORT_OutputType_GS8208) && defined(SUPPORT_RMT_OUTPUT)
Loading