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
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;
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
48 {
50 uint32_t BytesToCopy;
54 uint32_t num_packets;
55
56 };
58
59 void SetUpArtnet ();
61 void NetworkStateChanged (bool IsConnected, bool RebootAllowed); // used by poorly designed rx functions
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
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
82 virtual void Process () {}
83
84};
Definition InputArtnet.hpp:25
uint32_t PollCounter
Definition InputArtnet.hpp:40
static const uint8_t MAX_NUM_UNIVERSES
Definition InputArtnet.hpp:29
uint32_t packet_errors
Definition InputArtnet.hpp:39
void onDmxPoll(IPAddress broadcastIP)
Definition InputArtnet.cpp:169
uint16_t LastUniverse
Last Universe to listen for.
Definition InputArtnet.hpp:35
virtual ~c_InputArtnet()
Definition InputArtnet.cpp:38
static const uint16_t UNIVERSE_MAX
Definition InputArtnet.hpp:27
Artnet * pArtnet
Definition InputArtnet.hpp:31
void NetworkStateChanged(bool IsConnected, bool RebootAllowed)
Definition InputArtnet.cpp:368
uint16_t ChannelsPerUniverse
Universe boundary limit.
Definition InputArtnet.hpp:36
void Begin()
set up the operating environment based on the current config (or defaults)
Definition InputArtnet.cpp:47
void SetUpArtnet()
Definition InputArtnet.cpp:264
Universe_t UniverseArray[MAX_NUM_UNIVERSES]
Definition InputArtnet.hpp:57
void GetDriverName(String &sDriverName)
get the name for the instantiated driver
Definition InputArtnet.hpp:78
virtual void Process()
Call from loop(), renders Input data.
Definition InputArtnet.hpp:82
uint32_t num_packets
Definition InputArtnet.hpp:38
uint16_t channel_count
from sketch globals
Definition InputArtnet.hpp:45
void SetBufferInfo(uint32_t BufferSize)
Definition InputArtnet.cpp:180
void GetStatus(JsonObject &jsonStatus)
Definition InputArtnet.cpp:85
void SetBufferTranslation()
Definition InputArtnet.cpp:200
bool SetConfig(JsonObject &jsonConfig)
Set a new config in the driver.
Definition InputArtnet.cpp:243
bool isShutDownRebootNeeded()
Definition InputArtnet.hpp:81
uint16_t startUniverse
JSON configuration parameters.
Definition InputArtnet.hpp:34
void validateConfiguration()
Definition InputArtnet.cpp:301
void onDmxFrame(uint16_t CurrentUniverseId, uint32_t length, uint8_t sequence, uint8_t *data, IPAddress remoteIP)
Definition InputArtnet.cpp:116
void GetConfig(JsonObject &jsonConfig)
Get the current config used by the driver.
Definition InputArtnet.cpp:72
uint8_t lastData
Definition InputArtnet.hpp:42
uint16_t FirstUniverseChannelOffset
Channel to start listening at - 1 based.
Definition InputArtnet.hpp:37
static const char ConfigFileName[]
Definition InputArtnet.hpp:28
c_InputArtnet(c_InputMgr::e_InputChannelIds NewInputChannelId, c_InputMgr::e_InputType NewChannelType, uint32_t BufferSize)
Definition InputArtnet.cpp:25
Definition InputCommon.hpp:27
bool HasBeenInitialized
Definition InputCommon.hpp:51
e_InputType
Definition InputMgr.hpp:71
e_InputChannelIds
Definition InputMgr.hpp:40
Definition InputArtnet.hpp:48
uint32_t SourceDataOffset
Definition InputArtnet.hpp:51
uint8_t SequenceNumber
Definition InputArtnet.hpp:53
uint32_t num_packets
Definition InputArtnet.hpp:54
uint32_t BytesToCopy
Definition InputArtnet.hpp:50
uint32_t DestinationOffset
Definition InputArtnet.hpp:49
uint32_t SequenceErrorCounter
Definition InputArtnet.hpp:52