Files
OpenRGB/Controllers/DMXController/RGBController_DMX.h
Adam Honse 81aaf67ff0 Initial DMX (Enttec OpenDMX USB) support and serial_port improvements
* Support DMX RGB lights (PAR lights, spotlights, wash lights, etc)
  * Configurable R/G/B channel and Brightness/Master channel
  * Add configurable parameters to serial_port needed to configure a port for DMX
  * Add DMX tab to settings
2023-05-06 08:06:19 +00:00

53 lines
1.5 KiB
C++

/*-----------------------------------------*\
| RGBController_DMX.h |
| |
| Generic RGB Interface for OpenAuraSDK |
| DMX interface |
| |
| Adam Honse (CalcProgrammer1) 4/30/2023 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "serial_port.h"
#include <chrono>
#include <thread>
struct DMXDevice
{
std::string name;
std::string port;
unsigned int keepalive_time;
unsigned int red_channel;
unsigned int green_channel;
unsigned int blue_channel;
unsigned int brightness_channel;
};
class RGBController_DMX : public RGBController
{
public:
RGBController_DMX(std::vector<DMXDevice> device_list);
~RGBController_DMX();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void DeviceUpdateMode();
void KeepaliveThreadFunction();
private:
std::vector<DMXDevice> devices;
serial_port * port;
std::thread * keepalive_thread;
std::atomic<bool> keepalive_thread_run;
std::chrono::milliseconds keepalive_delay;
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
};