Browse Source

Indentation in gcode_M100

Scott Lahteine 8 years ago
parent
commit
3e1bbd5e27
1 changed files with 61 additions and 64 deletions
  1. 61
    64
      Marlin/M100_Free_Mem_Chk.cpp

+ 61
- 64
Marlin/M100_Free_Mem_Chk.cpp View File

@@ -57,9 +57,6 @@ void prt_hex_byte(unsigned int);
57 57
 void prt_hex_word(unsigned int);
58 58
 int how_many_E5s_are_here(unsigned char*);
59 59
 
60
-
61
-
62
-
63 60
 void gcode_M100() {
64 61
   static int m100_not_initialized = 1;
65 62
   unsigned char* sp, *ptr;
@@ -73,49 +70,49 @@ void gcode_M100() {
73 70
   // probably caused by bad pointers.  Any unexpected values will be flagged in
74 71
   // the right hand column to help spotting them.
75 72
   //
76
-#if ENABLED(M100_FREE_MEMORY_DUMPER) // Disable to remove Dump sub-command
77
-  if (code_seen('D')) {
78
-    ptr = (unsigned char*) __brkval;
79
-    //
80
-    // We want to start and end the dump on a nice 16 byte boundry even though
81
-    // the values we are using are not 16 byte aligned.
82
-    //
83
-    SERIAL_ECHOPGM("\n__brkval : ");
84
-    prt_hex_word((unsigned int) ptr);
85
-    ptr = (unsigned char*)((unsigned long) ptr & 0xfff0);
86
-    sp = top_of_stack();
87
-    SERIAL_ECHOPGM("\nStack Pointer : ");
88
-    prt_hex_word((unsigned int) sp);
89
-    SERIAL_EOL;
90
-    sp = (unsigned char*)((unsigned long) sp | 0x000f);
91
-    n = sp - ptr;
92
-    //
93
-    // This is the main loop of the Dump command.
94
-    //
95
-    while (ptr < sp) {
96
-      prt_hex_word((unsigned int) ptr); // Print the address
97
-      SERIAL_CHAR(':');
98
-      for (i = 0; i < 16; i++) {      // and 16 data bytes
99
-        prt_hex_byte(*(ptr + i));
100
-        SERIAL_CHAR(' ');
101
-        delay(2);
102
-      }
103
-      SERIAL_CHAR('|');         // now show where non 0xE5's are
104
-      for (i = 0; i < 16; i++) {
105
-        delay(2);
106
-        if (*(ptr + i) == 0xe5)
73
+  #if ENABLED(M100_FREE_MEMORY_DUMPER) // Disable to remove Dump sub-command
74
+    if (code_seen('D')) {
75
+      ptr = (unsigned char*) __brkval;
76
+      //
77
+      // We want to start and end the dump on a nice 16 byte boundry even though
78
+      // the values we are using are not 16 byte aligned.
79
+      //
80
+      SERIAL_ECHOPGM("\n__brkval : ");
81
+      prt_hex_word((unsigned int) ptr);
82
+      ptr = (unsigned char*)((unsigned long) ptr & 0xfff0);
83
+      sp = top_of_stack();
84
+      SERIAL_ECHOPGM("\nStack Pointer : ");
85
+      prt_hex_word((unsigned int) sp);
86
+      SERIAL_EOL;
87
+      sp = (unsigned char*)((unsigned long) sp | 0x000f);
88
+      n = sp - ptr;
89
+      //
90
+      // This is the main loop of the Dump command.
91
+      //
92
+      while (ptr < sp) {
93
+        prt_hex_word((unsigned int) ptr); // Print the address
94
+        SERIAL_CHAR(':');
95
+        for (i = 0; i < 16; i++) {      // and 16 data bytes
96
+          prt_hex_byte(*(ptr + i));
107 97
           SERIAL_CHAR(' ');
108
-        else
109
-          SERIAL_CHAR('?');
98
+          delay(2);
99
+        }
100
+        SERIAL_CHAR('|');         // now show where non 0xE5's are
101
+        for (i = 0; i < 16; i++) {
102
+          delay(2);
103
+          if (*(ptr + i) == 0xe5)
104
+            SERIAL_CHAR(' ');
105
+          else
106
+            SERIAL_CHAR('?');
107
+        }
108
+        SERIAL_EOL;
109
+        ptr += 16;
110
+        delay(2);
110 111
       }
111
-      SERIAL_EOL;
112
-      ptr += 16;
113
-      delay(2);
112
+      SERIAL_ECHOLNPGM("Done.");
113
+      return;
114 114
     }
115
-    SERIAL_ECHOLNPGM("Done.");
116
-    return;
117
-  }
118
-#endif
115
+  #endif
119 116
   //
120 117
   // M100 F   requests the code to return the number of free bytes in the memory pool along with
121 118
   // other vital statistics that define the memory pool.
@@ -158,28 +155,28 @@ void gcode_M100() {
158 155
   // M100 C x  Corrupts x locations in the free memory pool and reports the locations of the corruption.
159 156
   // This is useful to check the correctness of the M100 D and the M100 F commands.
160 157
   //
161
-#if ENABLED(M100_FREE_MEMORY_CORRUPTOR)
162
-  if (code_seen('C')) {
163
-    int x = code_value_int(); // x gets the # of locations to corrupt within the memory pool
164
-    SERIAL_ECHOLNPGM("Corrupting free memory block.\n");
165
-    ptr = (unsigned char*) __brkval;
166
-    SERIAL_ECHOPAIR("\n__brkval : ", ptr);
167
-    ptr += 8;
168
-    sp = top_of_stack();
169
-    SERIAL_ECHOPAIR("\nStack Pointer : ", sp);
170
-    SERIAL_ECHOLNPGM("\n");
171
-    n = sp - ptr - 64;    // -64 just to keep us from finding interrupt activity that
172
-    // has altered the stack.
173
-    j = n / (x + 1);
174
-    for (i = 1; i <= x; i++) {
175
-      *(ptr + (i * j)) = i;
176
-      SERIAL_ECHOPGM("\nCorrupting address: 0x");
177
-      prt_hex_word((unsigned int)(ptr + (i * j)));
158
+  #if ENABLED(M100_FREE_MEMORY_CORRUPTOR)
159
+    if (code_seen('C')) {
160
+      int x = code_value_int(); // x gets the # of locations to corrupt within the memory pool
161
+      SERIAL_ECHOLNPGM("Corrupting free memory block.\n");
162
+      ptr = (unsigned char*) __brkval;
163
+      SERIAL_ECHOPAIR("\n__brkval : ", ptr);
164
+      ptr += 8;
165
+      sp = top_of_stack();
166
+      SERIAL_ECHOPAIR("\nStack Pointer : ", sp);
167
+      SERIAL_ECHOLNPGM("\n");
168
+      n = sp - ptr - 64;    // -64 just to keep us from finding interrupt activity that
169
+      // has altered the stack.
170
+      j = n / (x + 1);
171
+      for (i = 1; i <= x; i++) {
172
+        *(ptr + (i * j)) = i;
173
+        SERIAL_ECHOPGM("\nCorrupting address: 0x");
174
+        prt_hex_word((unsigned int)(ptr + (i * j)));
175
+      }
176
+      SERIAL_ECHOLNPGM("\n");
177
+      return;
178 178
     }
179
-    SERIAL_ECHOLNPGM("\n");
180
-    return;
181
-  }
182
-#endif
179
+  #endif
183 180
   //
184 181
   // M100 I    Initializes the free memory pool so it can be watched and prints vital
185 182
   // statistics that define the free memory pool.

Loading…
Cancel
Save