Skip to content
Snippets Groups Projects
Commit 815fc367 authored by moon2's avatar moon2 :speech_balloon:
Browse files

captouch: bugfix in afe saturation logic

parent 8ae4de16
No related branches found
No related tags found
No related merge requests found
......@@ -220,17 +220,13 @@ static int8_t captouch_configure_stage_afe_offset(uint8_t top, uint8_t stage, in
int8_t sat = 0;
struct ad714x_chip * chip = chip_bot;
if(top) chip = chip_top;
int8_t afe = chip->pos_afe_offsets[stage] - chip->neg_afe_offsets[stage];
if((afe >= 63) && (delta_afe > 0)) sat = 1;
if((afe <= 63) && (delta_afe < 0)) sat = -1;
afe += delta_afe;
if(afe >= 63){
afe = 63;
sat = 1;
}
if(afe <= -63){
afe = -63;
sat = -1;
}
if(afe >= 63) afe = 63;
if(afe <= -63)afe = -63;
if(afe>0){
chip->pos_afe_offsets[stage] = afe;
chip->neg_afe_offsets[stage] = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment