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