Просмотр исходного кода

add logger

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui 5 лет назад
Родитель
Сommit
985844f6d7

+ 14 - 1
Application/app/sox/health.c

@@ -3,6 +3,7 @@
 #include "state.h"
 #include "iostate.h"
 #include "measure_task.h"
+#include "libs/logger.h"
 
 #define MAX_CURRENT_FOR_CHARGER (20*1000) //最大充电电流20A
 #define MIN_VOLTAGE_FOR_DISCHARGER (34 * 1000) //允许能放电的最小电压
@@ -34,6 +35,7 @@ void health_init(void){
 	/* 5238如果有异常情况,比如短路,负载移除,通过这个handler上报 */
 	ml5238_register_notify_handler(check_ml5238_state);
 	init_detect_timer();
+	set_log_level(MOD_HEALTH, L_debug);
 }
 
 bms_health_t *bms_health(){
@@ -59,6 +61,7 @@ static void load_delect_handler(shark_timer_t *timer){
 	if (_load_detect_timer.count >= _load_detect_timer.max_count) {
 		_health.load_current_short = 0; //负载移除,clear load current short
 		ml5238_enable_load_detect(0);
+		health_debug("load disconnect\n");
 	}else {		
 		shark_timer_post(&_load_detect_timer._timer, _load_detect_timer.interval);
 	}
@@ -78,6 +81,7 @@ static void charger_detect_handler(shark_timer_t *timer){
 }
 
 static void check_ml5238_state(int event){
+	health_warning("ml5238 event=0x%x\n", event);
 	if (event == ML5238_Event_Charger_Over_Current){
 		shark_timer_post(&_charger_detect_timer._timer, _charger_detect_timer.interval);
 	}else if (event == ML5238_Event_Short_Current) { //ml5238触发短路保护,充放电mos全部关闭
@@ -89,6 +93,13 @@ static void check_ml5238_state(int event){
 	}
 }
 
+static void debug_health(void){
+	uint32_t *value = (uint32_t *)&_health;
+	if (*value != 0){
+		health_error("health value = 0x%x\n", *value);
+	}
+}
+
 /* 检测电流情况,看是否过流等 */
 static debounce_t _charger_over_current = {
 	.count = 0,
@@ -109,10 +120,10 @@ void check_current_state(void){
 			shark_timer_post(&_charger_detect_timer._timer, _charger_detect_timer.interval);
 		}
 	}
+	debug_health();
 }
 
 /* 检测pack电压,cell电压,pack电压过低触发powerdown*/
-
 static debounce_t _discharger_lower_voltage = {.count = 0, .max_count = 10};
 static debounce_t _discharger_low_normal_voltage = {.count = 0, .max_count = 10};
 static debounce_t _power_down_voltage = {.count = 0, .max_count = 10};
@@ -181,6 +192,7 @@ void check_voltage_state(void) {
 			debounce_reset(_power_down_voltage);
 		}	
 	}
+	debug_health();
 }
 
 /* 检测温度情况,看是否过高温,或者过低温 */
@@ -283,4 +295,5 @@ void check_temp_state(void){
 		}
 
 	}
+	debug_health();
 }

+ 14 - 0
Application/app/sox/iostate.c

@@ -1,5 +1,6 @@
 #include "bsp/gpio.h"
 #include "libs/shark_task.h"
+#include "libs/logger.h"
 #include "state.h"
 #include "iostate.h"
 
@@ -21,8 +22,13 @@ static io_timer_t dcdc_pwr_io;
 
 static void io_timer_handler(shark_timer_t *t);
 
+static void debug_io(void){
+	uint16_t *io = (uint16_t *)&_io_state;
+	io_debug("io state = 0x%x\n", *io);
+}
 
 void io_state_init(void){
+	set_log_level(MOD_IO, L_debug);
 	_io_state.hall_detect = IS_HALL1_DETECTED()|| IS_HALL2_DETECTED();
 	_io_state.charger_detect = IS_CHARGER_IN();
 	_io_state.dcdc_good_detect= IS_DCDC_POWER_GOOD();
@@ -35,6 +41,7 @@ void io_state_init(void){
 	shark_timer_post(&charger_io._timer, io_detect_intv_time);
 	shark_timer_post(&aux_short_io._timer, io_detect_intv_time);
 	shark_timer_post(&dcdc_pwr_io._timer, io_detect_intv_time);
+	debug_io();
 }
 
 io_state_t *io_state(void){
@@ -84,6 +91,8 @@ static void _set_io_value(io_timer_t *t){
 		shark_timer_post(&t->_timer, io_detect_intv_time);
 	}
 	__enable_irq();
+
+	debug_io();
 }
 
 
@@ -107,29 +116,34 @@ void charger_detect_irq_handler(void){
 	charger_io.detect_cnt = 0;
 	shark_timer_post(&charger_io._timer, io_detect_intv_time);
 	charger_detect_irq_enable(0);
+	io_debug("charger irq\n");
 }
 void hall1_detect_irq_handler(void){
 	hall_io.value = IS_HALL1_DETECTED()|| IS_HALL2_DETECTED();
 	hall_io.detect_cnt = 0;
 	shark_timer_post(&hall_io._timer, io_detect_intv_time);
 	hall_1_detect_irq_enable(0);
+	io_debug("hall 1 irq\n");
 }
 void hall2_detect_irq_handler(void){
 	hall_io.value = IS_HALL1_DETECTED()|| IS_HALL2_DETECTED();
 	hall_io.detect_cnt = 0;
 	shark_timer_post(&hall_io._timer, io_detect_intv_time);
 	hall_2_detect_irq_enable(0);
+	io_debug("hall 2 irq\n");
 }
 void small_current_short_handler(void){
 	aux_short_io.value = IS_AUX_VOL_LOCKED();
 	aux_short_io.detect_cnt = 0;
 	shark_timer_post(&aux_short_io._timer, io_detect_intv_time);
 	small_current_short_irq_enable(0);
+	io_debug("aux lock irq\n");
 }
 void dcdc_pwr_detect_irq_handler(void) {
 	dcdc_pwr_io.value = IS_DCDC_POWER_GOOD();
 	dcdc_pwr_io.detect_cnt = 0;
 	shark_timer_post(&dcdc_pwr_io._timer, io_detect_intv_time);
 	dcdc_pwr_detect_irq_enable(0);
+	io_debug("dcdc lock irq");
 }
 

+ 42 - 0
Application/app/sox/state.c

@@ -1,5 +1,6 @@
 #include "bsp/gpio.h"
 #include "bsp/ml5238.h"
+#include "bsp/mcu_power_sleep.h"
 #include "app/sox/measure.h"
 #include "app/sox/measure_task.h"
 #include "libs/shark_task.h"
@@ -7,6 +8,10 @@
 #include "state.h"
 #include "iostate.h"
 
+#define ALLOW_DEEP_SLEEP 0
+#define ALLOW_POWER_DOWN 0
+#define ALLOW_5238_BALANCE 1
+
 static bms_state_t _bms_state;
 static shark_task_t _bms_main_task;
 static void _current_notify(void);
@@ -78,6 +83,7 @@ static void _process_user_request(s32 health){
 }
 
 static void _process_power_down(void){
+#if (ALLOW_POWER_DOWN==1)	
 	if (bms_health()->powerdown_lower_voltage){
 		ml5238_enable_charger_detect(1);
 		delay_us(2* 1000);
@@ -91,12 +97,46 @@ static void _process_power_down(void){
 		ml5238_enable_charger_mosfet(0);		
 		ml5238_power_down();
 	}
+#endif
+}
+
+
+static void _process_deepsleep(s32 health){
+#if (ALLOW_DEEP_SLEEP==1)	
+	if (health != Health_Success){
+		return;
+	}
+	if (ml5238_is_charging() || ml5238_is_discharging() || IS_CHARGER_IN()){
+		return;
+	}
+	if (!(io_state()->hall_detect)){
+		mcu_enter_deepsleep();
+	}
+#endif	
+}
+
+static void _process_iostate_changed(void){
+	if (!(io_state()->hall_detect)){
+		if (ml5238_is_discharging()){
+			ml5238_enable_discharger_mosfet(0);
+		}
+		if (!AUX_VOL_IS_OPEN()){
+			AUX_VOL_OPEN(1);
+		}
+	}
+	if (IS_CHARGER_IN()) {
+		if (!ml5238_is_charging()){
+			ml5238_enable_charger_mosfet(1);
+		}
+	}
 }
 
 static u32 _bms_main_task_handler(void){
 	s32 unhealth = _process_unheath();
 	_process_user_request(unhealth);
+	_process_deepsleep(unhealth);
 	_process_power_down();
+	_process_iostate_changed();
 	return 0;
 }
 
@@ -191,7 +231,9 @@ static uint8_t calc_cell_voltage(void){
 static void _voltage_notify(void){
 	uint8_t max_index = calc_cell_voltage();
 	check_voltage_state(); //check health of cell voltage
+#if (ALLOW_5238_BALANCE==1)
 	check_cell_balance(max_index);
+#endif
 }
 
 static void _temperature_notify(void){

+ 62 - 0
Application/bsp/mcu_power_sleep.c

@@ -0,0 +1,62 @@
+#include "mcu_power_sleep.h"
+#include "bsp/ml5238.h"
+#include "bsp/cs1180.h"
+#include "bsp/gpio.h"
+#include "bsp/spi.h"
+
+extern void system_clock_24m_irc8m(void);
+extern void system_clock_config(void);
+
+static void enable_wakeup_irq(void){
+	charger_detect_irq_enable(1);
+	hall_1_detect_irq_enable(1);
+	hall_2_detect_irq_enable(1);
+}
+
+static void pre_deepsleep(void){
+#if (CONFIG_BOARD_TYPE==SHARK_BOARD_SP700)
+	UART0_IR_EN(0);
+	UART1_IR_EN(0);
+#elif (CONFIG_BOARD_TYPE==SHARK_BOARD_SP600)
+	RS485_PWR_ENABLE(0);
+#endif
+	CS1180_PWR_ENABLE(0);
+	//uart0_deinit();
+	//uart1_deinit();
+	//gd32_i2c_deinit();
+	ml5238_power_save(1); //call, before spi0_deinit
+	spi0_deinit();
+	spi1_deinit();
+	system_clock_24m_irc8m();//before dcdc off, should set clock to 24M, avoid ml5238's supply is not enough
+	DCDC_VOL_OPEN(0);
+	wdog_start(10);
+}
+
+static void post_deepsleep(void){
+	DCDC_VOL_OPEN(1);
+	SystemInit();
+	system_clock_config();
+	spi0_init();
+	ml5238_power_save(0);
+	CS1180_PWR_ENABLE(1);
+	cs1180_adc_init();
+#if (CONFIG_BOARD_TYPE==SHARK_BOARD_SP700)
+	UART0_IR_EN(1);
+	UART1_IR_EN(1);
+#elif (CONFIG_BOARD_TYPE==SHARK_BOARD_SP600)
+	RS485_PWR_ENABLE(1);
+#endif
+	//uart0_init();
+	//uart1_init();
+	//gd32_i2c_init();
+	wdog_start(4);
+}
+
+void mcu_enter_deepsleep(void){
+
+	pre_deepsleep();
+	enable_wakeup_irq();
+	pmu_to_deepsleepmode(PMU_LDO_LOWPOWER, WFI_CMD);
+	post_deepsleep();
+}
+

+ 7 - 0
Application/bsp/mcu_power_sleep.h

@@ -0,0 +1,7 @@
+#ifndef _Mcu_Power_Sleep_H__
+#define _Mcu_Power_Sleep_H__
+
+void mcu_enter_deepsleep(void);
+
+#endif /* _Mcu_Power_Sleep_H__ */
+

+ 18 - 0
Application/bsp/ml5238.c

@@ -117,6 +117,14 @@ static int __inline__ _discharger_mosfet_is_open(void){
 	return (data & FET_DF) != 0;
 }
 
+int ml5238_is_charging(void){
+	return _charger_mosfet_is_open();
+}
+
+int ml5238_is_discharging(void){
+	return _discharger_mosfet_is_open();
+}
+
 void ml5238_cell_start_balance(uint16_t balance_mask){
 	ml5238_write(ML5238_CBALH, (balance_mask >> 8) & 0xFF);
 	ml5238_write(ML5238_CBALL, balance_mask & 0xFF);
@@ -206,6 +214,16 @@ void ml5238_power_down(void){
 	}while(1);
 }
 
+void ml5238_power_save(int save){
+	ml5238_write(ML5238_PSENSE, PSENSE_EPSH|PSENSE_IPSH);
+	if (save) {
+		ml5238_write(ML5238_POWER, POWER_PSV);
+		ml5238_irq_enable(1);  //enable charger detect irq, to wakeup bms when charger insert
+	}else {
+		ml5238_write(ML5238_POWER, 0);
+	}
+}
+
 static void __inline__ call_handler(int event){
 	if (_handler) {
 		_handler(event);

+ 3 - 0
Application/bsp/ml5238.h

@@ -10,8 +10,11 @@ int ml5238_is_load_disconnect(void);
 int ml5238_enable_load_detect(int enable);
 void ml5238_cell_start_balance(uint16_t balance_mask);
 void ml5238_power_down(void);
+void ml5238_power_save(int save);
 int ml5238_charger_is_disconnect(void);
 int ml5238_enable_charger_detect(int enable);
+int ml5238_is_charging(void);
+int ml5238_is_discharging(void);
 
 
 typedef void (*ml5238_notify_hander)(int event);

+ 58 - 0
Application/libs/logger.c

@@ -0,0 +1,58 @@
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdint.h>
+#include "logger.h"
+
+
+static uint32_t level_data[2];
+
+static int _get_level(int mod){
+	int index = mod_bit_start(mod)/(32+1);
+	mod = mod_bit_start(mod) % 32;
+	return (level_data[index] >> mod) & LEVEL_MASK;
+}
+
+void set_log_level(int mod, int l){
+	int index = mod_bit_start(mod)/(32+1);
+	mod = mod_bit_start(mod) % 32;
+	level_data[index] = (level_data[index] & (~(LEVEL_MASK<<mod))) | ((l & LEVEL_MASK)<<mod);
+}
+
+static void log_out(char *fmt, va_list args){
+	vprintf(fmt, args);
+}
+
+void log_debug(int mod, char *fmt, ...){
+	if (_get_level(mod) >= L_debug){
+		va_list args;
+		va_start(args, fmt);		
+		log_out(fmt, args);
+		va_end(args);
+	}
+}
+
+void log_warning(int mod, char *fmt, ...){
+	if (_get_level(mod) >= L_warning){
+		va_list args;
+		va_start(args, fmt);		
+		log_out(fmt, args);
+		va_end(args);
+	}
+}
+
+void log_error(int mod, char *fmt, ...){
+	if (_get_level(mod) >= L_error){
+		va_list args;
+		va_start(args, fmt);		
+		log_out(fmt, args);
+		va_end(args);
+	}
+}
+//rewrite the fputc, so that the printf,vprintf can log the info the can
+//static char log_buffer[8];
+//static int log_index = 0;
+int fputc(int c, FILE *fp){
+	
+	return 1;
+}
+

+ 50 - 0
Application/libs/logger.h

@@ -0,0 +1,50 @@
+#ifndef _Shark_Logger_h__
+#define _Shark_Logger_h__
+#include <stdarg.h>
+
+#define L_disable 0
+#define L_debug  1
+#define L_warning 2
+#define L_error 3
+
+#define LEVEL_MASK 0x03
+
+#define mod_bit_start(mod) (mod*2)
+
+
+/* define the module which need debug info here 
+* at most is 32 modules (index from 0 - 31) 
+*/
+#define MOD_IO 0  //for io state
+#define MOD_HEALTH 1
+#define MOD_MEASURE 2
+#define MOD_STATE   3
+#define MOD_SYSTEM    4
+
+extern void set_log_level(int mod, int l);
+extern void log_debug(int mod, char *fmt, ...);
+extern void log_warning(int mod, char *fmt, ...);
+extern void log_error(int mod, char *fmt, ...);
+
+/* logger functions */
+#define io_debug(fmt, args...) log_debug(MOD_IO, "[IO:D]"fmt, ##args)
+#define io_warning(fmt, args...) log_warning(MOD_IO, "[IO:W]"fmt, ##args)
+#define io_error(fmt, args...) log_error(MOD_IO, "[IO:E]"fmt, ##args)
+
+#define health_debug(fmt, args...) log_debug(MOD_HEALTH, "[HEALTH:D]"fmt, ##args)
+#define health_warning(fmt, args...) log_warning(MOD_HEALTH, "[HEALTH:W]"fmt, ##args)
+#define health_error(fmt, args...) log_error(MOD_HEALTH, "[HEALTH:E]"fmt, ##args)
+
+#define measure_debug(fmt, args...) log_debug(MOD_MEASURE, "[MEASURE:D]"fmt, ##args)
+#define measure_warning(fmt, args...) log_warning(MOD_MEASURE, "[MEASURE:W]"fmt, ##args)
+#define measure_error(fmt, args...) log_error(MOD_MEASURE, "[MEASURE:E]"fmt, ##args)
+
+#define state_debug(fmt, args...) log_debug(MOD_STATE, "[STATE:D]"fmt, ##args)
+#define state_warning(fmt, args...) log_warning(MOD_STATE, "[STATE:W]"fmt, ##args)
+#define state_error(fmt, args...) log_error(MOD_STATE, fmt, "[STATE:E]"##args)
+
+#define sys_debug(fmt, args...) log_debug(MOD_SYSTEM, fmt, "[SYS:D]"##args)
+#define sys_warning(fmt, args...) log_warning(MOD_SYSTEM, "[SYS:W]"fmt, ##args)
+#define sys_error(fmt, args...) log_error(MOD_SYSTEM, fmt, "[SYS:E]"##args)
+#endif /* _Shark_Logger_h__ */
+

+ 29 - 0
Librarys/CMSIS/GD32F3x0/Source/system_gd32f3x0.c

@@ -745,6 +745,35 @@ static void system_clock_8m_irc8m(void)
 }
 #endif /* __SYSTEM_CLOCK_8M_HXTAL */
 
+void system_clock_24m_irc8m(void)
+{
+    /* AHB = SYSCLK */
+    RCU_CFG0 |= RCU_AHB_CKSYS_DIV1;
+    /* APB2 = AHB/2 */
+    RCU_CFG0 |= RCU_APB2_CKAHB_DIV2;
+    /* APB1 = AHB/2 */
+    RCU_CFG0 |= RCU_APB1_CKAHB_DIV2;
+    /* PLL = (IRC8M/2) * 21 = 84 MHz */
+    RCU_CFG0 &= ~(RCU_CFG0_PLLSEL | RCU_CFG0_PLLMF);
+    RCU_CFG0 |= (RCU_PLLSRC_IRC8M_DIV2 | RCU_PLL_MUL6); //8/2*6 = 24M, power consume:6.7ma
+    
+    /* enable PLL */
+    RCU_CTL0 |= RCU_CTL0_PLLEN;
+
+    /* wait until PLL is stable */
+    while(0U == (RCU_CTL0 & RCU_CTL0_PLLSTB)){
+    }
+
+    /* select PLL as system clock */
+    RCU_CFG0 &= ~RCU_CFG0_SCS;
+    RCU_CFG0 |= RCU_CKSYSSRC_PLL;
+
+    /* wait until PLL is selected as system clock */
+    while(0U == (RCU_CFG0 & RCU_SCSS_PLL)){
+    }
+}
+
+
 /*!
     \brief      update the SystemCoreClock with current core clock retrieved from cpu registers
     \param[in]  none

+ 54 - 30
Project/SP700.uvoptx

@@ -311,7 +311,7 @@
 
   <Group>
     <GroupName>BSP</GroupName>
-    <tvExp>0</tvExp>
+    <tvExp>1</tvExp>
     <tvExpOptDlg>0</tvExpOptDlg>
     <cbSel>0</cbSel>
     <RteFlg>0</RteFlg>
@@ -447,17 +447,29 @@
       <RteFlg>0</RteFlg>
       <bShared>0</bShared>
     </File>
+    <File>
+      <GroupNumber>3</GroupNumber>
+      <FileNumber>18</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\Application\bsp\mcu_power_sleep.c</PathWithFileName>
+      <FilenameWithoutPath>mcu_power_sleep.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
   </Group>
 
   <Group>
     <GroupName>Libs</GroupName>
-    <tvExp>0</tvExp>
+    <tvExp>1</tvExp>
     <tvExpOptDlg>0</tvExpOptDlg>
     <cbSel>0</cbSel>
     <RteFlg>0</RteFlg>
     <File>
       <GroupNumber>4</GroupNumber>
-      <FileNumber>18</FileNumber>
+      <FileNumber>19</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -469,7 +481,7 @@
     </File>
     <File>
       <GroupNumber>4</GroupNumber>
-      <FileNumber>19</FileNumber>
+      <FileNumber>20</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -481,7 +493,7 @@
     </File>
     <File>
       <GroupNumber>4</GroupNumber>
-      <FileNumber>20</FileNumber>
+      <FileNumber>21</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -491,6 +503,18 @@
       <RteFlg>0</RteFlg>
       <bShared>0</bShared>
     </File>
+    <File>
+      <GroupNumber>4</GroupNumber>
+      <FileNumber>22</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\Application\libs\logger.c</PathWithFileName>
+      <FilenameWithoutPath>logger.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
   </Group>
 
   <Group>
@@ -501,7 +525,7 @@
     <RteFlg>0</RteFlg>
     <File>
       <GroupNumber>5</GroupNumber>
-      <FileNumber>21</FileNumber>
+      <FileNumber>23</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -513,7 +537,7 @@
     </File>
     <File>
       <GroupNumber>5</GroupNumber>
-      <FileNumber>22</FileNumber>
+      <FileNumber>24</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -525,7 +549,7 @@
     </File>
     <File>
       <GroupNumber>5</GroupNumber>
-      <FileNumber>23</FileNumber>
+      <FileNumber>25</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -537,7 +561,7 @@
     </File>
     <File>
       <GroupNumber>5</GroupNumber>
-      <FileNumber>24</FileNumber>
+      <FileNumber>26</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -549,7 +573,7 @@
     </File>
     <File>
       <GroupNumber>5</GroupNumber>
-      <FileNumber>25</FileNumber>
+      <FileNumber>27</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -561,7 +585,7 @@
     </File>
     <File>
       <GroupNumber>5</GroupNumber>
-      <FileNumber>26</FileNumber>
+      <FileNumber>28</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -573,7 +597,7 @@
     </File>
     <File>
       <GroupNumber>5</GroupNumber>
-      <FileNumber>27</FileNumber>
+      <FileNumber>29</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -585,7 +609,7 @@
     </File>
     <File>
       <GroupNumber>5</GroupNumber>
-      <FileNumber>28</FileNumber>
+      <FileNumber>30</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -597,7 +621,7 @@
     </File>
     <File>
       <GroupNumber>5</GroupNumber>
-      <FileNumber>29</FileNumber>
+      <FileNumber>31</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -609,7 +633,7 @@
     </File>
     <File>
       <GroupNumber>5</GroupNumber>
-      <FileNumber>30</FileNumber>
+      <FileNumber>32</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -621,7 +645,7 @@
     </File>
     <File>
       <GroupNumber>5</GroupNumber>
-      <FileNumber>31</FileNumber>
+      <FileNumber>33</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -633,7 +657,7 @@
     </File>
     <File>
       <GroupNumber>5</GroupNumber>
-      <FileNumber>32</FileNumber>
+      <FileNumber>34</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -645,7 +669,7 @@
     </File>
     <File>
       <GroupNumber>5</GroupNumber>
-      <FileNumber>33</FileNumber>
+      <FileNumber>35</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -657,7 +681,7 @@
     </File>
     <File>
       <GroupNumber>5</GroupNumber>
-      <FileNumber>34</FileNumber>
+      <FileNumber>36</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -669,7 +693,7 @@
     </File>
     <File>
       <GroupNumber>5</GroupNumber>
-      <FileNumber>35</FileNumber>
+      <FileNumber>37</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -681,7 +705,7 @@
     </File>
     <File>
       <GroupNumber>5</GroupNumber>
-      <FileNumber>36</FileNumber>
+      <FileNumber>38</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -693,7 +717,7 @@
     </File>
     <File>
       <GroupNumber>5</GroupNumber>
-      <FileNumber>37</FileNumber>
+      <FileNumber>39</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -705,7 +729,7 @@
     </File>
     <File>
       <GroupNumber>5</GroupNumber>
-      <FileNumber>38</FileNumber>
+      <FileNumber>40</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -717,7 +741,7 @@
     </File>
     <File>
       <GroupNumber>5</GroupNumber>
-      <FileNumber>39</FileNumber>
+      <FileNumber>41</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -729,7 +753,7 @@
     </File>
     <File>
       <GroupNumber>5</GroupNumber>
-      <FileNumber>40</FileNumber>
+      <FileNumber>42</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -741,7 +765,7 @@
     </File>
     <File>
       <GroupNumber>5</GroupNumber>
-      <FileNumber>41</FileNumber>
+      <FileNumber>43</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -753,7 +777,7 @@
     </File>
     <File>
       <GroupNumber>5</GroupNumber>
-      <FileNumber>42</FileNumber>
+      <FileNumber>44</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -765,7 +789,7 @@
     </File>
     <File>
       <GroupNumber>5</GroupNumber>
-      <FileNumber>43</FileNumber>
+      <FileNumber>45</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -785,7 +809,7 @@
     <RteFlg>0</RteFlg>
     <File>
       <GroupNumber>6</GroupNumber>
-      <FileNumber>44</FileNumber>
+      <FileNumber>46</FileNumber>
       <FileType>2</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -797,7 +821,7 @@
     </File>
     <File>
       <GroupNumber>6</GroupNumber>
-      <FileNumber>45</FileNumber>
+      <FileNumber>47</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>

+ 10 - 0
Project/SP700.uvprojx

@@ -478,6 +478,11 @@
               <FileType>1</FileType>
               <FilePath>..\Application\bsp\bsp.c</FilePath>
             </File>
+            <File>
+              <FileName>mcu_power_sleep.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\Application\bsp\mcu_power_sleep.c</FilePath>
+            </File>
           </Files>
         </Group>
         <Group>
@@ -498,6 +503,11 @@
               <FileType>1</FileType>
               <FilePath>..\Application\libs\shark_utils.c</FilePath>
             </File>
+            <File>
+              <FileName>logger.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\Application\libs\logger.c</FilePath>
+            </File>
           </Files>
         </Group>
         <Group>