Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
CrazyDude1994 committed Jan 25, 2021
2 parents 9b348f9 + 95634fd commit 63c2722
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ or you can donate to my patreon: https://www.patreon.com/android_rc_telemetry

# Special thanks
hyperion11 - Ardupilot support
RomanLut - fixes, new features

Alexey Stankevich - initial testing, feedback

Expand Down
12 changes: 8 additions & 4 deletions app/src/main/java/crazydude/com/telemetry/ui/MapsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ class MapsActivity : AppCompatActivity(), DataDecoder.Listener {

override fun onAltitudeData(altitude: Float) {
runOnUiThread {
this.altitude.text = "$altitude m"
this.altitude.text = "${"%.2f".format(altitude)} m"
}
}

Expand Down Expand Up @@ -1123,7 +1123,7 @@ class MapsActivity : AppCompatActivity(), DataDecoder.Listener {

override fun onCurrentData(current: Float) {
runOnUiThread {
this.current.text = "$current A"
this.current.text = "${"%.2f".format(current)} A"
}
}

Expand Down Expand Up @@ -1153,7 +1153,10 @@ class MapsActivity : AppCompatActivity(), DataDecoder.Listener {
}

private fun updateVoltage() {
this.voltage.text = "$lastVBAT (${"%.2f".format(lastCellVoltage)}) V"
if ( lastCellVoltage > 0 )
this.voltage.text = "${"%.2f".format(lastVBAT)} (${"%.2f".format(lastCellVoltage)}) V"
else
this.voltage.text = "${"%.2f".format(lastVBAT)} V"
}

override fun onDisconnected() {
Expand Down Expand Up @@ -1224,7 +1227,8 @@ class MapsActivity : AppCompatActivity(), DataDecoder.Listener {
when (batteryUnits) {
"mAh", "mWh" -> {
this.fuel.text = "$fuel $batteryUnits"
realFuel = ((1 - (4.2f - lastCellVoltage)).coerceIn(0f, 1f) * 100).toInt()
if ( lastCellVoltage > 0)
realFuel = ((1 - (4.2f - lastCellVoltage)).coerceIn(0f, 1f) * 100).toInt()
}
"Percentage" -> {
this.fuel.text = "$fuel%"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class SensorsActivity : AppCompatActivity(), SensorsAdapterListener {

recyclerView.viewTreeObserver.addOnGlobalLayoutListener {
MaterialShowcaseView.Builder(this)
.setTarget(linearLayoutManager.findViewByPosition(1)!!.findViewById(R.id.move))
.setTarget(linearLayoutManager.findViewByPosition(1)?.findViewById(R.id.move) ?: linearLayoutManager.findViewByPosition(2)?.findViewById(R.id.move))
.setMaskColour(Color.argb(180, 0, 0, 0))
.setDismissText("GOT IT")
.singleUse("sensors_guide1")
Expand Down

0 comments on commit 63c2722

Please sign in to comment.