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

captouch: linearized bottom petal pos a bit

parent cde04346
No related branches found
No related tags found
1 merge request!735various bugfixes
Pipeline #13258 passed
......@@ -1401,6 +1401,16 @@ static inline void pos_calc_bot(int index, int mode, int *rad, int *raw_sum,
int rad_calc = tip - base;
rad_calc *= petal_pos_gain[index];
rad_calc /= ((tip + base) >> 2) + 1;
rad_calc = 16384 - rad_calc;
int rad_calc_gain = rad_calc > 0 ? rad_calc : 0;
rad_calc_gain = (rad_calc_gain + 32768) >> 5;
rad_calc_gain = (rad_calc_gain * rad_calc_gain) >> 12;
rad_calc = (rad_calc * rad_calc_gain) >> 10;
rad_calc = 16384 - rad_calc;
*rad = rad_calc;
} else {
*rad = 0;
......@@ -1435,9 +1445,20 @@ static inline void pos_calc_top2(int index, int mode, int *rad, int *phi,
}
}
static void pos_calc_bot2(int index, int mode, int *rad, int *raw_sum,
uint16_t *raw_petal) {
pos_calc_bot(index, mode, rad, raw_sum, raw_petal);
static inline void pos_calc_bot2(int index, int mode, int *rad, int *raw_sum,
uint16_t *raw_petal) {
int32_t tip = raw_petal[petal_pad_tip];
int32_t base = raw_petal[petal_pad_base];
*raw_sum = base + tip;
if (mode > 1) {
base += ((base * 3) >> 2); // tiny gain correction
int rad_calc = tip - base;
rad_calc *= petal_pos_gain[index];
rad_calc /= ((tip + base) >> 2) + 1;
*rad = rad_calc;
} else {
*rad = 0;
}
}
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment