Memory diagnostics added. Mem usage is printed whenever you turn debugging on (even if it is already on).

This commit is contained in:
Adrian Bowyer 2013-11-13 18:16:43 +00:00
parent 6c22f30600
commit 8b3931c8cf
17 changed files with 46319 additions and 7671 deletions

View file

@ -8,6 +8,9 @@ module Gauge()
union() union()
{ {
cube([long,8,8]); cube([long,8,8]);
translate([3, 5, 0])
rotate([0,0,45])
cube([8,5,8]);
rotate([0,0,5]) rotate([0,0,5])
cube([8,long,8]); cube([8,long,8]);
} }
@ -57,6 +60,6 @@ module TestPiece()
//TestPiece(); //TestPiece();
//Gauge(); Gauge();
ThumbWheel(); //ThumbWheel();

BIN
Data/duet-testing.doc Normal file

Binary file not shown.

16148
Data/gauge.g Normal file

File diff suppressed because it is too large Load diff

View file

@ -31,7 +31,21 @@ solid OpenSCAD_Model
outer loop outer loop
vertex 0 0 0 vertex 0 0 0
vertex 0.125541 90.3548 0 vertex 0.125541 90.3548 0
vertex 7.33065 8 0 vertex 6.94877 12.3649 0
endloop
endfacet
facet normal 0 0 -1
outer loop
vertex 7.2236 9.2236 0
vertex 6.94877 12.3649 0
vertex 8.65685 10.6569 0
endloop
endfacet
facet normal 0 0 -1
outer loop
vertex 0 0 0
vertex 6.94877 12.3649 0
vertex 7.2236 9.2236 0
endloop endloop
endfacet endfacet
facet normal 0 0 -1 facet normal 0 0 -1
@ -48,6 +62,13 @@ solid OpenSCAD_Model
vertex 90 0 0 vertex 90 0 0
endloop endloop
endfacet endfacet
facet normal 0 0 -1
outer loop
vertex 7.33065 8 0
vertex 0 0 0
vertex 7.2236 9.2236 0
endloop
endfacet
facet normal -1 0 0 facet normal -1 0 0
outer loop outer loop
vertex -7 86.5217 3.50557 vertex -7 86.5217 3.50557
@ -293,13 +314,6 @@ solid OpenSCAD_Model
vertex 0 0 8 vertex 0 0 8
endloop endloop
endfacet endfacet
facet normal 0 0 1
outer loop
vertex 7.33065 8 8
vertex 0.125541 90.3548 8
vertex -7 89.7314 8
endloop
endfacet
facet normal 0 0 1 facet normal 0 0 1
outer loop outer loop
vertex 7.33065 8 8 vertex 7.33065 8 8
@ -314,6 +328,34 @@ solid OpenSCAD_Model
vertex 0 0 8 vertex 0 0 8
endloop endloop
endfacet endfacet
facet normal 0 0 1
outer loop
vertex 7.2236 9.2236 8
vertex -7 89.7314 8
vertex 7.33065 8 8
endloop
endfacet
facet normal 0 0 1
outer loop
vertex 6.94877 12.3649 8
vertex -7 89.7314 8
vertex 7.2236 9.2236 8
endloop
endfacet
facet normal 0 0 1
outer loop
vertex 6.94877 12.3649 8
vertex 0.125541 90.3548 8
vertex -7 89.7314 8
endloop
endfacet
facet normal 0 0 1
outer loop
vertex 8.65685 10.6569 8
vertex 6.94877 12.3649 8
vertex 7.2236 9.2236 8
endloop
endfacet
facet normal 0 0 1 facet normal 0 0 1
outer loop outer loop
vertex 90 8 8 vertex 90 8 8
@ -365,15 +407,57 @@ solid OpenSCAD_Model
endfacet endfacet
facet normal 0.996195 0.0871557 0 facet normal 0.996195 0.0871557 0
outer loop outer loop
vertex 0.314059 88.2 4 vertex 7.33065 8 0
vertex 0.125541 90.3548 0 vertex 7.2236 9.2236 0
vertex 0.125541 90.3548 8 vertex 7.2236 9.2236 8
endloop endloop
endfacet endfacet
facet normal 0.996195 0.0871557 0 facet normal 0.996195 0.0871557 0
outer loop outer loop
vertex 7.33065 8 8 vertex 7.33065 8 8
vertex 7.33065 8 0 vertex 7.33065 8 0
vertex 7.2236 9.2236 8
endloop
endfacet
facet normal 0.707107 -0.707107 0
outer loop
vertex 7.2236 9.2236 8
vertex 7.2236 9.2236 0
vertex 8.65685 10.6569 0
endloop
endfacet
facet normal 0.707107 -0.707107 0
outer loop
vertex 8.65685 10.6569 8
vertex 7.2236 9.2236 8
vertex 8.65685 10.6569 0
endloop
endfacet
facet normal 0.707107 0.707107 0
outer loop
vertex 6.94877 12.3649 0
vertex 6.94877 12.3649 8
vertex 8.65685 10.6569 0
endloop
endfacet
facet normal 0.707107 0.707107 0
outer loop
vertex 8.65685 10.6569 0
vertex 6.94877 12.3649 8
vertex 8.65685 10.6569 8
endloop
endfacet
facet normal 0.996195 0.0871557 0
outer loop
vertex 0.314059 88.2 4
vertex 0.125541 90.3548 0
vertex 0.125541 90.3548 8
endloop
endfacet
facet normal 0.996195 0.0871557 0
outer loop
vertex 6.94877 12.3649 8
vertex 6.94877 12.3649 0
vertex 0.125541 90.3548 8 vertex 0.125541 90.3548 8
endloop endloop
endfacet endfacet
@ -386,14 +470,14 @@ solid OpenSCAD_Model
endfacet endfacet
facet normal 0.996195 0.0871557 0 facet normal 0.996195 0.0871557 0
outer loop outer loop
vertex 7.33065 8 0 vertex 6.94877 12.3649 0
vertex 0.125541 90.3548 0 vertex 0.125541 90.3548 0
vertex 0.45404 86.6 1.22872 vertex 0.45404 86.6 1.22872
endloop endloop
endfacet endfacet
facet normal 0.996195 0.0871557 0 facet normal 0.996195 0.0871557 0
outer loop outer loop
vertex 7.33065 8 0 vertex 6.94877 12.3649 0
vertex 0.45404 86.6 1.22872 vertex 0.45404 86.6 1.22872
vertex 0.734004 83.4 1.22872 vertex 0.734004 83.4 1.22872
endloop endloop
@ -402,19 +486,19 @@ solid OpenSCAD_Model
outer loop outer loop
vertex 0.734004 83.4 1.22872 vertex 0.734004 83.4 1.22872
vertex 0.873986 81.8 4 vertex 0.873986 81.8 4
vertex 7.33065 8 0 vertex 6.94877 12.3649 0
endloop endloop
endfacet endfacet
facet normal 0.996195 0.0871557 0 facet normal 0.996195 0.0871557 0
outer loop outer loop
vertex 7.33065 8 0 vertex 6.94877 12.3649 0
vertex 0.734004 83.4 6.77128 vertex 0.734004 83.4 6.77128
vertex 0.125541 90.3548 8 vertex 0.125541 90.3548 8
endloop endloop
endfacet endfacet
facet normal 0.996195 0.0871557 0 facet normal 0.996195 0.0871557 0
outer loop outer loop
vertex 7.33065 8 0 vertex 6.94877 12.3649 0
vertex 0.873986 81.8 4 vertex 0.873986 81.8 4
vertex 0.734004 83.4 6.77128 vertex 0.734004 83.4 6.77128
endloop endloop
@ -447,20 +531,6 @@ solid OpenSCAD_Model
vertex 0.125541 90.3548 8 vertex 0.125541 90.3548 8
endloop endloop
endfacet endfacet
facet normal -4.6166e-17 0.978147 0.207913
outer loop
vertex -4 83.4783 3.50557
vertex -7 83.4783 3.50557
vertex -4 83.4088 3.83275
endloop
endfacet
facet normal -4.6166e-17 0.978147 0.207913
outer loop
vertex -4 83.4088 3.83275
vertex -7 83.4783 3.50557
vertex -7 83.4088 3.83275
endloop
endfacet
facet normal 0 1 0 facet normal 0 1 0
outer loop outer loop
vertex -4 83.4088 4.16725 vertex -4 83.4088 4.16725
@ -475,6 +545,20 @@ solid OpenSCAD_Model
vertex -7 83.4088 3.83275 vertex -7 83.4088 3.83275
endloop endloop
endfacet endfacet
facet normal -4.6166e-17 0.978147 0.207913
outer loop
vertex -4 83.4783 3.50557
vertex -7 83.4783 3.50557
vertex -4 83.4088 3.83275
endloop
endfacet
facet normal -4.6166e-17 0.978147 0.207913
outer loop
vertex -4 83.4088 3.83275
vertex -7 83.4783 3.50557
vertex -7 83.4088 3.83275
endloop
endfacet
facet normal 4.6166e-17 0.978147 -0.207913 facet normal 4.6166e-17 0.978147 -0.207913
outer loop outer loop
vertex -4 83.4783 4.49443 vertex -4 83.4783 4.49443
@ -867,20 +951,6 @@ solid OpenSCAD_Model
vertex -7 83.4783 3.50557 vertex -7 83.4783 3.50557
endloop endloop
endfacet endfacet
facet normal -1.11022e-16 -0.866025 0.5
outer loop
vertex -4 86.6 1.22872
vertex 0.45404 86.6 1.22872
vertex 0.314059 88.2 4
endloop
endfacet
facet normal -1.11022e-16 -0.866025 0.5
outer loop
vertex -4 88.2 4
vertex -4 86.6 1.22872
vertex 0.314059 88.2 4
endloop
endfacet
facet normal 1.11022e-16 -0.866025 -0.5 facet normal 1.11022e-16 -0.866025 -0.5
outer loop outer loop
vertex -4 88.2 4 vertex -4 88.2 4
@ -895,6 +965,20 @@ solid OpenSCAD_Model
vertex 0.45404 86.6 6.77128 vertex 0.45404 86.6 6.77128
endloop endloop
endfacet endfacet
facet normal -1.11022e-16 -0.866025 0.5
outer loop
vertex -4 86.6 1.22872
vertex 0.45404 86.6 1.22872
vertex 0.314059 88.2 4
endloop
endfacet
facet normal -1.11022e-16 -0.866025 0.5
outer loop
vertex -4 88.2 4
vertex -4 86.6 1.22872
vertex 0.314059 88.2 4
endloop
endfacet
facet normal 2.22045e-16 -4.56422e-08 -1 facet normal 2.22045e-16 -4.56422e-08 -1
outer loop outer loop
vertex 0.45404 86.6 6.77128 vertex 0.45404 86.6 6.77128

29985
Data/ormaxis.g Normal file

File diff suppressed because it is too large Load diff

View file

@ -37,6 +37,7 @@ GCodes::GCodes(Platform* p, Webserver* w)
void GCodes::Exit() void GCodes::Exit()
{ {
platform->Message(HOST_MESSAGE, "GCodes class exited.\n");
active = false; active = false;
} }

View file

@ -39,6 +39,7 @@ void Heat::Init()
void Heat::Exit() void Heat::Exit()
{ {
platform->Message(HOST_MESSAGE, "Heat class exited.\n");
active = false; active = false;
} }
@ -110,9 +111,6 @@ void PID::Init()
void PID::Spin() void PID::Spin()
{ {
if(temperatureFault)
return;
temperature = platform->GetTemperature(heater); temperature = platform->GetTemperature(heater);
if(temperature < BAD_LOW_TEMPERATURE || temperature > BAD_HIGH_TEMPERATURE) if(temperature < BAD_LOW_TEMPERATURE || temperature > BAD_HIGH_TEMPERATURE)
@ -174,5 +172,7 @@ void PID::Spin()
if (result < 0.0) result = 0.0; if (result < 0.0) result = 0.0;
if (result > 255.0) result = 255.0; if (result > 255.0) result = 255.0;
result = result/255.0; result = result/255.0;
if(!temperatureFault)
platform->SetHeater(heater, result); platform->SetHeater(heater, result);
} }

View file

@ -147,6 +147,7 @@ void Move::Init()
tanXY = 0.0; tanXY = 0.0;
tanYZ = 0.0; tanYZ = 0.0;
tanXZ = 0.0; tanXZ = 0.0;
zPlaneSet = false;
lastZHit = 0.0; lastZHit = 0.0;
zProbing = false; zProbing = false;
@ -157,6 +158,7 @@ void Move::Init()
void Move::Exit() void Move::Exit()
{ {
platform->Message(HOST_MESSAGE, "Move class exited.\n");
active = false; active = false;
} }
@ -625,6 +627,7 @@ void Move::SetProbedBedPlane()
aX = -a/c; aX = -a/c;
aY = -b/c; aY = -b/c;
aC = -d/c; aC = -d/c;
zPlaneSet = true;
} }
// FIXME // FIXME

1
Move.h
View file

@ -214,6 +214,7 @@ class Move
float extruderStepDistances[(1<<(DRIVES-AXES))]; // NB - limits us to 5 extruders float extruderStepDistances[(1<<(DRIVES-AXES))]; // NB - limits us to 5 extruders
long nextMachineEndPoints[DRIVES+1]; long nextMachineEndPoints[DRIVES+1];
float aX, aY, aC; // Bed plane explicit equation z' = z + aX*x + aY*y + aC float aX, aY, aC; // Bed plane explicit equation z' = z + aX*x + aY*y + aC
bool zPlaneSet;
float tanXY, tanYZ, tanXZ; // 90 degrees + angle gives angle between axes float tanXY, tanYZ, tanXZ; // 90 degrees + angle gives angle between axes
float lastZHit; float lastZHit;
bool zProbing; bool zProbing;

View file

@ -262,20 +262,25 @@ void Platform::Diagnostics()
Message(HOST_MESSAGE, "Platform Diagnostics:\n"); Message(HOST_MESSAGE, "Platform Diagnostics:\n");
} }
//extern int __bss_end; // void? long? extern char _end;
//extern void *__brkval; extern "C" char *sbrk(int i);
//
//long Platform::GetFreeMemory() void Platform::PrintMemoryUsage()
//{ {
// long free_memory; char *ramstart=(char *)0x20070000;
// char *ramend=(char *)0x20088000;
// if((long)__brkval == 0) char *heapend=sbrk(0);
// free_memory = ((long)&free_memory) - ((long)&__bss_end); register char * stack_ptr asm ("sp");
// else struct mallinfo mi=mallinfo();
// free_memory = ((long)&free_memory) - ((long)__brkval); snprintf(scratchString, STRING_LENGTH, "\nMemory usage:\nDynamic ram used: %d\n",mi.uordblks);
// Message(HOST_MESSAGE, scratchString);
// return free_memory; snprintf(scratchString, STRING_LENGTH, "Program static ram used %d\n",&_end - ramstart);
//} Message(HOST_MESSAGE, scratchString);
snprintf(scratchString, STRING_LENGTH, "Stack ram used %d\n",ramend - stack_ptr);
Message(HOST_MESSAGE, scratchString);
snprintf(scratchString, STRING_LENGTH, "My guess at free mem: %d\n\n",stack_ptr - heapend + mi.fordblks);
Message(HOST_MESSAGE, scratchString);
}
//=========================================================================== //===========================================================================

View file

@ -39,6 +39,8 @@ Licence: GPL
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
#include <malloc.h>
#include <stdlib.h>
// Platform-specific includes // Platform-specific includes
@ -408,7 +410,11 @@ class Platform
void Diagnostics(); void Diagnostics();
// long GetFreeMemory(); void PrintMemoryUsage(); // Print memory stats for debugging
void GetMemoryPointers(unsigned long& heap, unsigned long& stack);
int FreeMemory();
// Timing // Timing
@ -584,6 +590,7 @@ inline float Platform::Time()
inline void Platform::Exit() inline void Platform::Exit()
{ {
Message(HOST_MESSAGE, "Platform class exited.\n");
active = false; active = false;
} }

View file

@ -191,6 +191,7 @@ void RepRap::Exit()
move->Exit(); move->Exit();
gCodes->Exit(); gCodes->Exit();
webserver->Exit(); webserver->Exit();
platform->Message(HOST_MESSAGE, "RepRap class exited.\n");
platform->Exit(); platform->Exit();
} }

View file

@ -57,7 +57,7 @@ inline Heat* RepRap::GetHeat() { return heat; }
inline GCodes* RepRap::GetGCodes() { return gCodes; } inline GCodes* RepRap::GetGCodes() { return gCodes; }
inline Webserver* RepRap::GetWebserver() { return webserver; } inline Webserver* RepRap::GetWebserver() { return webserver; }
inline bool RepRap::Debug() { return debug; } inline bool RepRap::Debug() { return debug; }
inline void RepRap::SetDebug(bool d) { debug = d; } inline void RepRap::SetDebug(bool d) { debug = d; if(debug) platform->PrintMemoryUsage(); }
inline void RepRap::Interrupt() { move->Interrupt(); } inline void RepRap::Interrupt() { move->Interrupt(); }

File diff suppressed because it is too large Load diff

View file

@ -1,13 +1,13 @@
; RepRapPro Ormerod ; RepRapPro Ormerod
; Standard configuration G Codes ; Standard configuration G Codes
M111 S1; Debug on M111 S1; Debug on
M501 POrmerod
M500 Preprap
G21 ; mm G21 ; mm
G90 ; Absolute positioning G90 ; Absolute positioning
M83 ; Extrusion relative M83 ; Extrusion relative
M107; Fan off G31 Z0.7 P550 ; Set Z probe height and threshold
G31 Z0.7 P344 ; Set Z probe height and threshold M906 X800 Y800 Z800 E800 ; Motor currents (mA)
M906 X500 Y500 Z500 E500 ; Motor currents (mA)
;M201 X4000 Y4000 E4000 ; Accelerations (mms-2)
T0 ; Extruder 0 T0 ; Extruder 0

View file

@ -1,8 +1,11 @@
<!DOCTYPE HTML> <!DOCTYPE HTML>
<head> <head>
<!--
<link rel="shortcut icon" href="https://github.com/reprappro/RepRapFirmware/raw/due/SD-image/www/favicon.ico" /> <link rel="shortcut icon" href="https://github.com/reprappro/RepRapFirmware/raw/due/SD-image/www/favicon.ico" />
<!-- <link rel="shortcut icon" href="favicon.ico" /> --> -->
<link rel="shortcut icon" href="favicon.ico" />
<style type="text/css"> <style type="text/css">
.pages .pages
@ -139,7 +142,12 @@ function heatRowHTML(heater, hNumber)
</script> </script>
<!-- HEADER --> <!-- HEADER -->
<a href="http://reprappro.com" target="_blank"><img src="https://github.com/reprappro/RepRapFirmware/raw/due/SD-image/www/logo.png" alt="RepRapPro logo" align="right"></a>
<a href="http://reprappro.com" target="_blank"><img src="https://github.com/reprappro/RepRapFirmware/raw/duet/SD-image/www/logo.png" alt="RepRapPro logo" align="right"></a>
<!--
<a href="http://reprappro.com" target="_blank"><img src="logo.png" alt="RepRapPro logo" align="right"></a>
-->
<div style="font-size:20px" data-bind="with: machineName">RepRap: <strong data-bind="text: myName"></strong></div> <div style="font-size:20px" data-bind="with: machineName">RepRap: <strong data-bind="text: myName"></strong></div>

View file

@ -699,6 +699,7 @@ void Webserver::Init()
void Webserver::Exit() void Webserver::Exit()
{ {
platform->Message(HOST_MESSAGE, "Webserver class exited.\n");
active = false; active = false;
} }