From 6c9328da5c611959c2fc336eced57df05a7e6de9 Mon Sep 17 00:00:00 2001 From: Mirko Banchi Date: Wed, 13 Aug 2025 17:56:30 +0200 Subject: [PATCH] Use PRIu32/PRIx32 macros instead of harcoded %u/%X format specifiers to avoid -Wformat warnings. --- CANopenNode_STM32/CO_app_STM32.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CANopenNode_STM32/CO_app_STM32.c b/CANopenNode_STM32/CO_app_STM32.c index ff46b46..ec16162 100644 --- a/CANopenNode_STM32/CO_app_STM32.c +++ b/CANopenNode_STM32/CO_app_STM32.c @@ -28,6 +28,7 @@ #include "CANopen.h" #include "main.h" #include +#include #include "CO_storageBlank.h" #include "OD.h" @@ -90,7 +91,7 @@ canopen_app_init(CANopenNodeSTM32* _canopenNodeSTM32) { log_printf("Error: Can't allocate memory\n"); return 1; } else { - log_printf("Allocated %u bytes for CANopen objects\n", heapMemoryUsed); + log_printf("Allocated %" PRIu32 " bytes for CANopen objects\n", heapMemoryUsed); } canopenNodeSTM32->canOpenStack = CO; @@ -155,7 +156,7 @@ canopen_app_resetCommunication() { canopenNodeSTM32->activeNodeID, &errInfo); if (err != CO_ERROR_NO && err != CO_ERROR_NODE_ID_UNCONFIGURED_LSS) { if (err == CO_ERROR_OD_PARAMETERS) { - log_printf("Error: Object Dictionary entry 0x%X\n", errInfo); + log_printf("Error: Object Dictionary entry 0x%" PRIx32 "\n", errInfo); } else { log_printf("Error: CANopen initialization failed: %d\n", err); } @@ -165,7 +166,7 @@ canopen_app_resetCommunication() { err = CO_CANopenInitPDO(CO, CO->em, OD, canopenNodeSTM32->activeNodeID, &errInfo); if (err != CO_ERROR_NO && err != CO_ERROR_NODE_ID_UNCONFIGURED_LSS) { if (err == CO_ERROR_OD_PARAMETERS) { - log_printf("Error: Object Dictionary entry 0x%X\n", errInfo); + log_printf("Error: Object Dictionary entry 0x%" PRIx32 "\n", errInfo); } else { log_printf("Error: PDO initialization failed: %d\n", err); }