chiark / gitweb /
added M503 to display eeprom storage, and renamed eeprom routings. This version is...
authorBernhard <bkubicek@x201.(none)>
Sun, 4 Dec 2011 21:26:42 +0000 (22:26 +0100)
committerBernhard <bkubicek@x201.(none)>
Sun, 4 Dec 2011 21:26:42 +0000 (22:26 +0100)
Marlin/EEPROMwrite.h
Marlin/Marlin.pde
Marlin/ultralcd.pde

index 1099d08864f919ba3e1a2521017593eb13f1bc47..8680a5fdc85699131a09791362c3254c035b41ce 100644 (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
 }  
 
index 016702ee3636869e6d32960fc7aad686bf85ac27..9985471b72406afd92d2bf27f80907f264b81750 100644 (file)
 // 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;
 
index 65ba86f109788acb5caee7564b6fa0f9f54748a4..88f8f32fb31c36358c6d862a299c2c36fd06d428 100644 (file)
@@ -1402,7 +1402,7 @@ void MainMenu::showControl()
         //enquecommand("M84");\r
         beepshort();\r
         BLOCK;\r
-        StoreSettings();\r
+        EEPROM_StoreSettings();\r
       }\r
     }break;\r
     case ItemC_load:\r
@@ -1416,7 +1416,7 @@ void MainMenu::showControl()
         //enquecommand("M84");\r
         beepshort();\r
         BLOCK;\r
-        RetrieveSettings();\r
+        EEPROM_RetrieveSettings();\r
       }\r
     }break;\r
     case ItemC_failsafe:\r
@@ -1430,7 +1430,7 @@ void MainMenu::showControl()
         //enquecommand("M84");\r
         beepshort();\r
         BLOCK;\r
-        RetrieveSettings(true);\r
+        EEPROM_RetrieveSettings(true);\r
       }\r
     }break;\r
     default:   \r