-
Notifications
You must be signed in to change notification settings - Fork 221
UsbPro Extended Device/Widget #1573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
b429cbd
cdb1200
70f1823
4d7aee8
58430d1
8126b7a
d658402
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -246,3 +246,5 @@ javascript/new-src/node_modules | |
| .cproject | ||
| .settings | ||
| .vscode/ | ||
| etc | ||
| .pydevproject | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,6 +46,7 @@ | |
| #include "ola/io/IOUtils.h" | ||
| #include "ola/Logging.h" | ||
| #include "plugins/uartdmx/UartWidget.h" | ||
| #include "plugins/uartdmx/UartDmxDevice.h" | ||
|
|
||
| namespace ola { | ||
| namespace plugin { | ||
|
|
@@ -54,8 +55,9 @@ namespace uartdmx { | |
| using std::string; | ||
| using std::vector; | ||
|
|
||
| UartWidget::UartWidget(const string& path) | ||
| UartWidget::UartWidget(const std::string &path, unsigned int padding) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You don't need the std:: as we're already using string. |
||
| : m_path(path), | ||
| m_padding (padding), | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Align with the line above and below (and drop the space before |
||
| m_fd(NOT_OPEN) { | ||
| } | ||
|
|
||
|
|
@@ -122,6 +124,10 @@ bool UartWidget::Write(const ola::DmxBuffer& data) { | |
| buffer[0] = DMX512_START_CODE; | ||
|
|
||
| data.Get(buffer + 1, &length); | ||
| if (length < m_padding) { | ||
| memset ((buffer + 1 + length), 0x00, (m_padding - length) ); | ||
| length = m_padding; | ||
| } | ||
|
|
||
| if (write(m_fd, buffer, length + 1) <= 0) { | ||
| // TODO(richardash1981): handle errors better as per the test code, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,8 +48,9 @@ class UartWidget { | |
| /** | ||
| * Construct a new UartWidget instance for one widget. | ||
| * @param path The device file path of the serial port | ||
| * @param padding Minimal DMX frame size, padded with zeros | ||
| */ | ||
| explicit UartWidget(const std::string &path); | ||
| explicit UartWidget(const std::string &path, unsigned int padding); | ||
|
|
||
| /** Destructor */ | ||
| virtual ~UartWidget(); | ||
|
|
@@ -80,7 +81,8 @@ class UartWidget { | |
| bool SetupOutput(); | ||
|
|
||
| private: | ||
| const std::string m_path; | ||
| const std::string m_path; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you leave the indenting where it was, two in from the start of the line. |
||
| unsigned int m_padding; | ||
|
|
||
| /** | ||
| * variable to hold the Unix file descriptor used to open and manipulate | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this data slots, or including start code? I think in theory it can be less than 24 depending on frame rate etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is data slots. Got this number somewhere on net.
Wikipedia: However, it does require that packets be transmitted so that the leading edges of any two sequential BREAKs must be separated by at least 1204 μs, and receivers must be able to handle packets with break-to-break times as short as 1196 μs.[10] The minimum break-to-break transmit time can be achieved by sending packets that contain at least 24 slots