Skip to content
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

Bug in Edge2Edge in ModbusType Float64 fixed. #2265

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
import io.openems.edge.bridge.modbus.api.element.AbstractModbusElement;
import io.openems.edge.bridge.modbus.api.element.DummyRegisterElement;
import io.openems.edge.bridge.modbus.api.element.FloatDoublewordElement;
import io.openems.edge.bridge.modbus.api.element.FloatQuadruplewordElement;
import io.openems.edge.bridge.modbus.api.element.ModbusElement;
import io.openems.edge.bridge.modbus.api.element.StringWordElement;
import io.openems.edge.bridge.modbus.api.element.UnsignedDoublewordElement;
import io.openems.edge.bridge.modbus.api.element.UnsignedQuadruplewordElement;
import io.openems.edge.bridge.modbus.api.element.UnsignedWordElement;
import io.openems.edge.bridge.modbus.api.task.FC16WriteRegistersTask;
import io.openems.edge.bridge.modbus.api.task.FC3ReadRegistersTask;
Expand Down Expand Up @@ -363,20 +363,14 @@ protected abstract io.openems.edge.common.channel.ChannelId getWriteChannelId(
* @return the {@link ModbusElement}
*/
private static AbstractModbusElement<?> generateModbusElement(ModbusType type, int address) {
switch (type) {
case ENUM16:
case UINT16:
return new UnsignedWordElement(address);
case UINT32:
return new UnsignedDoublewordElement(address);
case FLOAT32:
return new FloatDoublewordElement(address);
case FLOAT64:
return new UnsignedQuadruplewordElement(address);
case STRING16:
return new StringWordElement(address, 16);
}
return null;
return switch (type) {
case ENUM16, UINT16 -> new UnsignedWordElement(address);
case UINT32 -> new UnsignedDoublewordElement(address);
case FLOAT32 -> new FloatDoublewordElement(address);
case FLOAT64 -> new FloatQuadruplewordElement(address);
case STRING16 -> new StringWordElement(address, 16);
default -> null;
};
}

/**
Expand Down