Skip to content

Commit

Permalink
fix bug + codacy
Browse files Browse the repository at this point in the history
  • Loading branch information
pkotamnives committed Aug 9, 2023
1 parent e38a77a commit 5728596
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
30 changes: 15 additions & 15 deletions projects/cm_mcu/LocalTasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -576,10 +576,10 @@ void readFFpresent(void)
(present_FFLDAQ_F1) << 6 | // 4 bits
((present_FFL12_F1)); // 6 bits

ffldaq_f1_args.present_bit_mask = (~((present_FFLDAQ_F2) << 16)) & 0xFU; // 4 bits
ffl12_f1_args.present_bit_mask = (~((present_FFL12_F2) << 10)) & 0x3FU; // 6 bits
ffldaq_f2_args.present_bit_mask = (~((present_FFLDAQ_F2) << 6)) & 0xFU; // 4 bits
ffl12_f2_args.present_bit_mask = (~(present_FFL12_F2)) & 0x3FU; // 6 bits
ffldaq_f1_args.present_bit_mask = present_FFLDAQ_F1; // 4 bits
ffl12_f1_args.present_bit_mask = present_FFL12_F1; // 6 bits
ffldaq_f2_args.present_bit_mask = present_FFLDAQ_F2; // 4 bits
ffl12_f2_args.present_bit_mask = present_FFL12_F2; // 6 bits

f1_ff12xmit_4v0_sel = (f1_ff12xmit_4v0_sel >> 4) & 0x7; // bits 4-6
f2_ff12xmit_4v0_sel = (f2_ff12xmit_4v0_sel >> 4) & 0x7; // bits 4-6
Expand Down Expand Up @@ -668,33 +668,33 @@ int8_t getFFtemp(const uint8_t i)
return val;
}

int8_t getFFpresentbit(const uint8_t i)
uint8_t getFFpresentbit(const uint8_t i)
{
uint8_t j;
int8_t val;
uint8_t sel_bit_mask;
uint8_t val;
uint32_t sel_bit_mask;
configASSERT(i < NFIREFLIES);
if (i < NFIREFLIES_IT_F1) {
j = i;
sel_bit_mask = 0x1U << j;
val = ffl12_f1_args.present_bit_mask & (uint32_t)sel_bit_mask;
sel_bit_mask = 1 << j;
val = (ffl12_f1_args.present_bit_mask & sel_bit_mask) >> j;
}

else if (NFIREFLIES_IT_F1 <= i && i < NFIREFLIES_IT_F1 + NFIREFLIES_DAQ_F1) {
j = i - NFIREFLIES_IT_F1;
sel_bit_mask = 0x1U << j;
val = ffl12_f1_args.present_bit_mask & (uint32_t)sel_bit_mask;
sel_bit_mask = 1 << j;
val = (ffldaq_f1_args.present_bit_mask & sel_bit_mask) >> j;
}

else if (NFIREFLIES_F1 <= i && i < NFIREFLIES_F1 + NFIREFLIES_IT_F2) {
j = i - NFIREFLIES_F1;
sel_bit_mask = 0x1U << j;
val = ffl12_f1_args.present_bit_mask & (uint32_t)sel_bit_mask;
sel_bit_mask = 1 << j;
val = (ffl12_f2_args.present_bit_mask & sel_bit_mask) >> j;
}
else {
j = i - (NFIREFLIES_F1 + NFIREFLIES_IT_F2);
sel_bit_mask = 0x1U << j;
val = ffl12_f1_args.present_bit_mask & (uint32_t)sel_bit_mask;
sel_bit_mask = 1 << j;
val = (ffldaq_f2_args.present_bit_mask & sel_bit_mask) >> j;
}

return val;
Expand Down
2 changes: 1 addition & 1 deletion projects/cm_mcu/Tasks.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ bool isEnabledFF(int ff);
void setFFmask(uint32_t ff_combined_mask);
void readFFpresent(void);
int8_t getFFtemp(const uint8_t i);
int8_t getFFpresentbit(const uint8_t i);
uint8_t getFFpresentbit(const uint8_t i);
#ifdef REV2
void getFFpart(void);
#endif
Expand Down

0 comments on commit 5728596

Please sign in to comment.