diff --git a/examples/lighting-app/nrfconnect/README.md b/examples/lighting-app/nrfconnect/README.md index e51f6c5010b780..ab0fbb860c7463 100644 --- a/examples/lighting-app/nrfconnect/README.md +++ b/examples/lighting-app/nrfconnect/README.md @@ -358,11 +358,11 @@ Semiconductor's kit you own. ### Building with Pigweed RPCs -The RPCs in `lighting-common/pigweed-lighting.proto` can be used to control -various functionalities of the lighting app from a USB-connected host computer. -To build the example with the RPC server, run the following command with -_build-target_ replaced with the build target name of the Nordic Semiconductor's -kit you own: +The RPCs in `lighting-common/lighting_service/lighting_service.proto` can be +used to control various functionalities of the lighting app from a USB-connected +host computer. To build the example with the RPC server, run the following +command with _build-target_ replaced with the build target name of the Nordic +Semiconductor's kit you own: $ west build -b build-target -- -DOVERLAY_CONFIG=rpc.overlay diff --git a/examples/lighting-app/nrfconnect/main/Rpc.cpp b/examples/lighting-app/nrfconnect/main/Rpc.cpp index 4ef155ec0c4349..54bb6aea1ba7be 100644 --- a/examples/lighting-app/nrfconnect/main/Rpc.cpp +++ b/examples/lighting-app/nrfconnect/main/Rpc.cpp @@ -41,6 +41,16 @@ LOG_MODULE_DECLARE(app); namespace chip { namespace rpc { +namespace { + +void reboot_timer_handler(struct k_timer * dummy) +{ + NVIC_SystemReset(); +} +K_TIMER_DEFINE(reboot_timer, reboot_timer_handler, NULL); + +} // namespace + class Lighting final : public generated::Lighting { public: @@ -75,12 +85,13 @@ class Device final : public generated::Device { // TODO: Clear data from KVS DeviceLayer::ConfigurationMgr().InitiateFactoryReset(); + // Reboot device after clearing data + k_timer_start(&reboot_timer, K_SECONDS(1), K_FOREVER); return pw::OkStatus(); } pw::Status Reboot(ServerContext & ctx, const pw_protobuf_Empty & request, pw_protobuf_Empty & response) { - NVIC_SystemReset(); - // WILL NOT RETURN + k_timer_start(&reboot_timer, K_SECONDS(1), K_FOREVER); return pw::OkStatus(); } pw::Status TriggerOta(ServerContext & ctx, const pw_protobuf_Empty & request, pw_protobuf_Empty & response)