From 1311408e92c4c6ee8f041249335ea77b0f1b84ea Mon Sep 17 00:00:00 2001 From: Alex Tsitsiura Date: Fri, 5 May 2023 22:09:44 +0300 Subject: [PATCH] [Telink] Fix simulatedIndex max number & disable NET_MGMT (#26293) * [Telink] Fix SensorManager simulatedIndex max number * Restyled by clang-format * [Telink] Fix copy paste typo * [Telink] Remove NET_CONFIG_SETTINGS which select NET_MGMT * [Telink] Enable extended discovery * Revert "[Telink] Enable extended discovery" This reverts commit 4555e99e24a60cc4b596efc5ba1886813088f6b3. * [Telink] Use ArraySize macro * [Telink] Temporary button IRQ issue hotfix --------- Co-authored-by: Restyled.io --- config/telink/app/zephyr.conf | 4 ---- .../platform/telink/common/src/AppTaskCommon.cpp | 12 ++++++------ .../telink/src/SensorManager.cpp | 2 +- .../thermostat/silabs/efr32/src/SensorManager.cpp | 2 +- examples/thermostat/telink/src/SensorManager.cpp | 2 +- src/platform/telink/ConnectivityManagerImpl.h | 2 +- 6 files changed, 10 insertions(+), 14 deletions(-) diff --git a/config/telink/app/zephyr.conf b/config/telink/app/zephyr.conf index 2a97b363833dcc..a8a4c0af92b8a7 100644 --- a/config/telink/app/zephyr.conf +++ b/config/telink/app/zephyr.conf @@ -46,7 +46,6 @@ CONFIG_LOG_MAX_LEVEL=3 # Generic networking options CONFIG_NETWORKING=y -CONFIG_NET_CONFIG_SETTINGS=y CONFIG_NET_SOCKETS=y CONFIG_NET_SOCKETS_POSIX_NAMES=n CONFIG_NET_CONFIG_INIT_TIMEOUT=0 @@ -94,9 +93,6 @@ CONFIG_NET_L2_OPENTHREAD=y CONFIG_OPENTHREAD_DEBUG=y CONFIG_OPENTHREAD_L2_DEBUG=y -CONFIG_NET_CONFIG_MY_IPV6_ADDR="fdde:ad00:beef::1" -CONFIG_NET_CONFIG_PEER_IPV6_ADDR="fdde:ad00:beef::2" - # OpenThread configs CONFIG_OPENTHREAD_SLAAC=y CONFIG_OPENTHREAD_RADIO_WORKQUEUE_STACK_SIZE=608 diff --git a/examples/platform/telink/common/src/AppTaskCommon.cpp b/examples/platform/telink/common/src/AppTaskCommon.cpp index 46f42f0c66c1fd..341839796a4922 100644 --- a/examples/platform/telink/common/src/AppTaskCommon.cpp +++ b/examples/platform/telink/common/src/AppTaskCommon.cpp @@ -247,27 +247,27 @@ void AppTaskCommon::InitButtons(void) #if CONFIG_CHIP_BUTTON_MANAGER_IRQ_MODE sFactoryResetButton.Configure(BUTTON_PORT, BUTTON_PIN_1, FactoryResetButtonEventHandler); sBleAdvStartButton.Configure(BUTTON_PORT, BUTTON_PIN_4, StartBleAdvButtonEventHandler); -#if APP_USE_THREAD_START_BUTTON - sThreadStartButton.Configure(BUTTON_PORT, BUTTON_PIN_3, StartThreadButtonEventHandler); -#endif #if APP_USE_EXAMPLE_START_BUTTON if (ExampleActionEventHandler) { sExampleActionButton.Configure(BUTTON_PORT, BUTTON_PIN_2, ExampleActionButtonEventHandler); } #endif +#if APP_USE_THREAD_START_BUTTON + sThreadStartButton.Configure(BUTTON_PORT, BUTTON_PIN_3, StartThreadButtonEventHandler); +#endif #else sFactoryResetButton.Configure(BUTTON_PORT, BUTTON_PIN_3, BUTTON_PIN_1, FactoryResetButtonEventHandler); sBleAdvStartButton.Configure(BUTTON_PORT, BUTTON_PIN_4, BUTTON_PIN_2, StartBleAdvButtonEventHandler); -#if APP_USE_THREAD_START_BUTTON - sThreadStartButton.Configure(BUTTON_PORT, BUTTON_PIN_3, BUTTON_PIN_2, StartThreadButtonEventHandler); -#endif #if APP_USE_EXAMPLE_START_BUTTON if (ExampleActionEventHandler) { sExampleActionButton.Configure(BUTTON_PORT, BUTTON_PIN_4, BUTTON_PIN_1, ExampleActionButtonEventHandler); } #endif +#if APP_USE_THREAD_START_BUTTON + sThreadStartButton.Configure(BUTTON_PORT, BUTTON_PIN_3, BUTTON_PIN_2, StartThreadButtonEventHandler); +#endif #endif ButtonManagerInst().AddButton(sFactoryResetButton); diff --git a/examples/temperature-measurement-app/telink/src/SensorManager.cpp b/examples/temperature-measurement-app/telink/src/SensorManager.cpp index 8ab8a42d9cc276..22d9bb1c57ef19 100644 --- a/examples/temperature-measurement-app/telink/src/SensorManager.cpp +++ b/examples/temperature-measurement-app/telink/src/SensorManager.cpp @@ -49,7 +49,7 @@ int16_t SensorManager::SensorEventHandler() #ifdef TEMPERATURE_SIMULATION_IS_USED static uint8_t nbOfRepetition = 0; static uint8_t simulatedIndex = 0; - if (simulatedIndex >= sizeof(mSimulatedTemp) - 1) + if (simulatedIndex >= ArraySize(mSimulatedTemp)) { simulatedIndex = 0; } diff --git a/examples/thermostat/silabs/efr32/src/SensorManager.cpp b/examples/thermostat/silabs/efr32/src/SensorManager.cpp index 427b1dad57d8ed..2d2246a44d20eb 100644 --- a/examples/thermostat/silabs/efr32/src/SensorManager.cpp +++ b/examples/thermostat/silabs/efr32/src/SensorManager.cpp @@ -104,7 +104,7 @@ void SensorManager::SensorTimerEventHandler(TimerHandle_t xTimer) #else static uint8_t nbOfRepetition = 0; static uint8_t simulatedIndex = 0; - if (simulatedIndex >= sizeof(mSimulatedTemp)) + if (simulatedIndex >= ArraySize(mSimulatedTemp)) { simulatedIndex = 0; } diff --git a/examples/thermostat/telink/src/SensorManager.cpp b/examples/thermostat/telink/src/SensorManager.cpp index 534a519b049cf4..981447c8a12bd6 100644 --- a/examples/thermostat/telink/src/SensorManager.cpp +++ b/examples/thermostat/telink/src/SensorManager.cpp @@ -62,7 +62,7 @@ void SensorManager::SensorTimerEventHandler(AppEvent * aEvent) static uint8_t nbOfRepetition = 0; static uint8_t simulatedIndex = 0; - if (simulatedIndex >= sizeof(mSimulatedTemp)) + if (simulatedIndex >= ArraySize(mSimulatedTemp)) { simulatedIndex = 0; } diff --git a/src/platform/telink/ConnectivityManagerImpl.h b/src/platform/telink/ConnectivityManagerImpl.h index 549f2ca156f4a8..ce6ae49a4283e7 100644 --- a/src/platform/telink/ConnectivityManagerImpl.h +++ b/src/platform/telink/ConnectivityManagerImpl.h @@ -100,7 +100,7 @@ inline ConnectivityManager & ConnectivityMgr(void) * Returns the platform-specific implementation of the ConnectivityManager singleton object. * * chip applications can use this to gain access to features of the ConnectivityManager - * that are specific to the ESP32 platform. + * that are specific to the Telink platform. */ inline ConnectivityManagerImpl & ConnectivityMgrImpl(void) {