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
= 10;
30
31
Artnet *
pArtnet
=
nullptr
;
32
34
uint16_t
startUniverse
= 1;
35
uint16_t
LastUniverse
= 1;
36
uint16_t
ChannelsPerUniverse
= 512;
37
uint16_t
FirstUniverseChannelOffset
= 1;
38
uint32_t
num_packets
= 0;
39
uint32_t
packet_errors
= 0;
40
uint32_t
PollCounter
= 0;
41
42
uint8_t
lastData
= 255;
43
45
uint16_t
channel_count
= 0;
46
47
struct
Universe_t
48
{
49
uint32_t
DestinationOffset
;
50
uint32_t
BytesToCopy
;
51
uint32_t
SourceDataOffset
;
52
uint32_t
SequenceErrorCounter
;
53
uint8_t
SequenceNumber
;
54
uint32_t
num_packets
;
55
56
};
57
Universe_t
UniverseArray
[
MAX_NUM_UNIVERSES
];
58
59
void
SetUpArtnet
();
60
void
validateConfiguration
();
61
void
NetworkStateChanged
(
bool
IsConnected,
bool
RebootAllowed);
// used by poorly designed rx functions
62
void
SetBufferTranslation
();
63
void
onDmxFrame
(uint16_t CurrentUniverseId, uint32_t length, uint8_t sequence, uint8_t* data, IPAddress remoteIP);
64
void
onDmxPoll
(IPAddress broadcastIP);
65
66
public
:
67
68
c_InputArtnet
(
c_InputMgr::e_InputChannelIds
NewInputChannelId,
69
c_InputMgr::e_InputType
NewChannelType,
70
uint32_t BufferSize);
71
virtual
~c_InputArtnet
();
72
73
// functions to be provided by the derived class
74
void
Begin
();
75
bool
SetConfig
(JsonObject & jsonConfig);
76
void
GetConfig
(JsonObject & jsonConfig);
77
void
GetStatus
(JsonObject & jsonStatus);
78
void
GetDriverName
(String & sDriverName) { sDriverName =
"Artnet"
; }
79
void
SetBufferInfo
(uint32_t BufferSize);
80
void
NetworkStateChanged
(
bool
IsConnected);
// used by poorly designed rx functions
81
bool
isShutDownRebootNeeded
() {
return
HasBeenInitialized
; }
82
virtual
void
Process
() {}
83
84
};
InputCommon.hpp
c_InputArtnet
Definition
InputArtnet.hpp:25
c_InputArtnet::PollCounter
uint32_t PollCounter
Definition
InputArtnet.hpp:40
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:39
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:35
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:31
c_InputArtnet::NetworkStateChanged
void NetworkStateChanged(bool IsConnected, bool RebootAllowed)
Definition
InputArtnet.cpp:368
c_InputArtnet::ChannelsPerUniverse
uint16_t ChannelsPerUniverse
Universe boundary limit.
Definition
InputArtnet.hpp:36
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:264
c_InputArtnet::UniverseArray
Universe_t UniverseArray[MAX_NUM_UNIVERSES]
Definition
InputArtnet.hpp:57
c_InputArtnet::GetDriverName
void GetDriverName(String &sDriverName)
get the name for the instantiated driver
Definition
InputArtnet.hpp:78
c_InputArtnet::Process
virtual void Process()
Call from loop(), renders Input data.
Definition
InputArtnet.hpp:82
c_InputArtnet::num_packets
uint32_t num_packets
Definition
InputArtnet.hpp:38
c_InputArtnet::channel_count
uint16_t channel_count
from sketch globals
Definition
InputArtnet.hpp:45
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:200
c_InputArtnet::SetConfig
bool SetConfig(JsonObject &jsonConfig)
Set a new config in the driver.
Definition
InputArtnet.cpp:243
c_InputArtnet::isShutDownRebootNeeded
bool isShutDownRebootNeeded()
Definition
InputArtnet.hpp:81
c_InputArtnet::startUniverse
uint16_t startUniverse
JSON configuration parameters.
Definition
InputArtnet.hpp:34
c_InputArtnet::validateConfiguration
void validateConfiguration()
Definition
InputArtnet.cpp:301
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:42
c_InputArtnet::FirstUniverseChannelOffset
uint16_t FirstUniverseChannelOffset
Channel to start listening at - 1 based.
Definition
InputArtnet.hpp:37
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:71
c_InputMgr::e_InputChannelIds
e_InputChannelIds
Definition
InputMgr.hpp:40
c_InputArtnet::Universe_t
Definition
InputArtnet.hpp:48
c_InputArtnet::Universe_t::SourceDataOffset
uint32_t SourceDataOffset
Definition
InputArtnet.hpp:51
c_InputArtnet::Universe_t::SequenceNumber
uint8_t SequenceNumber
Definition
InputArtnet.hpp:53
c_InputArtnet::Universe_t::num_packets
uint32_t num_packets
Definition
InputArtnet.hpp:54
c_InputArtnet::Universe_t::BytesToCopy
uint32_t BytesToCopy
Definition
InputArtnet.hpp:50
c_InputArtnet::Universe_t::DestinationOffset
uint32_t DestinationOffset
Definition
InputArtnet.hpp:49
c_InputArtnet::Universe_t::SequenceErrorCounter
uint32_t SequenceErrorCounter
Definition
InputArtnet.hpp:52
include
input
InputArtnet.hpp
Generated by
1.12.0