From 8a7baaf87aad04fea7963a8af0d6f5111a9a629f Mon Sep 17 00:00:00 2001 From: yelvlab Date: Wed, 8 Jan 2025 09:14:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=80=9A=E4=BF=A1=E5=8D=8F?= =?UTF-8?q?=E8=AE=AE=E9=83=A8=E5=88=86=EF=BC=8C=E4=BF=AE=E6=94=B9=E7=89=88?= =?UTF-8?q?=E5=9E=8B=E4=B8=BA0x04?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/rs485_protocol.h | 4 ++-- src/rs485_protocol.c | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/inc/rs485_protocol.h b/inc/rs485_protocol.h index baf471e..d046836 100644 --- a/inc/rs485_protocol.h +++ b/inc/rs485_protocol.h @@ -21,7 +21,7 @@ #define RX_BUFFER_SIZE 32 #define PROTOCOL_PACKAGE_HEADER 0xD5 -#define PROTOCOL_BOARD_TYPE 0x03 +#define PROTOCOL_BOARD_TYPE 0x04 #define PROTOCOL_PACKAGE_LENGTH 0x02 /******************************************************************************/ @@ -49,7 +49,7 @@ validation_result_t validate_package_type(uint8_t* data); validation_result_t validate_data_length(uint8_t* data); -void gd60914_tempture(void); +void gd60914_tempture_report(void); void ultrasonic_distance_report(void); diff --git a/src/rs485_protocol.c b/src/rs485_protocol.c index 4ffed9e..06bf928 100644 --- a/src/rs485_protocol.c +++ b/src/rs485_protocol.c @@ -21,8 +21,9 @@ void process_command(uint8_t *cmd, size_t length) { sprintf(combined_str, "%c%c", cmd[3], cmd[4]); if (strcmp(combined_str, "M1") == 0) { ultrasonic_distance_report(); - } else if (strcmp(combined_str, "M2") == 0) { - gd60914_tempture(); + } else if (strcmp(combined_str, "M2") == 0) + { + gd60914_tempture_report(); } else if (strcmp(combined_str, "M3") == 0) { printf("%c%c%c%c%c%c", 0xB5, 0xF1, 0x02, 0x6F, 0x6B, 0xCC); @@ -131,7 +132,7 @@ void ultrasonic_distance_report(void) { printf("%c", calculate_crc(combined_data, 8)); } -void gd60914_tempture(void) { +void gd60914_tempture_report(void) { static uint8_t package_header[3] = {0xB5, 0xF0, 0x02}; uint8_t combined_data[5];