Fix PROGMEM read in ProgressCode message

This could cause the printer to crash. The Serial Stream would show
a garbled string and the same corruption would appear on the Status
Screen's status line.
This commit is contained in:
Guðni Már Gilbert 2022-04-23 18:12:39 +00:00 committed by D.R.racer
parent d6044387d9
commit 4b71466526
1 changed files with 2 additions and 1 deletions

View File

@ -62,7 +62,8 @@ static const char * const progressTexts[] PROGMEM = {
};
const char * const ProgressCodeToText(uint16_t pc){
return ( pc <= 26 ) ? progressTexts[pc] : progressTexts[0]; // @@TODO ?? a better fallback option?
// @@TODO ?? a better fallback option?
return ( pc <= 26 ) ? static_cast<const char * const>(pgm_read_ptr(&progressTexts[pc])) : static_cast<const char * const>(pgm_read_ptr(&progressTexts[0]));
}
void TranslateProgress(uint16_t pc, char *dst, size_t dstSize) {