openems icon indicating copy to clipboard operation
openems copied to clipboard

Bug in Edge2Edge in ModbusType Float64 fixed.

Open tsicking opened this issue 2 years ago • 8 comments

Fixed Typo: Changed UnsignedQuadrupleWordElement to FloatQuadrupleWordElement.

tsicking avatar Jul 11 '23 08:07 tsicking

Code Coverage

github-actions[bot] avatar Jul 11 '23 09:07 github-actions[bot]

Thanks a lot for this bug fix. I have a wish here; Can you please use new java 17 features here; in that case for switch case format like; return switch (type) { case UINT16, ENUM16 -> new UnsignedWordElement(address); case UINT32 -> new UnsignedDoublewordElement(address); case FLOAT32 -> new FloatDoublewordElement(address); case FLOAT64 -> new UnsignedQuadruplewordElement(address); case STRING16 -> new StringWordElement(address, 16); }; Thanks a lot.

huseyinsaht avatar Jul 12 '23 12:07 huseyinsaht

Hi Huseyin, thanks for your comment. I have done the needful :-)

tsicking avatar Jul 12 '23 14:07 tsicking

Code Coverage

github-actions[bot] avatar Jul 12 '23 14:07 github-actions[bot]

yep I have seen it. One return before switch case is enough and in my opinion we dont need this curly braces anymore. and we can use the default to return null back. Can you please check it again.

I would so write it;

private static AbstractModbusElement<?> generateModbusElement(ModbusType type, int address) {
	return switch (type) {
	case UINT16, ENUM16 -> 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;
	};
}

huseyinsaht avatar Jul 12 '23 14:07 huseyinsaht

yep I have seen it. One return before switch case is enough and in my opinion we dont need this curly braces anymore. and we can use the default to return null back. Can you please check it again.

I would so write it;

private static AbstractModbusElement<?> generateModbusElement(ModbusType type, int address) {
	return switch (type) {
	case UINT16, ENUM16 -> 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;
	};
}

Oh, I see. I will update in a minute. Haven't got used to the new switch-case format.

tsicking avatar Jul 12 '23 14:07 tsicking

yep I have seen it. One return before switch case is enough and in my opinion we dont need this curly braces anymore. and we can use the default to return null back. Can you please check it again. I would so write it;

private static AbstractModbusElement<?> generateModbusElement(ModbusType type, int address) {
	return switch (type) {
	case UINT16, ENUM16 -> 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;
	};
}

Oh, I see. I will update in a minute. Haven't got used to the new switch-case format.

👍🏻 Thanks a lot. I ll approve and inform Stefan.

huseyinsaht avatar Jul 12 '23 14:07 huseyinsaht

Code Coverage

github-actions[bot] avatar Jul 12 '23 14:07 github-actions[bot]

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #2265      +/-   ##
=============================================
+ Coverage      58.48%   58.49%   +0.01%     
  Complexity       159      159              
=============================================
  Files           2544     2544              
  Lines         108999   108999              
  Branches        8028     8028              
=============================================
+ Hits           63740    63748       +8     
+ Misses         42921    42915       -6     
+ Partials        2338     2336       -2     
:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Jan 23 '25 12:01 codecov[bot]

@sfeilmeier This PR is pretty old. Is there a specific reason for not merging it or did iit get lost in the crowd of PRs? Without this the Edge2EdgeEss will not work. If there is no specific reason we would add the missing Junit tests in the next week.

clehne avatar Jan 24 '25 19:01 clehne