Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit64a976c

Browse files
committed
Polisihing Battery
1 parent4e1d525 commit64a976c

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

‎src/main/java/ev3dev/sensors/Battery.java‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@ private Battery() {
6767
currentRereader =newDataChannelRereader(batteryPath +"/" +batteryEv3 +"/" +current);
6868
}
6969

70-
publicintgetVoltageMicroVolts() {
70+
publicintgetVoltageMicroVolt() {
7171
returnInteger.parseInt(voltageRereader.readString());
7272
}
7373

7474
@Override
7575
publicintgetVoltageMilliVolt() {
76-
returngetVoltageMicroVolts() /1000;
76+
returngetVoltageMicroVolt() /1000;
7777
}
7878

7979
/**
@@ -82,23 +82,21 @@ public int getVoltageMilliVolt() {
8282
* @return voltage
8383
*/
8484
publicfloatgetVoltage() {
85-
returngetVoltageMicroVolts() /1000000f;
85+
returngetVoltageMicroVolt() /1000000f;
8686
}
8787

8888
//TODO Review output
8989
//TODO Review units
9090

9191
/**
92-
* Returns the current of the battery in amps.
93-
*
94-
* @return current
92+
* @return current from the battery in amps, or Float.NaN if run on something other than EV3BRICK
9593
*/
9694
publicfloatgetBatteryCurrent() {
9795
if (CURRENT_PLATFORM.equals(EV3DevPlatform.EV3BRICK)) {
9896
returnFloat.parseFloat(currentRereader.readString());
9997
}else {
10098
LOGGER.warn("This method is not available for {} & {}",EV3DevPlatform.PISTORMS,EV3DevPlatform.BRICKPI);
101-
return-1f;
99+
returnFloat.NaN;
102100
}
103101
}
104102

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp