From f47dbcc94cd6e5c9fedb5b3c4dbe8a04dce357c7 Mon Sep 17 00:00:00 2001 From: xiaozhou233 Date: Sun, 12 Jul 2026 14:36:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AF=B9ESP8266=E5=92=8CFire?= =?UTF-8?q?Water=EF=BC=88VOFA+=EF=BC=89=E7=9A=84UART=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E4=BC=A0=E8=BE=93=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- stm32f103c8t6/Core/Src/main.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/stm32f103c8t6/Core/Src/main.c b/stm32f103c8t6/Core/Src/main.c index d9e2f93..038635c 100644 --- a/stm32f103c8t6/Core/Src/main.c +++ b/stm32f103c8t6/Core/Src/main.c @@ -114,6 +114,7 @@ int main(void) PH_Init(); char uart_buf[80]; + char uart_buf_2[80]; /* USER CODE END 2 */ /* Infinite loop */ @@ -142,6 +143,7 @@ int main(void) float tds_avg = tds_sum / 10.0f; float tur_avg = tur_sum / 10.0f; + // For ESP8266 snprintf( uart_buf, sizeof(uart_buf), @@ -151,13 +153,23 @@ int main(void) tur_avg ); + // For FireWater (VOFA+) + snprintf( + uart_buf_2, + sizeof(uart_buf_2), + "ph-tds-turbidity: %.2f,%.2f,%.2f\r\n", + ph_avg, + tds_avg, + tur_avg + ); + HAL_UART_Transmit(&huart3, (uint8_t*)uart_buf, strlen(uart_buf), 100); HAL_UART_Transmit(&huart1, - (uint8_t*)uart_buf, - strlen(uart_buf), + (uint8_t*)uart_buf_2, + strlen(uart_buf_2), 100); HAL_Delay(500);