-
Notifications
You must be signed in to change notification settings - Fork 61
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
based on machine (pi5) set pwmchip to 2, Also set provider priority … #343
Conversation
…f Gpiod input/output, linuxFS i2c & pwm, so they are loaded and Pigpio is not. On all legacy Pi (! Pi5) do the opposite priority and pwmchip is 0
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 seem to be a C programmer by heart, using the int rval = 0;
at the beginning of the method. I think this can be changed to a simple;
BoardModel model = BoardModelDetection.current().getBoardModel();
if (model.getSoc() != Soc.BCM2712) {
return x;
} else {
return y;
}
But my bigger question is: Should we really have a different priority for the pigpio provider? What would the benefit of this be? Currently we know users will have a better experience with the Linux FS provider on a Raspberry Pi 5, as the Pigpio doesn't work. But if the user is on a Raspberry Pi 4, then it just depends which dependencies are added to their project.
We currently have three providers for PWM: raspberry, pigpio and linuxfs. The first is basically a stub, the latter the only that works on the Raspberry Pi 5. So in my opinion, that would be a reason to change the priority based on the Board type.
@FDelporte what is your opinion?
Furthermore, the |
Good idea, I will add that to the BoardDetection |
From the tickets it's clear that adding the right dependencies is a problem for a lot of users. So I think the extra priority decision in the plugin can help to tell users to "include all dependencies" and let Pi4J decide which will be used. |
The linuxfs pwm does work on pi4 but only HW and the address having a different meaning I think the old code had linuxfs i2c higher than pigpio I am not sure what is less trouble for users moving to this code base if they have all providers in their pom file. I thought this made sense but Robert u don't and Frank i am not sure your preference I can agree with any plan. So maybe the way to explain your thoughts is us the pi4 output to say what provider u want for each ioType |
@eitch @FDelporte Forgot to add your names so u got notified |
The branch requires newly added PR in the develop branch
…n/out, linuxfs for i2c, all others are Pigpio
Ok, then lets keep it like this |
if(BoardInfoHelper.usesRP1()) { | ||
rval = 150; | ||
}else{ | ||
rval = 150; |
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.
value is the same in both if cases?
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, in both are the same to match what Robert did for 2.5 So I did the update and did pay attention to the fact both legs were equal.
Fixed
// the gpioD driver should be higher priority when on RP1 chip | ||
int rval = 0; | ||
if(BoardInfoHelper.usesRP1()) { | ||
rval = 150; |
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.
idem
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.
Should be the same as above.
fixed
// the linux FS driver should be higher priority when on RP1 chip | ||
int rval = 0; | ||
if(BoardInfoHelper.usesRP1()) { | ||
rval = 150; |
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.
idem
// the pigpio SPI driver should be used over the default | ||
return 100; | ||
// the Pigpio driver should be higher priority when NOT on RP1 chip. | ||
int rval = 0; |
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.
can be simplified as
int rval = 100;
if (BoardInfoHelper.usesRP1()) {
rval = 50;
}
…of Gpiod input/output, linuxFS i2c & pwm, so they are loaded and Pigpio is not. On all legacy Pi (! Pi5) do the opposite priority and pwmchip is 0. I still have the WEB pages updates to do.
@eitch Result, I also had to use the static way to set the Board info for selecting the pwmchip value. Repeated runs showed occasionally the Context was not set in the class, same as I hit with getPriority.
I decided on Pi5 to make the GpioD provider a higher priority then the linuxfs digital. Both higher than Pigpio on Pi5. Below are the providers loaded when all are available