From f13067463052ec48f889ecf67878d2402d2c8618 Mon Sep 17 00:00:00 2001 From: yelvlab Date: Thu, 26 Dec 2024 01:02:07 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"=E6=B5=8B=E8=AF=95=E6=8F=90=E4=BA=A4"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 6c9543648f5c719cc00f1a56cb2e5e6426dcd664. --- README.md | 3 --- inc/rs485.h | 1 - src/main.c | 22 ++-------------------- src/rs485.c | 10 ++++------ 4 files changed, 6 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 6070274..3ed2592 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,3 @@ - 数据长度错误回包 - `B5 F4 03 65 72 72 40`, 有效数据为 `err` -### 3. 读取数据时间间隔 - -- 推荐数据时间间隔至少为200ms diff --git a/inc/rs485.h b/inc/rs485.h index 33ce875..b24f233 100644 --- a/inc/rs485.h +++ b/inc/rs485.h @@ -13,7 +13,6 @@ #include #include #include -#include "tmp112.h" /******************************************************************************/ diff --git a/src/main.c b/src/main.c index 814f3b7..6d9db53 100644 --- a/src/main.c +++ b/src/main.c @@ -18,21 +18,6 @@ uint32_t g_temperature_uint32; uint32_t g_eddy_current_value_uint32; -void watchdog_init(void) { - /* Enable the LSI clock */ - rcu_osci_on(RCU_IRC8M); - rcu_osci_stab_wait(RCU_IRC8M); - - /* Enable the FWDGT clock */ - rcu_periph_clock_enable(RCU_WWDGT); - - /* Configure FWDGT counter clock: 40KHz(IRC40K) / 256 = 0.15625 KHz */ - fwdgt_config(156, FWDGT_PSC_DIV256); // Set timeout to 4 seconds (625 / 0.15625 KHz) - - /* Enable FWDGT */ - fwdgt_enable(); -} - /*! \brief main function \param[in] none @@ -55,16 +40,13 @@ int main(void) { /* configure LDC1612 */ ldc1612_single_ch0_config(); - watchdog_init(); - while (1) { - delay_ms(99); + delay_ms(100); g_eddy_current_value_uint32 = 0; g_temperature_uint32 = 0; g_eddy_current_value_uint32 = ldc1612_get_raw_channel_result(CHANNEL_0); - // g_temperature_uint32 = tmp112a_get_raw_channel_result(); + g_temperature_uint32 = tmp112a_get_raw_channel_result(); // printf("1"); - fwdgt_counter_reload(); } } diff --git a/src/rs485.c b/src/rs485.c index 1182126..b578061 100644 --- a/src/rs485.c +++ b/src/rs485.c @@ -135,12 +135,10 @@ void eddy_current_value_report(void) { } void tempture_value_report(void) { - uint32_t temperature_uint32 = tmp112a_get_raw_channel_result(); - - package_data[0] = (temperature_uint32 >> 24) & 0xFF; - package_data[1] = (temperature_uint32 >> 16) & 0xFF; - package_data[2] = (temperature_uint32 >> 8) & 0xFF; - package_data[3] = temperature_uint32 & 0xFF; + package_data[0] = (g_temperature_uint32 >> 24) & 0xFF; + package_data[1] = (g_temperature_uint32 >> 16) & 0xFF; + package_data[2] = (g_temperature_uint32 >> 8) & 0xFF; + package_data[3] = g_temperature_uint32 & 0xFF; uint8_t combined_data[7]; memcpy(combined_data, package_header, 3);