Merge pull request #946 from david-cermak/fix/examples_mqtt

Add optional mqtt deps to examples
This commit is contained in:
david-cermak
2025-11-19 10:33:14 +01:00
committed by GitHub
6 changed files with 33 additions and 9 deletions

View File

@@ -13,10 +13,7 @@ jobs:
name: Build examples
strategy:
matrix:
idf_ver: ["latest", "release-v5.1", "release-v5.2", "release-v5.3", "release-v5.4"]
include:
- idf_ver: "latest"
warning: "Warning: The smallest app partition is nearly full"
idf_ver: ["latest", "release-v5.1", "release-v5.2", "release-v5.3", "release-v5.4", "release-v5.5", "release-v6.0"]
runs-on: ubuntu-22.04
container: espressif/idf:${{ matrix.idf_ver }}
env:
@@ -27,7 +24,7 @@ jobs:
uses: actions/checkout@v4
- name: Build with IDF-${{ matrix.idf_ver }}
env:
EXPECTED_WARNING: ${{ matrix.warning }}
EXPECTED_WARNING: "Warning: The smallest app partition is nearly full"
shell: bash
run: |
. ${IDF_PATH}/export.sh
@@ -75,7 +72,7 @@ jobs:
needs: build_all_examples
strategy:
matrix:
idf_ver: ["release-v5.4", "latest"]
idf_ver: ["release-v5.5", "latest"]
runs-on:
- self-hosted
- modem

View File

@@ -18,6 +18,7 @@
#include "esp_log.h"
#include "sdkconfig.h"
#include "iface_info.h"
#include "esp_idf_version.h"
static const char *TAG = "ethernet_connect";
@@ -109,7 +110,11 @@ iface_info_t *example_eth_init(int prio)
// Use internal ESP32's ethernet
eth_esp32_emac_config_t esp32_emac_config = ETH_ESP32_EMAC_DEFAULT_CONFIG();
eth_info->mac = esp_eth_mac_new_esp32(&esp32_emac_config, &mac_config);
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 0)
eth_info->phy = esp_eth_phy_new_generic(&phy_config);
#else
eth_info->phy = esp_eth_phy_new_ip101(&phy_config);
#endif
// Init Ethernet driver to default and install it
esp_eth_config_t config = ETH_DEFAULT_CONFIG(eth_info->mac, eth_info->phy);
ESP_ERROR_CHECK(esp_eth_driver_install(&config, &eth_info->eth_handle));

View File

@@ -2,3 +2,7 @@ dependencies:
espressif/esp_modem:
version: "^1.0.0"
override_path: "../../../../components/esp_modem"
espressif/mqtt:
rules:
- if: idf_version >=6.0
version: ^1.0.0

View File

@@ -1,7 +1,12 @@
# SLIP Modem Component
if("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_GREATER "5.3")
set(dependencies esp_driver_uart)
else()
set(dependencies driver)
endif()
idf_component_register(
SRCS "library/slip_modem.c" "library/slip_modem_netif.c"
INCLUDE_DIRS "include"
REQUIRES esp_netif driver
REQUIRES esp_netif ${dependencies}
)

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2019-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2019-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -53,10 +53,18 @@ esp_err_t slip_modem_netif_start(esp_netif_t *esp_netif, esp_ip6_addr_t *addr)
return ESP_OK;
}
#if defined(CONFIG_ESP_NETIF_RECEIVE_REPORT_ERRORS)
typedef esp_err_t esp_netif_recv_ret_t;
#define ESP_NETIF_OPTIONAL_RETURN_CODE(expr) expr
#else
typedef void esp_netif_recv_ret_t;
#define ESP_NETIF_OPTIONAL_RETURN_CODE(expr)
#endif // CONFIG_ESP_NETIF_RECEIVE_REPORT_ERRORS
/**
* @brief Write incoming serial data to the SLIP interface
*/
void esp_netif_lwip_slip_input(void *h, void *buffer, unsigned int len, void *eb)
esp_netif_recv_ret_t esp_netif_lwip_slip_input(void *h, void *buffer, unsigned int len, void *eb)
{
struct netif *netif = h;
@@ -76,6 +84,7 @@ void esp_netif_lwip_slip_input(void *h, void *buffer, unsigned int len, void *eb
for (int i = 0; i < len; i++) {
slipif_process_rxqueue(netif);
}
return ESP_NETIF_OPTIONAL_RETURN_CODE(ESP_OK);
}
/**

View File

@@ -1,3 +1,7 @@
dependencies:
protocol_examples_common:
path: ${IDF_PATH}/examples/common_components/protocol_examples_common
espressif/mqtt:
rules:
- if: idf_version >=6.0
version: ^1.0.0