-
Notifications
You must be signed in to change notification settings - Fork 2
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
Spin out driver subclass #4
base: master
Are you sure you want to change the base?
Conversation
…o include edge cases and sad paths.
…waiting. Method call to pin_wait_for now blocks instead. Test coverage up to 100%
|
||
module PiPiper | ||
self.driver= PiPiper::Sysfs | ||
self.driver = PiPiper::Sysfs::Driver.new |
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.
Unless you changed PiPiper's code #driver=
need a subclass of Driver, not an instance.
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.
Yes you are correct, forgot to remove the .new
. I will fix this.
Hi @zsyed91, |
@elmatou see my note in the code regarding |
Hi @zsyed91, |
@elmatou Yeah I have been insanely busy this past week with some life stuff. I will push the suggestions soon. Glad you tested I2C with the code and that it works 😄 |
My bad, select was and should listen to value_file of course, edge_file is only for setup. As far I understand, FileWatcher use modification time, I get through the code and only found this line referring to the file : as for select(2) not blocking on read. We need to investigate more, the SO thread you mentioned was listening on the reading part of the file descriptor and not the error part hence the difference in behaviour. |
Sure I can take a look again. I will have to look at the difference between checking errors vs just reading via select. If it helps, I can pull that logic out of this PR and open a separate one containing those changes. |
I think it would be best to keep atomic/feature oriented PR. I will
|
Hi @zsyed91, |
@elmatou Hey, sorry I just switched jobs and am currently moving cross-country so this slipped through the cracks. I just pushed the changes. I fixed the driver class and removed the |
…ch. Removed commented out driver line and added a placeholder in the spec_helper until 3.0 PiPiper is released
14b79a9
to
c7b7a01
Compare
Ok, thx you, I'm gonna do a full review of the PR, and it will be good to merge |
Awesome, let me know and then I will merge if everything is good to go 😄 |
module PiPiper | ||
def self.driver=(driver) | ||
# Placeholder for testing, PiPiper 3.0 contains this so we can remove | ||
end |
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.
you are right, we should remove this.
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.
right, once we release 3.0 officially I can open a new pr to remove this.
I just pointed to 2 methods not useful for now. |
Driver
subclassFileWatcher
instead ofIO.select
to prevent 100% cpu usage when waiting for value to change. Method now blocks until value is updated.