-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Openwb-native: follow-up #25334
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
Openwb-native: follow-up #25334
Conversation
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.
Hey there - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `charger/openwb-native_linux.go:144` </location>
<code_context>
-func (wb *OpenWbNative) gpioExecute(worker func() error) error {
+// runGpioSequence executes a sequence of GPIO operations
+func (wb *OpenWbNative) runGpioSequence(seq []gpioAction) error {
if err := wb.Enable(false); err != nil {
return err
</code_context>
<issue_to_address>
**issue (complexity):** Consider keeping the new generic GPIO sequence runner, as it reduces duplication and maintains clarity.
No action needed—this abstraction cleanly eliminates duplicated GPIO setup/teardown while keeping each sequence concise. The generic runner is well scoped and doesn’t add undue complexity.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| pinGpioCP.Low() | ||
| return nil | ||
| return wb.runGpioSequence([]gpioAction{ | ||
| {pin: cpPin, high: true, delay: time.Second}, // enable phases switch relay (NO), disconnect CP |
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.
Schade, dass man hier nicht einfach pin.High anstatt pin und high als Parameter mitgeben kann. Oder ginge das, wenn man alle PINs einfach bei Start auf Output schalten würde? Das ist ja eine statische Einstellung?
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.
Verstehe nicht was du meinst.
pin ist die Nummer des GPIO-Pins und high ist der gewünschte digitale Zustand (an/aus bzw. 1/0).
Mit Output hat das doch hier nichts zu tun?
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.
Code wäre schöner, wenn nur die high/lo funktion übergeben werden müssten. Hier muss aber auch das pin übergeben werden, damit Output() aufgerufen werden kann. Brauchts das denn? Falls ja: reichts nicht, das einmal beim Start zu machen?
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.
Ah, jetzt.
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.
Und der Code wäre auch noch schneller wenn nicht für jeden Zustandswechsel bei jedem Pin open/close aufgerufen würde.
Wobei man bei der Ansteuerung von Relais über die Notwendigkeit streiten kann...
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.
Also #25349
|
Schöner commit Title wäre gut. Mit "follow-up" lässt sich in den Release Notes wenig anfangen. |
|
ich bekomme beim kompilieren: |
|
Das hat aber, soweit ich das sehe, mit diesem PR nichts zu tun. |
sorry mein fehler - ist wohl schon schon gefixt. |
Follow-up from #21984