mirror of
https://github.com/xiaozhou233/RiverWaterQualityMonitoring.git
synced 2026-12-05 13:05:53 +08:00
更新主程序、修复PH、TDS和浊度的UART输出格式
This commit is contained in:
1 parent
20c44ac853
commit
4b9a921122
1 file changed
+5
-7
@@ -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,
|
||||||
|
|||||||
Reference in new issue
Block a user