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
24
class
c_InputE131
:
public
c_InputCommon
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
ESPAsyncE131 *
e131
=
nullptr
;
32
// e131_packet_t packet; ///< Packet buffer for parsing
33
35
uint16_t
startUniverse
= 1;
36
uint16_t
LastUniverse
= 1;
37
uint16_t
ChannelsPerUniverse
= 512;
38
uint16_t
FirstUniverseChannelOffset
= 1;
39
ESPAsyncE131PortId
PortId
= E131_DEFAULT_PORT;
40
bool
ESPAsyncE131Initialized
=
false
;
41
43
uint16_t
channel_count
= 0;
44
45
struct
Universe_t
46
{
47
uint32_t
DestinationOffset
;
48
uint32_t
BytesToCopy
;
49
uint32_t
SourceDataOffset
;
50
uint8_t
SequenceNumber
;
51
uint32_t
SequenceErrorCounter
;
52
};
53
Universe_t
UniverseArray
[
MAX_NUM_UNIVERSES
];
54
55
void
validateConfiguration
();
56
void
NetworkStateChanged
(
bool
IsConnected,
bool
RebootAllowed);
// used by poorly designed rx functions
57
void
SetBufferTranslation
();
58
59
public
:
60
61
c_InputE131
(
c_InputMgr::e_InputChannelIds
NewInputChannelId,
62
c_InputMgr::e_InputType
NewChannelType,
63
uint32_t BufferSize);
64
virtual
~c_InputE131
();
65
66
// functions to be provided by the derived class
67
void
Begin
();
68
bool
SetConfig
(JsonObject & jsonConfig);
69
void
GetConfig
(JsonObject & jsonConfig);
70
void
GetStatus
(JsonObject & jsonStatus);
71
void
Process
();
72
void
GetDriverName
(String & sDriverName) { sDriverName =
"E1.31"
; }
73
void
SetBufferInfo
(uint32_t BufferSize);
74
void
NetworkStateChanged
(
bool
IsConnected);
// used by poorly designed rx functions
75
bool
isShutDownRebootNeeded
() {
return
HasBeenInitialized
; }
76
void
ProcessIncomingE131Data
(e131_packet_t *);
77
};
InputCommon.hpp
OM_MAX_NUM_CHANNELS
#define OM_MAX_NUM_CHANNELS
Definition
OutputMgr.hpp:197
c_InputCommon
Definition
InputCommon.hpp:27
c_InputCommon::HasBeenInitialized
bool HasBeenInitialized
Definition
InputCommon.hpp:51
c_InputE131
Definition
InputE131.hpp:25
c_InputE131::LastUniverse
uint16_t LastUniverse
Last Universe to listen for.
Definition
InputE131.hpp:36
c_InputE131::UNIVERSE_MAX
static const uint16_t UNIVERSE_MAX
Definition
InputE131.hpp:27
c_InputE131::validateConfiguration
void validateConfiguration()
Definition
InputE131.cpp:288
c_InputE131::ProcessIncomingE131Data
void ProcessIncomingE131Data(e131_packet_t *)
Definition
InputE131.cpp:131
c_InputE131::ConfigFileName
static const char ConfigFileName[]
Definition
InputE131.hpp:28
c_InputE131::startUniverse
uint16_t startUniverse
JSON configuration parameters.
Definition
InputE131.hpp:35
c_InputE131::Process
void Process()
Call from loop(), renders Input data.
Definition
InputE131.cpp:122
c_InputE131::PortId
ESPAsyncE131PortId PortId
Definition
InputE131.hpp:39
c_InputE131::~c_InputE131
virtual ~c_InputE131()
Definition
InputE131.cpp:40
c_InputE131::c_InputE131
c_InputE131(c_InputMgr::e_InputChannelIds NewInputChannelId, c_InputMgr::e_InputType NewChannelType, uint32_t BufferSize)
Definition
InputE131.cpp:24
c_InputE131::NetworkStateChanged
void NetworkStateChanged(bool IsConnected, bool RebootAllowed)
Definition
InputE131.cpp:353
c_InputE131::ChannelsPerUniverse
uint16_t ChannelsPerUniverse
Universe boundary limit.
Definition
InputE131.hpp:37
c_InputE131::channel_count
uint16_t channel_count
from sketch globals
Definition
InputE131.hpp:43
c_InputE131::GetStatus
void GetStatus(JsonObject &jsonStatus)
Definition
InputE131.cpp:91
c_InputE131::SetBufferTranslation
void SetBufferTranslation()
Definition
InputE131.cpp:214
c_InputE131::ESPAsyncE131Initialized
bool ESPAsyncE131Initialized
Definition
InputE131.hpp:40
c_InputE131::FirstUniverseChannelOffset
uint16_t FirstUniverseChannelOffset
Channel to start listening at - 1 based.
Definition
InputE131.hpp:38
c_InputE131::GetConfig
void GetConfig(JsonObject &jsonConfig)
Get the current config used by the driver.
Definition
InputE131.cpp:77
c_InputE131::GetDriverName
void GetDriverName(String &sDriverName)
get the name for the instantiated driver
Definition
InputE131.hpp:72
c_InputE131::Begin
void Begin()
set up the operating environment based on the current config (or defaults)
Definition
InputE131.cpp:49
c_InputE131::MAX_NUM_UNIVERSES
static const uint8_t MAX_NUM_UNIVERSES
Definition
InputE131.hpp:29
c_InputE131::SetBufferInfo
void SetBufferInfo(uint32_t BufferSize)
Definition
InputE131.cpp:194
c_InputE131::isShutDownRebootNeeded
bool isShutDownRebootNeeded()
Definition
InputE131.hpp:75
c_InputE131::e131
ESPAsyncE131 * e131
ESPAsyncE131.
Definition
InputE131.hpp:31
c_InputE131::SetConfig
bool SetConfig(JsonObject &jsonConfig)
Set a new config in the driver.
Definition
InputE131.cpp:260
c_InputE131::UniverseArray
Universe_t UniverseArray[MAX_NUM_UNIVERSES]
Definition
InputE131.hpp:53
c_InputMgr::e_InputType
e_InputType
Definition
InputMgr.hpp:71
c_InputMgr::e_InputChannelIds
e_InputChannelIds
Definition
InputMgr.hpp:40
c_InputE131::Universe_t
Definition
InputE131.hpp:46
c_InputE131::Universe_t::SequenceErrorCounter
uint32_t SequenceErrorCounter
Definition
InputE131.hpp:51
c_InputE131::Universe_t::DestinationOffset
uint32_t DestinationOffset
Definition
InputE131.hpp:47
c_InputE131::Universe_t::SequenceNumber
uint8_t SequenceNumber
Definition
InputE131.hpp:50
c_InputE131::Universe_t::SourceDataOffset
uint32_t SourceDataOffset
Definition
InputE131.hpp:49
c_InputE131::Universe_t::BytesToCopy
uint32_t BytesToCopy
Definition
InputE131.hpp:48
include
input
InputE131.hpp
Generated by
1.12.0