macOS extremely slow refresh rate when using a serial-based controller due to break time
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 30/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- embedded-iot, operating-systems
Hướng nghiên cứu
Bắt đầu trong PyDMXControl/controllers/_SerialController.py, tại vòng lặp Ticker và lệnh gọi send_break của PySerial. Điều tra hành vi của break-time trên macOS và workaround break_condition đã được ghi chép; hoàn thành nghĩa là đạt được refresh rate nhanh hơn mà không vi phạm các yêu cầu về timing của DMX.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
This is more of an FYI for anyone else that tries to use this on macOS than an issue I expect fixed, but I'll document it here in case anyone wants to implement a more elegant solution.
When running PyDMXControl on macOS, the refresh rate for packets sent out is capped around ~2Hz due to the underlying implementation of sending a break in PySerial. A user in this thread helpful did some digging into the tcsendbreak function and found that it's hardcoded to 400ms on macOS, no matter what duration is passed in: link.
That means that the Ticker loop in this module blocks on the the call to PySerial's send_break function for 400ms and cannot spin any faster than that. My current workaround is to comment out the send_break and sleep calls here and instead replace it with:
self.__device.break_condition = True
sleep(5e-6)
self.__device.break_condition = False
sleep(1e-6)
Those sleep times are actually way shorter than what is supported by the DMX standard (min 88uS and 10uS respectively I think), but since the python sleep module isn't really accurate below 1ms, the actual break and MAB measured with a logic analyser ended up around 200uS and 300uS respectively. That will probably vary greatly depending on the system, but thankfully the DMX spec only mandates minimum lengths for both, and most DMX devices will do just find with longer breaks/MABs.
I don't know enough python to know if there are more reliable ways to do timing on a microsecond level, but this hack works well enough for the basic bringup I need to do with this module.
- Ngôn ngữ chính
- Python
- Star
- 143
- Fork
- 23
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của MattIPv4/PyDMXControl
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
MattIPv4/PyDMXControl#60 · 2 bình luận ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
MattIPv4/PyDMXControl#56 · 2 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
MattIPv4/PyDMXControl#55 · 3 bình luận ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 18/100
MattIPv4/PyDMXControl#52 · 5 bình luận ·
-
Custom Channels Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
MattIPv4/PyDMXControl#51 · 3 bình luận ·
Tất cả issue của MattIPv4/PyDMXControl
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
browser-use/browser-use#5905 ·
-
type: enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
ynput/ayon-python-api#363 ·
-
bug needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
modelscope/FunASR#3728 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
open-compass/opencompass#2655 ·