samavr
Junior Member

Posts: 16
|
Post by samavr on Apr 20, 2022 14:26:41 GMT -8
Hi,
How can I make the touch calibration procedure to start only once in the initial setup and not being shown later on (parameters should be saved somewhere possibly)?
|
|
|
Post by tftlcdcyg on Apr 23, 2022 18:54:05 GMT -8
You must save the vector to an EEPROM plugged into i2C. Once you've installed it, first make sure you erase the eeprom.
By default the gameduino library already has the routine enabled to read the first data of the calibration vector stored in the eeprom. When this data is 0, the calibration routine will start automatically, the vector will be stored in the eeprom.
These lines manage the calibration vector, from GD2.ccp
#if defined(ARDUINO) && !defined(__DUE__) if ((EEPROM.read(0) != 0x7c)) { self_calibrate(); // for (int i = 0; i < 24; i++) Serial.println(GDTR.rd(REG_TOUCH_TRANSFORM_A + i), HEX); for (int i = 0; i < 24; i++) EEPROM.write(1 + i, GDTR.rd(REG_TOUCH_TRANSFORM_A + i)); EEPROM.write(0, 0x7c); // is written! } else { for (int i = 0; i < 24; i++) GDTR.wr(REG_TOUCH_TRANSFORM_A + i, EEPROM.read(1 + i)); }
#endif
|
|