| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- /*
- * Copyright (c) 2026, RT-Thread Development Team
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Change Logs:
- * Date Author Notes
- * 2026-03-06 user first version
- */
- #ifndef __ECODE_H__
- #define __ECODE_H__
- #include <rtthread.h>
- #include <stdint.h>
- #define ECODE_MAGIC 0xEC0DE09D
- #define ECODE_VERSION 3
- #include "peri.h"
- extern struct rtc_time time_now;
- typedef enum
- {
- e_reboot = 1,
- e_clearecode,
- e_test_fun,
- e_update_timeout,
- e_bak_restore,
- e_bak_backup,
- e_update,
- e_update_ok,
- e_update_fail,
- e_update_WSUCC,
- e_update_WFAIL,
- e_hardfault,
- e_iwdg,
- e_mqtt0_outtime,
- e_BL,
- e_GUARD_NET,
- e_NET_INIT_FAIL,
- e_tilt_trigger,
- e_tilt_restore,
- e_rain_trigger,
- e_rain_restore,
- e_WARN,
- e_protect,
- e_work_start,
- e_work_stop,
- e_work_resume,
- e_platform_chg,
- e_mqtt_cmd,
- e_hv_info,
- e_protect_stopwork,
- e_CMD_restartwork,
- e_upload_ecode,
- e_para_setdef,
- e_work_without_ntp,
- e_SYSWATCH_KILL,
- e_typeMAX
- } ecode_list;
- typedef struct __attribute__((packed))
- {
- struct TM time_stamp; // 时间戳
- uint16_t code; // 异常码
- uint16_t para; // 附带参数
- uint32_t num; // 序号(全局递增)
- char detail[50]; // 内容
- } ecode_record_t;
- void Recode_e_code(ecode_list code, uint16_t para, char *detail);
- int ecode_read(uint32_t index, ecode_record_t *rec);
- uint32_t ecode_get_count(void);
- void ecode_clear(void);
- #endif /* __ECODE_H__ */
|