Explorar o código

1. rtc中断加红外发送中禁止进入标志
2. 调整nb等待tdc完成标志的方式,增加超时等待功能
3. 处理日结月结结算数据和累积量差值不一致的问题
4. 修改低电压显示和报警标志不同步问题
5. 修改低电压报警阈值3.15 返回值3.05

wxl hai 2 semanas
pai
achega
2a3286cb99
Modificáronse 6 ficheiros con 30 adicións e 13 borrados
  1. 1 1
      Users/app_nb/app_nb.c
  2. 9 4
      Users/bill/bill.c
  3. 3 3
      Users/lcd/lcd_ghg102.c
  4. 7 3
      Users/main.c
  5. 2 0
      Users/rtc_isr.c
  6. 8 2
      Users/stat/stat.h

+ 1 - 1
Users/app_nb/app_nb.c

@@ -1081,7 +1081,7 @@ uint8_t delay_send_cmd_cnt = 0;
 void send_nb_data_after_sample(char *dat)
 {
     delay_send_cmd_cnt++;
-    if (NB_CHECK_TDC_COMPLETE_FLAG == 1 && delay_send_cmd_cnt > 5)
+    if (NB_CHECK_TDC_COMPLETE_FLAG == 1 && delay_send_cmd_cnt > 3 ||delay_send_cmd_cnt > 12)
     {
         nb_tx_str(dat);
         delay_send_cmd_cnt = 0;

+ 9 - 4
Users/bill/bill.c

@@ -41,20 +41,25 @@ void bill_init(void)
 	init_cur_flow_bill();
 }
 
+uint32_t cal_cur_flow(double cum)
+{
+	uint64_t x = (uint64_t)cum;
+    return (uint32_t)((x + 5000ULL) / 10000ULL);
+}
 uint32_t get_month_fw_used_bill(void)
 { // 获取月正向流量数据
 
 	if (BillRun.fw_cum_flow <= bak_month_cum_flow.fw_cum_flow)
 		return 0;
 	else
-		return (uint32_t)((BillRun.fw_cum_flow - bak_month_cum_flow.fw_cum_flow) * 0.0001); // 锟斤拷前锟桔计斤拷锟斤拷锟斤拷细锟斤拷锟斤拷奂平锟斤拷锟侥诧拷值
+		return cal_cur_flow(BillRun.fw_cum_flow) - cal_cur_flow(bak_month_cum_flow.fw_cum_flow); // 
 }
 uint32_t get_month_bw_used_bill(void)
 { // 获取月反向流量
 	if (BillRun.bw_cum_flow <= bak_month_cum_flow.bw_cum_flow)
 		return 0;
 	else
-		return (uint32_t)((BillRun.bw_cum_flow - bak_month_cum_flow.bw_cum_flow) * 0.0001);
+		return cal_cur_flow(BillRun.bw_cum_flow) - cal_cur_flow(bak_month_cum_flow.bw_cum_flow);
 }
 
 uint32_t get_day_fw_used_bill(void) // 月结和日结都是两位小数点m3 wxl2026-5-6
@@ -62,14 +67,14 @@ uint32_t get_day_fw_used_bill(void) // 
 	if (BillRun.fw_cum_flow <= bak_day_cum_flow.fw_cum_flow)
 		return 0;
 	else
-		return (uint32_t)((BillRun.fw_cum_flow - bak_day_cum_flow.fw_cum_flow) * 0.0001);
+		return cal_cur_flow(BillRun.fw_cum_flow) - cal_cur_flow(bak_day_cum_flow.fw_cum_flow);
 }
 uint32_t get_day_bw_used_bill(void)
 { // 获取日反向流量
 	if (BillRun.bw_cum_flow <= bak_day_cum_flow.bw_cum_flow)
 		return 0;
 	else
-		return (uint32_t)((BillRun.bw_cum_flow - bak_day_cum_flow.bw_cum_flow) * 0.0001);
+		return cal_cur_flow(BillRun.bw_cum_flow) - cal_cur_flow(bak_day_cum_flow.bw_cum_flow);
 }
 
 uint32_t get_hour_fw_used_bill(void)

+ 3 - 3
Users/lcd/lcd_ghg102.c

@@ -348,7 +348,7 @@ void lcd_temp(void)
 void lcd_bat(void)
 {
     LCD_DispStr("U=", 3, 2);
-    LCD_DispFloat((float)McuVbat * 1.0f / 1000, 5, 3, 1);
+    LCD_DispFloat((float)(McuVbat+0.001) * 1.0f / 1000, 5, 3, 1);
 }
 
 void lcd_date(void)
@@ -500,9 +500,9 @@ void lcd_run_time(void)
 
 void lcd_low_power(void)
 {
-    boolean_t flag = McuVbat < LOW_PWR_THRESHOLD;
+  //  boolean_t flag = McuVbat < LOW_PWR_THRESHOLD;
 
-    if (flag)
+    if (alarm_status(ERR_LOW_POWER))
     {
         DispMem_Status |= LCD_STATUS_LOWPWR;
     }

+ 7 - 3
Users/main.c

@@ -146,6 +146,7 @@ void PeriodProc(void) // 
             if ((get_rtc_interrupt_time() == 2) || (get_rtc_interrupt_time() == 1))
             {
                 set_rtc_interrupt_time(0.5); // 0.5
+//							  c_step=1;
             }
         }
         else if (G_NB_CAN_DEEP_SLEEP == 0) // 空管,正在上报
@@ -153,6 +154,7 @@ void PeriodProc(void) // 
             if ((uint8_t)get_rtc_interrupt_time() != 1)
             {
                 set_rtc_interrupt_time(1);
+//							  c_step=1;
             }
         }
         else // 空管,无上报
@@ -160,6 +162,7 @@ void PeriodProc(void) // 
             if ((uint8_t)get_rtc_interrupt_time() != 2)
             {
                 set_rtc_interrupt_time(2);
+//							  c_step=2;
             }
         }
         // add by yuewei 20260519 start
@@ -194,6 +197,7 @@ void PeriodProc(void) // 
         run_clk_task_handler(); // wxl2026-5-8 一秒一次一些零星任务放在这个里面
         AlarmHandle();          // wxl2026-4-30
         feed_dog();
+
     }
 
     if (rr->flag_1m)
@@ -371,11 +375,11 @@ static void tdc_business_thread(void *parameter)
             // rt_thread_mdelay(15);
             rtc_run_t *rr;
             get_rtc_run(&rr);
-//#ifdef DEBUG_TDC
-//            LOG("Diff=%.6f, AvgDiff=%.6f, T=%.6f, vol=%.6f\n", SerPlot.f.Data[0], SerPlot.f.Data[3], WaterPrmt[0], FlowVol * 0.000001f * 3600);
+#ifdef DEBUG_TDC
+            LOG("Diff=%.6f, AvgDiff=%.6f, T=%.6f, vol=%.6f\n", SerPlot.f.Data[0], SerPlot.f.Data[3], WaterPrmt[0], FlowVol * 0.000001f * 3600);
             // LOG("diff=%.6f, U=%.6f, D=%.6f\n", SerPlot.f.Data[0], SerPlot.f.Data[1], SerPlot.f.Data[2]);
             rt_thread_mdelay(4);
-//#endif
+#endif
 #endif
             G_TDC_DEEP_SLEEP = 1;
             // rt_thread_mdelay(10);

+ 2 - 0
Users/rtc_isr.c

@@ -163,6 +163,8 @@ void RTC_IRQHandler(void)
 		//if(NB_RUN_UPDATE_FLAG == 1)return; //2026-4-8 wuxiaolin
 		//add by yuewei 20260309 to deal hongwai long data
     if(HONGWAI_LONG_RX_FLAG == 1)return;
+		extern uint8_t finsh_txing_flag;
+		if(finsh_txing_flag == 1)return;
 		//LOG("---------------------------------0\n");
     extern uint8_t finsh_txing_flag;     //modify by HBR 20260914 ,·ÀÖ¹ÔÚºìÍâͨÐÅʱ¿¨ËÀms1031    
     if(finsh_txing_flag==1) return;

+ 8 - 2
Users/stat/stat.h

@@ -3,11 +3,14 @@
 
 #include "stdint.h"
 
+#define MIN_WARN_VBAT 3050
+#define WARN_VBAT_RET 3150
+		
 #ifdef __cplusplus
 extern "C"
 {
 #endif
-
+		
     extern void SetStatFlow(double flow_rate);
     extern void ClrStatFlow(void);
     extern double get_max_flow_rate(void);
@@ -29,7 +32,10 @@ extern "C"
     extern void high_pressure_monitor(void);
     extern void low_pressure_monitor(void);
     extern void pressure_monitor(void);
-
+//		extern uint8_t c_step;
+		
+		
+		
 #ifdef __cplusplus
 }
 #endif