forked from SZV10X_Software/SZV103_FM33A0xxEV_SiZhu

jinlicong
2024-05-06 64cf4a779ef5c16c79bbbee27370169dc8d69499
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#ifndef _SIZHU_HISTORY_RECORD_H
#define _SIZHU_HISTORY_RECORD_H
 
#include "sizhu_ctrl_word.h"
#include "system_general_para.h"
 
 
 
/*ÈÕÖ¾¶¨ÒåÀàÐÍ*/
 
#define     LOG_SIZHU_HOUR_TYPE                    1
#define     LOG_SIZHU_DAY_TYPE                    2
#define     LOG_SIZHU_MONTH_TYPE                3
#define     LOG_SIZHU_PERIOD_TYPE                4
 
 
#pragma pack(1)
//¼ä¸ô¶³½áÈÕÖ¾ÄÚÈÝ
typedef struct log_sizhu_log_save_period_t
{
    uint8_t         sample_year;
    uint8_t         sample_month;
    uint8_t         sample_day;
    uint8_t         sample_hour;
    uint8_t         sample_min;
    uint8_t         sample_sec;
 
    double              standardgasusagetotal;
    double              workinggasusagetotal;
 
    float                standardvec;
    float                workingvec;
    
    float           temperature;
    float           pressure;
    
    u32           current_price;
    double        residual_amount;
    double        cumulative_gas_usage;
    double        cumulative_fee_usage;
    uint8_t            lith_bat_v;
    uint8_t            lith_bat_per;
 
    uint8_t            alka_bat_v;
    uint8_t            alka_bat_per;
 
    SYSTEM_STATUS_WORD_T  status_word;
 
}LOG_SIZHU_LOG_SAVE_PERIOD_T;
 
//Ô¡¢ÈÕ¡¢Ê±ÈÕÖ¾ÄÚÈÝ
typedef struct log_sizhu_log_save_t
{
    uint8_t         sample_year;
    uint8_t         sample_month;
    uint8_t         sample_day;
    uint8_t         sample_hour;
    uint8_t         sample_min;
    uint8_t         sample_sec;
 
    double              standardgasusagetotal;
    double              workinggasusagetotal;
 
    float                standardvec;
    float                workingvec;
 
    float           temperature;
    float           pressure;
    
    u32           unitprice;
    double        residualamount;
    uint8_t            reverse[2];
}LOG_SIZHU_LOG_SAVE_T;
 
 
typedef struct 
{
    LOG_SIZHU_RUN_T per_period_log;
    LOG_SIZHU_RUN_T per_hour_log;
    LOG_SIZHU_RUN_T per_day_log;
    LOG_SIZHU_RUN_T per_month_log;
}LOG_SIZHU_HISTORY_RUN_T;
 
#pragma pack()
 
 
extern LOG_SIZHU_HISTORY_RUN_T        log_sizhu_history_run_g;
 
 
uint8_t sizhu_historical_eeprom_default_init(void);
uint8_t sizhu_historical_record_only_read_init(void);
 
uint8_t sizhu_historical_record_clean(uint32_t epprom_begin_addr, LOG_SIZHU_RUN_T * log_run_ptr);
 
uint8_t sizhu_historical_record_save(uint8_t logtype, LOG_SIZHU_LOG_SAVE_T * log_run_ptr);
uint8_t sizhu_period_historical_record_save(uint8_t logtype, LOG_SIZHU_LOG_SAVE_PERIOD_T * log_run_ptr);
 
//
uint16_t sizhu_historical_period_log(void);
uint16_t sizhu_historical_hour_log(void);
uint16_t sizhu_historical_day_log(void);
uint16_t sizhu_historical_month_log(void);
uint32_t sizhu_historical_record_read(uint8_t logtype, uint32_t addr, LOG_SIZHU_LOG_SAVE_T * log_run_ptr);
uint8_t sizhu_historical_read_init(u32 * read_addr, u16 * save_count, uint8_t logtype);
 
void sizhuHistoryRecord(sClockBCD sys_clockBCD_in);
#endif