# HG changeset patch # User paul # Date 2017-01-26 07:01:05 # Node ID 571c142ee2b36a6b32db4bdd723140ffbd172118 # Parent 718b17428d4a08ca0a85f8cf8a3ec2626d5b28f9 Bug #657 HK_LFR_xE_CNT doesn't manage the wrap of 8bits counter error diff --git a/src/fsw_misc.c b/src/fsw_misc.c --- a/src/fsw_misc.c +++ b/src/fsw_misc.c @@ -786,7 +786,7 @@ void increment_hk_counter( unsigned char } else { - delta = (255 - oldValue) + newValue; + delta = (CONST_256 - oldValue) + newValue; } *counter = *counter + delta; @@ -798,7 +798,7 @@ void hk_lfr_le_update( void ) hk_lfr_le_t new_hk_lfr_le; unsigned int counter; - counter = (((unsigned int) housekeeping_packet.hk_lfr_le_cnt[0]) * 256) + housekeeping_packet.hk_lfr_le_cnt[1]; + counter = (((unsigned int) housekeeping_packet.hk_lfr_le_cnt[0]) * CONST_256) + housekeeping_packet.hk_lfr_le_cnt[1]; // DPU new_hk_lfr_le.dpu_spw_parity = housekeeping_packet.hk_lfr_dpu_spw_parity; @@ -868,7 +868,7 @@ void hk_lfr_me_update( void ) hk_lfr_me_t new_hk_lfr_me; unsigned int counter; - counter = (((unsigned int) housekeeping_packet.hk_lfr_me_cnt[0]) * 256) + housekeeping_packet.hk_lfr_me_cnt[1]; + counter = (((unsigned int) housekeeping_packet.hk_lfr_me_cnt[0]) * CONST_256) + housekeeping_packet.hk_lfr_me_cnt[1]; // get the current values new_hk_lfr_me.dpu_spw_early_eop = housekeeping_packet.hk_lfr_dpu_spw_early_eop;