Fixed connection quality display
This commit is contained in:
parent
2680402f2e
commit
7dacb18479
|
@ -628,9 +628,9 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
|
||||||
override fun connectionSuccessRatio(): Float {
|
override fun connectionSuccessRatio(): Float {
|
||||||
val attempts = connectionAttempts
|
val attempts = connectionAttempts
|
||||||
if (attempts == 0) {
|
if (attempts == 0) {
|
||||||
return 1.0F
|
return 0.0F
|
||||||
}
|
}
|
||||||
return successfulConnections.toFloat() * 100 / attempts.toFloat()
|
return successfulConnections.toFloat() / attempts.toFloat()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun reset() {
|
override fun reset() {
|
||||||
|
|
|
@ -244,7 +244,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
val connectionSuccessPercentage = podStateManager.connectionSuccessRatio() * 100
|
val connectionSuccessPercentage = podStateManager.connectionSuccessRatio() * 100
|
||||||
val successPercentageString = String.format("%.2f %%", podStateManager.connectionSuccessRatio())
|
val successPercentageString = String.format("%.2f %%", connectionSuccessPercentage)
|
||||||
val quality =
|
val quality =
|
||||||
"${podStateManager.successfulConnections}/${podStateManager.connectionAttempts} :: $successPercentageString"
|
"${podStateManager.successfulConnections}/${podStateManager.connectionAttempts} :: $successPercentageString"
|
||||||
bluetoothStatusBinding.omnipodDashBluetoothConnectionQuality.text = quality
|
bluetoothStatusBinding.omnipodDashBluetoothConnectionQuality.text = quality
|
||||||
|
|
Loading…
Reference in a new issue