Updated dependencies, code cleanup

This commit is contained in:
Arty Bishop committed 2020-09-20 15:31:28 +01:00
1 parent dd6151a6cf
commit d8d6a3263e
2 files changed
+20 -24

No files matched your search

@@ -92,10 +92,10 @@ class PolarViewFragment : Fragment(R.layout.fragment_polar_view), SensorEventLis
override fun onAccuracyChanged(sensor: Sensor?, accuracy: Int) {}
override fun onSensorChanged(event: SensorEvent?) {
event?.let { useSoftwareSensor(it) }
event?.let { calculateAzimuth(it) }
}
private fun useSoftwareSensor(event: SensorEvent) {
private fun calculateAzimuth(event: SensorEvent) {
val rotationValues = FloatArray(9)
SensorManager.getRotationMatrixFromVector(rotationValues, event.values)
val orientationValues = FloatArray(3)
@@ -105,11 +105,6 @@ class PolarViewFragment : Fragment(R.layout.fragment_polar_view), SensorEventLis
polarView?.rotation = -(roundedAzimuth + magneticDeclination)
}
private fun filterSensorData(input: FloatArray, output: FloatArray) {
val filterStep = 1f
input.indices.forEach { output[it] = output[it] + filterStep * (input[it] - output[it]) }
}
private fun observePasses() {
viewModel.getPassList().observe(viewLifecycleOwner, { result ->
if (result is Result.Success) {