Browse Source

Rename as M100

Richard Wackerbarth 9 years ago
parent
commit
ae00fad75b
3 changed files with 33 additions and 32 deletions
  1. 2
    2
      Marlin/Configuration.h
  2. 25
    25
      Marlin/M100_Free_Mem_Chk.cpp
  3. 6
    5
      Marlin/Marlin_main.cpp

+ 2
- 2
Marlin/Configuration.h View File

@@ -613,9 +613,9 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
613 613
 #endif
614 614
 
615 615
 //
616
-// M99 Free Memory Watcher
616
+// M100 Free Memory Watcher
617 617
 //
618
-#define M99_FREE_MEMORY_WATCHER // uncomment to add the M99 Free Memory Watcher for debug purpose
618
+//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose
619 619
 
620 620
 // @section temperature
621 621
 

Marlin/M99_Free_Mem_Chk.cpp → Marlin/M100_Free_Mem_Chk.cpp View File

@@ -1,20 +1,20 @@
1
-#define M99_FREE_MEMORY_DUMPER			// Comment out to remove Dump sub-command
2
-#define M99_FREE_MEMORY_CORRUPTOR		// Comment out to remove Corrupt sub-command
1
+#define M100_FREE_MEMORY_DUMPER			// Comment out to remove Dump sub-command
2
+#define M100_FREE_MEMORY_CORRUPTOR		// Comment out to remove Corrupt sub-command
3 3
 
4 4
 
5
-// M99 Free Memory Watcher
5
+// M100 Free Memory Watcher
6 6
 //
7 7
 // This code watches the free memory block between the bottom of the heap and the top of the stack.
8
-// This memory block is initialized and watched via the M99 command.
8
+// This memory block is initialized and watched via the M100 command.
9 9
 //
10
-// M99 I	Initializes the free memory block and prints vitals statistics about the area
11
-// M99 F	Identifies how much of the free memory block remains free and unused.  It also
10
+// M100 I	Initializes the free memory block and prints vitals statistics about the area
11
+// M100 F	Identifies how much of the free memory block remains free and unused.  It also
12 12
 // 		detects and reports any corruption within the free memory block that may have
13 13
 // 		happened due to errant firmware.
14
-// M99 D	Does a hex display of the free memory block along with a flag for any errant
14
+// M100 D	Does a hex display of the free memory block along with a flag for any errant
15 15
 // 		data that does not match the expected value.
16
-// M99 C x	Corrupts x locations within the free memory block.   This is useful to check the
17
-// 		correctness of the M99 F and M99 D commands.
16
+// M100 C x	Corrupts x locations within the free memory block.   This is useful to check the
17
+// 		correctness of the M100 F and M100 D commands.
18 18
 //
19 19
 // Initial version by Roxy-3DPrintBoard
20 20
 //
@@ -23,7 +23,7 @@
23 23
 
24 24
 #include "Marlin.h"
25 25
 
26
-#ifdef M99_FREE_MEMORY_WATCHER
26
+#ifdef M100_FREE_MEMORY_WATCHER
27 27
 extern void *__brkval;
28 28
 extern size_t  __heap_start, __heap_end, __flp;
29 29
 
@@ -45,7 +45,7 @@ void serial_echopair_P(const char *, long );
45 45
 
46 46
 
47 47
 //
48
-// Utility functions used by M99 to get its work done.
48
+// Utility functions used by M100 to get its work done.
49 49
 //
50 50
 
51 51
 unsigned char *top_of_stack();
@@ -57,14 +57,14 @@ int how_many_E5s_are_here( unsigned char *);
57 57
 
58 58
 
59 59
 
60
-void m99_code()
60
+void gcode_M100()
61 61
 {
62
-static int m99_not_initialized=1;
62
+static int m100_not_initialized=1;
63 63
 unsigned char *sp, *ptr;
64 64
 int i, j, n;
65 65
 
66 66
 //
67
-// M99 D dumps the free memory block from __brkval to the stack pointer.
67
+// M100 D dumps the free memory block from __brkval to the stack pointer.
68 68
 // malloc() eats memory from the start of the block and the stack grows
69 69
 // up from the bottom of the block.    Solid 0xE5's indicate nothing has
70 70
 // used that memory yet.   There should not be anything but 0xE5's within
@@ -73,7 +73,7 @@ int i, j, n;
73 73
 // the right hand column to help spotting them.
74 74
 //
75 75
 
76
-#ifdef M99_FREE_MEMORY_DUMPER			// Comment out to remove Dump sub-command
76
+#ifdef M100_FREE_MEMORY_DUMPER			// Comment out to remove Dump sub-command
77 77
 	if ( code_seen('D') ) {
78 78
  		ptr = (unsigned char *) __brkval;
79 79
 
@@ -123,7 +123,7 @@ int i, j, n;
123 123
 #endif
124 124
 
125 125
 //
126
-// M99 F   requests the code to return the number of free bytes in the memory pool along with
126
+// M100 F   requests the code to return the number of free bytes in the memory pool along with
127 127
 // other vital statistics that define the memory pool.
128 128
 //
129 129
 	if ( code_seen('F') ) {
@@ -160,10 +160,10 @@ int i, j, n;
160 160
 		return;
161 161
 	}
162 162
 //
163
-// M99 C x  Corrupts x locations in the free memory pool and reports the locations of the corruption.
164
-// This is useful to check the correctness of the M99 D and the M99 F commands.
163
+// M100 C x  Corrupts x locations in the free memory pool and reports the locations of the corruption.
164
+// This is useful to check the correctness of the M100 D and the M100 F commands.
165 165
 //
166
-#ifdef M99_FREE_MEMORY_CORRUPTOR
166
+#ifdef M100_FREE_MEMORY_CORRUPTOR
167 167
 	if ( code_seen('C') ) {
168 168
 		int x;			// x gets the # of locations to corrupt within the memory pool
169 169
 		x = code_value();
@@ -190,12 +190,12 @@ int i, j, n;
190 190
 #endif
191 191
 
192 192
 //
193
-// M99 I    Initializes the free memory pool so it can be watched and prints vital
193
+// M100 I    Initializes the free memory pool so it can be watched and prints vital
194 194
 // statistics that define the free memory pool.
195 195
 //
196
-	if (m99_not_initialized || code_seen('I') ) {				// If no sub-command is specified, the first time
196
+	if (m100_not_initialized || code_seen('I') ) {				// If no sub-command is specified, the first time
197 197
   		SERIAL_ECHOLNPGM("Initializing free memory block.\n");   	// this happens, it will Initialize.
198
-  		ptr = (unsigned char *) __brkval;				// Repeated M99 with no sub-command will not destroy the
198
+  		ptr = (unsigned char *) __brkval;				// Repeated M100 with no sub-command will not destroy the
199 199
   		SERIAL_ECHOPAIR("\n__brkval : ",(long) ptr );			// state of the initialized free memory pool.
200 200
   		ptr += 8;
201 201
 
@@ -219,7 +219,7 @@ int i, j, n;
219 219
   				SERIAL_ECHOLNPGM("\n");
220 220
 			}
221 221
 		}
222
-		m99_not_initialized = 0;
222
+		m100_not_initialized = 0;
223 223
   		SERIAL_ECHOLNPGM("Done.\n");
224 224
 		return;
225 225
 	}
@@ -230,8 +230,8 @@ int i, j, n;
230 230
 // the stack once the function returns to the caller.
231 231
 
232 232
 unsigned char *top_of_stack() {
233
-unsigned char x;
234
-	return &x;
233
+  unsigned char x;
234
+  return &x + 1; // x is pulled on return;
235 235
 }
236 236
 
237 237
 //

+ 6
- 5
Marlin/Marlin_main.cpp View File

@@ -213,6 +213,7 @@
213 213
  * ************* SCARA End ***************
214 214
  *
215 215
  * ************ Custom codes - This can change to suit future G-code regulations
216
+ * M100 - Watch Free Memory (For Debugging Only)
216 217
  * M851 - Set probe's Z offset (mm above extruder -- The value will always be negative)
217 218
 
218 219
 
@@ -225,8 +226,8 @@
225 226
  *
226 227
  */
227 228
 
228
-#ifdef M99_FREE_MEMORY_WATCHER
229
-  void m99_code();
229
+#ifdef M100_FREE_MEMORY_WATCHER
230
+  void gcode_M100();
230 231
 #endif
231 232
 
232 233
 #ifdef SDSUPPORT
@@ -5378,9 +5379,9 @@ void process_next_command() {
5378 5379
           break;
5379 5380
       #endif // ENABLE_AUTO_BED_LEVELING && Z_PROBE_REPEATABILITY_TEST
5380 5381
 
5381
-      #ifdef M99_FREE_MEMORY_WATCHER
5382
-        case 99:
5383
-          m99_code();
5382
+      #ifdef M100_FREE_MEMORY_WATCHER
5383
+        case 100:
5384
+          gcode_M100();
5384 5385
           break;
5385 5386
       #endif
5386 5387
 

Loading…
Cancel
Save