From 65062d0d5b21f838aa0043a15ce54cfab8d72c43 Mon Sep 17 00:00:00 2001
From: wujiazhi <1147861305@qq.com>
Date: Tue, 11 Jun 2024 14:23:53 +0800
Subject: [PATCH] 1.Fixed communication failure between MCU and wireless module 2.Fix the wrong judgment of alkaline lithium power
---
Soft/billing.c | 408 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 408 insertions(+), 0 deletions(-)
diff --git a/Soft/billing.c b/Soft/billing.c
new file mode 100644
index 0000000..5cabd7c
--- /dev/null
+++ b/Soft/billing.c
@@ -0,0 +1,408 @@
+#include "billing.h"
+#include "sundry.h"
+#include "string.h"
+#include "system_parameter.h"
+#include "main.h"
+#include "system_log.h"
+
+double yesterday_cumulate_sc = 0;
+uint8_t no_use_gas_days_cnt = 0;
+
+ErrorStatus_STM32 have_gprs_send_flag = ERROR_1;
+uint8_t no_gprs_days_cnt = 0;
+
+BILLING_REAL_PARA_T billing_real_para_g = {
+ .price_type_mode_now = 0,
+ .price_now = 10000, // Ĭ�ϵ��� �Ŵ�10000��
+ .balance_now = 10.0f // Ĭ�����
+};
+
+TYPE_CHECK_SIZE(BILLING_ALARM_CFG_T,39);//�˲�ṹ���С
+BILLING_ALARM_CFG_T billing_alarm_cfg_g = {
+ .balance_small_value = {10000, 5000, 0, -5000, -10000}, //�Ŵ�100��
+ .cumulate_flow_value = 0,
+ .no_gprs_days = 5,
+ .no_use_gas_days = 7};
+
+TYPE_CHECK_SIZE(LADDER_PRICE_CFG_PARA_T,111);//�˲�ṹ���С
+LADDER_PRICE_CFG_PARA_T ladder_price_cfg_para_true_g = {
+ .price_ver = LADDER_PRICE_DEFAULT_VER,
+ .normal_price_now = 10000,
+ .set_price_type_mode = SPM_NORMAL,
+ .period_state = PPS_CYCLICALLY,
+ .period_start_time = {0x22, 0x11, 0x01, 0, 0, 0},
+ .period_unit = PPU_DAY,
+ .period_duration = 30,
+ .set_ladder_price = {35000, 40000, 50000, 60000, 70000},
+ .set_ladder_cumulate = {500, 1000, 1500, 2000, 2500},
+ .set_time_price[0] = {.time = {0x22, 0x11, 0x01, 0, 0, 0}, .duration = 0},
+ .set_time_price[1] = {.time = {0x22, 0x11, 0x01, 0, 0, 0}, .duration = 0},
+ .set_time_price[2] = {.time = {0x22, 0x11, 0x01, 0, 0, 0}, .duration = 0},
+ .set_time_price[3] = {.time = {0x22, 0x11, 0x01, 0, 0, 0}, .duration = 0},
+ .set_time_price[4] = {.time = {0x22, 0x11, 0x01, 0, 0, 0}, .duration = 0},
+ .time_unit = PPU_DAY,
+ .price_scheme_start_time = {0x22, 0x11, 0x01, 0, 0, 0},
+};
+LADDER_PRICE_CFG_PARA_T ladder_price_cfg_para_new_g = {
+ .price_ver = LADDER_PRICE_DEFAULT_VER,
+ .normal_price_now = 10000,
+ .set_price_type_mode = SPM_NORMAL,
+ .period_state = PPS_CYCLICALLY,
+ .period_start_time = {0x22, 0x11, 0x01, 0, 0, 0},
+ .period_unit = PPU_DAY,
+ .period_duration = 30,
+ .set_ladder_price = {35000, 40000, 50000, 60000, 70000},
+ .set_ladder_cumulate = {500, 1000, 1500, 2000, 2500},
+ .set_time_price[0] = {.time = {0x22, 0x11, 0x01, 0, 0, 0}, .duration = 0},
+ .set_time_price[1] = {.time = {0x22, 0x11, 0x01, 0, 0, 0}, .duration = 0},
+ .set_time_price[2] = {.time = {0x22, 0x11, 0x01, 0, 0, 0}, .duration = 0},
+ .set_time_price[3] = {.time = {0x22, 0x11, 0x01, 0, 0, 0}, .duration = 0},
+ .set_time_price[4] = {.time = {0x22, 0x11, 0x01, 0, 0, 0}, .duration = 0},
+ .time_unit = PPU_DAY,
+ .price_scheme_start_time = {0x22, 0x11, 0x01, 0, 0, 0},
+};
+
+/*��������״̬/�����ִ���*/
+void State_Alarm_Bytes_BillingDataHandler(double balance, BILLING_ALARM_CFG_T *billing_alarm_cfg_p)
+{
+ if (balance > (billing_alarm_cfg_p->balance_small_value[0] * 0.01f)) // 100 ~ ������
+ {
+ __SYS_STATUS_BYTES_STATUS(balance_small_1, RESET, AV_BALANCE_1);
+ __SYS_STATUS_BYTES_STATUS(balance_small_2, RESET, AV_BALANCE_2);
+ __SYS_STATUS_BYTES_STATUS(balance_small_3, RESET, AV_BALANCE_3);
+ __SYS_STATUS_BYTES_STATUS(balance_small_4, RESET, AV_BALANCE_4);
+ }
+ else if (balance > (billing_alarm_cfg_p->balance_small_value[1] * 0.01f)) // 50~100
+ __SYS_STATUS_ALARM_BYTES_SET(balance_small_1);
+ else if (balance > (billing_alarm_cfg_p->balance_small_value[2] * 0.01f)) // 0~50
+ {
+ __SYS_STATUS_ALARM_BYTES_SET(balance_small_1);
+ __SYS_STATUS_ALARM_BYTES_SET(balance_small_2);
+ }
+ else if (balance > (billing_alarm_cfg_p->balance_small_value[3] * 0.01f)) // -50~0
+ {
+ __SYS_STATUS_ALARM_BYTES_SET(balance_small_1);
+ __SYS_STATUS_ALARM_BYTES_SET(balance_small_2);
+ __SYS_STATUS_ALARM_BYTES_SET(balance_small_3);
+ }
+ else // if (balance > (billing_alarm_cfg_p->balance_small_value[4] * 0.01f)) //-100 ~ -50
+ {
+ __SYS_STATUS_ALARM_BYTES_SET(balance_small_1);
+ __SYS_STATUS_ALARM_BYTES_SET(balance_small_2);
+ __SYS_STATUS_ALARM_BYTES_SET(balance_small_3);
+ __SYS_STATUS_ALARM_BYTES_SET(balance_small_4);
+ }
+// else // ������ ~ -100
+// {
+// __SYS_STATUS_ALARM_BYTES_SET(balance_small_1);
+// __SYS_STATUS_ALARM_BYTES_SET(balance_small_2);
+// __SYS_STATUS_ALARM_BYTES_SET(balance_small_3);
+// __SYS_STATUS_ALARM_BYTES_SET(balance_small_4);
+// __SYS_STATUS_ALARM_BYTES_SET(balance_small_5);
+// }
+ /*�ۼ�������*/
+ if (billing_alarm_cfg_p->cumulate_flow_value != 0)
+ {
+ if (sys_realtime_data_g.measure_para_s.forward_cumulate_sc >= billing_alarm_cfg_p->cumulate_flow_value)
+ {
+ // Sys_Log_E2pParaWrite(cumulate_close_valve_flag,AV_SET_CUMULATE);
+ __SYS_STATUS_ALARM_BYTES_SET(set_cumulate_up_to);
+ }
+ }
+}
+/*������/�ϱ�����״̬/�����ִ���*/
+void State_Alarm_Bytes_NoGpra_NoGasHandler(BILLING_ALARM_CFG_T *billing_alarm_cfg_p)
+{
+ if (DAILY_ZERO) // 0��0��0��
+ {
+ /*������������*/
+ if (billing_alarm_cfg_p->no_use_gas_days)
+ {
+ if (sys_realtime_data_g.measure_para_s.forward_cumulate_sc > yesterday_cumulate_sc)
+ {
+ yesterday_cumulate_sc = sys_realtime_data_g.measure_para_s.forward_cumulate_sc;
+ no_use_gas_days_cnt = 0;
+ __SYS_STATUS_BYTES_STATUS(no_use_gas_date_up_to, RESET, AV_NO_USE_GAS);
+ }
+ else
+ {
+ if (++no_use_gas_days_cnt >= billing_alarm_cfg_p->no_use_gas_days)
+ __SYS_STATUS_ALARM_BYTES_SET(no_use_gas_date_up_to);
+ }
+ }
+ /*���ϱ�������*/
+ if (billing_alarm_cfg_p->no_gprs_days)
+ {
+ if (have_gprs_send_flag == SUCCESS_0)
+ {
+ have_gprs_send_flag = ERROR_1;
+ no_gprs_days_cnt = 0;
+ __SYS_STATUS_BYTES_STATUS(no_gprs_date_up_to, RESET, AV_NO_GPRS);
+ }
+ else
+ {
+ if (++no_gprs_days_cnt >= billing_alarm_cfg_p->no_gprs_days)
+ __SYS_STATUS_ALARM_BYTES_SET(no_gprs_date_up_to);
+ }
+ }
+ }
+}
+/*ʵʱ�Ʒѳ���
+ * single_flow_sum�����������
+ */
+void Billing_RealTimeProcess(BILLING_MODE_T start_flag, __IO double single_flow_sum, LADDER_PRICE_CFG_PARA_T *ladder_cfg_real_p, BILLING_REAL_PARA_T *billing_para_p)
+{
+ if ((start_flag == BM_DEVICE || (start_flag == BM_PLATFORM && __SYS_STATUS_BYTES_GET(virtual_billing) == SET)) && single_flow_sum > 0)
+ {
+ double price_double = 0;
+ double single_use_money = 0;
+ /*��������*/
+ GasCumulant_Ladder_PeriodCfg(ladder_cfg_real_p, &ladder_price_cfg_para_new_g, &calendar_g);
+ /*��Ǯ*/
+ if (ladder_cfg_real_p->set_price_type_mode == SPM_NORMAL) // ��ͨ�Ʒ�
+ {
+ if(start_flag == BM_DEVICE)
+ billing_para_p->price_type_mode_now = BPM_NORMAL;
+ billing_para_p->price_now = ladder_cfg_real_p->normal_price_now;
+ price_double = ladder_cfg_real_p->normal_price_now * 0.0001f;
+ single_use_money = single_flow_sum * price_double;
+ billing_para_p->residual_gas_now = billing_para_p->balance_now / price_double;
+ }
+ else if (ladder_cfg_real_p->set_price_type_mode == SPM_LADDER) // ���������ݼƷ�
+ {
+ single_use_money = GasCumulant_Ladder_PeriodCalculation(start_flag,single_flow_sum, ladder_cfg_real_p, billing_para_p);
+ }
+ else if (ladder_cfg_real_p->set_price_type_mode == SPM_TIME) // ��ʱ��μƷ�
+ {
+ }
+ billing_para_p->use_money_sum += single_use_money; // �ó��ۼ�ʹ�ý��
+ billing_para_p->balance_now -= single_use_money; // ���
+ /*�Ʒ�/������ر����ж�*/
+ State_Alarm_Bytes_BillingDataHandler(billing_para_p->balance_now, &billing_alarm_cfg_g);
+ }
+ State_Alarm_Bytes_NoGpra_NoGasHandler(&billing_alarm_cfg_g);
+
+ if(billing_para_p->balance_now > (billing_alarm_cfg_g.balance_small_value[0] * 0.01f))
+ {
+ /*����������ǿ���Ա����ط�����������ʱ�Զ�����*/
+ if(op_cl_valve_cause_id >= 0x90 && op_cl_valve_cause_id <= 0x94 && __SYS_STATUS_BYTES_GET(valve_state) == VALVE_CL)
+ {
+ if(__SYS_STATUS_BYTES_GET(valve_lock) == SET)
+ {
+ __VALVE_WORK_TYPE_SET(VWT_UNLOCK); // ���������ڴ洢��¼��
+ __SYS_STATUS_BYTES_STATUS(valve_lock, RESET, AV_NORMAL); // �����������������ƣ�
+ }
+ }
+ }
+}
+/*�����ۻ���-���ݼ���*/
+double GasCumulant_Ladder_PeriodCalculation(BILLING_MODE_T mode_flag,double single_flow_sum,
+ LADDER_PRICE_CFG_PARA_T *ladder_cfg_p_p, BILLING_REAL_PARA_T *billing_para_p_p)
+{
+ double price_double = 0; // ����
+ double single_use_money = 0; // ���ε�ʹ�ý��
+ double ladder_cumulate_sc_before = billing_para_p_p->ladder_cumulate_sc;
+ billing_para_p_p->ladder_cumulate_sc += single_flow_sum; // ���������ڵ��ۻ���
+ if (billing_para_p_p->ladder_cumulate_sc <= ladder_cfg_p_p->set_ladder_cumulate[0]) // 0~100
+ {
+ if(mode_flag == BM_DEVICE)
+ billing_para_p_p->price_type_mode_now = BPM_LADDER_1;
+ /*���㵥�ε�ʹ�ý��*/
+ billing_para_p_p->price_now = ladder_cfg_p_p->set_ladder_price[0];
+ price_double = ladder_cfg_p_p->set_ladder_price[0] * 0.0001f;
+ single_use_money = single_flow_sum * price_double;
+ }
+ else if (billing_para_p_p->ladder_cumulate_sc <= ladder_cfg_p_p->set_ladder_cumulate[1]) // 100~200
+ {
+
+ price_double = ladder_cfg_p_p->set_ladder_price[1] * 0.0001f;
+ if (ladder_cumulate_sc_before < ladder_cfg_p_p->set_ladder_cumulate[0]) // �ϴ�����С���ٽ�ֵ����������ȴ�����ٽ�ֵ
+ {
+ if(mode_flag == BM_DEVICE)
+ billing_para_p_p->price_type_mode_now = BPM_LADDER_2;
+ single_use_money = (ladder_cfg_p_p->set_ladder_cumulate[0] - ladder_cumulate_sc_before) * (ladder_cfg_p_p->set_ladder_price[0] * 0.0001f) +
+ (billing_para_p_p->ladder_cumulate_sc - ladder_cfg_p_p->set_ladder_cumulate[0]) * price_double;
+ billing_para_p_p->price_now = ladder_cfg_p_p->set_ladder_price[1];
+ }
+ else
+ single_use_money = single_flow_sum * price_double;
+ }
+ else if (billing_para_p_p->ladder_cumulate_sc <= ladder_cfg_p_p->set_ladder_cumulate[2]) // 200~300
+ {
+ price_double = ladder_cfg_p_p->set_ladder_price[2] * 0.0001f;
+ if (ladder_cumulate_sc_before < ladder_cfg_p_p->set_ladder_cumulate[1]) // �ϴ�����С���ٽ�ֵ����������ȴ�����ٽ�ֵ
+ {
+ if(mode_flag == BM_DEVICE)
+ billing_para_p_p->price_type_mode_now = BPM_LADDER_3;
+ single_use_money = (ladder_cfg_p_p->set_ladder_cumulate[1] - ladder_cumulate_sc_before) * (ladder_cfg_p_p->set_ladder_price[1] * 0.0001f) +
+ (billing_para_p_p->ladder_cumulate_sc - ladder_cfg_p_p->set_ladder_cumulate[1]) * price_double;
+ billing_para_p_p->price_now = ladder_cfg_p_p->set_ladder_price[2];
+ }
+ else
+ single_use_money = single_flow_sum * price_double;
+ }
+ else if (billing_para_p_p->ladder_cumulate_sc <= ladder_cfg_p_p->set_ladder_cumulate[3]) // 300~400
+ {
+ price_double = ladder_cfg_p_p->set_ladder_price[3] * 0.0001f;
+ if (ladder_cumulate_sc_before < ladder_cfg_p_p->set_ladder_cumulate[2]) // �ϴ�����С���ٽ�ֵ����������ȴ�����ٽ�ֵ
+ {
+ if(mode_flag == BM_DEVICE)
+ billing_para_p_p->price_type_mode_now = BPM_LADDER_4;
+ single_use_money = (ladder_cfg_p_p->set_ladder_cumulate[2] - ladder_cumulate_sc_before) * (ladder_cfg_p_p->set_ladder_price[2] * 0.0001f) +
+ (billing_para_p_p->ladder_cumulate_sc - ladder_cfg_p_p->set_ladder_cumulate[2]) * price_double;
+ billing_para_p_p->price_now = ladder_cfg_p_p->set_ladder_price[3];
+ }
+ else
+ single_use_money = single_flow_sum * price_double;
+ }
+ else // >400
+ {
+ price_double = ladder_cfg_p_p->set_ladder_price[4] * 0.0001f;
+ if (ladder_cumulate_sc_before < ladder_cfg_p_p->set_ladder_cumulate[3]) // �ϴ�����С���ٽ�ֵ����������ȴ�����ٽ�ֵ
+ {
+ if(mode_flag == BM_DEVICE)
+ billing_para_p_p->price_type_mode_now = BPM_LADDER_5;
+ single_use_money = (ladder_cfg_p_p->set_ladder_cumulate[3] - ladder_cumulate_sc_before) * (ladder_cfg_p_p->set_ladder_price[3] * 0.0001f) +
+ (billing_para_p_p->ladder_cumulate_sc - ladder_cfg_p_p->set_ladder_cumulate[3]) * price_double;
+ billing_para_p_p->price_now = ladder_cfg_p_p->set_ladder_price[4];
+ }
+ else
+ single_use_money = single_flow_sum * price_double;
+ }
+ return single_use_money;
+}
+/*�����ۻ���-�����������ã�����ʱ�䵽�����ۻ������㣩*/
+void GasCumulant_Ladder_PeriodCfg(LADDER_PRICE_CFG_PARA_T *ladder_cfg_old, LADDER_PRICE_CFG_PARA_T *ladder_cfg_new, __IO RTC_TimeDateTypeDef *calendar)
+{
+ static uint8_t period_flag = 0; // �����״α�־λ
+ static uint8_t next_period_start_time[6] = {0}; // ��һ�ε����ڿ�ʼʱ��
+ uint8_t real_time[6] = {calendar->Year & 0xFF, calendar->Month, calendar->Date, calendar->Hour, calendar->Minute, calendar->Second}; // ��ǰʱ��
+ /*���ϰ汾��ͬ���µļ۸���Чʱ�䵽*/
+ if ((ladder_cfg_old->price_ver != ladder_cfg_new->price_ver) &&
+ Datecmp(ladder_cfg_new->price_scheme_start_time, real_time) <= 0) // �¼۸���Чʱ�� <= ��ǰʱ�䣨�¼۸�ʱ�䵽��
+ {
+ memcpy(ladder_cfg_old, ladder_cfg_new, sizeof(LADDER_PRICE_CFG_PARA_T)); // �۸��滻
+ period_flag = 0;
+ }
+ if (ladder_cfg_old->set_price_type_mode == SPM_LADDER) // �����ǰ�ǽ��ݼƷ�
+ {
+ if (period_flag == 0 && Datecmp(ladder_cfg_old->period_start_time, real_time) <= 0) // �״ε�������ʱ��
+ {
+ billing_real_para_g.ladder_cumulate_sc = 0;
+ period_flag = 1;
+ memcpy(next_period_start_time, ladder_cfg_old->period_start_time, sizeof(next_period_start_time));
+ StartTime_NextCalculation(ladder_cfg_old->period_unit, ladder_cfg_old->period_duration, next_period_start_time);
+ }
+ else if (period_flag)
+ {
+ if (Datecmp(next_period_start_time, real_time) <= 0)
+ {
+ if (ladder_cfg_old->period_state == PPS_CYCLICALLY) // ѭ��ִ��
+ StartTime_NextCalculation(ladder_cfg_old->period_unit, ladder_cfg_old->period_duration, next_period_start_time);
+ else if (ladder_cfg_old->period_state == PPS_ONLY_ONE) // ִֻ��һ��
+ ladder_cfg_old->set_price_type_mode = SPM_NORMAL;
+ billing_real_para_g.ladder_cumulate_sc = 0;
+ }
+ }
+ }
+}
+/*�����´ο�ʼʱ��*/
+void StartTime_NextCalculation(PRICE_PERIOD_UNIT_T price_unit, uint16_t time_duration, uint8_t *pNext_time)
+{
+ uint8_t year_h, month_h, day_h, hour_h;
+ uint8_t temp_quarter = 0;
+ switch (price_unit)
+ {
+ case PPU_HOUR:
+ hour_h = BCD_2_HEX_U8(pNext_time[3]) + time_duration;
+ day_h = hour_h / 24;
+ pNext_time[3] = HEX_2_BCD_U8(hour_h % 24);
+ if (day_h)
+ Add_days_CalculateYearMonTHDay(&pNext_time[0], &pNext_time[1], &pNext_time[2], day_h);
+ break;
+ case PPU_DAY:
+ Add_days_CalculateYearMonTHDay(&pNext_time[0], &pNext_time[1], &pNext_time[2], time_duration);
+ break;
+ case PPU_MONTH:
+ month_h = BCD_2_HEX_U8(pNext_time[1]) + time_duration;
+ year_h = BCD_2_HEX_U8(pNext_time[0]);
+ while (month_h > 12)
+ {
+ month_h -= 12;
+ year_h++;
+ }
+ pNext_time[0] = HEX_2_BCD_U8(year_h);
+ pNext_time[1] = HEX_2_BCD_U8(month_h);
+ break;
+ case PPU_QUARTER:
+ year_h = BCD_2_HEX_U8(pNext_time[0]);
+ month_h = BCD_2_HEX_U8(pNext_time[1]);
+ temp_quarter = (month_h - 1) / 3; // 1~3Ϊ1 4~6Ϊ2 7~9Ϊ3 10~12Ϊ4
+ temp_quarter += time_duration;
+ while (temp_quarter > 3)
+ {
+ temp_quarter -= 4;
+ year_h++;
+ }
+ month_h = temp_quarter * 3 + 1;
+ pNext_time[0] = HEX_2_BCD_U8(year_h);
+ pNext_time[1] = HEX_2_BCD_U8(month_h);
+ pNext_time[2] = 1;
+ pNext_time[3] = 0;
+ pNext_time[4] = 0;
+ pNext_time[5] = 0;
+ break;
+ default:
+ break;
+ }
+}
+/******************************************
+ * func: Add_days_CalculateYearMonTHDay
+ * desc: ����ij��ij��ij������Щ��������Ϊij��ij��ij��
+ * input: pYear_bcd ���bcd
+ * pMonth_bcd �·�bcd
+ * pDay_bcd ��bcd
+ * add_days ���ӵ�����
+ * output: *pYear_bcd ����Ľ�����bcd
+ * *pMonth_bcd ����Ľ���·�bcd
+ * *pDay_bcd ����Ľ����bcd
+ * return: none
+ * bug: �ú�����ӵ��������ܿ��������ϣ����������磺���Դ�2016�����������2017�꣬���ǵ�2018�����ϻ����
+ *****************************************/
+void Add_days_CalculateYearMonTHDay(uint8_t *pYear_bcd, uint8_t *pMonth_bcd, uint8_t *pDay_bcd, uint16_t add_days)
+{
+ uint16_t year_h = BCD_2_HEX_U8(*pYear_bcd) + 2000, temp_year_h = 0, days_of_year = 0;
+ uint8_t month_h = BCD_2_HEX_U8(*pMonth_bcd), day_h = BCD_2_HEX_U8(*pDay_bcd), i;
+ uint8_t leap = ((year_h % 4 == 0) && (year_h % 100 != 0)) || (year_h % 400 == 0); // 1Ϊ���� 0Ϊƽ��
+ uint8_t days_of_month[2][13] = {{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
+ {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}};
+ /*���������¸���Ϊ�ڼ���*/
+ for (i = 1; i < month_h; i++)
+ days_of_year += days_of_month[leap][i];
+ days_of_year += day_h;
+ /*��������*/
+ days_of_year += add_days;
+ temp_year_h = year_h;
+ if (leap)
+ {
+ if (days_of_year > 366)
+ {
+ temp_year_h += days_of_year / 366;
+ days_of_year -= 366;
+ }
+ }
+ else
+ {
+ if (days_of_year > 365)
+ {
+ temp_year_h += days_of_year / 365;
+ days_of_year -= 365;
+ }
+ }
+ leap = ((temp_year_h % 4 == 0) && (temp_year_h % 100 != 0)) || (temp_year_h % 400 == 0);
+ for (i = 1; days_of_year > days_of_month[leap][i]; i++)
+ days_of_year -= days_of_month[leap][i];
+ *pYear_bcd = HEX_2_BCD_U8(temp_year_h - 2000);
+ *pMonth_bcd = HEX_2_BCD_U8(i);
+ *pDay_bcd = HEX_2_BCD_U8(days_of_year);
+}
--
Gitblit v1.9.3