Get rid of sprintf.

This commit is contained in:
Chris Giacofei 2022-01-20 14:13:49 -05:00
parent 3a1d2ad3ad
commit e12f3e262f

View File

@ -50,21 +50,29 @@ unsigned long lastRun = 0;
// On/Off state of the kettle.
char* ShowKettleState() {
if (KettleMode == MANUAL) {
return (char*)"Kettle: Manual";
return (char*)F("Kettle: Manual");
} else if (KettleMode == AUTOMATIC) {
return (char*)"Kettle: Auto";
return (char*)F("Kettle: Auto");
} else {
return (char*)"Kettle: Off";
return (char*)F("Kettle: Off");
}
}
char* ShowKettleSetting() {
static char LCD_Line[20];
static char LCD_Line[21];
char setting[4];
if (KettleMode == MANUAL) {
sprintf(LCD_Line, "Kettle Power: %03d%", KettleDuty / 10);
strcpy(LCD_Line, (char*)F("Kettle Power: "));
itoa(KettleDuty / 10, setting, 10);
strcat(LCD_Line, setting);
strcat(LCD_Line, "%");
return LCD_Line;
} else if (KettleMode == AUTOMATIC) {
sprintf(LCD_Line, "Kettle Temp: %03dF", KettleSetpoint / 10);
strcpy(LCD_Line, (char*)F("Kettle Temp: "));
itoa(KettleSetpoint / 10, setting, 10);
strcat(LCD_Line, setting);
strcat(LCD_Line, "F");
return LCD_Line;
} else {
return (char*)"";