From fb9fb9bdf03ac9c2ab815f17357461593ee7f609 Mon Sep 17 00:00:00 2001 From: Timo Date: Sun, 31 Aug 2025 12:25:02 +0200 Subject: [PATCH] reduced logging --- .../microros_transports/fdcan/microros_transports.c | 4 ++++ src/microros/subscribers/led0/led0_subscriber.cpp | 2 +- src/microros/subscribers/led1/led1_subscriber.cpp | 2 +- src/microros/subscribers/led2/led2_subscriber.cpp | 2 +- src/microros/subscribers/servo0/servo0_subscriber.cpp | 4 +++- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/modules/libmicroros/microros_transports/fdcan/microros_transports.c b/modules/libmicroros/microros_transports/fdcan/microros_transports.c index 7620023..6c53d99 100644 --- a/modules/libmicroros/microros_transports/fdcan/microros_transports.c +++ b/modules/libmicroros/microros_transports/fdcan/microros_transports.c @@ -50,11 +50,13 @@ static void can_rx_handler(const struct device *dev, struct can_frame *frame, vo ring_buf_put(&in_ringbuf, msg->data, MIN(ring_buf_space_get(&in_ringbuf), msg->len)); + /* printf("RX: "); for (size_t i = 0; i < msg->len; i++) { printf("%02X ", msg->data[i]); } printf(" / %i\n", msg->len); + */ } bool zephyr_transport_open(struct uxrCustomTransport * transport){ @@ -112,11 +114,13 @@ size_t zephyr_transport_write(struct uxrCustomTransport* transport, const uint8_ can_send(params->uart_dev, &frame, K_NO_WAIT, NULL, NULL); + /* printf("TX: "); for (size_t i = 0; i < len; i++) { printf("%02X ", msg->data[i]); } printf(" / %i\n", msg->len); + */ return len; } diff --git a/src/microros/subscribers/led0/led0_subscriber.cpp b/src/microros/subscribers/led0/led0_subscriber.cpp index 528cd1b..1b8ea10 100644 --- a/src/microros/subscribers/led0/led0_subscriber.cpp +++ b/src/microros/subscribers/led0/led0_subscriber.cpp @@ -11,7 +11,7 @@ std_msgs__msg__Bool led0_msg; void led0_callback(const void *msgin){ const std_msgs__msg__Bool *msg = (const std_msgs__msg__Bool *)msgin; - printk("Set led0 to %s\n", msg->data ? "on" : "off"); + //printk("Set led0 to %s\n", msg->data ? "on" : "off"); gpio_pin_configure_dt(&led0, msg->data ? GPIO_OUTPUT_ACTIVE : GPIO_OUTPUT_INACTIVE); } diff --git a/src/microros/subscribers/led1/led1_subscriber.cpp b/src/microros/subscribers/led1/led1_subscriber.cpp index cee27ae..97dabba 100644 --- a/src/microros/subscribers/led1/led1_subscriber.cpp +++ b/src/microros/subscribers/led1/led1_subscriber.cpp @@ -11,7 +11,7 @@ std_msgs__msg__Bool led1_msg; void led1_callback(const void *msgin){ const std_msgs__msg__Bool *msg = (const std_msgs__msg__Bool *)msgin; - printk("Set led1 to %s\n", msg->data ? "on" : "off"); + //printk("Set led1 to %s\n", msg->data ? "on" : "off"); gpio_pin_configure_dt(&led1, msg->data ? GPIO_OUTPUT_ACTIVE : GPIO_OUTPUT_INACTIVE); } diff --git a/src/microros/subscribers/led2/led2_subscriber.cpp b/src/microros/subscribers/led2/led2_subscriber.cpp index c1c7aa1..808dcc2 100644 --- a/src/microros/subscribers/led2/led2_subscriber.cpp +++ b/src/microros/subscribers/led2/led2_subscriber.cpp @@ -11,7 +11,7 @@ std_msgs__msg__Bool led2_msg; void led2_callback(const void *msgin){ const std_msgs__msg__Bool *msg = (const std_msgs__msg__Bool *)msgin; - printk("Set led2 to %s\n", msg->data ? "on" : "off"); + //printk("Set led2 to %s\n", msg->data ? "on" : "off"); gpio_pin_configure_dt(&led2, msg->data ? GPIO_OUTPUT_ACTIVE : GPIO_OUTPUT_INACTIVE); } diff --git a/src/microros/subscribers/servo0/servo0_subscriber.cpp b/src/microros/subscribers/servo0/servo0_subscriber.cpp index 3c9595d..0e18766 100644 --- a/src/microros/subscribers/servo0/servo0_subscriber.cpp +++ b/src/microros/subscribers/servo0/servo0_subscriber.cpp @@ -23,15 +23,17 @@ void servo_callback(const void *msgin){ uint32_t pulse_ns = min_pulse_ns + (angle / 180.0f) * (max_pulse_ns - min_pulse_ns); - printk("Set servo to %d.%d° = %d.%d ms°\n", int(angle), int(angle * 100) % 100, pulse_ns / 1000000, (pulse_ns / 1000) % 1000); + //printk("Set servo to %d.%d° = %d.%d ms°\n", int(angle), int(angle * 100) % 100, pulse_ns / 1000000, (pulse_ns / 1000) % 1000); int ret = pwm_set_pulse_dt(&servo0, pulse_ns); + /* if (ret == 0) { printk("PWM pulse set successfully.\n"); } else { printk("Failed to set PWM pulse! Error: %d\n", ret); } + */ }