touchpad calibration storage update

ugfx_release_2.6
Joel Bodenmann 2012-10-23 06:19:18 +02:00
parent 9379d17303
commit 0685eb445a
1 changed files with 1 additions and 7 deletions

View File

@ -50,10 +50,6 @@ extern struct cal_t *lld_tpReadCalibration(void);
/*===========================================================================*/ /*===========================================================================*/
static struct cal_t *cal; static struct cal_t *cal;
#if TOUCHPAD_STORE_CALIBRATION
static bool_t calibration_failed = FALSE;
#endif
/*===========================================================================*/ /*===========================================================================*/
/* Driver local functions. */ /* Driver local functions. */
/*===========================================================================*/ /*===========================================================================*/
@ -150,7 +146,6 @@ void tpInit(const TOUCHPADDriver *tp) {
cal = lld_tpReadCalibration(); cal = lld_tpReadCalibration();
if(cal == NULL) { if(cal == NULL) {
cal = (struct cal_t*)chHeapAlloc(NULL, sizeof(struct cal_t)); cal = (struct cal_t*)chHeapAlloc(NULL, sizeof(struct cal_t));
calibration_failed = TRUE;
tpCalibrate(); tpCalibrate();
} }
#endif #endif
@ -248,8 +243,7 @@ void tpCalibrate(void) {
cal->yn = (float)cross[0][1] - cal->ym * (float)points[0][1]; cal->yn = (float)cross[0][1] - cal->ym * (float)points[0][1];
#if TOUCHPAD_STORE_CALIBRATION #if TOUCHPAD_STORE_CALIBRATION
if(!calibration_failed) lld_tpWriteCalibration(cal);
lld_tpWriteCalibration(cal);
#endif #endif
} }