ESPixelStick Firmware
Firmware for the ESPixelStick
Loading...
Searching...
No Matches
InputE131.hpp
Go to the documentation of this file.
1#pragma once
2/*
3* E131Input.h - Code to wrap ESPAsyncE131 for input
4*
5* Project: ESPixelStick - An ESP8266 / ESP32 and E1.31 based pixel driver
6* Copyright (c) 2021, 2025 Shelby Merrick
7* http://www.forkineye.com
8*
9* This program is provided free for you to use in any way that you wish,
10* subject to the laws and regulations where you are using it. Due diligence
11* is strongly suggested before using this code. Please give credit where due.
12*
13* The Author makes no warranty of any kind, express or implied, with regard
14* to this program or the documentation contained in this document. The
15* Author shall not be liable in any event for incidental or consequential
16* damages in connection with, or arising out of, the furnishing, performance
17* or use of these programs.
18*
19*/
20
21#include "InputCommon.hpp"
22#include <ESPAsyncE131.h>
23
25{
26 private:
27 static const uint16_t UNIVERSE_MAX = 512;
28 static const char ConfigFileName[];
29 static const uint8_t MAX_NUM_UNIVERSES = (OM_MAX_NUM_CHANNELS / UNIVERSE_MAX) + 1;
30
31 byte _e131[sizeof(ESPAsyncE131)];
32 #define e131 static_cast<ESPAsyncE131>(*(&_e131[0]))
33 ESPAsyncE131 * pE131 = nullptr;
34
35 // e131_packet_t packet; ///< Packet buffer for parsing
36
38 uint16_t startUniverse = 1;
39 uint16_t LastUniverse = 1;
40 uint16_t ChannelsPerUniverse = 512;
42 ESPAsyncE131PortId PortId = E131_DEFAULT_PORT;
44
46 uint16_t channel_count = 0;
47
49 {
51 uint32_t BytesToCopy;
55 };
57
59 void NetworkStateChanged (bool IsConnected, bool RebootAllowed); // used by poorly designed rx functions
61
62 public:
63
65 c_InputMgr::e_InputType NewChannelType,
66 uint32_t BufferSize);
67 virtual ~c_InputE131();
68
69 // functions to be provided by the derived class
70 void Begin ();
71 bool SetConfig (JsonObject & jsonConfig);
72 void GetConfig (JsonObject & jsonConfig);
73 void GetStatus (JsonObject & jsonStatus);
74 void Process ();
75 void GetDriverName (String & sDriverName) { sDriverName = "E1.31"; }
76 void SetBufferInfo (uint32_t BufferSize);
77 void NetworkStateChanged (bool IsConnected); // used by poorly designed rx functions
79 void ProcessIncomingE131Data (e131_packet_t *);
80};
#define OM_MAX_NUM_CHANNELS
Definition OutputMgr.hpp:198
Definition InputCommon.hpp:27
bool HasBeenInitialized
Definition InputCommon.hpp:51
Definition InputE131.hpp:25
uint16_t LastUniverse
Last Universe to listen for.
Definition InputE131.hpp:39
static const uint16_t UNIVERSE_MAX
Definition InputE131.hpp:27
void validateConfiguration()
Definition InputE131.cpp:302
ESPAsyncE131 * pE131
Definition InputE131.hpp:33
void ProcessIncomingE131Data(e131_packet_t *)
Definition InputE131.cpp:143
static const char ConfigFileName[]
Definition InputE131.hpp:28
uint16_t startUniverse
JSON configuration parameters.
Definition InputE131.hpp:38
void Process()
Call from loop(), renders Input data.
Definition InputE131.cpp:134
ESPAsyncE131PortId PortId
Definition InputE131.hpp:42
byte _e131[sizeof(ESPAsyncE131)]
Definition InputE131.hpp:31
virtual ~c_InputE131()
Definition InputE131.cpp:39
c_InputE131(c_InputMgr::e_InputChannelIds NewInputChannelId, c_InputMgr::e_InputType NewChannelType, uint32_t BufferSize)
Definition InputE131.cpp:24
void NetworkStateChanged(bool IsConnected, bool RebootAllowed)
Definition InputE131.cpp:367
uint16_t ChannelsPerUniverse
Universe boundary limit.
Definition InputE131.hpp:40
uint16_t channel_count
from sketch globals
Definition InputE131.hpp:46
void GetStatus(JsonObject &jsonStatus)
Definition InputE131.cpp:103
void SetBufferTranslation()
Definition InputE131.cpp:227
bool ESPAsyncE131Initialized
Definition InputE131.hpp:43
uint16_t FirstUniverseChannelOffset
Channel to start listening at - 1 based.
Definition InputE131.hpp:41
void GetConfig(JsonObject &jsonConfig)
Get the current config used by the driver.
Definition InputE131.cpp:89
void GetDriverName(String &sDriverName)
get the name for the instantiated driver
Definition InputE131.hpp:75
void Begin()
set up the operating environment based on the current config (or defaults)
Definition InputE131.cpp:48
static const uint8_t MAX_NUM_UNIVERSES
Definition InputE131.hpp:29
void SetBufferInfo(uint32_t BufferSize)
Definition InputE131.cpp:207
bool isShutDownRebootNeeded()
Definition InputE131.hpp:78
bool SetConfig(JsonObject &jsonConfig)
Set a new config in the driver.
Definition InputE131.cpp:274
Universe_t UniverseArray[MAX_NUM_UNIVERSES]
Definition InputE131.hpp:56
e_InputType
Definition InputMgr.hpp:72
e_InputChannelIds
Definition InputMgr.hpp:40
Definition InputE131.hpp:49
uint32_t SequenceErrorCounter
Definition InputE131.hpp:54
uint32_t DestinationOffset
Definition InputE131.hpp:50
uint8_t SequenceNumber
Definition InputE131.hpp:53
uint32_t SourceDataOffset
Definition InputE131.hpp:52
uint32_t BytesToCopy
Definition InputE131.hpp:51