Procházet zdrojové kódy

Merge pull request #6657 from thinkyhead/bf_cleanup_tuesday

Fix M100 compiler warnings, general patches
Scott Lahteine před 7 roky
rodič
revize
e1e043d0d0

+ 4
- 4
Marlin/Conditionals_LCD.h Zobrazit soubor

@@ -357,15 +357,15 @@
357 357
     #define BLTOUCH_RESET    160
358 358
     #define _TEST_BLTOUCH(P) (READ(P##_PIN) != P##_ENDSTOP_INVERTING)
359 359
 
360
+    // Always disable probe pin inverting for BLTouch
361
+    #undef Z_MIN_PROBE_ENDSTOP_INVERTING
362
+    #define Z_MIN_PROBE_ENDSTOP_INVERTING false
363
+
360 364
     #if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
361 365
       #undef Z_MIN_ENDSTOP_INVERTING
362 366
       #define Z_MIN_ENDSTOP_INVERTING false
363
-      #undef Z_MIN_PROBE_ENDSTOP_INVERTING
364
-      #define Z_MIN_PROBE_ENDSTOP_INVERTING false
365 367
       #define TEST_BLTOUCH() _TEST_BLTOUCH(Z_MIN)
366 368
     #else
367
-      #undef Z_MIN_PROBE_ENDSTOP_INVERTING
368
-      #define Z_MIN_PROBE_ENDSTOP_INVERTING false
369 369
       #define TEST_BLTOUCH() _TEST_BLTOUCH(Z_MIN_PROBE)
370 370
     #endif
371 371
   #endif

+ 9
- 9
Marlin/M100_Free_Mem_Chk.cpp Zobrazit soubor

@@ -78,7 +78,7 @@ char* top_of_stack() {
78 78
 }
79 79
 
80 80
 // Count the number of test bytes at the specified location.
81
-int16_t count_test_bytes(const uint8_t * const ptr) {
81
+int16_t count_test_bytes(const char * const ptr) {
82 82
   for (uint16_t i = 0; i < 32000; i++)
83 83
     if (((char) ptr[i]) != TEST_BYTE)
84 84
       return i - 1;
@@ -100,13 +100,13 @@ int16_t count_test_bytes(const uint8_t * const ptr) {
100 100
    *  the block. If so, it may indicate memory corruption due to a bad pointer.
101 101
    *  Unexpected bytes are flagged in the right column.
102 102
    */
103
-  void dump_free_memory(const uint8_t *ptr, const uint8_t *sp) {
103
+  void dump_free_memory(const char *ptr, const char *sp) {
104 104
     //
105 105
     // Start and end the dump on a nice 16 byte boundary
106 106
     // (even though the values are not 16-byte aligned).
107 107
     //
108
-    ptr = (uint8_t *)((uint16_t)ptr & 0xFFF0); // Align to 16-byte boundary
109
-    sp  = (uint8_t *)((uint16_t)sp  | 0x000F); // Align sp to the 15th byte (at or above sp)
108
+    ptr = (char *)((uint16_t)ptr & 0xFFF0); // Align to 16-byte boundary
109
+    sp  = (char *)((uint16_t)sp  | 0x000F); // Align sp to the 15th byte (at or above sp)
110 110
 
111 111
     // Dump command main loop
112 112
     while (ptr < sp) {
@@ -121,7 +121,7 @@ int16_t count_test_bytes(const uint8_t * const ptr) {
121 121
       SERIAL_CHAR('|');                   // Point out non test bytes
122 122
       for (uint8_t i = 0; i < 16; i++) {
123 123
         char ccc = (char)ptr[i]; // cast to char before automatically casting to char on assignment, in case the compiler is broken
124
-        if (&ptr[i] >= command_queue && &ptr[i] < &command_queue[BUFSIZE][MAX_CMD_SIZE]) { // Print out ASCII in the command buffer area
124
+        if (&ptr[i] >= (const char*)command_queue && &ptr[i] < (const char*)(command_queue + sizeof(command_queue))) { // Print out ASCII in the command buffer area
125 125
           if (!WITHIN(ccc, ' ', 0x7E)) ccc = ' ';
126 126
         }
127 127
         else { // If not in the command buffer area, flag bytes that don't match the test byte
@@ -153,13 +153,13 @@ void M100_dump_routine(const char * const title, const char *start, const char *
153 153
  *  Return the number of free bytes in the memory pool,
154 154
  *  with other vital statistics defining the pool.
155 155
  */
156
-void free_memory_pool_report(const char * const ptr, const uint16_t size) {
156
+void free_memory_pool_report(char * const ptr, const uint16_t size) {
157 157
   int16_t max_cnt = -1;
158 158
   uint16_t block_cnt = 0;
159 159
   char *max_addr = NULL;
160 160
   // Find the longest block of test bytes in the buffer
161 161
   for (uint16_t i = 0; i < size; i++) {
162
-    char * const addr = ptr + i;
162
+    char *addr = ptr + i;
163 163
     if (*addr == TEST_BYTE) {
164 164
       const uint16_t j = count_test_bytes(addr);
165 165
       if (j > 8) {
@@ -209,7 +209,7 @@ void free_memory_pool_report(const char * const ptr, const uint16_t size) {
209 209
  * M100 I
210 210
  *  Init memory for the M100 tests. (Automatically applied on the first M100.)
211 211
  */
212
-void init_free_memory(uint8_t *ptr, int16_t size) {
212
+void init_free_memory(char *ptr, int16_t size) {
213 213
   SERIAL_ECHOLNPGM("Initializing free memory block.\n\n");
214 214
 
215 215
   size -= 250;    // -250 to avoid interrupt activity that's altered the stack.
@@ -292,7 +292,7 @@ int check_for_free_memory_corruption(const char * const title) {
292 292
     //   idle();
293 293
     safe_delay(20);
294 294
     #ifdef M100_FREE_MEMORY_DUMPER
295
-      M100_dump_routine("   Memory corruption detected with sp<Heap\n", (char*)0x1B80, 0x21FF);
295
+      M100_dump_routine("   Memory corruption detected with sp<Heap\n", (char*)0x1B80, (char*)0x21FF);
296 296
     #endif
297 297
   }
298 298
 

+ 1
- 1
Marlin/Marlin_main.cpp Zobrazit soubor

@@ -9731,7 +9731,7 @@ void process_next_command() {
9731 9731
     SERIAL_ECHOLN(current_command);
9732 9732
     #if ENABLED(M100_FREE_MEMORY_WATCHER)
9733 9733
       SERIAL_ECHOPAIR("slot:", cmd_queue_index_r);
9734
-      M100_dump_routine("   Command Queue:", &command_queue[0][0], &command_queue[BUFSIZE][MAX_CMD_SIZE]);
9734
+      M100_dump_routine("   Command Queue:", (const char*)command_queue, (const char*)(command_queue + sizeof(command_queue)));
9735 9735
     #endif
9736 9736
   }
9737 9737
 

Loading…
Zrušit
Uložit