← 输入框|github.com|刷新
Skip to content

Prototype use of DataChannelRereader in EV3GyroSensor - #795

Closed
dwalend wants to merge 1 commit into
ev3dev-lang-java:sysfs_perf2from
dwalend:gyroRereader
Closed

dwalend wants to merge 1 commit into
ev3dev-lang-java:sysfs_perf2from
dwalend:gyroRereader

Conversation

@dwalend

@dwalend dwalend commented Jan 15, 2021

Copy link
Copy Markdown
Contributor

Prototype of using DataChannelRereader in EV3Gyro

@jabrena

jabrena commented Jan 16, 2021

Copy link
Copy Markdown
Member

Reviewing code

@jabrena jabrena left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Waiting for changes

* See {@link lejos.robotics.SampleProvider leJOS conventions for SampleProviders}
*/
public SampleProvider getAngleMode() {
public EV3GyroAngleMode getAngleMode() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every mode returns a SampleProvider

@dwalend dwalend Jan 18, 2021 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EV3GyroAngleMode is a SampleProvider - by implementing SensorMode.

switchMode(MODE_RATE_ANGLE, SWITCH_DELAY);
}

public static class EV3GyroAngleMode implements SensorMode {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That mode is not necessary. I understand that you added the method getAngle() but it breaks the contract.
It is necessary to upgrade with DataChannelRereader:
https://github.com/ev3dev-lang-java/ev3dev-lang-java/blob/master/src/main/java/ev3dev/sensors/GenericMode.java

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In what way does it break the contract?

Touching GenericMode is a much broader change. I'll put in a pull request to show that.

public EV3GyroAngleMode getAngleMode() {
switchMode(MODE_ANGLE, SWITCH_DELAY);
return getMode(1);
return (EV3GyroAngleMode)getMode(1);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not necessary to change that line

@jabrena

jabrena commented Mar 12, 2024

Copy link
Copy Markdown
Member

Old proposal

@jabrena jabrena closed this Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants