From 9e9624d56384c1a9037d594dfd34a4a70dd53748 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 3 Oct 2023 14:55:54 -0400 Subject: [PATCH 1/6] Add delay_ms to reboot commands, fix wpg --- .../common/pigweed/protos/device_service.proto | 6 +++++- examples/common/pigweed/rpc_services/Device.h | 2 +- examples/platform/ameba/Rpc.cpp | 12 +++++++++--- .../platform/bouffalolab/common/rpc/Rpc.cpp | 17 ++++++++++++----- examples/platform/esp32/Rpc.cpp | 17 +++++++++++++---- examples/platform/nrfconnect/Rpc.cpp | 12 ++++++++++-- examples/platform/qpg/Rpc.cpp | 18 +++++++++++++++--- examples/platform/silabs/Rpc.cpp | 12 +++++++++--- examples/platform/telink/Rpc.cpp | 12 ++++++++++-- 9 files changed, 84 insertions(+), 24 deletions(-) diff --git a/examples/common/pigweed/protos/device_service.proto b/examples/common/pigweed/protos/device_service.proto index 19be27ab7f960e..0bd6680ef354c5 100644 --- a/examples/common/pigweed/protos/device_service.proto +++ b/examples/common/pigweed/protos/device_service.proto @@ -45,9 +45,13 @@ message MetadataForProvider { bytes tlv = 1; } +message RebootRequest { + uint32 delay_ms = 1; +} + service Device { rpc FactoryReset(pw.protobuf.Empty) returns (pw.protobuf.Empty){} - rpc Reboot(pw.protobuf.Empty) returns (pw.protobuf.Empty){} + rpc Reboot(RebootRequest) returns (pw.protobuf.Empty){} rpc TriggerOta(pw.protobuf.Empty) returns (pw.protobuf.Empty){} rpc SetOtaMetadataForProvider(MetadataForProvider) returns (pw.protobuf.Empty){} rpc GetDeviceInfo(pw.protobuf.Empty) returns (DeviceInfo){} diff --git a/examples/common/pigweed/rpc_services/Device.h b/examples/common/pigweed/rpc_services/Device.h index e82095a59a309e..611c85caa37db9 100644 --- a/examples/common/pigweed/rpc_services/Device.h +++ b/examples/common/pigweed/rpc_services/Device.h @@ -217,7 +217,7 @@ class Device : public pw_rpc::nanopb::Device::Service return pw::OkStatus(); } - virtual pw::Status Reboot(const pw_protobuf_Empty & request, pw_protobuf_Empty & response) + virtual pw::Status Reboot(const chip_rpc_RebootRequest & request, pw_protobuf_Empty & response) { return pw::Status::Unimplemented(); } diff --git a/examples/platform/ameba/Rpc.cpp b/examples/platform/ameba/Rpc.cpp index 55312d3a769620..9c5c12ba985525 100644 --- a/examples/platform/ameba/Rpc.cpp +++ b/examples/platform/ameba/Rpc.cpp @@ -76,15 +76,21 @@ class AmebaButton final : public Button class AmebaDevice final : public Device { public: - pw::Status Reboot(const pw_protobuf_Empty & request, pw_protobuf_Empty & response) override + pw::Status Reboot(const chip_rpc_RebootRequest & request, pw_protobuf_Empty & response) override { - mRebootTimer = xTimerCreateStatic("Reboot", kRebootTimerPeriodTicks, false, nullptr, RebootHandler, &mRebootTimerBuffer); + TickType_t delayMs = kRebootTimerPeriodMs; + if (request.delay_ms != 0) { + delayMs = request.delay_ms; + } else { + ChipLogProgress(NotSpecified, "Did not receive a reboot delay. Defaulting to %d ms", static_cast(kRebootTimerPeriodMs)); + } + mRebootTimer = xTimerCreateStatic("Reboot", pdMS_TO_TICKS(kRebootTimerPeriodMs), false, nullptr, RebootHandler, &mRebootTimerBuffer); xTimerStart(mRebootTimer, 0); return pw::OkStatus(); } private: - static constexpr TickType_t kRebootTimerPeriodTicks = 1000; + static constexpr uint32_t kRebootTimerPeriodMs = 1000; TimerHandle_t mRebootTimer; StaticTimer_t mRebootTimerBuffer; diff --git a/examples/platform/bouffalolab/common/rpc/Rpc.cpp b/examples/platform/bouffalolab/common/rpc/Rpc.cpp index cead7e2e72913e..031da89fcb2a98 100644 --- a/examples/platform/bouffalolab/common/rpc/Rpc.cpp +++ b/examples/platform/bouffalolab/common/rpc/Rpc.cpp @@ -96,12 +96,19 @@ class BouffaloDevice final : public Device public: pw::Status Reboot(const pw_protobuf_Empty & request, pw_protobuf_Empty & response) override { - if (!mRebootTimer) + if (mRebootTimer) { - mRebootTimer = - xTimerCreateStatic("Reboot", kRebootTimerPeriodTicks, false, nullptr, RebootHandler, &mRebootTimerBuffer); - xTimerStart(mRebootTimer, 0); + return pw::OkStatus(); + } + + TickType_t delayMs = kRebootTimerPeriodMs; + if (request.delay_ms != 0) { + delayMs = request.delay_ms; + } else { + ChipLogProgress(NotSpecified, "Did not receive a reboot delay. Defaulting to %d ms", static_cast(kRebootTimerPeriodMs)); } + mRebootTimer = xTimerCreateStatic("Reboot", pdMS_TO_TICKS(delayMs), false, nullptr, RebootHandler, &mRebootTimerBuffer); + xTimerStart(mRebootTimer, 0); return pw::OkStatus(); } @@ -117,7 +124,7 @@ class BouffaloDevice final : public Device } private: - static constexpr TickType_t kRebootTimerPeriodTicks = 1000; + static constexpr uint32_t kRebootTimerPeriodMs = 1000; TimerHandle_t mRebootTimer; StaticTimer_t mRebootTimerBuffer; diff --git a/examples/platform/esp32/Rpc.cpp b/examples/platform/esp32/Rpc.cpp index f34172a05e0a98..546381d1a8c029 100644 --- a/examples/platform/esp32/Rpc.cpp +++ b/examples/platform/esp32/Rpc.cpp @@ -112,19 +112,28 @@ class Esp32Button final : public Button class Esp32Device final : public Device { public: - pw::Status Reboot(const pw_protobuf_Empty & request, pw_protobuf_Empty & response) override + pw::Status Reboot(const chip_rpc_RebootRequest & request, pw_protobuf_Empty & response) override { - mRebootTimer = xTimerCreateStatic("Reboot", kRebootTimerPeriodTicks, false, nullptr, RebootHandler, &mRebootTimerBuffer); + TickType_t delayMs = kRebootTimerPeriodMs; + if (request.delay_ms != 0) { + delayMs = request.delay_ms; + } else { + ChipLogProgress(NotSpecified, "Did not receive a reboot delay. Defaulting to %d ms", static_cast(kRebootTimerPeriodMs)); + } + mRebootTimer = xTimerCreateStatic("Reboot", pdMS_TO_TICKS(delayMs), false, nullptr, RebootHandler, &mRebootTimerBuffer); + xTimerStart(mRebootTimer, 0); return pw::OkStatus(); } private: - static constexpr TickType_t kRebootTimerPeriodTicks = 1000; + static constexpr uint32_t kRebootTimerPeriodMs = 1000; TimerHandle_t mRebootTimer; StaticTimer_t mRebootTimerBuffer; - static void RebootHandler(TimerHandle_t) { esp_restart(); } + static void RebootHandler(TimerHandle_t) { + esp_restart(); + } }; #endif // defined(PW_RPC_DEVICE_SERVICE) && PW_RPC_DEVICE_SERVICE diff --git a/examples/platform/nrfconnect/Rpc.cpp b/examples/platform/nrfconnect/Rpc.cpp index c89dd6c7e25de2..23121c9fdf4d52 100644 --- a/examples/platform/nrfconnect/Rpc.cpp +++ b/examples/platform/nrfconnect/Rpc.cpp @@ -95,9 +95,17 @@ K_TIMER_DEFINE(reboot_timer, reboot_timer_handler, NULL); class NrfDevice final : public Device { public: - pw::Status Reboot(const pw_protobuf_Empty & request, pw_protobuf_Empty & response) override + pw::Status Reboot(const chip_rpc_RebootRequest & request, pw_protobuf_Empty & response) override { - k_timer_start(&reboot_timer, K_SECONDS(1), K_FOREVER); + k_timeout_t delay; + if (request.delay_ms != 0) { + delay = K_MSEC(request.delay_ms); + } else { + ChipLogProgress(NotSpecified, "Did not receive a reboot delay. Defaulting to 1s"); + delay = K_SECONDS(1); + } + + k_timer_start(&reboot_timer, delay, K_FOREVER); return pw::OkStatus(); } }; diff --git a/examples/platform/qpg/Rpc.cpp b/examples/platform/qpg/Rpc.cpp index 45d31ccd2083cb..820e72943e4ac8 100644 --- a/examples/platform/qpg/Rpc.cpp +++ b/examples/platform/qpg/Rpc.cpp @@ -63,10 +63,18 @@ class QpgButton final : public Button class QpgDevice final : public Device { public: - pw::Status Reboot(const pw_protobuf_Empty & request, pw_protobuf_Empty & response) + pw::Status Reboot(const chip_rpc_RebootRequest & request, pw_protobuf_Empty & response) { - qvCHIP_ResetSystem(); - // WILL NOT RETURN + Clock::Timeout delay; + + if (request.delay_ms != 0) { + delay = System::Clock::Milliseconds64(request.delay_ms); + } else { + delay = System::Clock::Seconds32(1); + ChipLogProgress(NotSpecified, "Did not receive a reboot delay. Defaulting to 1s"); + } + + DeviceLayer::SystemLayer().StartTimer(delay, RebootImpl, nullptr); return pw::OkStatus(); } pw::Status TriggerOta(const pw_protobuf_Empty & request, pw_protobuf_Empty & response) @@ -74,6 +82,10 @@ class QpgDevice final : public Device TriggerOTAQuery(); return pw::OkStatus(); } +private: + static void RebootImpl(System::Layer *, void *) { + qvCHIP_ResetSystem(); + } }; #endif // defined(PW_RPC_DEVICE_SERVICE) && PW_RPC_DEVICE_SERVICE diff --git a/examples/platform/silabs/Rpc.cpp b/examples/platform/silabs/Rpc.cpp index 55cc232c382617..ef9467f437e2b9 100644 --- a/examples/platform/silabs/Rpc.cpp +++ b/examples/platform/silabs/Rpc.cpp @@ -94,13 +94,19 @@ class Efr32Device final : public Device public: pw::Status Reboot(const pw_protobuf_Empty & request, pw_protobuf_Empty & response) override { - mRebootTimer = xTimerCreateStatic("Reboot", kRebootTimerPeriodTicks, false, nullptr, RebootHandler, &mRebootTimerBuffer); - xTimerStart(mRebootTimer, pdMS_TO_TICKS(0)); + TickType_t delayMs = kRebootTimerPeriodMs; + if (request.delay_ms != 0) { + delayMs = request.delay_ms; + } else { + ChipLogProgress(NotSpecified, "Did not receive a reboot delay. Defaulting to %d ms", static_cast(kRebootTimerPeriodMs)); + } + mRebootTimer = xTimerCreateStatic("Reboot", pdMS_TO_TICKS(delayMs), false, nullptr, RebootHandler, &mRebootTimerBuffer); + xTimerStart(mRebootTimer, 0); return pw::OkStatus(); } private: - static constexpr TickType_t kRebootTimerPeriodTicks = 1000; + static constexpr uint32_t kRebootTimerPeriodMs = 1000; TimerHandle_t mRebootTimer; StaticTimer_t mRebootTimerBuffer; diff --git a/examples/platform/telink/Rpc.cpp b/examples/platform/telink/Rpc.cpp index e8c9500ab68291..50f915878e3f0e 100644 --- a/examples/platform/telink/Rpc.cpp +++ b/examples/platform/telink/Rpc.cpp @@ -96,9 +96,17 @@ K_TIMER_DEFINE(reboot_timer, reboot_timer_handler, NULL); class TelinkDevice final : public Device { public: - pw::Status Reboot(const pw_protobuf_Empty & request, pw_protobuf_Empty & response) override + pw::Status Reboot(const chip_rpc_RebootRequest & request, pw_protobuf_Empty & response) override { - k_timer_start(&reboot_timer, K_SECONDS(1), K_FOREVER); + k_timeout_t delay; + if (request.delay_ms != 0) { + delay = K_MSEC(request.delay_ms); + } else { + ChipLogProgress(NotSpecified, "Did not receive a reboot delay. Defaulting to 1s"); + delay = K_SECONDS(1); + } + + k_timer_start(&reboot_timer, delay, K_FOREVER); return pw::OkStatus(); } }; From b1821436ce8d2d738463c106eb15d725e116d797 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 3 Oct 2023 14:56:32 -0400 Subject: [PATCH 2/6] Fix efr32 build --- examples/platform/silabs/Rpc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/platform/silabs/Rpc.cpp b/examples/platform/silabs/Rpc.cpp index ef9467f437e2b9..2f72a4e8c9b3f3 100644 --- a/examples/platform/silabs/Rpc.cpp +++ b/examples/platform/silabs/Rpc.cpp @@ -92,7 +92,7 @@ class Efr32Button final : public Button class Efr32Device final : public Device { public: - pw::Status Reboot(const pw_protobuf_Empty & request, pw_protobuf_Empty & response) override + pw::Status Reboot(const chip_rpc_RebootRequest & request, pw_protobuf_Empty & response) override { TickType_t delayMs = kRebootTimerPeriodMs; if (request.delay_ms != 0) { From e764c84465f70b4e8feb681374a8b4631d02e495 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 3 Oct 2023 15:05:24 -0400 Subject: [PATCH 3/6] Restyle --- examples/platform/ameba/Rpc.cpp | 13 +++++++++---- examples/platform/bouffalolab/common/rpc/Rpc.cpp | 10 +++++++--- examples/platform/esp32/Rpc.cpp | 14 ++++++++------ examples/platform/nrfconnect/Rpc.cpp | 7 +++++-- examples/platform/qpg/Rpc.cpp | 12 +++++++----- examples/platform/silabs/Rpc.cpp | 10 +++++++--- examples/platform/telink/Rpc.cpp | 7 +++++-- 7 files changed, 48 insertions(+), 25 deletions(-) diff --git a/examples/platform/ameba/Rpc.cpp b/examples/platform/ameba/Rpc.cpp index 9c5c12ba985525..cd33631f078155 100644 --- a/examples/platform/ameba/Rpc.cpp +++ b/examples/platform/ameba/Rpc.cpp @@ -79,12 +79,17 @@ class AmebaDevice final : public Device pw::Status Reboot(const chip_rpc_RebootRequest & request, pw_protobuf_Empty & response) override { TickType_t delayMs = kRebootTimerPeriodMs; - if (request.delay_ms != 0) { + if (request.delay_ms != 0) + { delayMs = request.delay_ms; - } else { - ChipLogProgress(NotSpecified, "Did not receive a reboot delay. Defaulting to %d ms", static_cast(kRebootTimerPeriodMs)); } - mRebootTimer = xTimerCreateStatic("Reboot", pdMS_TO_TICKS(kRebootTimerPeriodMs), false, nullptr, RebootHandler, &mRebootTimerBuffer); + else + { + ChipLogProgress(NotSpecified, "Did not receive a reboot delay. Defaulting to %d ms", + static_cast(kRebootTimerPeriodMs)); + } + mRebootTimer = + xTimerCreateStatic("Reboot", pdMS_TO_TICKS(kRebootTimerPeriodMs), false, nullptr, RebootHandler, &mRebootTimerBuffer); xTimerStart(mRebootTimer, 0); return pw::OkStatus(); } diff --git a/examples/platform/bouffalolab/common/rpc/Rpc.cpp b/examples/platform/bouffalolab/common/rpc/Rpc.cpp index 031da89fcb2a98..02c0632b04fc09 100644 --- a/examples/platform/bouffalolab/common/rpc/Rpc.cpp +++ b/examples/platform/bouffalolab/common/rpc/Rpc.cpp @@ -102,10 +102,14 @@ class BouffaloDevice final : public Device } TickType_t delayMs = kRebootTimerPeriodMs; - if (request.delay_ms != 0) { + if (request.delay_ms != 0) + { delayMs = request.delay_ms; - } else { - ChipLogProgress(NotSpecified, "Did not receive a reboot delay. Defaulting to %d ms", static_cast(kRebootTimerPeriodMs)); + } + else + { + ChipLogProgress(NotSpecified, "Did not receive a reboot delay. Defaulting to %d ms", + static_cast(kRebootTimerPeriodMs)); } mRebootTimer = xTimerCreateStatic("Reboot", pdMS_TO_TICKS(delayMs), false, nullptr, RebootHandler, &mRebootTimerBuffer); xTimerStart(mRebootTimer, 0); diff --git a/examples/platform/esp32/Rpc.cpp b/examples/platform/esp32/Rpc.cpp index 546381d1a8c029..57f01b8f60b2ae 100644 --- a/examples/platform/esp32/Rpc.cpp +++ b/examples/platform/esp32/Rpc.cpp @@ -115,10 +115,14 @@ class Esp32Device final : public Device pw::Status Reboot(const chip_rpc_RebootRequest & request, pw_protobuf_Empty & response) override { TickType_t delayMs = kRebootTimerPeriodMs; - if (request.delay_ms != 0) { + if (request.delay_ms != 0) + { delayMs = request.delay_ms; - } else { - ChipLogProgress(NotSpecified, "Did not receive a reboot delay. Defaulting to %d ms", static_cast(kRebootTimerPeriodMs)); + } + else + { + ChipLogProgress(NotSpecified, "Did not receive a reboot delay. Defaulting to %d ms", + static_cast(kRebootTimerPeriodMs)); } mRebootTimer = xTimerCreateStatic("Reboot", pdMS_TO_TICKS(delayMs), false, nullptr, RebootHandler, &mRebootTimerBuffer); @@ -131,9 +135,7 @@ class Esp32Device final : public Device TimerHandle_t mRebootTimer; StaticTimer_t mRebootTimerBuffer; - static void RebootHandler(TimerHandle_t) { - esp_restart(); - } + static void RebootHandler(TimerHandle_t) { esp_restart(); } }; #endif // defined(PW_RPC_DEVICE_SERVICE) && PW_RPC_DEVICE_SERVICE diff --git a/examples/platform/nrfconnect/Rpc.cpp b/examples/platform/nrfconnect/Rpc.cpp index 23121c9fdf4d52..ec21fd7e379f05 100644 --- a/examples/platform/nrfconnect/Rpc.cpp +++ b/examples/platform/nrfconnect/Rpc.cpp @@ -98,9 +98,12 @@ class NrfDevice final : public Device pw::Status Reboot(const chip_rpc_RebootRequest & request, pw_protobuf_Empty & response) override { k_timeout_t delay; - if (request.delay_ms != 0) { + if (request.delay_ms != 0) + { delay = K_MSEC(request.delay_ms); - } else { + } + else + { ChipLogProgress(NotSpecified, "Did not receive a reboot delay. Defaulting to 1s"); delay = K_SECONDS(1); } diff --git a/examples/platform/qpg/Rpc.cpp b/examples/platform/qpg/Rpc.cpp index 820e72943e4ac8..c57865ec4602d1 100644 --- a/examples/platform/qpg/Rpc.cpp +++ b/examples/platform/qpg/Rpc.cpp @@ -67,9 +67,12 @@ class QpgDevice final : public Device { Clock::Timeout delay; - if (request.delay_ms != 0) { + if (request.delay_ms != 0) + { delay = System::Clock::Milliseconds64(request.delay_ms); - } else { + } + else + { delay = System::Clock::Seconds32(1); ChipLogProgress(NotSpecified, "Did not receive a reboot delay. Defaulting to 1s"); } @@ -82,10 +85,9 @@ class QpgDevice final : public Device TriggerOTAQuery(); return pw::OkStatus(); } + private: - static void RebootImpl(System::Layer *, void *) { - qvCHIP_ResetSystem(); - } + static void RebootImpl(System::Layer *, void *) { qvCHIP_ResetSystem(); } }; #endif // defined(PW_RPC_DEVICE_SERVICE) && PW_RPC_DEVICE_SERVICE diff --git a/examples/platform/silabs/Rpc.cpp b/examples/platform/silabs/Rpc.cpp index 2f72a4e8c9b3f3..c78426847c1a42 100644 --- a/examples/platform/silabs/Rpc.cpp +++ b/examples/platform/silabs/Rpc.cpp @@ -95,10 +95,14 @@ class Efr32Device final : public Device pw::Status Reboot(const chip_rpc_RebootRequest & request, pw_protobuf_Empty & response) override { TickType_t delayMs = kRebootTimerPeriodMs; - if (request.delay_ms != 0) { + if (request.delay_ms != 0) + { delayMs = request.delay_ms; - } else { - ChipLogProgress(NotSpecified, "Did not receive a reboot delay. Defaulting to %d ms", static_cast(kRebootTimerPeriodMs)); + } + else + { + ChipLogProgress(NotSpecified, "Did not receive a reboot delay. Defaulting to %d ms", + static_cast(kRebootTimerPeriodMs)); } mRebootTimer = xTimerCreateStatic("Reboot", pdMS_TO_TICKS(delayMs), false, nullptr, RebootHandler, &mRebootTimerBuffer); xTimerStart(mRebootTimer, 0); diff --git a/examples/platform/telink/Rpc.cpp b/examples/platform/telink/Rpc.cpp index 50f915878e3f0e..104e7c453cbda2 100644 --- a/examples/platform/telink/Rpc.cpp +++ b/examples/platform/telink/Rpc.cpp @@ -99,9 +99,12 @@ class TelinkDevice final : public Device pw::Status Reboot(const chip_rpc_RebootRequest & request, pw_protobuf_Empty & response) override { k_timeout_t delay; - if (request.delay_ms != 0) { + if (request.delay_ms != 0) + { delay = K_MSEC(request.delay_ms); - } else { + } + else + { ChipLogProgress(NotSpecified, "Did not receive a reboot delay. Defaulting to 1s"); delay = K_SECONDS(1); } From d37cca9cfadea701f394b93c7ed5d1897d80bbd0 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 3 Oct 2023 15:28:29 -0400 Subject: [PATCH 4/6] Fix type for boufallolab --- examples/platform/bouffalolab/common/rpc/Rpc.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/examples/platform/bouffalolab/common/rpc/Rpc.cpp b/examples/platform/bouffalolab/common/rpc/Rpc.cpp index 02c0632b04fc09..d6d188faa147f0 100644 --- a/examples/platform/bouffalolab/common/rpc/Rpc.cpp +++ b/examples/platform/bouffalolab/common/rpc/Rpc.cpp @@ -94,11 +94,11 @@ class BouffaloButton final : public Button class BouffaloDevice final : public Device { public: - pw::Status Reboot(const pw_protobuf_Empty & request, pw_protobuf_Empty & response) override + pw::Status Reboot(const chip_rpc_RebootRequest & request, pw_protobuf_Empty & response) override { if (mRebootTimer) { - return pw::OkStatus(); + return pw::Status::Unavailable(); } TickType_t delayMs = kRebootTimerPeriodMs; @@ -118,12 +118,15 @@ class BouffaloDevice final : public Device pw::Status FactoryReset(const pw_protobuf_Empty & request, pw_protobuf_Empty & response) override { - if (!mRebootTimer) + if (mRebootTimer) { - mRebootTimer = xTimerCreateStatic("FactoryReset", kRebootTimerPeriodTicks, false, nullptr, FactoryResetHandler, - &mRebootTimerBuffer); - xTimerStart(mRebootTimer, 0); + return pw::Status::Unavailable(); } + + // Notice: reboot delay not configurable here + mRebootTimer = xTimerCreateStatic("FactoryReset", pdMS_TO_TICKS(kRebootTimerPeriodMs), false, nullptr, FactoryResetHandler, + &mRebootTimerBuffer); + xTimerStart(mRebootTimer, 0); return pw::OkStatus(); } From 674915ec84fb7b8ada953cd5b93bc15e59f1b6fe Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 3 Oct 2023 15:56:38 -0400 Subject: [PATCH 5/6] Ensure 0 initialization for member variable used in checks --- examples/platform/bouffalolab/common/rpc/Rpc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/platform/bouffalolab/common/rpc/Rpc.cpp b/examples/platform/bouffalolab/common/rpc/Rpc.cpp index d6d188faa147f0..faac342167cfd2 100644 --- a/examples/platform/bouffalolab/common/rpc/Rpc.cpp +++ b/examples/platform/bouffalolab/common/rpc/Rpc.cpp @@ -132,7 +132,7 @@ class BouffaloDevice final : public Device private: static constexpr uint32_t kRebootTimerPeriodMs = 1000; - TimerHandle_t mRebootTimer; + TimerHandle_t mRebootTimer = 0; StaticTimer_t mRebootTimerBuffer; static void RebootHandler(TimerHandle_t) { bl_sys_reset_por(); } From a7b37b75251d39d6b2722e8a3db808c0cf7f6820 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 3 Oct 2023 15:57:12 -0400 Subject: [PATCH 6/6] Restyle --- examples/platform/bouffalolab/common/rpc/Rpc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/platform/bouffalolab/common/rpc/Rpc.cpp b/examples/platform/bouffalolab/common/rpc/Rpc.cpp index faac342167cfd2..ba71648b68c42b 100644 --- a/examples/platform/bouffalolab/common/rpc/Rpc.cpp +++ b/examples/platform/bouffalolab/common/rpc/Rpc.cpp @@ -132,7 +132,7 @@ class BouffaloDevice final : public Device private: static constexpr uint32_t kRebootTimerPeriodMs = 1000; - TimerHandle_t mRebootTimer = 0; + TimerHandle_t mRebootTimer = 0; StaticTimer_t mRebootTimerBuffer; static void RebootHandler(TimerHandle_t) { bl_sys_reset_por(); }