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 = (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;
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
49 {
51 uint32_t BytesToCopy;
55 uint32_t num_packets;
56
57 };
59
60 void SetUpArtnet ();
62 void NetworkStateChanged (bool IsConnected, bool RebootAllowed); // used by poorly designed rx functions
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
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
83 virtual void Process () {}
84
85};
#define OM_MAX_NUM_CHANNELS
Definition OutputMgr.hpp:198
Definition InputArtnet.hpp:25
uint32_t PollCounter
Definition InputArtnet.hpp:41
static const uint8_t MAX_NUM_UNIVERSES
Definition InputArtnet.hpp:29
uint32_t packet_errors
Definition InputArtnet.hpp:40
void onDmxPoll(IPAddress broadcastIP)
Definition InputArtnet.cpp:169
uint16_t LastUniverse
Last Universe to listen for.
Definition InputArtnet.hpp:36
virtual ~c_InputArtnet()
Definition InputArtnet.cpp:38
static const uint16_t UNIVERSE_MAX
Definition InputArtnet.hpp:27
Artnet * pArtnet
Definition InputArtnet.hpp:32
void NetworkStateChanged(bool IsConnected, bool RebootAllowed)
Definition InputArtnet.cpp:361
uint16_t ChannelsPerUniverse
Universe boundary limit.
Definition InputArtnet.hpp:37
char _Artnet[sizeof(Artnet)]
Definition InputArtnet.hpp:31
void Begin()
set up the operating environment based on the current config (or defaults)
Definition InputArtnet.cpp:47
void SetUpArtnet()
Definition InputArtnet.cpp:265
Universe_t UniverseArray[MAX_NUM_UNIVERSES]
Definition InputArtnet.hpp:58
void GetDriverName(String &sDriverName)
get the name for the instantiated driver
Definition InputArtnet.hpp:79
virtual void Process()
Call from loop(), renders Input data.
Definition InputArtnet.hpp:83
uint32_t num_packets
Definition InputArtnet.hpp:39
uint16_t channel_count
from sketch globals
Definition InputArtnet.hpp:46
void SetBufferInfo(uint32_t BufferSize)
Definition InputArtnet.cpp:180
void GetStatus(JsonObject &jsonStatus)
Definition InputArtnet.cpp:85
void SetBufferTranslation()
Definition InputArtnet.cpp:201
bool SetConfig(JsonObject &jsonConfig)
Set a new config in the driver.
Definition InputArtnet.cpp:244
bool isShutDownRebootNeeded()
Definition InputArtnet.hpp:82
uint16_t startUniverse
JSON configuration parameters.
Definition InputArtnet.hpp:35
void validateConfiguration()
Definition InputArtnet.cpp:302
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:43
uint16_t FirstUniverseChannelOffset
Channel to start listening at - 1 based.
Definition InputArtnet.hpp:38
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:72
e_InputChannelIds
Definition InputMgr.hpp:40
Definition InputArtnet.hpp:49
uint32_t SourceDataOffset
Definition InputArtnet.hpp:52
uint8_t SequenceNumber
Definition InputArtnet.hpp:54
uint32_t num_packets
Definition InputArtnet.hpp:55
uint32_t BytesToCopy
Definition InputArtnet.hpp:51
uint32_t DestinationOffset
Definition InputArtnet.hpp:50
uint32_t SequenceErrorCounter
Definition InputArtnet.hpp:53