[Edge] Controller.Evcs: fix awaitLastChanges checking INCREASING twice instead of DECREASING#3668
Open
rishabhvaish wants to merge 2 commits intoOpenEMS:developfrom
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #3668 +/- ##
=============================================
+ Coverage 60.13% 60.19% +0.06%
Complexity 104 104
=============================================
Files 3209 3209
Lines 141232 141232
Branches 10402 10402
=============================================
+ Hits 84910 84994 +84
+ Misses 53157 53075 -82
+ Partials 3165 3163 -2 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
awaitLastChanges()method inControllerEvcsImplhas a copy-paste bug — it checks forChargeState.INCREASINGtwice instead of checking for bothINCREASINGandDECREASING.This means the controller never waits for the EVCS response time when the charge state is DECREASING. The
ChargeStateHandlercorrectly sets DECREASING and starts a pause timer, butapplyHysteresisskips the wait and immediately calculates a new power target. During PV excess charging, when available solar power drops, the controller sends repeated decreasing commands every cycle without waiting for the car to respond — causing power oscillations instead of smooth ramp-down.Added a test that verifies both INCREASING and DECREASING states cause the controller to hold the last charge power.