fix: update_moving_average window 参数 uint8_t→uint16_t
WINDOW_ORIGIN=500 超出 uint8_t 范围,会被截断为 244。 改为 uint16_t 支持 WINDOW_ORIGIN 最大到 60000+。
This commit is contained in:
@@ -180,7 +180,7 @@ void poll_sw_state(void);
|
||||
uint32_t get_flt_value(uint32_t new_value, uint32_t last_Value);
|
||||
uint8_t update_moving_average(uint32_t* p_sum, uint16_t* p_cnt,
|
||||
uint32_t* p_origin, uint32_t new_value,
|
||||
uint8_t window);
|
||||
uint16_t window);
|
||||
void poll_yellow_led(void);
|
||||
void poll_green_led(void);
|
||||
void LEDA_ON_OFF(void);
|
||||
|
||||
@@ -175,7 +175,7 @@ uint32_t get_flt_value(uint32_t new_value, uint32_t last_Value)
|
||||
*===========================================================================*/
|
||||
uint8_t update_moving_average(uint32_t* p_sum, uint16_t* p_cnt,
|
||||
uint32_t* p_origin, uint32_t new_value,
|
||||
uint8_t window)
|
||||
uint16_t window)
|
||||
{
|
||||
if (!p_sum || !p_cnt || !p_origin || window == 0) {
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user