Ok so ive finally got the screen displaying etc and ive made a “calibrate” function in ui_events.c. i need to pass the pitch value to the ui.ino pitch value to change it.
This is the calibrate function
void calibrate(lv_event_t * e)
{
// Retrieve the values from ui_FirstPos and ui_SecPos text areas
const char* firstPosText = lv_textarea_get_text(ui_FirstPos);
const char* secPosText = lv_textarea_get_text(ui_SecPos);
// Convert the text values to integers
int firstPos = atoi(firstPosText);
int secPos = atoi(secPosText);
// Calculate the difference in positions
int posDifference = secPos - firstPos;
// Calculate the pitch adjustment factor
// Assuming a desired range of motion in millimeters
float desiredRange = 100.0; // Adjust this value according to your requirements
float calculatedPitch = desiredRange / posDifference;
// Adjust the pitch or encoder settings based on the calculated value
// For example:
pitch = calculatedPitch; // Update the pitch value
}
im sure it something simple but i have been hitting a brick wall ATM