variables to PROGMEM, text formating
This commit is contained in:
parent
b5129ff2ec
commit
b9f622f8a6
4 changed files with 11 additions and 7 deletions
|
@ -314,6 +314,11 @@ extern bool axis_known_position[3];
|
|||
extern int fanSpeed;
|
||||
extern int8_t lcd_change_fil_state;
|
||||
|
||||
const char smooth1[] PROGMEM = "Smooth1";
|
||||
const char smooth2[] PROGMEM = "Smooth2";
|
||||
const char textured[] PROGMEM = "Textur1";
|
||||
const char *const defaultSheetNames[] PROGMEM = {smooth1,smooth2,textured};
|
||||
|
||||
#ifdef TMC2130
|
||||
void homeaxis(int axis, uint8_t cnt = 1, uint8_t* pstep = 0);
|
||||
#else
|
||||
|
|
|
@ -63,7 +63,6 @@ void eeprom_init()
|
|||
if (eeprom_read_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL) == 0xff) eeprom_update_byte((uint8_t *)EEPROM_MMU_LOAD_FAIL, 0);
|
||||
if (eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)) == 0xff) eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), 0);
|
||||
|
||||
char defaultSheetNames[3][8] = {"Smooth1","Smooth2","Textur1"};
|
||||
for (uint_least8_t i = 0; i < (sizeof(Sheets::s)/sizeof(Sheets::s[0])); ++i)
|
||||
{
|
||||
bool is_uninitialized = true;
|
||||
|
@ -73,8 +72,10 @@ void eeprom_init()
|
|||
}
|
||||
if(is_uninitialized)
|
||||
{
|
||||
char sheet_PROGMEM_buffer[8];
|
||||
strcpy_P(sheet_PROGMEM_buffer, (char *)pgm_read_word(&(defaultSheetNames[i])));
|
||||
for (uint_least8_t a = 0; a < sizeof(Sheet::name); ++a){
|
||||
eeprom_write(&(EEPROM_Sheets_base->s[i].name[a]), defaultSheetNames[i][a]);
|
||||
eeprom_write(&(EEPROM_Sheets_base->s[i].name[a]), sheet_PROGMEM_buffer[a]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -202,7 +202,7 @@ void menu_format_sheet_E(const Sheet &sheet_E, SheetFormatBuffer &buffer)
|
|||
//! @param[out] buffer for formatted output
|
||||
void menu_format_sheet_select_E(const Sheet &sheet_E, SheetFormatBuffer &buffer)
|
||||
{
|
||||
uint_least8_t index = sprintf_P(buffer.c,PSTR("%.10S ["), _T(MSG_SHEET));
|
||||
uint_least8_t index = sprintf_P(buffer.c,PSTR("%-9.9S["), _T(MSG_SHEET));
|
||||
eeprom_read_block(&(buffer.c[index]), sheet_E.name, 7);
|
||||
buffer.c[index + 7] = ']';
|
||||
buffer.c[index + 8] = '\0';
|
||||
|
|
|
@ -304,7 +304,6 @@ bool lcd_oldcardstatus;
|
|||
#endif
|
||||
|
||||
uint8_t selected_sheet = 0;
|
||||
char defaultSheetNames[3][8] = {"Smooth1","Smooth2","Textur1"};
|
||||
|
||||
bool ignore_click = false;
|
||||
bool wait_for_unclick;
|
||||
|
@ -6596,9 +6595,8 @@ static void lcd_reset_sheet()
|
|||
eeprom_read_block(menuData->name, EEPROM_Sheets_base->s[selected_sheet].name, sizeof(Sheet::name));
|
||||
|
||||
menuData->initialized = false;
|
||||
for (uint_least8_t i = 0; i < sizeof(Sheet::name); ++i){
|
||||
menuData->name[i] = defaultSheetNames[selected_sheet][i];
|
||||
}
|
||||
strcpy_P(menuData->name, (char *)pgm_read_word(&(defaultSheetNames[selected_sheet])));
|
||||
|
||||
|
||||
eeprom_update_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->s[selected_sheet].z_offset)),0xffff);
|
||||
eeprom_update_block(menuData->name,EEPROM_Sheets_base->s[selected_sheet].name,sizeof(Sheet::name));
|
||||
|
|
Loading…
Reference in a new issue