MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / RGBController_DMX

Method RGBController_DMX

Controllers/DMXController/RGBController_DMX.cpp:28–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26\*-------------------------------------------------------------------*/
27
28RGBController_DMX::RGBController_DMX(std::vector<DMXDevice> device_list)
29{
30 devices = device_list;
31
32 name = "DMX Device Group";
33 type = DEVICE_TYPE_LEDSTRIP;
34 description = "DMX Device";
35 location = "DMX: " + devices[0].port;
36
37 /*-----------------------------------------*\
38 | If this controller only represents a |
39 | single device, use the device name for the|
40 | controller name |
41 \*-----------------------------------------*/
42 if(devices.size() == 1)
43 {
44 name = devices[0].name;
45 }
46
47 /*-----------------------------------------*\
48 | Open OpenDMX port |
49 \*-----------------------------------------*/
50 port = new serial_port(devices[0].port.c_str(), 250000, SERIAL_PORT_PARITY_NONE, SERIAL_PORT_SIZE_8, SERIAL_PORT_STOP_BITS_2, false);
51
52 /*-----------------------------------------*\
53 | Clear the RTS signal, which enables the |
54 | OpenDMX RS-485 drive enable |
55 \*-----------------------------------------*/
56 port->serial_set_rts(false);
57
58 /*-----------------------------------------*\
59 | Set up modes |
60 \*-----------------------------------------*/
61 mode Direct;
62 Direct.name = "Direct";
63 Direct.value = 0;
64 Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
65 Direct.color_mode = MODE_COLORS_PER_LED;
66 Direct.brightness = 255;
67 Direct.brightness_min = 0;
68 Direct.brightness_max = 255;
69 modes.push_back(Direct);
70
71 keepalive_delay = 0ms;
72
73 SetupZones();
74
75 for (std::size_t device_idx = 0; device_idx < devices.size(); device_idx++)
76 {
77 /*-----------------------------------------*\
78 | Update keepalive delay |
79 \*-----------------------------------------*/
80 if(devices[device_idx].keepalive_time > 0)
81 {
82 if(keepalive_delay.count() == 0 || keepalive_delay.count() > devices[device_idx].keepalive_time)
83 {
84 keepalive_delay = std::chrono::milliseconds(devices[device_idx].keepalive_time);
85 }

Callers

nothing calls this directly

Calls 4

serial_set_rtsMethod · 0.80
sizeMethod · 0.45
push_backMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected