From fd2f72914dbf5d2d7642b33a416611408eca06cd Mon Sep 17 00:00:00 2001 From: yelvlab Date: Wed, 2 Apr 2025 15:33:35 +0800 Subject: [PATCH] debug vofa --- inc/board_config.h | 2 ++ src/rs485.c | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/inc/board_config.h b/inc/board_config.h index c8a2284..f0341a5 100644 --- a/inc/board_config.h +++ b/inc/board_config.h @@ -9,6 +9,8 @@ // #define DEBUG_VERBOES +#define DEBUG_VOFA_TOOL + /******************************************************************************/ #define RCU_GPIO_I2C RCU_GPIOF diff --git a/src/rs485.c b/src/rs485.c index 368f267..384dafb 100644 --- a/src/rs485.c +++ b/src/rs485.c @@ -131,6 +131,15 @@ void eddy_current_value_report(void) { package_data[2] = (eddy_current_value_uint32 >> 8) & 0xFF; package_data[3] = eddy_current_value_uint32 & 0xFF; + +#ifdef DEBUG_VOFA_TOOL + printf("%d\n", eddy_current_value_uint32); +#else + package_data[0] = (eddy_current_value_uint32 >> 24) & 0xFF; + package_data[1] = (eddy_current_value_uint32 >> 16) & 0xFF; + package_data[2] = (eddy_current_value_uint32 >> 8) & 0xFF; + package_data[3] = eddy_current_value_uint32 & 0xFF; + uint8_t combined_data[7]; memcpy(combined_data, package_header, 3); memcpy(combined_data + 3, package_data, 4); @@ -138,6 +147,7 @@ void eddy_current_value_report(void) { printf("%c%c%c", package_header[0], package_header[1], package_header[2]); printf("%c%c%c%c", package_data[0], package_data[1], package_data[2], package_data[3]); printf("%c", calculate_crc(combined_data, 8)); +#endif } void tempture_value_report(void) {