¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

7 inch Screen Calibration -- Opps, pressed wrong button


 



On Saturday, March 16, 2019, 10:06:31 PM EDT, Jack Purdum <jjpurdum@...> wrote:


The problem is that the code goes out and checks the first byte of EEPROM (EEPROMNew.cpp):

void ReadUserSettings()
{
? int val;
? EEPROM.get(0, val);????? // Read first byte of EEPROM memory
//val = 0;???????????????? // Uncomment this line forces a rewrite of EEPROM. Comment out line 23 to display
?????????????????????????? // is not changed.
Serial.print("Val = ");
Serial.println(val);?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?
? if (val != EEPROMINITVALUE) {???????????????????????????? // Already set or not?
??? GlobalDefaultEEPROMValues();??????????????????????????? // No, so set some common values
??? WriteEEPROMSettings(EEPROMDEFAULTOFFSET);?????????????? // Write default values to default block
??? WriteEEPROMSettings(EEPROMUSEROFFSET);????????????????? // Also assume defaults for user first time through



If that first byte (e.g., EEPROM address 0) read into val is not equal to EEPROMINITVALUE, the program automatically goes into the initialization routines. Raw EEPROM on a new Teensy is initialized to 0xFF, which is not what EEPROMINITVALUE. This will cause the code to write default values into EEPROM. No doubt, that's what happened to your system.

Exactly what is the problem after you init the screen? Is it that the buttons don't respond to presses at all, or that the presses are way off target? I did find some early tests we did with the 7" display (it died!) and the values we were using were:


#ifdef AL7
// ------------------------? Al's 7" Calibration ------------? 8-14-18
? calty = map(yFinal, 838, 174, 50, 430);?????? // Al

? range = map(int(calty), 0, 479, 1, 4);
? switch (range) {
??? case 1:
????? caltx = map(xFinal, 684, 321, 50, 750); // Map from ADC values to Screen??? // Al
????? break;
??? case 2:
????? caltx = map(xFinal, 684, 321, 50, 750); // Map from ADC values to Screen??? // Al
????? break;
??? case 3:
????? caltx = map(xFinal, 684, 321, 50, 750); // Map from ADC values to Screen??? // Al
????? break;
??? case 4:
????? caltx = map(xFinal, 684, 321, 50, 750); // Map from ADC values to Screen??? // Al
????? break;
? }
#endif



which is near line 158 in the DisplayCalibration.cpp file. You'll notice this code was only toggled in when we were testing Al's 7" display (e.g., #define AL7) much like I explained with the DEBUG symbolic constant. I don't know if this will help, as we don't have a working 7" display right now. It might be a starting point...


Jack, W8TEE


On Saturday, March 16, 2019, 11:37:36 AM EDT, Vince Loschiavo <vince320@...> wrote:


Jack,
maybe I didn't ask the correct question.
I missed the initial cal routine at first powerup...probably because i didn't have the display installed?? anyway.
to get to run the cal routine, i should
set VAL = 0? ??
then what is the next step??
Vince
n2aie