L1NNA/SV1DUR

Write delay

JBanks opened this issue · 2 comments

There should be a delay between 4 microseconds and 12 microseconds between the receipt and response for a message. Maybe we should just introduce a delay before the following lines:

https://github.com/L1NNA/I-NEED-A-NAME/blob/c51d235acbcdaa7a90136d3fff83d2665244ed4c/pkg/src/sys.rs#L253

https://github.com/L1NNA/I-NEED-A-NAME/blob/c51d235acbcdaa7a90136d3fff83d2665244ed4c/pkg/src/sys.rs#L323

Actually the write delays is done asynchronously by polling. When the write function is called, we only push it to the write queue with the timestamp of actually writing it (added artificial delays controlled on the system object)

https://github.com/L1NNA/I-NEED-A-NAME/blob/c51d235acbcdaa7a90136d3fff83d2665244ed4c/pkg/src/sys.rs#L416-L417

Then the device goes back to the normal event loop so it can still file events while the write is pending (by mil1553 design). Once the current time stamp is later than the specified write delayed timestamp, it will be sent out here:

https://github.com/L1NNA/I-NEED-A-NAME/blob/c51d235acbcdaa7a90136d3fff83d2665244ed4c/pkg/src/sys.rs#L655-L672

Only the messages that has entry.0 <= current (0 is the timestamp) will be written out.

Ah! Thank you! I missed this part. I'll close this issue.