It's BACK!!
This error: R_AVR_7_PCREL keeps popping up its ugly head from time to time in my code. I will make some changes, the error appears; I figure out another way to accomplish the same logic and it goes away.
Is there not a diagnostic capability that points to the root cause of such an error.
Many times it is when I add a Serial.print statement. But just now I added the a block of general code with strcpy, strcat, sprintf, etc. to form c-strings.
I added the following case statement to an existing module: updateLCD()
These variables are declared:
char pLine[50];
char tLine[20], t2Line[20], t3Line[20], t4Line[20];
_alarmRec * ptr;
case 53:
// 12345678901234567890
// { 420 , 0 , 53 , 56 }, // "%s %s %s" P1S+ HNN.NNN LNN.NNN
// { 420 , 1 , 53 , 56 }, // "%s %s %s" T1S+ HNN.NNN LNN.NNN
// { 420 , 2 , 53 , 56 }, // "%s %s %s" P2S+ HNN.NNN LNN.NNN
// { 420 , 3 , 53 , 56 }, // "%s %s %s" T2S+ HNN.NNN LNN.NNN
ptr = &(sensors[menus[i].lineNum].alarm);
if(menus[i].lineNum == P1) sprintf(tLine,"P1");
if(menus[i].lineNum == T1) sprintf(tLine,"T1");
if(menus[i].lineNum == P2) sprintf(tLine,"P2");
if(menus[i].lineNum == T2) sprintf(tLine,"T2");
if(thePars[1] == 0) { // SIREN
if(ptr->enab) {
strcat(tLine,"S+");
if(ptr->hiSiren.enab) strcpy(t2Line,"H"); else strcpy(t2Line,"h");
dtostrf(ptr->hiSiren.lim,6,3,t4Line);
strcat(t2Line,t4Line);
if(ptr->loSiren.enab) strcpy(t3Line,"L"); else strcpy(t3Line,"l");
dtostrf(ptr->loSiren.lim,6,3,t4Line);
strcat(t3Line,t4Line);
} else {
strcat(tLine,"S-");
sprintf(t2Line," DISABLED");
sprintf(t3Line," ");
}
}
if(thePars[1] == 1) { // RED
if(ptr->enab) {
strcat(tLine,"S+");
if(ptr->hiRed.enab) strcpy(t2Line,"H"); else strcpy(t2Line,"h");
dtostrf(ptr->hiRed.lim,6,3,t4Line);
strcat(t2Line,t4Line);
if(ptr->loRed.enab) strcpy(t3Line,"L"); else strcpy(t3Line,"l");
dtostrf(ptr->loRed.lim,6,3,t4Line);
strcat(t3Line,t4Line);
} else {
strcat(tLine,"S-");
sprintf(t2Line," DISABLED");
sprintf(t3Line," ");
}
}
if(thePars[10] == 2) { // YELLOW
if(ptr->enab) {
strcat(tLine,"S+");
if(ptr->hiYellow.enab) strcpy(t2Line,"H"); else strcpy(t2Line,"h");
dtostrf(ptr->hiYellow.lim,6,3,t4Line);
strcat(t2Line,t4Line);
if(ptr->loYellow.enab) strcpy(t3Line,"L"); else strcpy(t3Line,"l");
dtostrf(ptr->loYellow.lim,6,3,t4Line);
strcat(t3Line,t4Line);
} else {
strcat(tLine,"S-");
sprintf(t2Line," DISABLED");
sprintf(t3Line," ");
}
}
if(thePars[1] == 3) { // GREEN
if(ptr->enab) {
strcat(tLine,"S+");
if(ptr->hiGreen.enab) strcpy(t2Line,"H"); else strcpy(t2Line,"h");
dtostrf(ptr->hiGreen.lim,6,3,t4Line);
strcat(t2Line,t4Line);
if(ptr->loGreen.enab) strcpy(t3Line,"L"); else strcpy(t3Line,"l");
dtostrf(ptr->loGreen.lim,6,3,t4Line);
strcat(t3Line,t4Line);
} else {
strcat(tLine,"S-");
sprintf(t2Line," DISABLED");
sprintf(t3Line," ");
}
}
snprintf(pLine, 21, lines[getMenuLine(menus[i].lineRec)].data, tLine,t2Line,t3Line);
break;
Any help in being able to find the root cause of this particular problem as well as an education on how I can research and locate the root cause myself would be GREATLY appreciated!!
Thank you
PH Meter 20200430A.zip (236 KB)