From 4b9a9211229c4c74c622957c0d87e1a55aff6472 Mon Sep 17 00:00:00 2001 From: xiaozhou233 Date: Fri, 3 Jul 2026 20:57:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=B8=BB=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E3=80=81=E4=BF=AE=E5=A4=8DPH=E3=80=81TDS=E5=92=8C=E6=B5=8A?= =?UTF-8?q?=E5=BA=A6=E7=9A=84UART=E8=BE=93=E5=87=BA=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- stm32f103c8t6/Core/Src/main.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/stm32f103c8t6/Core/Src/main.c b/stm32f103c8t6/Core/Src/main.c index e546855..a836102 100644 --- a/stm32f103c8t6/Core/Src/main.c +++ b/stm32f103c8t6/Core/Src/main.c @@ -48,6 +48,7 @@ PH_Data_t ph = {0}; /* USER CODE END PM */ /* Private variables ---------------------------------------------------------*/ +/* USER CODE BEGIN PV */ ADC_HandleTypeDef hadc1; DMA_HandleTypeDef hdma_adc1; @@ -55,9 +56,6 @@ SPI_HandleTypeDef hspi1; UART_HandleTypeDef huart1; UART_HandleTypeDef huart3; - -/* USER CODE BEGIN PV */ - /* USER CODE END PV */ /* Private function prototypes -----------------------------------------------*/ @@ -129,10 +127,10 @@ int main(void) PH_Calc(raw.ph, &ph); sprintf(uart_buf, - "PH=%.2f;TDS=%d;TUR=%d\r\n", - ph.ph, // ✔ 改这里 - (int)tds.tds, - (int)tur.ntu); + "PH=%.2f;TDS=%.2f;TUR=%.2f\r\n", + ph.ph, + tds.tds, + tur.ntu); HAL_UART_Transmit(&huart1, (uint8_t*)uart_buf,