Skip to content

Commit 47257dd

Browse files
committed
lib: sgp4: move SGP4 from app module to shared library
Move the SGP4 implementation from `app/src/modules/sgp4` to a new `lib/sgp4` library so it can be used as a proper Zephyr library, decoupled from the app module system. The new library splits `SGP4_PASS_PREDICT` into a separate Kconfig option. Tests are updated to use the new library path and enable `CONFIG_SGP4_PASS_PREDICT` via `prj.conf` instead of directly including source files. Also removes the `at_monitor` dependency from `sgp4_pass_predict.c`. Signed-off-by: Simen S. Røstad <simen.rostad@nordicsemi.no>
1 parent c209ff8 commit 47257dd

20 files changed

Lines changed: 54 additions & 31 deletions

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
# This CMake file is picked by the Zephyr build system because it is defined
55
# as the module CMake entry point (see zephyr/module.yml).
66

7+
add_subdirectory(lib)
78
add_subdirectory_ifdef(CONFIG_APP_CLOUD_MQTT examples/modules/cloud/)

Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
# as the module Kconfig entry point (see zephyr/module.yml). You can browse
66
# module options by going to Zephyr -> Modules in Kconfig.
77

8+
rsource "lib/Kconfig"
89
rsource "examples/modules/cloud/Kconfig.cloud_mqtt"

app/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,3 @@ add_subdirectory_ifdef(CONFIG_APP_LOCATION src/modules/location)
2929
add_subdirectory_ifdef(CONFIG_APP_CLOUD src/modules/cloud)
3030
add_subdirectory_ifdef(CONFIG_APP_FOTA src/modules/fota)
3131
add_subdirectory_ifdef(CONFIG_APP_STORAGE src/modules/storage)
32-
add_subdirectory_ifdef(CONFIG_APP_SGP4 src/modules/sgp4)

app/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ rsource "src/modules/fota/Kconfig.fota"
1616
rsource "src/modules/environmental/Kconfig.environmental"
1717
rsource "src/modules/button/Kconfig.button"
1818
rsource "src/modules/storage/Kconfig.storage"
19-
rsource "src/modules/sgp4/Kconfig.sgp4"
2019
rsource "memfault/Kconfig.memfault"
2120

2221
endmenu

app/src/modules/sgp4/CMakeLists.txt

Lines changed: 0 additions & 10 deletions
This file was deleted.

app/src/modules/sgp4/Kconfig.sgp4

Lines changed: 0 additions & 12 deletions
This file was deleted.

lib/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#
2+
# Copyright (c) 2026 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
add_subdirectory_ifdef(CONFIG_SGP4 sgp4)

lib/Kconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#
2+
# Copyright (c) 2026 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
menu "Libraries"
8+
9+
rsource "sgp4/Kconfig"
10+
11+
endmenu

lib/sgp4/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#
2+
# Copyright (c) 2026 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
zephyr_library()
8+
zephyr_library_sources(SGP4.c)
9+
zephyr_library_sources_ifdef(CONFIG_SGP4_PASS_PREDICT sgp4_pass_predict.c)
10+
zephyr_library_include_directories(${CMAKE_CURRENT_SOURCE_DIR})

lib/sgp4/Kconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#
2+
# Copyright (c) 2026 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
config SGP4
8+
bool "SGP4 satellite propagation library"
9+
help
10+
Enable Vallado SGP4 analytical orbit propagation (SGP4.c).
11+
12+
config SGP4_PASS_PREDICT
13+
bool "SGP4 satellite pass prediction"
14+
default n
15+
select SGP4
16+
select DATE_TIME
17+
help
18+
Enable satellite pass prediction using SGP4 and TLE/SIB32 data.

0 commit comments

Comments
 (0)