kopia lustrzana https://github.com/Aircoookie/WLED
Merge remote-tracking branch 'pbolduc/feature/upd-ddp-send' into virtual-bus
commit
284e748449
|
@ -386,7 +386,7 @@ class BusVirtual : public Bus {
|
|||
void show() {
|
||||
if (!_valid || _broadcastLock) return;
|
||||
_broadcastLock = true;
|
||||
realtimeBoroadcast(_client, _len, _data, _rgbw);
|
||||
realtimeBroadcast(_client, _len, _data, _rgbw);
|
||||
_broadcastLock = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -197,7 +197,7 @@ bool updateVal(const String* req, const char* key, byte* val, byte minv=0, byte
|
|||
|
||||
//udp.cpp
|
||||
void notify(byte callMode, bool followUp=false);
|
||||
void realtimeBoroadcast(IPAddress client, uint16_t length, byte *buffer, bool isRGBW);
|
||||
uint8_t realtimeBroadcast(IPAddress client, uint16_t length, byte *buffer, bool isRGBW);
|
||||
void realtimeLock(uint32_t timeoutMs, byte md = REALTIME_MODE_GENERIC);
|
||||
void handleNotifications();
|
||||
void setRealtimePixel(uint16_t i, byte r, byte g, byte b, byte w);
|
||||
|
|
1145
wled00/udp.cpp
1145
wled00/udp.cpp
Plik diff jest za duży
Load Diff
|
@ -0,0 +1,93 @@
|
|||
#ifndef UDP_H
|
||||
#define UDP_H
|
||||
|
||||
// expected to be included from wled.h where other dependencies are loaded first
|
||||
|
||||
void notify(byte callMode, bool followUp);
|
||||
void realtimeLock(uint32_t timeoutMs, byte md);
|
||||
void sendTPM2Ack();
|
||||
void handleNotifications();
|
||||
void setRealtimePixel(uint16_t i, byte r, byte g, byte b, byte w);
|
||||
|
||||
/*********************************************************************************************\
|
||||
Refresh aging for remote units, drop if too old...
|
||||
\*********************************************************************************************/
|
||||
void refreshNodeList();
|
||||
|
||||
/*********************************************************************************************\
|
||||
Broadcast system info to other nodes. (to update node lists)
|
||||
\*********************************************************************************************/
|
||||
void sendSysInfoUDP();
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Art-Net, DDP, E131 output - work in progress
|
||||
\*********************************************************************************************/
|
||||
|
||||
// Send real time DDP UDP updates to the specified client
|
||||
//
|
||||
// client - the IP address to send to
|
||||
// buffer - a buffer of at least length*3 or length*4 bytes long
|
||||
// length - the number of pixels
|
||||
// isRGBW - true if the buffer contains 4 components per pixel
|
||||
uint8_t realtimeBroadcast(IPAddress client, uint16_t length, uint8_t *buffer, bool isRGBW);
|
||||
|
||||
#define DDP_PORT 4048
|
||||
|
||||
#define DDP_PUSH_FLAG 0x01
|
||||
#define DDP_TIMECODE_FLAG 0x10
|
||||
|
||||
#ifdef UPD_OUTPUT // just disable out for now
|
||||
// Base class for all UDP output types.
|
||||
class UDPOutputData {
|
||||
public:
|
||||
UDPOutputData(const JsonDocument& config);
|
||||
virtual ~UDPOutputData();
|
||||
|
||||
virtual bool IsPingable() = 0;
|
||||
|
||||
virtual void PrepareData(unsigned char* channelData /*,UDPOutputMessages& msgs*/) = 0;
|
||||
virtual void PostPrepareData(unsigned char* channelData /*,UDPOutputMessages& msgs*/) { }
|
||||
|
||||
int startChannel;
|
||||
int channelCount;
|
||||
IPAddress ipAddress;
|
||||
|
||||
UDPOutputData(UDPOutputData const&) = delete;
|
||||
void operator=(UDPOutputData const& x) = delete;
|
||||
|
||||
protected:
|
||||
// functions and settings to detect duplicate frames to avoid sending the same data as last time
|
||||
void SaveFrame(unsigned char* channelData, int len);
|
||||
bool NeedToOutputFrame(unsigned char* channelData, int startChannel, int savedIdx, int count);
|
||||
bool deDuplicate = false;
|
||||
int skippedFrames;
|
||||
unsigned char* lastData;
|
||||
};
|
||||
|
||||
// Art-Net - https://en.wikipedia.org/wiki/Art-Net
|
||||
class ArtNetOutputData : public UDPOutputData {
|
||||
// TODO
|
||||
};
|
||||
|
||||
// Distributed Display Protocol (DDP)
|
||||
class DDPOutputData : public UDPOutputData {
|
||||
public:
|
||||
explicit DDPOutputData(const JsonDocument& config);
|
||||
virtual ~DDPOutputData();
|
||||
|
||||
virtual bool IsPingable() override { return true; }
|
||||
virtual void PrepareData(unsigned char* channelData /*,UDPOutputMessages& msgs*/) override;
|
||||
};
|
||||
|
||||
// E1.31 (Streaming-ACN) Protocol
|
||||
class E131OutputData : public UDPOutputData {
|
||||
// TODO
|
||||
};
|
||||
|
||||
class UDPOutput {
|
||||
public:
|
||||
void AddOutput(UDPOutputData*);
|
||||
};
|
||||
#endif // UPD_OUTPUT
|
||||
|
||||
#endif
|
|
@ -149,6 +149,7 @@ using PSRAMDynamicJsonDocument = BasicJsonDocument<PSRAM_Allocator>;
|
|||
#include "NodeStruct.h"
|
||||
#include "pin_manager.h"
|
||||
#include "bus_manager.h"
|
||||
#include "udp.h"
|
||||
|
||||
#ifndef CLIENT_SSID
|
||||
#define CLIENT_SSID DEFAULT_CLIENT_SSID
|
||||
|
|
Ładowanie…
Reference in New Issue