Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 34ae7433 authored by Ellen Poe's avatar Ellen Poe
Browse files

Merge branch 'ellenhp/ferrostar_wrapper_cleanup' into 'main'

refactor: move literals in FerrostarWrapper.kt to companion object

See merge request e/os/cardinal!42
parents 168ed4e4 c72bbac9
Loading
Loading
Loading
Loading
Loading
+23 −10
Original line number Diff line number Diff line
@@ -121,11 +121,11 @@ class FerrostarWrapper(
            httpClient = OkHttpClientProvider(OkHttpClient()),
            locationProvider = locationProvider,
            navigationControllerConfig = NavigationControllerConfig(
                waypointAdvance = WaypointAdvanceMode.WaypointWithinRange(100.0),
                stepAdvanceCondition = stepAdvanceDistanceEntryAndExit(30u, 5u, 32u),
                arrivalStepAdvanceCondition = stepAdvanceDistanceToEndOfStep(30u, 32u),
                routeDeviationTracking = RouteDeviationTracking.StaticThreshold(15U, 50.0),
                snappedLocationCourseFiltering = CourseFiltering.SNAP_TO_ROUTE
                waypointAdvance = WaypointAdvanceMode.WaypointWithinRange(WAYPOINT_ADVANCE_RANGE),
                stepAdvanceCondition = stepAdvanceDistanceEntryAndExit(STEP_ADVANCE_DISTANCE_TO_END.toUShort(), STEP_ADVANCE_DISTANCE_AFTER_END.toUShort(), STEP_ADVANCE_MINIMUM_HORIZONTAL_ACCURACY.toUShort()),
                arrivalStepAdvanceCondition = stepAdvanceDistanceToEndOfStep(ARRIVAL_STEP_ADVANCE_DISTANCE.toUShort(), ARRIVAL_STEP_ADVANCE_MINIMUM_HORIZONTAL_ACCURACY.toUShort()),
                routeDeviationTracking = RouteDeviationTracking.StaticThreshold(ROUTE_DEVIATION_MINIMUM_ACCURACY.toUShort(), ROUTE_DEVIATION_MAX_DEVIATION),
                snappedLocationCourseFiltering = COURSE_FILTERING
            ),
            foregroundServiceManager = foregroundServiceManager,
        )
@@ -152,14 +152,27 @@ class FerrostarWrapper(
            httpClient = OkHttpClientProvider(OkHttpClient()),
            locationProvider = locationProvider,
            navigationControllerConfig = NavigationControllerConfig(
                waypointAdvance = WaypointAdvanceMode.WaypointWithinRange(100.0),
                stepAdvanceCondition = stepAdvanceDistanceEntryAndExit(30u, 5u, 32u),
                arrivalStepAdvanceCondition = stepAdvanceDistanceToEndOfStep(30u, 32u),
                routeDeviationTracking = RouteDeviationTracking.StaticThreshold(15U, 50.0),
                snappedLocationCourseFiltering = CourseFiltering.SNAP_TO_ROUTE
                waypointAdvance = WaypointAdvanceMode.WaypointWithinRange(WAYPOINT_ADVANCE_RANGE),
                stepAdvanceCondition = stepAdvanceDistanceEntryAndExit(STEP_ADVANCE_DISTANCE_TO_END.toUShort(), STEP_ADVANCE_DISTANCE_AFTER_END.toUShort(), STEP_ADVANCE_MINIMUM_HORIZONTAL_ACCURACY.toUShort()),
                arrivalStepAdvanceCondition = stepAdvanceDistanceToEndOfStep(ARRIVAL_STEP_ADVANCE_DISTANCE.toUShort(), ARRIVAL_STEP_ADVANCE_MINIMUM_HORIZONTAL_ACCURACY.toUShort()),
                routeDeviationTracking = RouteDeviationTracking.StaticThreshold(ROUTE_DEVIATION_MINIMUM_ACCURACY.toUShort(), ROUTE_DEVIATION_MAX_DEVIATION),
                snappedLocationCourseFiltering = COURSE_FILTERING
            ),
            foregroundServiceManager = foregroundServiceManager
        )
        core.spokenInstructionObserver = androidTtsObserver
    }

    companion object {
        const val WAYPOINT_ADVANCE_RANGE = 100.0
        const val STEP_ADVANCE_DISTANCE_TO_END = 30u
        const val STEP_ADVANCE_DISTANCE_AFTER_END = 5u
        const val STEP_ADVANCE_MINIMUM_HORIZONTAL_ACCURACY = 32u
        const val ARRIVAL_STEP_ADVANCE_DISTANCE = 30u
        const val ARRIVAL_STEP_ADVANCE_MINIMUM_HORIZONTAL_ACCURACY = 32u
        const val ROUTE_DEVIATION_MINIMUM_ACCURACY = 15u
        const val ROUTE_DEVIATION_MAX_DEVIATION = 50.0
        val COURSE_FILTERING = CourseFiltering.SNAP_TO_ROUTE

    }
}