Matthew's Portfolio
touchPanelCalibration_main.py File Reference

Calibration program for the touch panel driver. More...

Variables

 touchPanelCalibration_main.tchPanelDriver
 Create an instance of the touch panel driver. More...
 
 touchPanelCalibration_main.myVCP = USB_VCP()
 Virtual Comms Port object. More...
 
list touchPanelCalibration_main.results = [0]*4
 Initialize a list for final results. More...
 
int touchPanelCalibration_main.numTests = 5
 Number of calibration trials. More...
 
int touchPanelCalibration_main.success = 0
 Counter for how many trials have been accepted by the user.
 
list touchPanelCalibration_main.calValues = [[0]*4 for i in range(numTests)]
 List of lists containing calibration data. More...
 

Detailed Description

Calibration program for the touch panel driver.

This main program utilizes the calibration method of the touchPanelDriver.py class file. Since calibration does not need to be completed every time the controller is tested, it made sense to create a seperate file for this process. The goal of this program is to have a robust method for determining a best fit line for converting ADC readings to actual position (in mm) on the board.

See source code here: Touch Panel Calibration Source Code

Author
Matthew Frost
Ryan McLaughlin
Date
Originally created on 05/29/21
Last modified on 05/30/21

Variable Documentation

◆ calValues

list touchPanelCalibration_main.calValues = [[0]*4 for i in range(numTests)]

List of lists containing calibration data.

After each calibration run, the user is instructed to accept or decline to add the run to the collection of data to be averaged for final calibration data. Each list has four elements, and the lists are contained in a parent list for looping through later on

◆ myVCP

touchPanelCalibration_main.myVCP = USB_VCP()

Virtual Comms Port object.

A VCP object is used to allow for user input during program operation. In most cases, non blocking code is neccesary, however for calibration timing is not essential, but rather it is desired to stop program operation until the user accepts a calibration run as accurate or an outlier. by using while not myVCP.any():, the program stops until myVCP.any() returns True (the user presses a keyboard key).

◆ numTests

int touchPanelCalibration_main.numTests = 5

Number of calibration trials.

The user can change this value to run more or less calibration trials to average from

◆ results

list touchPanelCalibration_main.results = [0]*4

Initialize a list for final results.

The final results include the following values: [ mx, xc, my, yc ] where mx and my represent slopes of best fit lines, and xc, xy represent intercepts. These can be directly used by the touch panel driver class.

◆ tchPanelDriver

touchPanelCalibration_main.tchPanelDriver
Initial value:
1= touchPanelDriver(debugFlag = True, xm = Pin.cpu.A1, xp = Pin.cpu.A7,
2 ym = Pin.cpu.A0, yp = Pin.cpu.A6, boardLength = 176,
3 boardWidth = 107, centerXPos = 88, centerYPos = 53)
Definition: touchPanelDriver.py:1

Create an instance of the touch panel driver.

This object needs the pin values for the xm, xp, ym, and yp ports on the resistive touch panel. These must be passed in as such Pin.cpu.##. Also, the length of the board, width of the board, and the coordinates of the center location must be passed in. For the purposes of calibration, these values will not be used, but are neccesary to the definition of an object of this class