added M503 to display eeprom storage, and renamed eeprom routings. This version is compatible with the qtmarlin eeprom-tab.

This commit is contained in:
Bernhard 2011-12-04 22:26:42 +01:00
parent 7714b98da7
commit cf50ba140f
3 changed files with 73 additions and 58 deletions

View File

@ -39,7 +39,7 @@ template <class T> int EEPROM_readAnything(int &ee, T& value)
// ALSO: always make sure the variables in the Store and retrieve sections are in the same order.
#define EEPROM_VERSION "V04"
FORCE_INLINE void StoreSettings()
inline void EEPROM_StoreSettings()
{
#ifdef EEPROM_SETTINGS
char ver[4]= "000";
@ -72,7 +72,64 @@ FORCE_INLINE void StoreSettings()
#endif //EEPROM_SETTINGS
}
FORCE_INLINE void RetrieveSettings(bool def=false)
inline void EEPROM_printSettings()
{ // if def=true, the default values will be used
#ifdef EEPROM_SETTINGS
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Steps per unit:");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M92 X",axis_steps_per_unit[0]);
SERIAL_ECHOPAIR(" Y",axis_steps_per_unit[1]);
SERIAL_ECHOPAIR(" Z",axis_steps_per_unit[2]);
SERIAL_ECHOPAIR(" E",axis_steps_per_unit[3]);
SERIAL_ECHOLN("");
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Maximum feedrates (mm/s):");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M203 X",max_feedrate[0]);
SERIAL_ECHOPAIR(" Y",max_feedrate[1] );
SERIAL_ECHOPAIR(" Z", max_feedrate[2] );
SERIAL_ECHOPAIR(" E", max_feedrate[3]);
SERIAL_ECHOLN("");
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Maximum Acceleration (mm/s2):");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M201 X" ,max_acceleration_units_per_sq_second[0] );
SERIAL_ECHOPAIR(" Y" , max_acceleration_units_per_sq_second[1] );
SERIAL_ECHOPAIR(" Z" ,max_acceleration_units_per_sq_second[2] );
SERIAL_ECHOPAIR(" E" ,max_acceleration_units_per_sq_second[3]);
SERIAL_ECHOLN("");
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Acceleration: S=acceleration, T=retract acceleration");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M204 S",acceleration );
SERIAL_ECHOPAIR(" T" ,retract_acceleration);
SERIAL_ECHOLN("");
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Advanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (ms), X=maximum xY jerk (mm/s), Z=maximum Z jerk (mm/s)");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M205 S",minimumfeedrate );
SERIAL_ECHOPAIR(" T" ,mintravelfeedrate );
SERIAL_ECHOPAIR(" B" ,minsegmenttime );
SERIAL_ECHOPAIR(" X" ,max_xy_jerk );
SERIAL_ECHOPAIR(" Z" ,max_z_jerk);
SERIAL_ECHOLN("");
#ifdef PIDTEMP
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("PID settings:");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M301 P",Kp);
SERIAL_ECHOPAIR(" I" ,Ki/PID_dT);
SERIAL_ECHOPAIR(" D" ,Kd*PID_dT);
SERIAL_ECHOLN("");
#endif
#endif
}
inline void EEPROM_RetrieveSettings(bool def=false)
{ // if def=true, the default values will be used
#ifdef EEPROM_SETTINGS
int i=EEPROM_OFFSET;
@ -125,55 +182,7 @@ FORCE_INLINE void RetrieveSettings(bool def=false)
SERIAL_ECHOLN("Using Default settings:");
}
#ifdef EEPROM_CHITCHAT
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Steps per unit:");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M92 X",axis_steps_per_unit[0]);
SERIAL_ECHOPAIR(" Y",axis_steps_per_unit[1]);
SERIAL_ECHOPAIR(" Z",axis_steps_per_unit[2]);
SERIAL_ECHOPAIR(" E",axis_steps_per_unit[3]);
SERIAL_ECHOLN("");
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Maximum feedrates (mm/s):");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M203 X",max_feedrate[0]);
SERIAL_ECHOPAIR(" Y",max_feedrate[1] );
SERIAL_ECHOPAIR(" Z", max_feedrate[2] );
SERIAL_ECHOPAIR(" E", max_feedrate[3]);
SERIAL_ECHOLN("");
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Maximum Acceleration (mm/s2):");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M201 X" ,max_acceleration_units_per_sq_second[0] );
SERIAL_ECHOPAIR(" Y" , max_acceleration_units_per_sq_second[1] );
SERIAL_ECHOPAIR(" Z" ,max_acceleration_units_per_sq_second[2] );
SERIAL_ECHOPAIR(" E" ,max_acceleration_units_per_sq_second[3]);
SERIAL_ECHOLN("");
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Acceleration: S=acceleration, T=retract acceleration");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M204 S",acceleration );
SERIAL_ECHOPAIR(" T" ,retract_acceleration);
SERIAL_ECHOLN("");
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Advanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (ms), X=maximum xY jerk (mm/s), Z=maximum Z jerk (mm/s)");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M205 S",minimumfeedrate );
SERIAL_ECHOPAIR(" T" ,mintravelfeedrate );
SERIAL_ECHOPAIR(" B" ,minsegmenttime );
SERIAL_ECHOPAIR(" X" ,max_xy_jerk );
SERIAL_ECHOPAIR(" Z" ,max_z_jerk);
SERIAL_ECHOLN("");
#ifdef PIDTEMP
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("PID settings:");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M301 P",Kp);
SERIAL_ECHOPAIR(" I" ,Ki/PID_dT);
SERIAL_ECHOPAIR(" D" ,Kd*PID_dT);
SERIAL_ECHOLN("");
#endif
EEPROM_printSettings();
#endif
}

View File

@ -112,6 +112,7 @@
// M500 - stores paramters in EEPROM
// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
// M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to.
// M503 - print the current settings (from memory not from eeprom)
//Stepper Movement Variables
@ -236,7 +237,7 @@ void setup()
fromsd[i] = false;
}
RetrieveSettings(); // loads data from EEPROM if available
EEPROM_RetrieveSettings(); // loads data from EEPROM if available
for(int8_t i=0; i < NUM_AXIS; i++)
{
@ -1034,17 +1035,22 @@ FORCE_INLINE void process_commands()
break;
case 500: // Store settings in EEPROM
{
StoreSettings();
EEPROM_StoreSettings();
}
break;
case 501: // Read settings from EEPROM
{
RetrieveSettings();
EEPROM_RetrieveSettings();
}
break;
case 502: // Revert to default settings
{
RetrieveSettings(true);
EEPROM_RetrieveSettings(true);
}
break;
case 503: // print settings currently in memory
{
EEPROM_printSettings();
}
break;

View File

@ -1402,7 +1402,7 @@ void MainMenu::showControl()
//enquecommand("M84");
beepshort();
BLOCK;
StoreSettings();
EEPROM_StoreSettings();
}
}break;
case ItemC_load:
@ -1416,7 +1416,7 @@ void MainMenu::showControl()
//enquecommand("M84");
beepshort();
BLOCK;
RetrieveSettings();
EEPROM_RetrieveSettings();
}
}break;
case ItemC_failsafe:
@ -1430,7 +1430,7 @@ void MainMenu::showControl()
//enquecommand("M84");
beepshort();
BLOCK;
RetrieveSettings(true);
EEPROM_RetrieveSettings(true);
}
}break;
default: