eeprom version for multimaterial changed, show message that hardcoded default settings were loaded during printer setup, improved scrolling in sd card menu

This commit is contained in:
PavelSindler 2017-07-19 16:59:53 +02:00
parent 2ace5fc827
commit 625b8acc8e
7 changed files with 43 additions and 21 deletions

View File

@ -43,7 +43,13 @@ void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size)
// wrong data being written to the variables.
// ALSO: always make sure the variables in the Store and retrieve sections are in the same order.
#define EEPROM_VERSION "V1"
#ifdef SNMM
#define EEPROM_VERSION "V1M"
#else
#define EEPROM_VERSION "V1"
#endif
#ifdef EEPROM_SETTINGS
void Config_StoreSettings()
@ -264,12 +270,15 @@ void Config_PrintSettings()
#ifdef EEPROM_SETTINGS
void Config_RetrieveSettings()
bool Config_RetrieveSettings()
{
int i=EEPROM_OFFSET;
bool settings_from_eeprom;
char stored_ver[4];
char ver[4]=EEPROM_VERSION;
EEPROM_READ_VAR(i,stored_ver); //read stored version
SERIAL_ECHOLNPGM("Stored EEPROM version:");
MYSERIAL.println(stored_ver);
// SERIAL_ECHOLN("Version: [" << ver << "] Stored version: [" << stored_ver << "]");
if (strncmp(ver,stored_ver,3) == 0)
{
@ -350,19 +359,20 @@ void Config_RetrieveSettings()
calculate_volumetric_multipliers();
// Call updatePID (similar to when we have processed M301)
updatePID();
float tmp1[] = DEFAULT_AXIS_STEPS_PER_UNIT;
axis_steps_per_unit[3] = tmp1[3];
SERIAL_ECHO_START;
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Stored settings retrieved");
settings_from_eeprom = true;
}
else
{
Config_ResetDefault();
settings_from_eeprom = false;
}
#ifdef EEPROM_CHITCHAT
Config_PrintSettings();
#endif
return settings_from_eeprom;
}
#endif

View File

@ -14,7 +14,7 @@ FORCE_INLINE void Config_PrintSettings() {}
#ifdef EEPROM_SETTINGS
void Config_StoreSettings();
void Config_RetrieveSettings();
bool Config_RetrieveSettings();
#else
FORCE_INLINE void Config_StoreSettings() {}
FORCE_INLINE void Config_RetrieveSettings() { Config_ResetDefault(); Config_PrintSettings(); }

View File

@ -1045,7 +1045,7 @@ void setup()
SERIAL_ECHOLN((int)sizeof(block_t)*BLOCK_BUFFER_SIZE);
lcd_update_enable(false);
// loads data from EEPROM if available else uses defaults (and resets step acceleration rate)
Config_RetrieveSettings();
settings_from_eeprom = Config_RetrieveSettings();
SdFatUtil::set_stack_guard(); //writes magic number at the end of static variables to protect against overwriting static memory by stack
tp_init(); // Initialize temperature loop
plan_init(); // Initialize planner;
@ -1211,6 +1211,9 @@ void setup()
for (int i = 0; i<4; i++) EEPROM_read_B(EEPROM_BOWDEN_LENGTH + i * 2, &bowden_length[i]);
lcd_update_enable(true);
//If eeprom version for storing parameters to eeprom using M500 changed, default settings are used. Inform user in this case.
if(!setting_from_eeprom) lcd_show_fullscreen_message_and_wait_P(MSG_DEFAULT_SETTINGS_LOADED);
// Store the currently running firmware into an eeprom,
// so the next time the firmware gets updated, it will know from which version it has been updated.
update_current_firmware_version_to_eeprom();
@ -4952,7 +4955,7 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
#endif
case 500: // M500 Store settings in EEPROM

View File

@ -775,6 +775,11 @@ const char * const MSG_DATE_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_DATE_DE
};
const char MSG_DEFAULT_SETTINGS_LOADED_EN[] PROGMEM = "Hardcoded default settings loaded";
const char * const MSG_DEFAULT_SETTINGS_LOADED_LANG_TABLE[1] PROGMEM = {
MSG_DEFAULT_SETTINGS_LOADED_EN
};
const char MSG_DISABLE_STEPPERS_EN[] PROGMEM = "Disable steppers";
const char MSG_DISABLE_STEPPERS_CZ[] PROGMEM = "Vypnout motory";
const char MSG_DISABLE_STEPPERS_IT[] PROGMEM = "Disabilit motori";

View File

@ -150,6 +150,8 @@ extern const char* const MSG_CURRENT_LANG_TABLE[LANG_NUM];
#define MSG_CURRENT LANG_TABLE_SELECT(MSG_CURRENT_LANG_TABLE)
extern const char* const MSG_DATE_LANG_TABLE[LANG_NUM];
#define MSG_DATE LANG_TABLE_SELECT(MSG_DATE_LANG_TABLE)
extern const char* const MSG_DEFAULT_SETTINGS_LOADED_LANG_TABLE[1];
#define MSG_DEFAULT_SETTINGS_LOADED LANG_TABLE_SELECT_EXPLICIT(MSG_DEFAULT_SETTINGS_LOADED_LANG_TABLE, 0)
extern const char* const MSG_DISABLE_STEPPERS_LANG_TABLE[LANG_NUM];
#define MSG_DISABLE_STEPPERS LANG_TABLE_SELECT(MSG_DISABLE_STEPPERS_LANG_TABLE)
extern const char* const MSG_DWELL_LANG_TABLE[LANG_NUM];

View File

@ -310,4 +310,5 @@
#define(length=12, lines=1) MSG_RIGHT "Right:"
#define(length=15, lines=1) MSG_MEASURED_SKEW "Measured skew:"
#define(length=15, lines=1) MSG_SLIGHT_SKEW "Slight skew:"
#define(length=15, lines=1) MSG_SEVERE_SKEW "Severe skew:"
#define(length=15, lines=1) MSG_SEVERE_SKEW "Severe skew:"
#define(length=20, lines=4) MSG_DEFAULT_SETTINGS_LOADED "Hardcoded default settings loaded"

View File

@ -1182,33 +1182,34 @@ static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char*
int i = 1;
int j = 0;
int inter = 0;
char* longFilenameTMP = longFilename;
while( ((c = *longFilenameTMP) != '\0') && (inter == 0) )
while((c = *longFilenameTMP) != '\0')
{
lcd.setCursor(i, row);
lcd.print(c);
i++;
longFilenameTMP++;
if(i==LCD_WIDTH){
if(i==LCD_WIDTH) {
i=1;
j++;
longFilenameTMP = longFilename;
longFilenameTMP = longFilenameTMP+j;
longFilenameTMP = longFilename + j;
n = LCD_WIDTH - 1;
for(int g = 0; ((g<300)&&(inter == 0)) ;g++){
for(int g = 0; g<300 ;g++){
if(LCD_CLICKED || ( enc_dif != encoderDiff )){
// inter = 1;
longFilenameTMP = longFilename;
*(longFilenameTMP + LCD_WIDTH - 2) = '\0';
int i = 1;
int j = 0;
break;
}else{
delay(1);
if (j == 1) delay(3); //wait around 1.2 s to start scrolling text
delay(1); //then scroll with redrawing every 300 ms
}
}
}
}
if(c!='\0'){
lcd.setCursor(i, row);
@ -1217,7 +1218,7 @@ static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char*
}
n=n-i+1;
while(n--)
lcd.print(' ');
lcd.print(' ');
}
static void lcd_implementation_drawmenu_sdfile(uint8_t row, const char* pstr, const char* filename, char* longFilename)
{