From c1b6451b9c990ef7a5a63718887366ce63e4ed69 Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Mon, 20 Jun 2016 13:25:13 -1000 Subject: [PATCH] his is needed to work with the latest upstream nuttx 7.16+ Logger changes --- .../stm32/driver/src/internal.hpp | 4 +-- .../stm32/driver/src/uc_stm32_clock.cpp | 2 +- .../stm32/test_stm32f107/src/board/board.cpp | 2 +- .../stm32/test_stm32f107/src/main.cpp | 32 +++++++++---------- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/libuavcan_drivers/stm32/driver/src/internal.hpp b/libuavcan_drivers/stm32/driver/src/internal.hpp index eba9a17bb3..eaf61c78b4 100644 --- a/libuavcan_drivers/stm32/driver/src/internal.hpp +++ b/libuavcan_drivers/stm32/driver/src/internal.hpp @@ -26,10 +26,10 @@ * Debug output */ #ifndef UAVCAN_STM32_LOG -// lowsyslog() crashes the system in this context +// syslog() crashes the system in this context // # if UAVCAN_STM32_NUTTX && CONFIG_ARCH_LOWPUTC # if 0 -# define UAVCAN_STM32_LOG(fmt, ...) lowsyslog("uavcan_stm32: " fmt "\n", ##__VA_ARGS__) +# define UAVCAN_STM32_LOG(fmt, ...) syslog("uavcan_stm32: " fmt "\n", ##__VA_ARGS__) # else # define UAVCAN_STM32_LOG(...) ((void)0) # endif diff --git a/libuavcan_drivers/stm32/driver/src/uc_stm32_clock.cpp b/libuavcan_drivers/stm32/driver/src/uc_stm32_clock.cpp index 97762423a6..80798c70a3 100644 --- a/libuavcan_drivers/stm32/driver/src/uc_stm32_clock.cpp +++ b/libuavcan_drivers/stm32/driver/src/uc_stm32_clock.cpp @@ -329,7 +329,7 @@ static void updateRatePID(uavcan::UtcDuration adjustment) utc_correction_nsec_per_overflow = uavcan::int32_t((USecPerOverflow * 1000) * (total_rate_correction_ppm / 1e6F)); -// lowsyslog("$ adj=%f rel_rate=%f rel_rate_eint=%f tgt_rel_rate=%f ppm=%f\n", +// syslog("$ adj=%f rel_rate=%f rel_rate_eint=%f tgt_rel_rate=%f ppm=%f\n", // adj_usec, utc_rel_rate_ppm, utc_rel_rate_error_integral, target_rel_rate_ppm, // total_rate_correction_ppm); } diff --git a/libuavcan_drivers/stm32/test_stm32f107/src/board/board.cpp b/libuavcan_drivers/stm32/test_stm32f107/src/board/board.cpp index 3f9bdd86ba..03d8c6f80a 100644 --- a/libuavcan_drivers/stm32/test_stm32f107/src/board/board.cpp +++ b/libuavcan_drivers/stm32/test_stm32f107/src/board/board.cpp @@ -37,7 +37,7 @@ void init() __attribute__((noreturn)) void die(int error) { - lowsyslog("Fatal error %i\n", error); + syslog("Fatal error %i\n", error); while (1) { setLed(false); diff --git a/libuavcan_drivers/stm32/test_stm32f107/src/main.cpp b/libuavcan_drivers/stm32/test_stm32f107/src/main.cpp index 5cf2921c9a..218acc124a 100644 --- a/libuavcan_drivers/stm32/test_stm32f107/src/main.cpp +++ b/libuavcan_drivers/stm32/test_stm32f107/src/main.cpp @@ -39,13 +39,13 @@ void init() do { ::sleep(1); - ::lowsyslog("CAN auto bit rate detection...\n"); + ::syslog("CAN auto bit rate detection...\n"); std::uint32_t bitrate = 0; res = can.init([]() { ::usleep(can.getRecommendedListeningDelay().toUSec()); }, bitrate); if (res >= 0) { - ::lowsyslog("CAN inited at %u bps\n", unsigned(bitrate)); + ::syslog("CAN inited at %u bps\n", unsigned(bitrate)); } } while (res < 0); @@ -68,7 +68,7 @@ class : public chibios_rt::BaseStaticThread<8192> getNode().setSoftwareVersion(swver); - lowsyslog("Git commit hash: 0x%08x\n", GIT_HASH); + syslog("Git commit hash: 0x%08x\n", GIT_HASH); /* * Hardware version @@ -82,12 +82,12 @@ class : public chibios_rt::BaseStaticThread<8192> getNode().setHardwareVersion(hwver); - lowsyslog("UDID:"); + syslog("UDID:"); for (auto b : hwver.unique_id) { - lowsyslog(" %02x", unsigned(b)); + syslog(" %02x", unsigned(b)); } - lowsyslog("\n"); + syslog("\n"); } void performDynamicNodeIDAllocation() @@ -100,17 +100,17 @@ class : public chibios_rt::BaseStaticThread<8192> board::die(client_start_res); } - lowsyslog("Waiting for dynamic node ID allocation...\n"); + syslog("Waiting for dynamic node ID allocation...\n"); while (!client.isAllocationComplete()) { const int spin_res = getNode().spin(uavcan::MonotonicDuration::fromMSec(100)); if (spin_res < 0) { - lowsyslog("Spin failure: %i\n", spin_res); + syslog("Spin failure: %i\n", spin_res); } } - lowsyslog("Dynamic node ID %d allocated by %d\n", + syslog("Dynamic node ID %d allocated by %d\n", int(client.getAllocatedNodeID().get()), int(client.getAllocatorNodeID().get())); @@ -154,24 +154,24 @@ public: /* * Main loop */ - lowsyslog("UAVCAN node started\n"); + syslog("UAVCAN node started\n"); getNode().setModeOperational(); while (true) { const int spin_res = getNode().spin(uavcan::MonotonicDuration::fromMSec(5000)); if (spin_res < 0) { - lowsyslog("Spin failure: %i\n", spin_res); + syslog("Spin failure: %i\n", spin_res); } - lowsyslog("Time sync master: %u\n", unsigned(time_sync_slave.getMasterNodeID().get())); + syslog("Time sync master: %u\n", unsigned(time_sync_slave.getMasterNodeID().get())); - lowsyslog("Memory usage: free=%u used=%u worst=%u\n", + syslog("Memory usage: free=%u used=%u worst=%u\n", getNode().getAllocator().getNumFreeBlocks(), getNode().getAllocator().getNumUsedBlocks(), getNode().getAllocator().getPeakNumUsedBlocks()); - lowsyslog("CAN errors: %lu %lu\n", + syslog("CAN errors: %lu %lu\n", static_cast(can.driver.getIface(0)->getErrorCount()), static_cast(can.driver.getIface(1)->getErrorCount())); @@ -194,7 +194,7 @@ int main() { app::init(); - lowsyslog("Starting the UAVCAN thread\n"); + syslog("Starting the UAVCAN thread\n"); app::uavcan_node_thread.start(LOWPRIO); while (true) @@ -206,7 +206,7 @@ int main() } const uavcan::UtcTime utc = uavcan_stm32::clock::getUtc(); - lowsyslog("UTC %lu sec Rate corr: %fPPM Jumps: %lu Locked: %i\n", + syslog("UTC %lu sec Rate corr: %fPPM Jumps: %lu Locked: %i\n", static_cast(utc.toMSec() / 1000), uavcan_stm32::clock::getUtcRateCorrectionPPM(), uavcan_stm32::clock::getUtcJumpCount(),