ESPixelStick Firmware
Firmware for the ESPixelStick
Loading...
Searching...
No Matches
InputArtnet.hpp
Go to the documentation of this file.
1
#pragma once
2
/*
3
* ArtnetInput.h - Code to wrap ESPAsyncArtnet for input
4
*
5
* Project: ESPixelStick - An ESP8266 / ESP32 and Artnet 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 <Artnet.h>
23
24
class
c_InputArtnet
:
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
char
_Artnet
[
sizeof
(Artnet)];
32
Artnet *
pArtnet
=
nullptr
;
33
35
uint16_t
startUniverse
= 1;
36
uint16_t
LastUniverse
= 1;
37
uint16_t
ChannelsPerUniverse
=
UNIVERSE_MAX
;
38
uint16_t
FirstUniverseChannelOffset
= 1;
39
uint32_t
num_packets
= 0;
40
uint32_t
packet_errors
= 0;
41
uint32_t
PollCounter
= 0;
42
43
uint8_t
lastData
= 255;
44
46
uint16_t
channel_count
= 0;
47
48
struct
Universe_t
49
{
50
uint32_t
DestinationOffset
;
51
uint32_t
BytesToCopy
;
52
uint32_t
SourceDataOffset
;
53
uint32_t
SequenceErrorCounter
;
54
uint8_t
SequenceNumber
;
55
uint32_t
num_packets
;
56
57
};
58
Universe_t
UniverseArray
[
MAX_NUM_UNIVERSES
];
59
60
void
SetUpArtnet
();
61
void
validateConfiguration
();
62
void
NetworkStateChanged
(
bool
IsConnected,
bool
RebootAllowed);
// used by poorly designed rx functions
63
void
SetBufferTranslation
();
64
void
onDmxFrame
(uint16_t CurrentUniverseId, uint32_t length, uint8_t sequence, uint8_t* data, IPAddress remoteIP);
65
void
onDmxPoll
(IPAddress broadcastIP);
66
67
public
:
68
69
c_InputArtnet
(
c_InputMgr::e_InputChannelIds
NewInputChannelId,
70
c_InputMgr::e_InputType
NewChannelType,
71
uint32_t BufferSize);
72
virtual
~c_InputArtnet
();
73
74
// functions to be provided by the derived class
75
void
Begin
();
76
bool
SetConfig
(JsonObject & jsonConfig);
77
void
GetConfig
(JsonObject & jsonConfig);
78
void
GetStatus
(JsonObject & jsonStatus);
79
void
GetDriverName
(String & sDriverName) { sDriverName =
"Artnet"
; }
80
void
SetBufferInfo
(uint32_t BufferSize);
81
void
NetworkStateChanged
(
bool
IsConnected);
// used by poorly designed rx functions
82
bool
isShutDownRebootNeeded
() {
return
HasBeenInitialized
; }
83
virtual
void
Process
() {}
84
85
};
InputCommon.hpp
OM_MAX_NUM_CHANNELS
#define OM_MAX_NUM_CHANNELS
Definition
OutputMgr.hpp:198
c_InputArtnet
Definition
InputArtnet.hpp:25
c_InputArtnet::PollCounter
uint32_t PollCounter
Definition
InputArtnet.hpp:41
c_InputArtnet::MAX_NUM_UNIVERSES
static const uint8_t MAX_NUM_UNIVERSES
Definition
InputArtnet.hpp:29
c_InputArtnet::packet_errors
uint32_t packet_errors
Definition
InputArtnet.hpp:40
c_InputArtnet::onDmxPoll
void onDmxPoll(IPAddress broadcastIP)
Definition
InputArtnet.cpp:169
c_InputArtnet::LastUniverse
uint16_t LastUniverse
Last Universe to listen for.
Definition
InputArtnet.hpp:36
c_InputArtnet::~c_InputArtnet
virtual ~c_InputArtnet()
Definition
InputArtnet.cpp:38
c_InputArtnet::UNIVERSE_MAX
static const uint16_t UNIVERSE_MAX
Definition
InputArtnet.hpp:27
c_InputArtnet::pArtnet
Artnet * pArtnet
Definition
InputArtnet.hpp:32
c_InputArtnet::NetworkStateChanged
void NetworkStateChanged(bool IsConnected, bool RebootAllowed)
Definition
InputArtnet.cpp:361
c_InputArtnet::ChannelsPerUniverse
uint16_t ChannelsPerUniverse
Universe boundary limit.
Definition
InputArtnet.hpp:37
c_InputArtnet::_Artnet
char _Artnet[sizeof(Artnet)]
Definition
InputArtnet.hpp:31
c_InputArtnet::Begin
void Begin()
set up the operating environment based on the current config (or defaults)
Definition
InputArtnet.cpp:47
c_InputArtnet::SetUpArtnet
void SetUpArtnet()
Definition
InputArtnet.cpp:265
c_InputArtnet::UniverseArray
Universe_t UniverseArray[MAX_NUM_UNIVERSES]
Definition
InputArtnet.hpp:58
c_InputArtnet::GetDriverName
void GetDriverName(String &sDriverName)
get the name for the instantiated driver
Definition
InputArtnet.hpp:79
c_InputArtnet::Process
virtual void Process()
Call from loop(), renders Input data.
Definition
InputArtnet.hpp:83
c_InputArtnet::num_packets
uint32_t num_packets
Definition
InputArtnet.hpp:39
c_InputArtnet::channel_count
uint16_t channel_count
from sketch globals
Definition
InputArtnet.hpp:46
c_InputArtnet::SetBufferInfo
void SetBufferInfo(uint32_t BufferSize)
Definition
InputArtnet.cpp:180
c_InputArtnet::GetStatus
void GetStatus(JsonObject &jsonStatus)
Definition
InputArtnet.cpp:85
c_InputArtnet::SetBufferTranslation
void SetBufferTranslation()
Definition
InputArtnet.cpp:201
c_InputArtnet::SetConfig
bool SetConfig(JsonObject &jsonConfig)
Set a new config in the driver.
Definition
InputArtnet.cpp:244
c_InputArtnet::isShutDownRebootNeeded
bool isShutDownRebootNeeded()
Definition
InputArtnet.hpp:82
c_InputArtnet::startUniverse
uint16_t startUniverse
JSON configuration parameters.
Definition
InputArtnet.hpp:35
c_InputArtnet::validateConfiguration
void validateConfiguration()
Definition
InputArtnet.cpp:302
c_InputArtnet::onDmxFrame
void onDmxFrame(uint16_t CurrentUniverseId, uint32_t length, uint8_t sequence, uint8_t *data, IPAddress remoteIP)
Definition
InputArtnet.cpp:116
c_InputArtnet::GetConfig
void GetConfig(JsonObject &jsonConfig)
Get the current config used by the driver.
Definition
InputArtnet.cpp:72
c_InputArtnet::lastData
uint8_t lastData
Definition
InputArtnet.hpp:43
c_InputArtnet::FirstUniverseChannelOffset
uint16_t FirstUniverseChannelOffset
Channel to start listening at - 1 based.
Definition
InputArtnet.hpp:38
c_InputArtnet::ConfigFileName
static const char ConfigFileName[]
Definition
InputArtnet.hpp:28
c_InputArtnet::c_InputArtnet
c_InputArtnet(c_InputMgr::e_InputChannelIds NewInputChannelId, c_InputMgr::e_InputType NewChannelType, uint32_t BufferSize)
Definition
InputArtnet.cpp:25
c_InputCommon
Definition
InputCommon.hpp:27
c_InputCommon::HasBeenInitialized
bool HasBeenInitialized
Definition
InputCommon.hpp:51
c_InputMgr::e_InputType
e_InputType
Definition
InputMgr.hpp:72
c_InputMgr::e_InputChannelIds
e_InputChannelIds
Definition
InputMgr.hpp:40
c_InputArtnet::Universe_t
Definition
InputArtnet.hpp:49
c_InputArtnet::Universe_t::SourceDataOffset
uint32_t SourceDataOffset
Definition
InputArtnet.hpp:52
c_InputArtnet::Universe_t::SequenceNumber
uint8_t SequenceNumber
Definition
InputArtnet.hpp:54
c_InputArtnet::Universe_t::num_packets
uint32_t num_packets
Definition
InputArtnet.hpp:55
c_InputArtnet::Universe_t::BytesToCopy
uint32_t BytesToCopy
Definition
InputArtnet.hpp:51
c_InputArtnet::Universe_t::DestinationOffset
uint32_t DestinationOffset
Definition
InputArtnet.hpp:50
c_InputArtnet::Universe_t::SequenceErrorCounter
uint32_t SequenceErrorCounter
Definition
InputArtnet.hpp:53
include
input
InputArtnet.hpp
Generated by
1.12.0