Hi,
Does the touch framework have a self-calibration that changes his reference each time the circuit is powered?
I have a 4 channel wheel in my board and I am trying to define "buttons" up, right, down and left.
The code looks likes:
wheel_offset = 15;
case SF_TOUCH_CTSU_SLIDER_STATE_TOUCHED:
if((p_args->current_position >= (347 - wheel_offset)) && (p_args->current_position <= (347 + wheel_offset))) {
kbd_pressed_button = KEY_UP;
}
else if((p_args->current_position >= (65 - wheel_offset)) && (p_args->current_position <= (65 + wheel_offset))) {
kbd_pressed_button = KEY_RIGHT;
}
else if((p_args->current_position >= (130 - wheel_offset)) && (p_args->current_position <= (130 + wheel_offset))) {
kbd_pressed_button = KEY_DOWN;
}
else if((p_args->current_position >= (245 - wheel_offset)) && (p_args->current_position <= (245 + wheel_offset))) {
kbd_pressed_button = KEY_LEFT;
}
ui_event.id = UI_EVENT_BUTTON_PRESSED;
ui_event.args = NULL;
tx_queue_send(&ui_queue, &ui_event, TX_WAIT_FOREVER);
break;
The problem is that the value of current_position changes a little each time I run the program.
The "down button" area, for instance, now is returning p_args->current_position around 130. If I shut down the board and re-start it, that bottom area of the wheel may start returning a value around 160.
Is there a way to minimize this effect?