add default names to PROGMEM, text formating edit
This commit is contained in:
parent
ab2eafe175
commit
19e7838c20
4 changed files with 9 additions and 8 deletions
|
@ -331,6 +331,10 @@ extern float retract_length_swap;
|
||||||
extern float retract_recover_length_swap;
|
extern float retract_recover_length_swap;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
const char smooth1[] PROGMEM = "Smooth1";
|
||||||
|
const char smooth2[] PROGMEM = "Smooth2";
|
||||||
|
const char textured[] PROGMEM = "Textur1";
|
||||||
|
const char *const defaultSheetNames[] PROGMEM = {smooth1,smooth2,textured};
|
||||||
|
|
||||||
extern uint8_t host_keepalive_interval;
|
extern uint8_t host_keepalive_interval;
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
#include <avr/eeprom.h>
|
#include <avr/eeprom.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -63,7 +62,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((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);
|
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)
|
for (uint_least8_t i = 0; i < (sizeof(Sheets::s)/sizeof(Sheets::s[0])); ++i)
|
||||||
{
|
{
|
||||||
bool is_uninitialized = true;
|
bool is_uninitialized = true;
|
||||||
|
@ -73,8 +71,10 @@ void eeprom_init()
|
||||||
}
|
}
|
||||||
if(is_uninitialized)
|
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){
|
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
|
//! @param[out] buffer for formatted output
|
||||||
void menu_format_sheet_select_E(const Sheet &sheet_E, SheetFormatBuffer &buffer)
|
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.10S["), _T(MSG_SHEET));
|
||||||
eeprom_read_block(&(buffer.c[index]), sheet_E.name, 7);
|
eeprom_read_block(&(buffer.c[index]), sheet_E.name, 7);
|
||||||
buffer.c[index + 7] = ']';
|
buffer.c[index + 7] = ']';
|
||||||
buffer.c[index + 8] = '\0';
|
buffer.c[index + 8] = '\0';
|
||||||
|
|
|
@ -304,7 +304,6 @@ bool lcd_oldcardstatus;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t selected_sheet = 0;
|
uint8_t selected_sheet = 0;
|
||||||
char defaultSheetNames[3][8] = {"Smooth1","Smooth2","Textur1"};
|
|
||||||
|
|
||||||
bool ignore_click = false;
|
bool ignore_click = false;
|
||||||
bool wait_for_unclick;
|
bool wait_for_unclick;
|
||||||
|
@ -6596,9 +6595,7 @@ static void lcd_reset_sheet()
|
||||||
eeprom_read_block(menuData->name, EEPROM_Sheets_base->s[selected_sheet].name, sizeof(Sheet::name));
|
eeprom_read_block(menuData->name, EEPROM_Sheets_base->s[selected_sheet].name, sizeof(Sheet::name));
|
||||||
|
|
||||||
menuData->initialized = false;
|
menuData->initialized = false;
|
||||||
for (uint_least8_t i = 0; i < sizeof(Sheet::name); ++i){
|
strcpy_P(menuData->name, (char *)pgm_read_word(&(defaultSheetNames[selected_sheet])));
|
||||||
menuData->name[i] = defaultSheetNames[selected_sheet][i];
|
|
||||||
}
|
|
||||||
|
|
||||||
eeprom_update_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->s[selected_sheet].z_offset)),0xffff);
|
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));
|
eeprom_update_block(menuData->name,EEPROM_Sheets_base->s[selected_sheet].name,sizeof(Sheet::name));
|
||||||
|
|
Loading…
Add table
Reference in a new issue