#
# Copyright (c) 2019 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
#

menu "GPS_CONTROL"

config GPS_CONTROL
	bool "GPS controller module for nRF9160 GPS"
	default y if BOARD_NRF9160_PCA20035NS
	select NRF9160_GPS

config GPS_CONTROL_ON_LONG_PRESS
	bool "Control the GPS state with button"
	default y
	help
	  Control the GPS operation with long-press on the button.
	  Press for 5 seconds to enable, or 5 seconds to disable.

config GPS_CONTROL_PSM_ENABLE_ON_START
	bool "Enable PSM when starting GPS"
	default y
	help
	  The nRF9160 modem needs to be set in PSM mode for the GPS to start
	  searching for satellites. Enabling this option will do so
	  automatically, otherwise the application must handle it.

config GPS_CONTROL_PSM_DISABLE_ON_STOP
	bool "Disable PSM when stopping GPS"
	default y
	help
	  Selecting this option will disable PSM when the GPS is stopped.
	  During a PSM interval, the device is not reachable from the outside
	  until the interval times out, or the device itself attempts to
	  send data on the link.

config GPS_CONTROL_FIRST_FIX_CHECK_DELAY
	int "Time from Cloud conenction until first fix check"
	default 30
	help
	  The amount of time that should pass between successfully establishing
	  connection to cloud until first attempt to get position fix.
	  Attempting to get a fix means entering PSM mode, in which the device
	  is not reachable for the duration of the interval, or until the
	  device itself sends data and then for the duration for the set
	  active time thereafter.

config GPS_CONTROL_FIX_CHECK_INTERVAL
	int "Interval in seconds to between check for position fix"
	default 120
	help
	  The fix check interval gives the interval for how long it will go
	  between each retry to achieve position fix. The actual fix time will
	  vary with factors such as satellite coverage, surrounding buildings
	  and landscape, PSM interval and activty time requested and granted
	  by the network.

config GPS_CONTROL_FIX_TRY_TIME
	int "Time in seconds to try to get fix"
	default 180
	help
	  Amount of time the device will attempt to get position fix. Note that
	  if the interval is interrupted by the device sending data, the timer
	  is not reset, and the actual try time will be shortened due to
	  the device not being in PSM mode all the time. If fix is not acquired
	  before it times out, the device will try to get fix again in
	  GPS_CONTROL_FIX_CHECK_INTERVAL seconds. If GPS_CONTROL_FIX_COUNT is reached
	  before the full GPS_CONTROL_FIX_TRY_TIME has passed, the GPS will be stopped.

config GPS_CONTROL_FIX_COUNT
	int "Number of position fix before stopping GPS"
	default 3
	help
	  The number of fixes to get before stopping the GPS, within the time
	  set in GPS_CONTROL_FIX_CHECK_INTERVAL.

config GPS_CONTROL_MAX_FAILED_FIX_ATTEMPTS
	int "Number of failed fix attempts before stopping GPS"
	default 3
	help
	  Number of retries to get fix before shutting down the GPS until user
	  input tells it to start retrying.

module = GPS_CONTROL
module-str = GPS controller
source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config"

endmenu

