Procházet zdrojové kódy

Fix LCD=graphic build errors with error message strings

The PSTR() macro cannot be used in global struct initializers when
compiling with -DLCD_GRAPHIC. This caused "braced-group within
expression allowed only inside a function" errors.

Solution: Define error message strings as separate __flash const char
arrays and reference them in the error_list[] initializer.

This approach works for both LCD=graphic and LCD=alnum builds while
maintaining the same flash memory storage.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
k4be před 4 týdny
rodič
revize
706fbd7c57
1 změnil soubory, kde provedl 17 přidání a 8 odebrání
  1. 17 8
      soft/display.c

+ 17 - 8
soft/display.c

@@ -314,18 +314,27 @@ static struct {
 	unsigned char count;
 } error_browser;
 
+__flash const char _error_temp[] = "Czujnik temp.";
+__flash const char _error_i2c[] = "I2C";
+__flash const char _error_i2c_timeout[] = "I2C timeout";
+__flash const char _error_disk[] = "Blad karty";
+__flash const char _error_file_write[] = "Blad zapisu";
+__flash const char _error_file_sync[] = "Blad zapisu FAT";
+__flash const char _error_file_close[] = "Blad zamk.pliku";
+__flash const char _error_file_open[] = "Blad otw. pliku";
+
 static __flash const struct {
 	unsigned int flag;
 	__flash const char *name;
 } error_list[] = {
-	{ERROR_TEMPERATURE, PSTR("Czujnik temp.")},
-	{ERROR_I2C, PSTR("I2C")},
-	{ERROR_I2C_TIMEOUT, PSTR("I2C timeout")},
-	{ERROR_DISK, PSTR("Blad karty")},
-	{ERROR_FILE_WRITE, PSTR("Blad zapisu")},
-	{ERROR_FILE_SYNC, PSTR("Blad zapisu FAT")},
-	{ERROR_FILE_CLOSE, PSTR("Blad zamk.pliku")},
-	{ERROR_FILE_OPEN, PSTR("Blad otw. pliku")},
+	{ERROR_TEMPERATURE, _error_temp},
+	{ERROR_I2C, _error_i2c},
+	{ERROR_I2C_TIMEOUT, _error_i2c_timeout},
+	{ERROR_DISK, _error_disk},
+	{ERROR_FILE_WRITE, _error_file_write},
+	{ERROR_FILE_SYNC, _error_file_sync},
+	{ERROR_FILE_CLOSE, _error_file_close},
+	{ERROR_FILE_OPEN, _error_file_open},
 };
 
 void disp_func_global_error(void) {