Skip to content

Commit

Permalink
Update Switch statement in getStartStopTarget
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasjbhayes committed Jan 13, 2025
1 parent cbcbba8 commit 3b59e5d
Showing 1 changed file with 9 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -373,22 +373,16 @@ public void setStartStop(StartStop value) throws OpenemsNamedException {

@Override
public StartStop getStartStopTarget() {
switch (this.config.startStop()) {
case AUTO:
// read StartStop-Channel
return this.startStopTarget.get();

case START:
// force START
return StartStop.START;

case STOP:
// force STOP
return StartStop.STOP;
}
return switch (this.config.startStop()) {
case AUTO -> this.startStopTarget.get(); // read StartStop-Channel
case START -> StartStop.START; // force START
case STOP -> StartStop.STOP; // force STOP
default -> {
assert false : "Unexpected startStop value";
yield StartStop.UNDEFINED; // can never happen

Check warning on line 382 in io.openems.edge.battery.pylontech/src/io/openems/edge/battery/pylontech/powercubem2/PylontechPowercubeM2BatteryImpl.java

View check run for this annotation

Codecov / codecov/patch

io.openems.edge.battery.pylontech/src/io/openems/edge/battery/pylontech/powercubem2/PylontechPowercubeM2BatteryImpl.java#L381-L382

Added lines #L381 - L382 were not covered by tests
}
};

assert false;
return StartStop.UNDEFINED; // can never happen
}

@Override
Expand Down

0 comments on commit 3b59e5d

Please sign in to comment.