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