|
|
@@ -3,7 +3,8 @@
|
|
|
#include "libs/shark_libs.h"
|
|
|
#include "libs/circle_buffer.h"
|
|
|
#include "libs/logger.h"
|
|
|
-#define MAX_SIZE 50
|
|
|
+
|
|
|
+#define MAX_SIZE 100
|
|
|
typedef struct {
|
|
|
c_buffer_t current;
|
|
|
c_buffer_t delta_ts;
|
|
|
@@ -53,6 +54,7 @@ int soft_current_push(float current_ma){
|
|
|
circle_put_one_data(&_fifo_i2.delta_ts,delta_ts);
|
|
|
}
|
|
|
_fifo_i2.last_ts = shark_get_mseconds();
|
|
|
- return (_fifo_i2.i2t_sum >= MAX_I2T); //ÕÛËãµ½1s
|
|
|
+ float f_sum = _fifo_i2.i2t_sum*(1.0f / ((float)_fifo_i2.ts_sum/1000.0f));
|
|
|
+ return (f_sum >= MAX_I2T); //ÕÛËãµ½1s
|
|
|
}
|
|
|
|