Skip to content
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

UART plugin recovers granularity if timing improves - closes #1798 #1800

Open
wants to merge 1,771 commits into
base: 0.10
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
1771 commits
Select commit Hold shift + click to select a range
13ae375
Clarify some of the comments
peternewman Jan 25, 2020
c1e17bb
Merge branch '0.10' of https://github.com/openlightingproject/ola int…
peternewman Jan 26, 2020
f69e4a6
Merge pull request #1603 from peternewman/master-resync
peternewman Jan 26, 2020
c1be091
Merge branch 'master' into e1.37-2
peternewman Jan 27, 2020
c3daf5c
Remove some unnecessary backslashes
peternewman Jan 27, 2020
15b6edb
Merge branch 'e1.37-2' of https://github.com/peternewman/ola into e1.…
peternewman Jan 27, 2020
bb96794
Merge pull request #26 from OpenLightingProject/master
peternewman Jan 30, 2020
a1b5326
Require the Protobuf 3.6 based OS X builds again on master
peternewman Jan 30, 2020
dd4fb74
Merge pull request #1611 from peternewman/travis-mac
peternewman Feb 17, 2020
ac4a401
Merge branch '0.10' of https://github.com/openlightingproject/ola int…
peternewman Feb 17, 2020
4faf2c5
Merge pull request #1617 from peternewman/master-resync
peternewman Feb 18, 2020
2022d7d
Use pkg-info to detect library flags to link against ncurses
kripton Mar 15, 2020
548b62a
Add a fallback to the old behaviour in case pkg-config didn't know an…
kripton Mar 17, 2020
4a3516e
Make configure not failing if PKG_CHECK_MODULES fails on ncurses
kripton Mar 18, 2020
681e8b7
Try and fix allowed failures
peternewman Mar 19, 2020
1d2904a
Merge branch 'master' into travis-mac
peternewman Mar 19, 2020
e3ab1dc
Remove unnecessary keys for the allowed failure
peternewman Mar 19, 2020
1045b59
Merge pull request #1622 from peternewman/travis-mac
peternewman Mar 19, 2020
7f5f9fd
Merge branch 'master' into ncurses-6
peternewman Mar 19, 2020
eee16b5
Indentation fixes
kripton Mar 20, 2020
80511ad
Indentation fixes, part 2
kripton Mar 21, 2020
e9fcf75
Merge pull request #1621 from kripton/ncurses-6
peternewman Mar 22, 2020
0d49cf2
Allow all origin in HTTPServer responses (CORS)
Mar 27, 2020
2fea299
CORS : renamed helper method to SetAccessControlAllowOriginAll
Mar 28, 2020
32e48b0
Merge pull request #1625 from quadbyte/master
peternewman Mar 29, 2020
694cdf1
Merge branch 'master' into e1.37-2
peternewman Mar 29, 2020
7df89f7
Merge pull request #1608 from peternewman/e1.37-2
peternewman Mar 30, 2020
56a7816
Revert "Revert "Attempt to fix Protobuf 3.7 builds""
peternewman Apr 30, 2019
d730d42
Revert "Revert "Add the missing config.h include""
peternewman Apr 30, 2019
8ff3288
Revert "Revert "Switch to protobuf 3.7/latest""
peternewman Apr 30, 2019
2e8cc80
Correct a comment
peternewman May 12, 2019
4754624
Change code snippets in our protoc-plugin so the code works with prot…
kripton Mar 14, 2020
2dd4cdc
Generate different code, depending on protobuf version
kripton Mar 15, 2020
2b43ae1
CppLint: Make sure all lines have <= 80 characters
kripton Mar 15, 2020
caf2fd1
Try to use inline and namespace again
kripton Mar 29, 2020
1484246
Pass function to ::google::protobuf::internal::call_once by reference
kripton Apr 6, 2020
6b36ff3
Generate the new code also for protobuf 3.7
kripton Apr 7, 2020
3a6e0c6
Merge pull request #1620 from kripton/protobuf-3.11
peternewman Apr 7, 2020
bba5f3f
Install and integrate Stylelint Grunt task
FloEdelmann Apr 24, 2020
79b204e
Reorder CSS rules to fix `no-descending-specificity` issue
FloEdelmann Apr 24, 2020
c6a5eea
Fix issues reported by VS Code
FloEdelmann Apr 24, 2020
0c251d8
Fix some issues in the old webinterface
FloEdelmann Apr 24, 2020
1e030e0
Add stylelintrc.json to Makefile.mk to fix Travis
FloEdelmann Apr 24, 2020
b92eaea
Merge branch '0.10' of https://github.com/openlightingproject/ola int…
peternewman Apr 28, 2020
7090ab2
Merge pull request #1635 from peternewman/master-resync
peternewman Apr 29, 2020
a46696a
Add missing Python TK package
peternewman Apr 30, 2020
c844c81
Merge branch '0.10' of https://github.com/openlightingproject/ola int…
peternewman May 15, 2020
99b8dd7
Merge branch '0.10' of https://github.com/openlightingproject/ola int…
peternewman May 15, 2020
ed6538e
Merge branch 'master' into stylelint
peternewman May 30, 2020
9da8253
Fix a dodgy merge and try adding the full matrix of options on OS X
peternewman Jun 3, 2020
a86cf34
Protobuf 3.6 doesn't link properly so don't try and test most of it f…
peternewman Jun 3, 2020
ff5cb35
Merge branch '0.10' of https://github.com/openlightingproject/ola int…
peternewman Jun 5, 2020
1da9ed1
Merge branch 'master-resync' of https://github.com/peternewman/ola in…
peternewman Jun 5, 2020
d52c280
Filter PIDs by program mode (get/set)
danielskeenan Jul 1, 2020
d56348c
Code style fixes
danielskeenan Jul 2, 2020
888c276
Include other files in Grunt task
FloEdelmann Jul 4, 2020
77ef86c
Fix/disable stylelint issues
FloEdelmann Jul 4, 2020
32bf6cb
Sort PIDs in PidStoreHelper
danielskeenan Jul 4, 2020
e401c32
Cleanup PID name display algorithm
danielskeenan Jul 4, 2020
17d8aff
Update help and man pages
danielskeenan Jul 4, 2020
ef013d1
Update AUTHORS
danielskeenan Jul 4, 2020
f28c5e4
Code style fixes
danielskeenan Jul 4, 2020
9ab8306
Add options for start and stop
danielskeenan Jul 4, 2020
eae187e
Refactor a bit to ensure show file read integrity
danielskeenan Jul 4, 2020
873b99e
Handle start points
danielskeenan Jul 4, 2020
c9b2d21
Handle stop points
danielskeenan Jul 4, 2020
6cd42da
Update docs
danielskeenan Jul 4, 2020
8c88500
Style fixes
danielskeenan Jul 4, 2020
8ce0ce8
Fix bug where loop delay was ignored.
danielskeenan Jul 4, 2020
24f511b
Move PID sorting to the main function
danielskeenan Jul 6, 2020
8a63f7f
Style fixes
danielskeenan Jul 6, 2020
4492afd
Fix bug in restarting from start point
danielskeenan Jul 6, 2020
b7deb80
Fix Authors sorting
danielskeenan Jul 6, 2020
54d3cda
Move PID sort comparison method to where it belongs
danielskeenan Jul 6, 2020
2ee33a0
Cleanup
danielskeenan Jul 6, 2020
52c02b4
Handle trailing timeouts in show files
danielskeenan Jul 6, 2020
44e1432
Taught verify about start/stop points
danielskeenan Jul 6, 2020
85e6910
Emit a warning if show file ends before the stop time
danielskeenan Jul 6, 2020
79eb0f4
Cleanup
danielskeenan Jul 6, 2020
5115749
Improve logging when user asks for something impossible
danielskeenan Jul 7, 2020
bf6c9cd
Honor loop delay
danielskeenan Jul 7, 2020
789ae53
Handle looping and start times more gracefully
danielskeenan Jul 7, 2020
eb3a3e1
Handle start times landing on the trailing edge of a frame's timeout
danielskeenan Jul 7, 2020
86a5417
Cleanup vestigial math
danielskeenan Jul 7, 2020
d3e2418
Cleanup
danielskeenan Jul 7, 2020
59a5dcb
Allow long-running shows
danielskeenan Jul 7, 2020
188a406
Avoid integer overflow on verify output
danielskeenan Jul 7, 2020
10c9735
Cleanup verify output
danielskeenan Jul 7, 2020
77ec60e
Give more helpful feedback about out-of-bounds start/stop times
danielskeenan Jul 7, 2020
fdab34a
Handle multiple universes more gracefully
danielskeenan Jul 7, 2020
e16767c
Get data from all universes when seeking
danielskeenan Jul 13, 2020
dd6fb01
Cleanup and better error checking
danielskeenan Jul 13, 2020
8b4e09f
Fix build
danielskeenan Jul 13, 2020
fbf6fca
Fix verify frame count to match player
danielskeenan Jul 13, 2020
d4d091c
Handle starting at EOF
danielskeenan Jul 13, 2020
43b162c
Always wait until desired end time even if beyond EOF
danielskeenan Jul 13, 2020
65c8bef
Fix playback position not updated properly
danielskeenan Jul 17, 2020
763fe24
Improve messaging when start/stop > EOF
danielskeenan Jul 17, 2020
95fd19f
Tell the user when seeking to EOF
danielskeenan Jul 17, 2020
697766f
Style
danielskeenan Jul 17, 2020
3321c00
Merge branch '0.10' of https://github.com/openlightingproject/ola int…
peternewman Jul 17, 2020
2f7bb0c
Cleanup
danielskeenan Jul 23, 2020
d1c0579
Make logging levels more sensible
danielskeenan Jul 23, 2020
0714ff0
Verify before playback
danielskeenan Jul 23, 2020
7baf3c5
Teach verify about playback options
danielskeenan Jul 23, 2020
bfcdf55
Add an option to not verify before playback
danielskeenan Jul 23, 2020
2fff7dd
Start working on simulation in ShowPlayer
danielskeenan Jul 23, 2020
5ad508e
Switch verify to simulating the ShowPlayer instead of a kludge
danielskeenan Jul 23, 2020
64d5f1d
Handle infinite playback properly when verifying.
danielskeenan Jul 24, 2020
33c55c7
Improve flag usage
danielskeenan Jul 30, 2020
51f0118
Cleanup
danielskeenan Jul 30, 2020
d5a7953
Try and silence the pychecker errors
peternewman Jul 31, 2020
3cbc6cb
Merge pull request #1639 from peternewman/master-resync
peternewman Aug 1, 2020
313e2c5
Cleanup verify output
danielskeenan Aug 2, 2020
2a3c234
Use old C++
danielskeenan Aug 2, 2020
88fa85a
Cleanup error handling
danielskeenan Aug 2, 2020
df0cc97
More cleanup
danielskeenan Aug 2, 2020
8701ec3
Cleanup error handling
danielskeenan Aug 2, 2020
1cfa7e8
Prettify verify output
danielskeenan Aug 2, 2020
57d8d07
Update some docs
danielskeenan Aug 2, 2020
6ff3229
Update duration option to take milliseconds
danielskeenan Aug 2, 2020
7ae42fc
Clarify duration overrides iterations
danielskeenan Aug 2, 2020
6387534
Fix exit status during playback
danielskeenan Aug 2, 2020
3ff582e
Clarify playback verify output
danielskeenan Aug 14, 2020
c543954
Cleanup
danielskeenan Aug 14, 2020
03ed8db
Warn when durations overrides iterations
danielskeenan Aug 14, 2020
2f002ab
Revert duration to seconds to avoid BC breaks
danielskeenan Aug 16, 2020
65e0d1d
Merge branch 'master' into #1632
peternewman Aug 27, 2020
28fa304
Merge pull request #1647 from DragoonBoots/#1632
peternewman Aug 29, 2020
3e1a6c4
Merge branch 'master' into #1604
peternewman Sep 2, 2020
ea3a18a
Merge pull request #1648 from DragoonBoots/#1604
peternewman Sep 3, 2020
f939938
Merge branch '0.10' of https://github.com/openlightingproject/ola int…
peternewman Nov 1, 2020
01a7afe
cppunit 1.13 doesn't currently install on Mac so disable those tests
peternewman Nov 2, 2020
0028d65
Merge pull request #1681 from peternewman/master-resync
peternewman Nov 3, 2020
1e8328e
examples/ola-streaming-client: Add option to read universe number fro…
shenghaoyang Nov 13, 2020
2e43608
examples/ola-streaming-client: Remove unnecessary string trim.
shenghaoyang Nov 13, 2020
c408082
examples/ola-streaming-client: Squash typo
shenghaoyang Nov 17, 2020
dafc5dc
man/ola-streaming-client: Add documentation for new option.
shenghaoyang Nov 17, 2020
e42807c
examples/ola-streaming-client: move whitespace to end
shenghaoyang Nov 21, 2020
6ff5ae1
examples/ola-streaming-client: Rename universe from STDIN option name…
shenghaoyang Nov 21, 2020
6055181
examples/ola-streaming-client: Add detailed error reporting and retur…
shenghaoyang Nov 21, 2020
1151e8d
Merge branch '0.10' of https://github.com/openlightingproject/ola int…
peternewman Dec 15, 2020
266e3fa
Fix a broken merge of the PID data
peternewman Dec 15, 2020
906e846
Try and fix the allowed failures of pychecker
peternewman Dec 15, 2020
a7c6009
Try and fix pychecker
peternewman Dec 16, 2020
fcac78a
Merge pull request #1695 from peternewman/master-resync
peternewman Dec 21, 2020
616ed88
Merge branch '0.10' of https://github.com/openlightingproject/ola int…
peternewman Dec 22, 2020
d4fa2ed
Old versions of libmicrohttpd don't have MHD_HTTP_HEADER_ACCESS_CONTR…
peternewman Dec 22, 2020
507adb0
Try and fix a compile issue on some older compilers
peternewman Dec 23, 2020
5d6f514
Be a bit more consistent with using an enum
peternewman Dec 23, 2020
7d108ff
Fix another compile issue on some older compilers
peternewman Dec 23, 2020
4c81827
Update examples/ola-streaming-client.cpp
shenghaoyang Dec 25, 2020
599fe7d
Update examples/ola-streaming-client.cpp
shenghaoyang Dec 25, 2020
a33ba8e
Fix make check on older compilers (ULL in UIDTest)
RenZ0 Dec 31, 2020
b7c64c1
Merge pull request #1705 from RenZ0/patch-1
peternewman Dec 31, 2020
d1723d4
Merge branch 'master' of https://github.com/openlightingproject/ola i…
peternewman Dec 31, 2020
2005e84
Remove an unnecessary include
peternewman Dec 31, 2020
f0ae738
Remove an unnecessary include
peternewman Dec 31, 2020
02a23dd
Fix some more Python 3 errors
peternewman Dec 31, 2020
ecd6424
Merge branch 'master' into mhd-no-cors
peternewman Jan 5, 2021
113f78e
Merge branch 'master' of https://github.com/openlightingproject/ola i…
peternewman Jan 5, 2021
2f4fbc2
Merge branch '0.10' of https://github.com/openlightingproject/ola int…
peternewman Jan 5, 2021
43163e4
Merge pull request #1706 from peternewman/e1.37-2
peternewman Jan 7, 2021
42ad12d
Merge branch 'master' into master-resync
peternewman Jan 7, 2021
fc59166
Merge branch 'master' into mhd-no-cors
peternewman Jan 7, 2021
d9c35bd
Merge pull request #1702 from peternewman/master-resync
peternewman Jan 7, 2021
33caf20
Merge branch 'master' into mhd-no-cors
peternewman Jan 7, 2021
58a4e5e
Merge branch 'master' into stylelint
FloEdelmann Jan 7, 2021
e8b9f77
Merge pull request #1701 from peternewman/mhd-no-cors
peternewman Jan 7, 2021
c70e599
Merge branch 'master' into extend-sclient
peternewman Jan 7, 2021
fb3e871
examples/ola-streaming-client: rename read_universe to universe
shenghaoyang Jan 8, 2021
d78389c
MInor tweak to formatting of message in code
peternewman Jan 23, 2021
a95a6f7
Merge pull request #1683 from shenghaoyang/extend-sclient
peternewman Jan 23, 2021
ef43e7f
Merge branch 'master' into stylelint
FloEdelmann Feb 6, 2021
fd23903
Set a default value for the enabling Eurolite Mk2 preference
peternewman Mar 2, 2021
ee116c2
Make the enable Eurolite Mk2 key name public
peternewman Mar 2, 2021
920cac2
Merge pull request #1717 from OpenLightingProject/peternewman-eurolit…
peternewman Mar 16, 2021
9cc6ad6
Merge branch 'master' into stylelint
peternewman Mar 25, 2021
29379d4
Rename the JS linting task to weblint
peternewman Mar 25, 2021
055c67d
Finish rename the JS linting task to weblint
peternewman Mar 25, 2021
c9add79
Merge pull request #1633 from FloEdelmann/stylelint
peternewman Mar 25, 2021
9defd26
Merge branch 'master' into feature/de-interface
peternewman May 7, 2021
30577e3
Fix some comments on the DE equivalent support
peternewman May 7, 2021
84cd83a
Merge pull request #1410 from bitte-ein-bit/feature/de-interface
peternewman Jun 1, 2021
ac60b02
Merge branch '0.10' of https://github.com/openlightingproject/ola int…
peternewman Jun 29, 2021
5a894a3
Make the grunt run verbose
peternewman Jun 30, 2021
125af12
Enable debug on the grunt run
peternewman Jun 30, 2021
106bdd9
Make the npm install verbose
peternewman Jun 30, 2021
7a62819
Try updating all the stylelint stuff to fix the error
peternewman Jun 30, 2021
8a24a2d
Revert "Try updating all the stylelint stuff to fix the error"
peternewman Jun 30, 2021
4d584ba
Try pinning the old stylelint versions for when they worked
peternewman Jun 30, 2021
963857d
Run using the latest available node
peternewman Jun 30, 2021
b8c8e1a
Revert "Try pinning the old stylelint versions for when they worked"
peternewman Jun 30, 2021
97564f4
Revert "Revert "Try updating all the stylelint stuff to fix the error""
peternewman Jun 30, 2021
ea11fd8
Drop to an older version of npm, and switch to it earlier
peternewman Jun 30, 2021
7a16dcd
Add some debugging of npm
peternewman Jun 30, 2021
d5e11f6
Fix the syntax error in Travis config
peternewman Jun 30, 2021
a0ae775
Undo my npm version fix
peternewman Jul 7, 2021
354a885
Add more version debugging
peternewman Jul 7, 2021
f2f228e
Throw a stack trace if grunt fails
peternewman Jul 7, 2021
a1ffd3b
Fix the indenting
peternewman Jul 7, 2021
4197b96
Only run the grunt version after we've installed it
peternewman Jul 7, 2021
36b803f
Try and fix the node version
peternewman Jul 7, 2021
1272892
More node debugging
peternewman Jul 7, 2021
5126158
More nvm testing
peternewman Jul 7, 2021
34303f4
Install and use the lts version of node
peternewman Jul 7, 2021
6316ed5
Tidy the nvm switching
peternewman Jul 7, 2021
022f1c7
Add some pip debugging
peternewman Jul 7, 2021
54b55c7
Find out which versions of python and pip we're really running
peternewman Jul 7, 2021
601d303
Check pip2 too
peternewman Jul 7, 2021
a99f8aa
Point pip back to pip2 when not on python3
peternewman Jul 7, 2021
3fdd151
Sudo the commands that need it
peternewman Jul 7, 2021
9070cef
Try to get numpy to build on xenial
peternewman Jul 7, 2021
fc0b533
Fix a broken merge
peternewman Jul 7, 2021
3220a37
Use a recent clang if we're compiling with clang on arm64 as the late…
peternewman Jul 7, 2021
6189c05
Merge branch '0.10' of https://github.com/openlightingproject/ola int…
peternewman Jul 7, 2021
a3456c8
Merge branch 'master-resync' of https://github.com/peternewman/ola in…
peternewman Jul 7, 2021
a7ea175
Merge pull request #1732 from peternewman/master-resync
peternewman Jul 7, 2021
dad7307
Merge branch '0.10' of https://github.com/openlightingproject/ola int…
peternewman Jul 12, 2021
3faa662
usbdmx: Move widget deletion to main thread
DanielG Feb 2, 2021
31bd61c
Merge pull request #1712 from DanielG/usbdmx-widget-deletion
peternewman Dec 6, 2021
3ed42d8
Merge branch 'master' of https://github.com/openlightingproject/ola i…
peternewman Jan 13, 2022
73568bc
Merge branch '0.10' of https://github.com/openlightingproject/ola int…
peternewman Jan 13, 2022
ebc7b91
Fix more flake8 errors
peternewman Jan 13, 2022
b587306
Switch ResponderTestFixture._EscapeData to a static method
peternewman Jan 19, 2022
39b2ebf
Disable another test that is inconsistent between Python 2 and 3
peternewman Jan 19, 2022
7f6ceaf
Tweak the level of checking some files have now we've got Python 3 co…
peternewman Jan 19, 2022
2fcbdd0
Don't also check the file via the stricter pychecker test
peternewman Jan 20, 2022
6294ded
Don't also check another file via the stricter pychecker test
peternewman Jan 20, 2022
2058e5c
Make ResponderTest.py pychecker run even less strict
peternewman Jan 20, 2022
d1433a1
Merge pull request #1763 from peternewman/master-resync
peternewman Jan 20, 2022
b5caa4f
Resync 0.10 changes in
peternewman Jul 23, 2022
990f0aa
Weblint doesn't fail on master, so no need to allow it to!
peternewman Jul 23, 2022
9df0b62
Merge pull request #1783 from peternewman/master-resync
peternewman Jul 24, 2022
7a07a52
Merge branch '0.10' of https://github.com/openlightingproject/ola int…
peternewman Sep 10, 2022
9604d48
Merge pull request #1789 from peternewman/master-resync
peternewman Sep 11, 2022
bb20eac
Merge branch '0.10' of https://github.com/openlightingproject/ola int…
peternewman Nov 17, 2022
235315e
Merge pull request #1796 from peternewman/master-resync
peternewman Nov 18, 2022
d6b6f41
UART plugin recovers granularity if timing improves
Dec 2, 2022
22e77da
fixed minor lint issues
Dec 5, 2022
4e475e0
applied UART plugin fix on branch 0.10
Dec 5, 2022
83b6f48
cleared content
Dec 5, 2022
b5a78b2
Merge branch 'master' of github.com:markus983/ola
Dec 5, 2022
aa3c21b
fixed lint issue - using spaces instead of tabs
markus983 Dec 6, 2022
97a1d17
fixed calculation of frame time
Dec 15, 2022
acee97b
Merge pull request #1 from markus983/0.10
markus983 Dec 15, 2022
ed8cb5b
introduced constants to avoid hardcoded numbers and did some minor re…
Feb 24, 2023
adc041c
Merge branch '0.10'
Feb 24, 2023
5657ca4
Merge branch 'master' of github.com:markus983/ola
Feb 24, 2023
b53b967
re-added missing files due to skrewed up git-history
Feb 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
40 changes: 33 additions & 7 deletions plugins/uartdmx/UartDmxThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,14 @@ bool UartDmxThread::WriteDMX(const DmxBuffer &buffer) {
* The method called by the thread
*/
void *UartDmxThread::Run() {
TimeStamp ts1, ts2;
TimeStamp ts1, ts2, ts3;
Clock clock;
CheckTimeGranularity();
DmxBuffer buffer;

int frameTime = static_cast<int>(floor(
(m_malft / static_cast<double>(1000)) + static_cast<double>(0.5)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I've just spotted this calculation won't be right for this plugin.
malft is Mark After Last Frame Time

The code you've copied it from is:

int frameTime = static_cast<int>(floor(
(static_cast<double>(1000) / m_frequency) + static_cast<double>(0.5)));

Which has a default frequency of 30:

static const uint8_t DEFAULT_FREQUENCY = 30;

Which gives:
=floor(1000/30)+0.5
=floor(33.33)+0.5
=33+0.5
=33.5

Whereas the input we've got here is the break time and the mark after last frame time (both in microseconds). So the frame time is
break time+(number of slots*slot time)+mark after last frame time

Your calculation will always be 0.5 with the default MALFT.

The standard is available here (E1.11):
https://tsp.esta.org/tsp/documents/published_docs.php

But essentially the break to break timing should be between 1204 microseconds and 1 second.

The standard also defines a minimum update time for 513 slots of 22.7 milliseconds (that appears to disagree with the minimum bit time from my calculations, but it's in the right ballpark).

So I suspect the easy fix here would be to find a frame time based on the minimum time for 513 slots plus the configured break and MALFT times. The nicer option would be to consider the number of slots being sent, but in both cases we should probably honour the minimum break to break time too, so we don't send too fast!

Which essentially is the conclusion that @richardash1981 and @rewolff reached in #1087 !


// Setup the widget
if (!m_widget->IsOpen())
m_widget->SetupOutput();
Expand All @@ -93,6 +96,8 @@ void *UartDmxThread::Run() {
buffer.Set(m_buffer);
}

clock.CurrentMonotonicTime(&ts1);

if (!m_widget->SetBreak(true))
goto framesleep;

Expand All @@ -110,7 +115,31 @@ void *UartDmxThread::Run() {

framesleep:
// Sleep for the remainder of the DMX frame time
usleep(m_malft);
clock.CurrentMonotonicTime(&ts2);
TimeInterval elapsed = ts2 - ts1;

if (m_granularity == GOOD) {
while (elapsed.InMilliSeconds() < frameTime) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above this value, or the calculation of this value, needs changing...

usleep(1000);
clock.CurrentMonotonicTime(&ts2);
elapsed = ts2 - ts1;
}
} else {
// See if we can drop out of bad mode.
usleep(1000);
markus983 marked this conversation as resolved.
Show resolved Hide resolved
clock.CurrentMonotonicTime(&ts3);
TimeInterval interval = ts3 - ts2;
if (interval.InMilliSeconds() <= BAD_GRANULARITY_LIMIT) {
m_granularity = GOOD;
OLA_INFO << "Switching from BAD to GOOD granularity for UART thread";
}

elapsed = ts3 - ts1;
while (elapsed.InMilliSeconds() < frameTime) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And again.

clock.CurrentMonotonicTime(&ts2);
elapsed = ts2 - ts1;
}
}
}
return NULL;
}
Expand All @@ -122,17 +151,14 @@ void *UartDmxThread::Run() {
void UartDmxThread::CheckTimeGranularity() {
TimeStamp ts1, ts2;
Clock clock;
/** If sleeping for 1ms takes longer than this, don't trust
* usleep for this session
*/
markus983 marked this conversation as resolved.
Show resolved Hide resolved
const int threshold = 3;

clock.CurrentMonotonicTime(&ts1);
usleep(1000);
clock.CurrentMonotonicTime(&ts2);

TimeInterval interval = ts2 - ts1;
m_granularity = interval.InMilliSeconds() > threshold ? BAD : GOOD;
m_granularity = (interval.InMilliSeconds() > BAD_GRANULARITY_LIMIT) ?
BAD : GOOD;
OLA_INFO << "Granularity for UART thread is "
<< (m_granularity == GOOD ? "GOOD" : "BAD");
}
Expand Down
1 change: 1 addition & 0 deletions plugins/uartdmx/UartDmxThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class UartDmxThread : public ola::thread::Thread {
void CheckTimeGranularity();

static const uint32_t DMX_MAB = 16;
static const uint32_t BAD_GRANULARITY_LIMIT = 3;
markus983 marked this conversation as resolved.
Show resolved Hide resolved

DISALLOW_COPY_AND_ASSIGN(UartDmxThread);
};
Expand Down