Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wifi remote]: Add example without esp_hosted #538

Merged
merged 4 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion .github/workflows/wifi_remote__build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

build_wifi_remote:
if: contains(github.event.pull_request.labels.*.name, 'wifi_remote') || github.event_name == 'push'
name: Build WiFi Remote
name: Build WiFi Remote Test
strategy:
matrix:
idf_ver: ["latest"]
Expand All @@ -49,3 +49,29 @@ jobs:
${IDF_PATH}/install.sh --enable-pytest
. ${IDF_PATH}/export.sh
python ./ci/build_apps.py ./components/esp_wifi_remote/${{matrix.test.path}} -vv --preserve-all

build_wifi_remote_example:
if: contains(github.event.pull_request.labels.*.name, 'wifi_remote') || github.event_name == 'push'
name: Build WiFi Remote Example
strategy:
matrix:
idf_ver: ["latest"]
example: [ { app: host, path: "examples/mqtt" }, { app: slave, path: "examples/server" }]
include:
- idf_ver: "latest"
example: { app: slave, path: "examples/server" }
warning: "Warning: The smallest app partition is nearly full"

runs-on: ubuntu-20.04
container: espressif/idf:${{ matrix.idf_ver }}
steps:
- name: Checkout esp-protocols
uses: actions/checkout@v3
- name: Build ${{ matrix.example.app }} with IDF-${{ matrix.idf_ver }}
env:
EXPECTED_WARNING: ${{ matrix.warning }}
shell: bash
run: |
${IDF_PATH}/install.sh --enable-pytest
. ${IDF_PATH}/export.sh
python ./ci/build_apps.py ./components/esp_wifi_remote/${{matrix.example.path}} -vv --preserve-all
2 changes: 1 addition & 1 deletion components/esp_wifi_remote/.cz.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ commitizen:
bump_message: 'bump(wifi_remote): $current_version -> $new_version'
pre_bump_hooks: python ../../ci/changelog.py esp_wifi_remote
tag_format: wifi_remote-v$version
version: 0.1.12
version: 0.2.0
version_files:
- idf_component.yml
11 changes: 11 additions & 0 deletions components/esp_wifi_remote/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## [0.2.0](https://github.com/espressif/esp-protocols/commits/wifi_remote-v0.2.0)

### Features

- Add support for simple eppp based RPC ([fd168d8](https://github.com/espressif/esp-protocols/commit/fd168d8))

### Bug Fixes

- Make services restartable, code cleanup ([6c82ce2](https://github.com/espressif/esp-protocols/commit/6c82ce2))
- Add examples to CI ([d2b7c55](https://github.com/espressif/esp-protocols/commit/d2b7c55))

## [0.1.12](https://github.com/espressif/esp-protocols/commits/wifi_remote-v0.1.12)

### Features
Expand Down
19 changes: 12 additions & 7 deletions components/esp_wifi_remote/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
if(NOT CONFIG_ESP_WIFI_ENABLED)
set(src_wifi_is_remote esp_wifi_remote.c esp_wifi_with_remote.c)
set(src_wifi_is_remote esp_wifi_remote.c esp_wifi_with_remote.c esp_wifi_remote_net.c)
endif()

if(CONFIG_ESP_WIFI_REMOTE_LIBRARY_EPPP)
set(src_wifi_remote_eppp eppp/wifi_remote_rpc_client.cpp eppp/wifi_remote_rpc_server.cpp eppp/eppp_init.c)
else()
set(src_wifi_remote_weak esp_wifi_remote_weak.c)
endif()

idf_component_register(INCLUDE_DIRS include
SRCS ${src_wifi_is_remote}
esp_wifi_remote_net.c
esp_wifi_remote_weak.c
SRCS ${src_wifi_remote_weak}
${src_wifi_remote_eppp}
${src_wifi_is_remote}
PRIV_INCLUDE_DIRS eppp
REQUIRES esp_event esp_netif
PRIV_REQUIRES esp_wifi)

idf_component_optional_requires(PRIVATE esp_hosted)
PRIV_REQUIRES esp_wifi esp-tls)

idf_component_get_property(wifi esp_wifi COMPONENT_LIB)
target_link_libraries(${wifi} PUBLIC ${COMPONENT_LIB})
37 changes: 29 additions & 8 deletions components/esp_wifi_remote/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ menu "Wi-Fi Remote"
default y

orsource "./Kconfig.soc_wifi_caps.in"
orsource "./Kconfig.rpc.in"

config ESP_WIFI_STATIC_RX_BUFFER_NUM
int "Max number of WiFi static RX buffers"
Expand Down Expand Up @@ -191,7 +192,7 @@ menu "Wi-Fi Remote"
Set the size of WiFi Block Ack RX window. Generally a bigger value means higher throughput and better
compatibility but more memory. Most of time we should NOT change the default value unless special
reason, e.g. test the maximum UDP RX throughput with iperf etc. For iperf test in shieldbox, the
recommended value is 9~12. If PSRAM is used and WiFi memory is prefered to allocat in PSRAM first,
recommended value is 9~12. If PSRAM is used and WiFi memory is preferred to allocate in PSRAM first,
the default and minimum value should be 16 to achieve better throughput and compatibility with both
stations and APs.

Expand Down Expand Up @@ -228,14 +229,14 @@ menu "Wi-Fi Remote"
help
ESP-MESH utilizes beacon frames to detect and resolve root node conflicts (see documentation). However
the default length of a beacon frame can simultaneously hold only five root node identifier structures,
meaning that a root node conflict of up to five nodes can be detected at one time. In the occurence of
meaning that a root node conflict of up to five nodes can be detected at one time. In the occurrence of
more root nodes conflict involving more than five root nodes, the conflict resolution process will
detect five of the root nodes, resolve the conflict, and re-detect more root nodes. This process will
repeat until all root node conflicts are resolved. However this process can generally take a very long
time.

To counter this situation, the beacon frame length can be increased such that more root nodes can be
detected simultaneously. Each additional root node will require 36 bytes and should be added ontop of
detected simultaneously. Each additional root node will require 36 bytes and should be added on top of
the default beacon frame length of
752 bytes. For example, if you want to detect 10 root nodes simultaneously, you need to set the beacon
frame length as
Expand Down Expand Up @@ -487,9 +488,9 @@ menu "Wi-Fi Remote"
help
Select this option to use MbedTLS TLS client for WPA2 enterprise connection.
Please note that from MbedTLS-3.0 onwards, MbedTLS does not support SSL-3.0
TLS-v1.0, TLS-v1.1 versions. Incase your server is using one of these version,
TLS-v1.0, TLS-v1.1 versions. In case your server is using one of these version,
it is advisable to update your server.
Please disable this option for compatibilty with older TLS versions.
Please disable this option for compatibility with older TLS versions.

config ESP_WIFI_EAP_TLS1_3
bool "Enable EAP-TLS v1.3 Support for WiFi Enterprise connection"
Expand Down Expand Up @@ -556,6 +557,26 @@ menu "Wi-Fi Remote"
help
Select this option to enable WiFi Multiband operation certification support.

config ESP_WIFI_ENABLE_ROAMING_APP
bool "Advanced support for Wi-Fi Roaming (Experimental)"
depends on IDF_EXPERIMENTAL_FEATURES
default n
select ESP_WIFI_SCAN_CACHE
help
Enable Espressif's roaming app to allow for efficient Wi-Fi roaming.
This includes configurable periodic environment scans, maintaining a cache of the
best APs, handling low rssi events etc.

Risk Warning
Please note that this feature is still experimental and enabling this potentially can
lead to unpredictable scanning, connection and roaming attempts.
We are still working on tuning and optimising this feature to ensure reliable and stable use.

menu "Configure roaming App"
depends on ESP_WIFI_ENABLE_ROAMING_APP
rsource "wifi_apps/roaming_app/src/Kconfig.roaming"
endmenu

config ESP_WIFI_DPP_SUPPORT
bool "Enable DPP support"
default n
Expand Down Expand Up @@ -597,17 +618,17 @@ menu "Wi-Fi Remote"
default n
help
Select this option to enable validate each WPS attribute
rigorously. Disabling this add the workaorunds with various APs.
rigorously. Disabling this add the workarounds with various APs.
Enabling this may cause inter operability issues with some APs.

config ESP_WIFI_WPS_PASSPHRASE
bool "Get WPA2 passphrase in WPS config"
default n
help
Select this option to get passphrase during WPS configuration.
This option fakes the virtual display capabilites to get the
This option fakes the virtual display capabilities to get the
configuration in passphrase mode.
Not recommanded to be used since WPS credentials should not
Not recommended to be used since WPS credentials should not
be shared to other devices, making it in readable format increases
that risk, also passphrase requires pbkdf2 to convert in psk.

Expand Down
57 changes: 57 additions & 0 deletions components/esp_wifi_remote/Kconfig.rpc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
choice ESP_WIFI_REMOTE_LIBRARY
prompt "Choose WiFi-remote implementation"
default ESP_WIFI_REMOTE_LIBRARY_EPPP
help
Select type of WiFi Remote implementation

ESP-HOSTED is the default and most versatile option.
It's also possible to use EPPP, which uses PPPoS link between micros and NAPT, so it's slower
and less universal.

config ESP_WIFI_REMOTE_LIBRARY_HOSTED
bool "ESP-HOSTED"
config ESP_WIFI_REMOTE_LIBRARY_EPPP
bool "EPPP"
endchoice

if ESP_WIFI_REMOTE_LIBRARY_EPPP

config ESP_WIFI_REMOTE_EPPP_UART_TX_PIN
int "TXD Pin Number"
default 10
range 0 31
help
Pin number of UART TX.

config ESP_WIFI_REMOTE_EPPP_UART_RX_PIN
int "RXD Pin Number"
default 11
range 0 31
help
Pin number of UART RX.

config ESP_WIFI_REMOTE_EPPP_SERVER_CA
string "Servers CA certificate"
default "--- Please copy content of the CA certificate ---"

config ESP_WIFI_REMOTE_EPPP_CLIENT_CRT
string "Client certificate"
default "--- Please copy content of the Client certificate ---"

config ESP_WIFI_REMOTE_EPPP_CLIENT_KEY
string "Client key"
default "--- Please copy content of the Client key ---"

config ESP_WIFI_REMOTE_EPPP_CLIENT_CA
string "Clients CA certificate"
default "--- Please copy content of the CA certificate ---"

config ESP_WIFI_REMOTE_EPPP_SERVER_CRT
string "Server certificate"
default "--- Please copy content of the Client certificate ---"

config ESP_WIFI_REMOTE_EPPP_SERVER_KEY
string "Server key"
default "--- Please copy content of the Client key ---"

endif
8 changes: 8 additions & 0 deletions components/esp_wifi_remote/Kconfig.soc_wifi_caps.in
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,11 @@ endif # ESP32C6
if SLAVE_IDF_TARGET_ESP32H2

endif # ESP32H2

if SLAVE_IDF_TARGET_ESP32P4

config SLAVE_SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH
int
default 12

endif # ESP32P4
david-cermak marked this conversation as resolved.
Show resolved Hide resolved
20 changes: 20 additions & 0 deletions components/esp_wifi_remote/eppp/eppp_init.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "esp_log.h"
#include "esp_wifi.h"
#include "eppp_link.h"

__attribute__((weak)) esp_netif_t *wifi_remote_eppp_init(eppp_type_t role)
david-cermak marked this conversation as resolved.
Show resolved Hide resolved
{
uint32_t our_ip = role == EPPP_SERVER ? EPPP_DEFAULT_SERVER_IP() : EPPP_DEFAULT_CLIENT_IP();
uint32_t their_ip = role == EPPP_SERVER ? EPPP_DEFAULT_CLIENT_IP() : EPPP_DEFAULT_SERVER_IP();
eppp_config_t config = EPPP_DEFAULT_CONFIG(our_ip, their_ip);
// We currently support only UART transport
config.transport = EPPP_TRANSPORT_UART;
config.uart.tx_io = CONFIG_ESP_WIFI_REMOTE_EPPP_UART_TX_PIN;
config.uart.rx_io = CONFIG_ESP_WIFI_REMOTE_EPPP_UART_RX_PIN;
return eppp_open(role, &config, portMAX_DELAY);
}
Loading
Loading