tcMenu
Public Member Functions | List of all members
tcextras::IoaTouchScreenCalibrator Class Reference

#include <DrawableTouchCalibrator.h>

Inheritance diagram for tcextras::IoaTouchScreenCalibrator:
CustomDrawing tcextras::TouchCalibrationManager

Public Member Functions

 IoaTouchScreenCalibrator (tcgfx::MenuTouchScreenManager *touchScreen, tcgfx::GraphicsDeviceRenderer *renderer, uint16_t romPos)
 
void initCalibration (IoaCalibrationScreenPrep screenPrepFn, bool presentUiUninitialised)
 
bool loadCalibration () override
 
void saveCalibration () override
 
void reCalibrateNow () override
 
void reset () override
 
void started (BaseMenuRenderer *currentRenderer) override
 
void renderLoop (unsigned int currentValue, RenderPressMode userClick) override
 
void giveItBack ()
 

Detailed Description

This class implements custom drawing so that it can take over the display and render a basic touch screen calibration UI. It depends upon the IoaCalibrationScreenPrep function that is called during screen take over to adjust the display and touch rotation back to the default non-rotated settings for the panel. It is assumed that with this the range of adjustments needed can be determined. It is assumed that during this call there is no difference between touch and display rotation.

Member Function Documentation

◆ initCalibration()

void tcextras::IoaTouchScreenCalibrator::initCalibration ( IoaCalibrationScreenPrep  screenPrepFn,
bool  presentUiUninitialised 
)
inline

During setup you'd normally call this function to initialise the touch calibrator with the previous settings, and also to provide the calibrator with a function that can remove all rotations while calibrating, and put them back after calibration is finished. This is because it is easier to calibrate with no rotation applied.

Parameters
screenPrepFna function to remove and restore rotations, bool param of true - starting calibration
presentUiUninitialisedtrue if the the UI should show when EEPROM load fails.

◆ loadCalibration()

bool IoaTouchScreenCalibrator::loadCalibration ( )
overridevirtual

Loads the calibration data back from EEPROM

Returns
true if loaded, otherwise false

Implements tcextras::TouchCalibrationManager.

◆ saveCalibration()

void IoaTouchScreenCalibrator::saveCalibration ( )
overridevirtual

Saves the calibration data to EEPROM

Implements tcextras::TouchCalibrationManager.

◆ reCalibrateNow()

void IoaTouchScreenCalibrator::reCalibrateNow ( )
overridevirtual

Forces recalibration immediately.

Implements tcextras::TouchCalibrationManager.

◆ reset()

void tcextras::IoaTouchScreenCalibrator::reset ( )
inlineoverridevirtual

Called when the menu has become inactive, IE after the idle time out has triggered.

Implements CustomDrawing.

◆ started()

void IoaTouchScreenCalibrator::started ( BaseMenuRenderer currentRenderer)
overridevirtual

Called when the display is taken over before any calls to renderLoop. You can set up anything you need here.

Parameters
currentRendererthe renderer object that sent this event.

Implements CustomDrawing.

◆ renderLoop()

void IoaTouchScreenCalibrator::renderLoop ( unsigned int  currentValue,
RenderPressMode  userClick 
)
overridevirtual

After takeOverDisplay is called, you'll first get the started event, then this loop will be called repeatedly, you should check if anything needs painting, and redraw display sections if need be.

Parameters
currentValuethe current value of the encoder, or simulated encoder.
userClickthe selection state, eg of the select button.

Implements CustomDrawing.


The documentation for this class was generated from the following files: