更新主程序、修复PH、TDS和浊度的UART输出格式

This commit is contained in:
xiaozhou233 committed 2026-07-03 20:57:15 +08:00
1 parent 20c44ac853
commit 4b9a921122
1 file changed
+5 -7
+5 -7
View File
@@ -48,6 +48,7 @@ PH_Data_t ph = {0};
/* USER CODE END PM */ /* USER CODE END PM */
/* Private variables ---------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/
/* USER CODE BEGIN PV */
ADC_HandleTypeDef hadc1; ADC_HandleTypeDef hadc1;
DMA_HandleTypeDef hdma_adc1; DMA_HandleTypeDef hdma_adc1;
@@ -55,9 +56,6 @@ SPI_HandleTypeDef hspi1;
UART_HandleTypeDef huart1; UART_HandleTypeDef huart1;
UART_HandleTypeDef huart3; UART_HandleTypeDef huart3;
/* USER CODE BEGIN PV */
/* USER CODE END PV */ /* USER CODE END PV */
/* Private function prototypes -----------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/
@@ -129,10 +127,10 @@ int main(void)
PH_Calc(raw.ph, &ph); PH_Calc(raw.ph, &ph);
sprintf(uart_buf, sprintf(uart_buf,
"PH=%.2f;TDS=%d;TUR=%d\r\n", "PH=%.2f;TDS=%.2f;TUR=%.2f\r\n",
ph.ph, // ✔ 改这里 ph.ph,
(int)tds.tds, tds.tds,
(int)tur.ntu); tur.ntu);
HAL_UART_Transmit(&huart1, HAL_UART_Transmit(&huart1,
(uint8_t*)uart_buf, (uint8_t*)uart_buf,