-
-
Notifications
You must be signed in to change notification settings - Fork 829
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
Remove guard timer #12053
Remove guard timer #12053
Conversation
if !enabled && lp.charging() { | ||
lp.log.WARN.Println("charger logic error: disabled but charging") | ||
enabled = true // treat as enabled when charging | ||
if lp.guardGracePeriodElapsed() { | ||
if err := lp.charger.Enable(true); err != nil { // also enable charger to correct internal state |
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.
Wann passiert das hier? Muss das enable nicht trotzdem gemacht werden?
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.
Ja, sehe ich auch so.
Ist auf jeden Fall schon mal ne ganze Menge Code, die hierdurch verschwinden würde. Auf jeden Fall lohnenswert 😄 |
So wünschenswert die Vereinfachung auch wäre, man wird aber auf Grund der verzögerten Reaktion mancher Charger nicht umhin kommen einen Timer zu haben, der ab der letzten Änderung des Enabled State läuft. Braucht man im Grunde überall da wo guardGracePeriodElapsed() aufgerufen wird. Ansonsten wird man mindestens sinnlose Fehlermeldungen bekommen, wahrscheinlich wird es schwer den Charger sinnvoll zu synchronisieren. In der momentanen Implementation steckt diesbezüglich viel Aufwand. Auf Wunsch mache ich einen Vorschlag. |
@MarkusGH kannst Du nochmal kurz zusammenfassen wofür |
Hier mein Vorschlag: #12084 @GrimmiMeloni: |
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.
Member guardUpdated
sollte dann konsequenterweise auch rausfliegen.
SyncCharger() ist zu stark ausgedünnt.
if !enabled && lp.charging() { | ||
lp.log.WARN.Println("charger logic error: disabled but charging") | ||
enabled = true // treat as enabled when charging | ||
if lp.guardGracePeriodElapsed() { | ||
if err := lp.charger.Enable(true); err != nil { // also enable charger to correct internal state |
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.
Ja, sehe ich auch so.
lp.elapsePVTimer() | ||
return nil |
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.
Die zwei müssen auch bleiben.
defer func() { | ||
lp.enabled = enabled | ||
lp.publish(keys.Enabled, lp.enabled) | ||
}() |
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.
Dieser defer Block muß bleiben.
@andig: Wollen wir wie von @GrimmiMeloni vorgeschlagen hier zumachen und in #12084 weitermachen? |
Fix #11953, Replace #12001
@GrimmiMeloni @MarkusGH der Versuch zeigt dass das nicht ganz trivial ist da mittlerweile einige Logik vom Guard Timer abhängt. Könnt ihr Euch das Diff mal bitte in Ruhe anschauen?
TODO