Skip to content

Commit e2fa111

Browse files
committed
fix(modem): Use generated AT command definitions for IDE navigation
BREAKING CHANGE: inc headers for AT command definitions are no longer used directly, but pregenerated into *.h(pp)
1 parent d2e94e5 commit e2fa111

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+4839
-560
lines changed

.github/workflows/modem__build-host-tests.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,21 @@ jobs:
9191
run_executable: false
9292
run_coverage: false
9393
pre_run_script: "esp-protocols/components/esp_modem/test/host_test/env.sh"
94+
95+
esp_modem_generated_commands:
96+
if: contains(github.event.pull_request.labels.*.name, 'modem') || github.event_name == 'push'
97+
name: Generated commands compatibility
98+
runs-on: ubuntu-latest
99+
steps:
100+
- name: Checkout esp-protocols
101+
uses: actions/checkout@v4
102+
- name: Compat check
103+
shell: bash
104+
run: |
105+
sudo apt-get update -y
106+
sudo apt-get install -y astyle
107+
cd components/esp_modem
108+
find examples/ -type f -regex '.*/generate/.*\.\(hpp\|cpp\)' -exec ./scripts/generate.sh {} \;
109+
./scripts/generate.sh
110+
git diff --name-only
111+
git diff --quiet

components/esp_modem/CMakeLists.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ else()
1515
endif()
1616

1717

18+
if(CONFIG_ESP_MODEM_ENABLE_DEVELOPMENT_MODE)
19+
set(command_dir "generate") # using in-place macro expansion with AT commands
20+
else()
21+
set(command_dir "command") # using pre-generated AT commands
22+
endif()
23+
24+
1825
set(srcs ${platform_srcs}
1926
"src/esp_modem_dte.cpp"
2027
"src/esp_modem_dce.cpp"
@@ -26,12 +33,10 @@ set(srcs ${platform_srcs}
2633
"src/esp_modem_term_fs.cpp"
2734
"src/esp_modem_vfs_uart_creator.cpp"
2835
"src/esp_modem_vfs_socket_creator.cpp"
29-
"src/esp_modem_modules.cpp")
30-
31-
set(include_dirs "include")
36+
"${command_dir}/src/esp_modem_modules.cpp")
3237

3338
idf_component_register(SRCS "${srcs}"
34-
INCLUDE_DIRS "${include_dirs}"
39+
INCLUDE_DIRS include ${command_dir}/include
3540
PRIV_INCLUDE_DIRS private_include
3641
REQUIRES ${dependencies})
3742

components/esp_modem/Kconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,15 @@ menu "esp-modem"
9292
If enabled, the library dumps all transmitted and received data.
9393
This option is only used for debugging.
9494

95+
config ESP_MODEM_ENABLE_DEVELOPMENT_MODE
96+
bool "Use development mode"
97+
default n
98+
help
99+
We use pre-generated headers and sources with common AT commands.
100+
This is useful for using ESP-MODEM library with IDEs and code navigation.
101+
When developing ESP-MODEM library, it's usually more convenient
102+
to work with sources directly, using C-preprocessor's metaprogramming.
103+
Set this to 'y' if you're making changes to the actual sources of
104+
the AT command definitions (typically in esp_modem_command_declare.inc)
105+
95106
endmenu

0 commit comments

Comments
 (0)