From 72def895431ad7a08e635b11f3da738e2b2c4618 Mon Sep 17 00:00:00 2001
From: wujiazhi <1147861305@qq.com>
Date: Thu, 13 Jun 2024 11:31:04 +0800
Subject: [PATCH] add lower model test

---
 Soft/sundry.c |  530 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 530 insertions(+), 0 deletions(-)

diff --git a/Soft/sundry.c b/Soft/sundry.c
new file mode 100644
index 0000000..17bd6fd
--- /dev/null
+++ b/Soft/sundry.c
@@ -0,0 +1,530 @@
+#include "main.h"
+#include "sundry.h"
+#include "time.h"
+#include "string.h"
+#include "administrator.h"
+#include "key.h"
+
+#define SYS_RESTART_DELAY_TIME 180 
+// Ĭ���ϵ�GET_FLOW_DATA_PERIOD_TIME�ɼ�һ�����ݣ�����ʱ��ΪSYS_WAKE_UP_TIME
+SYS_DELAY_SEC_PARA_T sys_delay_sec_para_g = {{RESET}, {RESET}, {RESET, GET_FLOW_DATA_PERIOD_TIME}, 
+																							{RESET, SYS_WAKE_UP_TIME}, {RESET}, {RESET,SYS_RESTART_DELAY_TIME}};
+PERIOD_PARA_T  period_para_g  = {{SET, 0}, {SET, 0}, {SET, 0}, {SET, 0}};
+
+typedef union
+{
+  float flo;
+  uint8_t data[4];
+} FLOAT_U8;
+typedef union
+{
+	double dou;
+	uint8_t data[8];
+}DOUBLE_U8;
+
+
+/*4�ֽ�תFloat*/
+float Byte4_To_Float(uint8_t *pData)
+{
+  FLOAT_U8 f_conv;
+  for (uint8_t i = 0; i < 4; i++)
+    f_conv.data[i] = pData[i];
+  return f_conv.flo;
+}
+/*Floatת4�ֽ�*/
+void Float_To_Byte4(float flo, uint8_t *pData)
+{
+  FLOAT_U8 f_conv;
+  f_conv.flo = flo;
+  for (uint8_t i = 0; i < 4; i++)
+    pData[i] = f_conv.data[i];
+}
+
+float BLEndianFloat(float fValue)
+{
+	FLOAT_U8 d1, d2;
+
+	d1.flo = fValue;
+	d2.data[0] = d1.data[3];
+	d2.data[1] = d1.data[2];
+	d2.data[2] = d1.data[1];
+	d2.data[3] = d1.data[0];
+ 
+	return d2.flo;
+}
+
+double BLEndianDouble(double ffValue)
+{
+	DOUBLE_U8 d1, d2;
+
+	d1.dou = ffValue;
+	d2.data[0] = d1.data[7];
+	d2.data[1] = d1.data[6];
+	d2.data[2] = d1.data[5];
+	d2.data[3] = d1.data[4];
+	d2.data[4] = d1.data[3];
+	d2.data[5] = d1.data[2];
+	d2.data[6] = d1.data[1];
+	d2.data[7] = d1.data[0];
+ 
+	return d2.dou;
+}
+
+uint8_t Bcd_2_Hex(uint8_t bcd_data) // BCD_TO_HEX
+{
+  /*�����Ʒ�Χ0~99��*/
+  uint8_t temp;
+  temp = ((bcd_data / 16) * 10 + bcd_data % 16);
+  return temp;
+}
+uint8_t Hex_2_Bcd(uint8_t hex_data) // HEX_TO_BCD
+{
+  /*�����Ʒ�Χ0~99��*/
+  uint8_t temp;
+  temp = ((hex_data / 10) * 16 + hex_data % 10);
+  return temp;
+}
+
+void Hex_2_Ascii(uint8_t *Hex, uint8_t *Ascii, int Len) //	HEX_TO_ASCII
+{
+  uint8_t Nibble[2];
+  uint8_t i, j;
+  for (i = 0; i < Len; i++)
+  {
+    Nibble[0] = (Hex[i] & 0xF0) >> 4;
+    Nibble[1] = (Hex[i] & 0x0F);
+    for (j = 0; j < 2; j++)
+    {
+      if (Nibble[j] < 10)
+      {
+        Nibble[j] += 0x30;
+      }
+      else
+      {
+        if (Nibble[j] < 16)
+          Nibble[j] = Nibble[j] - 10 + 'A';
+      }
+      *Ascii++ = Nibble[j];
+    }
+  }
+}
+void Ascii_2_Hex(uint8_t *Ascii, uint8_t *Hex, int Len) //	ASCII_TO_HEX
+{
+  if (Len & 1) // �ȼ���Len % 2�������������ٶȸ���
+    return;
+  int nHexLen = Len >> 1; // �ȼ���Len / 2�������������ٶȸ���
+  int i, j;
+  for (i = 0; i < nHexLen; i++)
+  {
+    uint8_t Nibble[2];
+    Nibble[0] = *Ascii++;
+    Nibble[1] = *Ascii++;
+    for (j = 0; j < 2; j++)
+    {
+      if (Nibble[j] <= 'F' && Nibble[j] >= 'A')
+      {
+        Nibble[j] = Nibble[j] - 'A' + 10;
+      }
+      else if (Nibble[j] <= 'f' && Nibble[j] >= 'a')
+      {
+        Nibble[j] = Nibble[j] - 'a' + 10;
+      }
+      else if (Nibble[j] >= '0' && Nibble[j] <= '9')
+      {
+        Nibble[j] = Nibble[j] - '0';
+      }
+      else
+      {
+        return;
+      }
+    }
+    Hex[i] = Nibble[0] << 4;
+    Hex[i] |= Nibble[1];
+  }
+}
+
+uint8_t restart_alarm_flag = 0;
+/*ϵͳѭ�����ӳ�ʱ��*/
+void Sys_Delay_Sec(SYS_DELAY_SEC_PARA_T *sys_delay_sec_para_p)
+{
+  // �ж�ϵͳ����ʱ���Ƿ����
+  if (sys_delay_sec_para_p->sys_active_time.delay_time)
+  {
+    if (!(--sys_delay_sec_para_p->sys_active_time.delay_time))
+		{
+			sys_delay_sec_para_p->sys_active_time.delay_flag = SET;
+			GPIO_EXTI_EXTIISR_ClrEx(KEYA_S1_PORT, KEYA_S1_PIN);
+		}
+  }
+  // �ж�GPRS�ӳ�ʱ���Ƿ�ﵽ
+  if (sys_delay_sec_para_p->gprs_delay_para.delay_time)
+  {
+    if (!(--sys_delay_sec_para_p->gprs_delay_para.delay_time))
+      sys_delay_sec_para_p->gprs_delay_para.delay_flag = SET;
+  }
+  // �ж�GPRS��ʱʱ��
+  if (sys_delay_sec_para_p->gprs_timeout_para.delay_time)
+  {
+    if (!(--sys_delay_sec_para_p->gprs_timeout_para.delay_time))
+      sys_delay_sec_para_p->gprs_timeout_para.delay_flag = SET;
+  }
+  // �ж��������ݻ�ȡ����ʱ���Ƿ�ﵽ
+  if (sys_delay_sec_para_p->flow_data_period_para.delay_time)
+  {
+    if (!(--sys_delay_sec_para_p->flow_data_period_para.delay_time))
+    {
+      sys_delay_sec_para_p->flow_data_period_para.delay_flag = SET;
+    }
+  }
+	// �ж��л�ģʽ��־λ����ʱ��
+  if (sys_delay_sec_para_p->mode_flag_active_time.delay_time)
+  {
+    if (!(--sys_delay_sec_para_p->mode_flag_active_time.delay_time))
+      sys_delay_sec_para_p->mode_flag_active_time.delay_flag = SET;
+  }
+	// �������ӳ�ʱ��
+  if (sys_delay_sec_para_p->sys_restart_delay_time.delay_time)
+  {
+    if (!(--sys_delay_sec_para_p->sys_restart_delay_time.delay_time))
+		{
+			__SYS_ALARM_BYTES_SET(restart, SET);// �����
+			restart_alarm_flag = 1;
+		}
+  }
+}
+
+/******************************************
+ * func:    Func_PeriodStartHandler
+ * desc:    �����������ܴ���
+ * input:   ref_time_m : ��׼ʱ�䣨���ӣ�
+            period_min_set �����õ�����ʱ�䣨���ӣ�
+            pPeriod_flag : �״��жϱ�־λ
+            pLast_time_m ����һ�ε�ʱ�䣨���ӣ�
+            calendar_p ���豸��ʱ��
+ * output:  none
+ * return: �Ƿ�ɹ���SET/RESET��
+ * ע�⣺�������Է���Ϊ�ж���Сֵ��ÿ����1440���ӣ���0�����㣬���Լ�����ֵΪ1440
+ *			 Ϊ�˼��ٲ���Ҫ�ij������̣�ÿ����ֻ�ж�һ�μ���
+ *****************************************/
+FlagStatus Func_PeriodStartHandler(uint16_t ref_time_m, uint16_t period_min_set,
+                                   uint16_t *pPeriod_flag, __IO uint16_t *pLast_time_m, __IO RTC_TimeDateTypeDef *calendar_p)
+{
+  FlagStatus flag = RESET;
+  uint16_t i = 0;
+  int16_t temp_min = 0; // ����ʱ�п���Ϊ���������Բ������޷���
+  uint16_t now_time_m = Bcd_2_Hex(calendar_p->Hour) * 60 + Bcd_2_Hex(calendar_p->Minute);
+  if (ref_time_m >= 1440)
+    ref_time_m = 0;
+  if (period_min_set > 1440)
+    period_min_set = 1440;
+  /*�״��ж��ϴε�����ʱ�䣬��ǰʱ��>=��׼ʱ��*/
+  if (*pPeriod_flag == 1)
+  {
+    *pPeriod_flag = 0;
+    if (now_time_m >= ref_time_m)
+    {
+      temp_min = ref_time_m;
+      while (now_time_m >= temp_min)
+      {
+        temp_min += period_min_set;
+        if (++i > 289) // 1440 / 5 + 1
+          break;
+      }
+      *pLast_time_m = temp_min - period_min_set;
+    }
+    else if (now_time_m < ref_time_m) // ��������ǣ���ǰʱ��<��׼ʱ��
+    {
+      temp_min = ref_time_m - period_min_set;
+      while (now_time_m <= temp_min)
+      {
+        temp_min -= period_min_set;
+        if (++i > 289)
+          break;
+      }
+      if (temp_min >= 0)
+        *pLast_time_m = temp_min;
+      else
+        *pLast_time_m = temp_min + 1440;
+    }
+  }
+  /*�������*/
+  if ((now_time_m <= *pLast_time_m) && ((now_time_m + 1440 - *pLast_time_m) % period_min_set == 0))
+  {
+    *pLast_time_m = now_time_m;
+    flag = SET;
+  }
+  else if ((now_time_m - *pLast_time_m) % period_min_set == 0) // ��ǰʱ�������һ��ʱ�����
+  {
+    *pLast_time_m = now_time_m;
+    flag = SET;
+  }
+  return flag;
+}
+
+/*�����������bitΪ1�ĸ���*/
+static const uint8_t numbits_lookup_table[256] = {
+    0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2,
+    3, 3, 4, 3, 4, 4, 5, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3,
+    3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3,
+    4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4,
+    3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5,
+    6, 6, 7, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4,
+    4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5,
+    6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 2, 3, 3, 4, 3, 4, 4, 5,
+    3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 3,
+    4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6,
+    6, 7, 6, 7, 7, 8};
+uint16_t get_one_in_data_3(uint16_t data)
+{
+  uint16_t n = 0;
+  n = numbits_lookup_table[data & 0x00ff];
+  n += numbits_lookup_table[data >> 8 & 0x00ff];
+  return n;
+}
+
+/******************************************
+ * func: Time_Compare
+ * desc: �����ڱȽϣ���ֵ��
+ * input:
+          pDate1  ʱ��1 BCD
+          pDate2  ʱ��2 BCD
+ * output: none
+ * return: ��ʱ���ֵ ʱ��1����ʱ��2��������������ȷ���0��С���ظ���
+ *****************************************/
+int Datecmp(const uint8_t *pDate1, const uint8_t *pDate2)
+{
+  uint16_t temp_year[2];
+  time_t date_time1, date_time2;
+  struct tm date_tm1 = {0}, date_tm2 = {0};
+  /*����ݲ����� Hex*/
+  temp_year[0] = 2000 + BCD_2_HEX_U8(pDate1[0]);
+  temp_year[1] = 2000 + BCD_2_HEX_U8(pDate2[0]);
+  /*ʱ��ṹ�帳ֵ*/
+  date_tm1.tm_year = temp_year[0] - 1900;
+  date_tm1.tm_mon = BCD_2_HEX_U8(pDate1[1]) - 1;
+  date_tm1.tm_mday = BCD_2_HEX_U8(pDate1[2]);
+  date_tm1.tm_hour = BCD_2_HEX_U8(pDate1[3]);
+  date_tm1.tm_min = BCD_2_HEX_U8(pDate1[4]);
+  date_tm1.tm_sec = BCD_2_HEX_U8(pDate1[5]);
+
+  date_tm2.tm_year = temp_year[1] - 1900;
+  date_tm2.tm_mon = BCD_2_HEX_U8(pDate2[1]) - 1;
+  date_tm2.tm_mday = BCD_2_HEX_U8(pDate2[2]);
+  date_tm2.tm_hour = BCD_2_HEX_U8(pDate2[3]);
+  date_tm2.tm_min = BCD_2_HEX_U8(pDate2[4]);
+  date_tm2.tm_sec = BCD_2_HEX_U8(pDate2[5]);
+  /*��ô�1900��1��1��0ʱ0��0�����������*/
+  date_time1 = mktime(&date_tm1);
+  date_time2 = mktime(&date_tm2);
+
+  // if (date_time1 > date_time2)
+  // {
+  //   *diff_value = date_time1 - date_time2;
+  //   return 1;
+  // }
+  // else if (date_time1 < date_time2)
+  // {
+  //   *diff_value = date_time2 - date_time1;
+  //   return -1;
+  // }
+  return (int)(date_time1 - date_time2);
+}
+/*����ij����˶�����*/
+uint16_t CalculateDays_of_the_year(uint8_t year_bcd, uint8_t month_bcd, uint8_t day_bcd)
+{
+  uint16_t sum = 0, year_h = BCD_2_HEX_U8(year_bcd) + 2000;
+  uint8_t month_h = BCD_2_HEX_U8(month_bcd), day_h = BCD_2_HEX_U8(day_bcd);
+  uint8_t months[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
+  for (uint8_t i = 0; i < month_h; i++)
+    sum += months[i];
+  sum += day_h;
+  if (((year_h % 4 == 0 && year_h % 100 != 0) || year_h % 400 == 0) && month_h >= 3)
+    sum += 1;
+  return sum;
+}
+/*���������ڵ�������*/
+int16_t Date_DaysDifference(uint8_t yearst_bcd, uint8_t monthst_bcd, uint8_t dayst_bcd,
+                            uint8_t yearend_bcd, uint8_t monthend_bcd, uint8_t dayend_bcd)
+{
+  int16_t total = 0, yearst_h = BCD_2_HEX_U8(yearst_bcd) + 2000, yearend_h = BCD_2_HEX_U8(yearend_bcd) + 2000;
+  total = (yearend_h - yearst_h) * 365;                                      // �����������ݵ�������
+  total -= CalculateDays_of_the_year(yearst_bcd, monthst_bcd, dayst_bcd);    // ��ȥ��ʼ���ڵ�����
+  total += CalculateDays_of_the_year(yearend_bcd, monthend_bcd, dayend_bcd); // �����ѹ����ڵ�����
+  while (yearst_h != yearend_h)                                              // �ж��Ƿ�����
+  {
+    if (total > 0) // ��ʼ������ > ����������
+    {
+      if ((yearst_h % 4 == 0 && yearst_h % 100 != 0) || yearst_h % 400 == 0)
+        total += 1;
+      yearst_h++;
+    }
+    else // ��ʼ������ < ����������
+    {
+      if ((yearst_h % 4 == 0 && yearst_h % 100 != 0) || yearst_h % 400 == 0)
+        total -= 1;
+      yearend_h++;
+    }
+  }
+  return total;
+}
+
+/*���������ڵ��·ݲ�*/
+int16_t Data_MonthsDifference(uint8_t yearst_bcd, uint8_t monthst_bcd,
+                              uint8_t yearend_bcd, uint8_t monthend_bcd)
+{
+  int16_t total = 0, yearst_h = BCD_2_HEX_U8(yearst_bcd) + 2000, yearend_h = BCD_2_HEX_U8(yearend_bcd) + 2000;
+  total = (yearend_h - yearst_h) * 12;
+  total -= BCD_2_HEX_U8(monthst_bcd);
+  total += BCD_2_HEX_U8(monthend_bcd);
+  return total;
+}
+/*��ƽ��ֵ*/
+float flow_ring_buffer[FLOW_RING_BUFFER_SIZE] = {0};
+float temp_ring_buffer[TEMP_RING_BUFFER_SIZE] = {0};
+float press_ring_buffer[PRESS_RING_BUFFER_SIZE] = {0};
+ANALOGOUS_RING_BUFFER_T __attribute__ ((aligned (4))) flow_ring = {flow_ring_buffer, 0, 0};
+ANALOGOUS_RING_BUFFER_T __attribute__ ((aligned (4))) temp_ring = {temp_ring_buffer, 0, 0};
+ANALOGOUS_RING_BUFFER_T __attribute__ ((aligned (4))) press_ring = {press_ring_buffer, 0, 0};
+/*ÿ���˲ʱ����*/
+float instant_wc_ring_queue_buffer[INSTANT_WC_RING_BUFFER_SIZE] = {0};
+ANALOGOUS_RING_BUFFER_T __attribute__ ((aligned (4))) instant_wc_ring = {instant_wc_ring_queue_buffer, 0, 0};
+/*���������Ƿ����*/
+uint8_t isFull(ANALOGOUS_RING_BUFFER_T *ring_buffer_p, uint8_t buffer_len_max)
+{
+  return (ring_buffer_p->rear_index + 1) % buffer_len_max == ring_buffer_p->front_index;
+}
+/*���������Ƿ�Ϊ��*/
+uint8_t isEmpty(ANALOGOUS_RING_BUFFER_T *ring_buffer_p)
+{
+  return (ring_buffer_p->rear_index == ring_buffer_p->front_index);
+}
+
+/*���������
+ * ע�⣺float * ���������Ը�Ϊ float ���������������ܷɣ��ݲ�����Ϊʲô��
+ */
+uint8_t ring_write_1_data(ANALOGOUS_RING_BUFFER_T *ring_buffer_p, const float *pData, uint8_t buffer_len_max)
+{
+  uint8_t full_flag = 0, modulo = 0;
+  modulo = (ring_buffer_p->rear_index + 1) % buffer_len_max;
+  if (modulo == ring_buffer_p->front_index) // ���á�ȡģ���ķ�ʽ���ж��Ƿ����
+  {
+    ring_buffer_p->front_index = (ring_buffer_p->front_index + 1) % buffer_len_max; // ��������ͷҲҪ���ű仯
+    full_flag = 1;
+  }
+  ring_buffer_p->pRing_buffer[ring_buffer_p->rear_index] = *pData;
+  ring_buffer_p->rear_index = modulo;
+  return full_flag;
+}
+/*���������*/
+uint8_t ring_write_array(ANALOGOUS_RING_BUFFER_T *ring_buffer_p, const float *pData, uint8_t write_cnt, uint8_t buffer_len_max)
+{
+  uint8_t full_flag = 0;
+  for (uint8_t i = 0; i < write_cnt; i++)
+    full_flag = ring_write_1_data(ring_buffer_p, &pData[i], buffer_len_max);
+  return full_flag;
+}
+/*������������*/
+uint8_t ring_read_1_data(ANALOGOUS_RING_BUFFER_T *ring_buffer_p, float *pData, uint8_t buffer_len_max)
+{
+  if (ring_buffer_p->rear_index == ring_buffer_p->front_index)
+    return 0;
+
+  *pData = ring_buffer_p->pRing_buffer[ring_buffer_p->front_index];
+  ring_buffer_p->front_index = (ring_buffer_p->front_index + 1) % buffer_len_max;
+  return 1;
+}
+
+/******************************************
+ * func:    LowPassFilter_Ring_Average
+ * desc:   ���û������鸲�ǵ���ʽ��ƽ��ֵ
+ * input:   ring_buffer_p : ���ζ��нṹ��ָ��
+            *pData ��д������ݵ�ַ
+            write_cnt : һ��д������ݸ���
+            buffer_len_max ����ƽ��ֵ��������
+ * output:  none
+ * return:  ƽ��ֵ
+ *****************************************/
+float LowPassFilter_Ring_Average(ANALOGOUS_RING_BUFFER_T *ring_buffer_p, const float *pData, uint8_t write_cnt, uint8_t buffer_len_max)
+{
+  float result = 0, add = 0;
+  if (ring_write_array(ring_buffer_p, pData, write_cnt, buffer_len_max))
+  {
+    for (uint8_t i = 0; i < buffer_len_max; i++)
+      add += ring_buffer_p->pRing_buffer[i];
+    result = add / buffer_len_max;
+  }
+  return result;
+}
+/*����*/
+void My_BubbleSort(float * pNum,int len)
+{
+	int i,j;
+	float temp;
+	for(i = 0;i < len - 1;i++)
+	{
+		for(j = 0;j < len - 1- i;j++)
+		{
+			if(pNum[j] > pNum[j + 1])
+			{
+				temp = pNum[j];
+				pNum[j] = pNum[j+1];
+				pNum[j+1] = temp;
+			}
+		}
+	}
+}
+/*ȥ�����ֵ����Сֵ�����������ƽ��ֵ*/
+float LowPassFilter_MaxMin_Ring_Average(ANALOGOUS_RING_BUFFER_T *ring_buffer_p, const float *pData, uint8_t write_cnt, uint8_t buffer_len_max)
+{
+  float result = 0, add = 0;
+  if (ring_write_array(ring_buffer_p, pData, write_cnt, buffer_len_max))
+  {
+		My_BubbleSort(ring_buffer_p->pRing_buffer,buffer_len_max);
+    for (uint8_t i = 1; i < buffer_len_max - 1; i++)
+      add += ring_buffer_p->pRing_buffer[i];
+    result = add / (buffer_len_max - 2);
+  }
+  return result;
+}
+
+
+
+/********************************************************************
+ * name         : CalcCheckSum
+ * description  : �������
+ * Input        :	*pData����������ָ�� Len�����ݳ���
+ * Output       : none
+ * Return       : Sum:���
+ ********************************************************************/
+uint8_t CalcCheckSum(const uint8_t *pData, uint16_t Len)
+{
+  uint32_t Sum = 0;
+  for (uint16_t i = 0; i < Len; i++)
+    Sum += pData[i];
+  return (Sum & 0xFF);
+}
+
+/*
+����ת���
+return ���������
+*/
+float Wc_2_Sc(float wc_flow, float real_press, float real_temp)
+{
+  float temp_factor = 0;
+  uint8_t standard_compressibility_factor = 1; // ��׼ѹ������
+  uint8_t real_compressibility_factor = 1;     // ʵʱѹ������
+  if (wc_flow != 0)
+    temp_factor = ((STANDARD_TEMPERATURE / STANDARD_PRESSURE) * real_press / (real_temp + 273.15f)) *
+              (standard_compressibility_factor / real_compressibility_factor);
+  return (temp_factor * wc_flow);
+}
+
+/*����memcmp�⺯��������pData_2�����е�ַƫ��*/
+int8_t my_memcmp(const void * pData_1,const void * pData_2,size_t n)
+{
+	if(!n)
+		return 0;
+	while(--n && *(int8_t *)pData_1 == *(int8_t *)pData_2)
+		pData_1++;
+	return (*(uint8_t *)pData_1 - *(uint8_t *)pData_2);	
+}

--
Gitblit v1.9.3