From 67ee9d567f949ef84743a591989aeae354c5cc1d Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Fri, 9 Oct 2015 01:53:53 +0300 Subject: [PATCH] STM32 example: cleaner node initialization --- .../stm32/test_stm32f107/src/main.cpp | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/libuavcan_drivers/stm32/test_stm32f107/src/main.cpp b/libuavcan_drivers/stm32/test_stm32f107/src/main.cpp index 88dcf5f1b9..6910edeea4 100644 --- a/libuavcan_drivers/stm32/test_stm32f107/src/main.cpp +++ b/libuavcan_drivers/stm32/test_stm32f107/src/main.cpp @@ -92,22 +92,12 @@ public: configureNodeInfo(); /* - * Initializing the UAVCAN node - this may take a while + * Initializing the UAVCAN node */ - while (true) + const int node_init_res = getNode().start(); + if (node_init_res < 0) { - // Calling start() multiple times is OK - only the first successfull call will be effective - int res = getNode().start(); - - if (res < 0) - { - lowsyslog("Node initialization failure: %i, will try agin soon\n", res); - } - else - { - break; - } - ::sleep(3); + board::die(node_init_res); } /*