Преглед на файлове

Merge pull request #1167 from thinkyhead/sd_freemem

Use SdFatUtil::FreeRam() for freeMemory() if there
Bo Herrmannsen преди 10 години
родител
ревизия
60628864ca
променени са 1 файла, в които са добавени 17 реда и са изтрити 12 реда
  1. 17
    12
      Marlin/Marlin_main.cpp

+ 17
- 12
Marlin/Marlin_main.cpp Целия файл

@@ -402,22 +402,27 @@ void serial_echopair_P(const char *s_P, double v)
402 402
 void serial_echopair_P(const char *s_P, unsigned long v)
403 403
     { serialprintPGM(s_P); SERIAL_ECHO(v); }
404 404
 
405
-extern "C"{
406
-  extern unsigned int __bss_end;
407
-  extern unsigned int __heap_start;
408
-  extern void *__brkval;
405
+#ifdef SDSUPPORT
406
+  #include "SdFatUtil.h"
407
+  int freeMemory() { return SdFatUtil::FreeRam(); }
408
+#else
409
+  extern "C" {
410
+    extern unsigned int __bss_end;
411
+    extern unsigned int __heap_start;
412
+    extern void *__brkval;
409 413
 
410
-  int freeMemory() {
411
-    int free_memory;
414
+    int freeMemory() {
415
+      int free_memory;
412 416
 
413
-    if((int)__brkval == 0)
414
-      free_memory = ((int)&free_memory) - ((int)&__bss_end);
415
-    else
416
-      free_memory = ((int)&free_memory) - ((int)__brkval);
417
+      if ((int)__brkval == 0)
418
+        free_memory = ((int)&free_memory) - ((int)&__bss_end);
419
+      else
420
+        free_memory = ((int)&free_memory) - ((int)__brkval);
417 421
 
418
-    return free_memory;
422
+      return free_memory;
423
+    }
419 424
   }
420
-}
425
+#endif //!SDSUPPORT
421 426
 
422 427
 //adds an command to the main command buffer
423 428
 //thats really done in a non-safe way.

Loading…
Отказ
Запис