Skip to content

Conversation

@premultiply
Copy link
Member

Follow-up from #21984

  1. RfIdContainer.Get() thread-safe gemacht (rfid.go)
  2. NewRFIDHandler Docstring korrigiert (rfid.go)
  3. GPIO Operationen refactored (openwb-native_linux.go)

@premultiply premultiply changed the title Device/openwb native fup Openwb-native: follow-up Nov 15, 2025
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a 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>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
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
Copy link
Member

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?

Copy link
Member Author

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?

Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, jetzt.

Copy link
Member Author

@premultiply premultiply Nov 16, 2025

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...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also #25349

@andig andig added the infrastructure Basic functionality label Nov 16, 2025
@premultiply premultiply merged commit 4f5a889 into master Nov 16, 2025
8 checks passed
@premultiply premultiply deleted the device/openwb-native-fup branch November 16, 2025 11:18
@andig
Copy link
Member

andig commented Nov 16, 2025

Schöner commit Title wäre gut. Mit "follow-up" lässt sich in den Release Notes wenig anfangen.

@TobiasHuber1980
Copy link
Contributor

ich bekomme beim kompilieren:

MacBookPro:evcc tobi$ make lint
golangci-lint run
0 issues.
go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -test -category "-omitzero" -c 0 ./...
/Users/tobi/evcc/charger/openwb-native.go:17:70: interface{} can be replaced by any
17	func NewOpenWbNativeFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
exit status 3
make: *** [lint] Error 1

@premultiply
Copy link
Member Author

Das hat aber, soweit ich das sehe, mit diesem PR nichts zu tun.
Gerne neues Issue. Die Lösung ist trivial.

@TobiasHuber1980
Copy link
Contributor

TobiasHuber1980 commented Nov 16, 2025

Das hat aber, soweit ich das sehe, mit diesem PR nichts zu tun. Gerne neues Issue. Die Lösung ist trivial.

sorry mein fehler - ist wohl schon schon gefixt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infrastructure Basic functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants