Version 0.78m preliminary
1. Fixed variable name of extrusion factors in JSON status response 2. Fixed bug: changing heat sample interval no longer messes up I and D pid factors. 3. Ensure that name of file being printed is null-terminated. 4. Removed redundant function SetStepHypotenuse.
This commit is contained in:
parent
13f2ab5bfd
commit
3520c24546
8 changed files with 25 additions and 54 deletions
|
@ -24,8 +24,8 @@ Licence: GPL
|
||||||
#define CONFIGURATION_H
|
#define CONFIGURATION_H
|
||||||
|
|
||||||
#define NAME "RepRapFirmware"
|
#define NAME "RepRapFirmware"
|
||||||
#define VERSION "0.78k-dc42"
|
#define VERSION "0.78m-dc42"
|
||||||
#define DATE "2014-08-18"
|
#define DATE "2014-08-24"
|
||||||
#define AUTHORS "reprappro, dc42, zpl"
|
#define AUTHORS "reprappro, dc42, zpl"
|
||||||
|
|
||||||
// Other firmware that we might switch to be compatible with.
|
// Other firmware that we might switch to be compatible with.
|
||||||
|
|
|
@ -1563,7 +1563,7 @@ void GCodes::SetPidParameters(GCodeBuffer *gb, int heater, StringRef& reply)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
reply.printf("Heater %d P:%.2f I:%.3f D:%.2f T:%.2f S:%.2f W:%.1f B:%.1f\n",
|
reply.printf("Heater %d P:%.2f I:%.3f D:%.2f T:%.2f S:%.2f W:%.1f B:%.1f\n",
|
||||||
heater, pp.kP, pp.kI * platform->HeatSampleTime(), pp.kD/platform->HeatSampleTime(), pp.kT, pp.kS, pp.pidMax, pp.fullBand);
|
heater, pp.kP, pp.kI, pp.kD, pp.kT, pp.kS, pp.pidMax, pp.fullBand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2013,10 +2013,6 @@ bool GCodes::HandleMcode(GCodeBuffer* gb)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
reprap.GetMove()->SetStepHypotenuse();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
5
Heat.cpp
5
Heat.cpp
|
@ -229,12 +229,13 @@ void PID::Spin()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
temp_iState += error * pp.kI;
|
float sampleInterval = platform->HeatSampleTime();
|
||||||
|
temp_iState += error * pp.kI * sampleInterval;
|
||||||
|
|
||||||
if (temp_iState < pp.pidMin) temp_iState = pp.pidMin;
|
if (temp_iState < pp.pidMin) temp_iState = pp.pidMin;
|
||||||
else if (temp_iState > pp.pidMax) temp_iState = pp.pidMax;
|
else if (temp_iState > pp.pidMax) temp_iState = pp.pidMax;
|
||||||
|
|
||||||
float temp_dState = pp.kD * (temperature - lastTemperature);
|
float temp_dState = pp.kD * (temperature - lastTemperature) / sampleInterval;
|
||||||
float result = pp.kP * error + temp_iState - temp_dState;
|
float result = pp.kP * error + temp_iState - temp_dState;
|
||||||
|
|
||||||
lastTemperature = temperature;
|
lastTemperature = temperature;
|
||||||
|
|
33
Move.cpp
33
Move.cpp
|
@ -103,8 +103,6 @@ void Move::Init()
|
||||||
lastMove->Release();
|
lastMove->Release();
|
||||||
liveCoordinates[DRIVES] = platform->HomeFeedRate(slow);
|
liveCoordinates[DRIVES] = platform->HomeFeedRate(slow);
|
||||||
|
|
||||||
SetStepHypotenuse();
|
|
||||||
|
|
||||||
currentFeedrate = -1.0;
|
currentFeedrate = -1.0;
|
||||||
|
|
||||||
SetIdentityTransform();
|
SetIdentityTransform();
|
||||||
|
@ -405,35 +403,6 @@ bool Move::GetCurrentUserPosition(float m[])
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Move::SetStepHypotenuse()
|
|
||||||
{
|
|
||||||
// The stepDistances array is a look-up table of the Euclidean distance
|
|
||||||
// between the start and end of a step. If the step is just along one axis,
|
|
||||||
// it's just that axis's step length. If it's more, it is a Pythagoran
|
|
||||||
// sum of all the axis steps that take part.
|
|
||||||
|
|
||||||
for(unsigned int i = 0; i < (1<<DRIVES); i++)
|
|
||||||
{
|
|
||||||
float d = 0.0;
|
|
||||||
for(unsigned int j = 0; j < DRIVES; j++)
|
|
||||||
{
|
|
||||||
if(i & (1<<j))
|
|
||||||
{
|
|
||||||
float e = 1.0/platform->DriveStepsPerUnit(j);
|
|
||||||
d += e*e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stepDistances[i] = sqrt(d);
|
|
||||||
}
|
|
||||||
|
|
||||||
// We don't want 0. If no axes/extruders are moving these should never be used.
|
|
||||||
// But try to be safe.
|
|
||||||
|
|
||||||
stepDistances[0] = 1.0/platform->DriveStepsPerUnit(AXES); //FIXME this is not multi extruder safe (but we should never get here)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Take an item from the look-ahead ring and add it to the DDA ring, if
|
// Take an item from the look-ahead ring and add it to the DDA ring, if
|
||||||
// possible.
|
// possible.
|
||||||
|
|
||||||
|
@ -1150,6 +1119,8 @@ void DDA::Start()
|
||||||
active = true;
|
active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This function is called from the ISR.
|
||||||
|
// Any variables it modifies that are also read by code outside the ISR must be declared 'volatile'.
|
||||||
void DDA::Step()
|
void DDA::Step()
|
||||||
{
|
{
|
||||||
if(!active)
|
if(!active)
|
||||||
|
|
8
Move.h
8
Move.h
|
@ -202,7 +202,6 @@ class Move
|
||||||
void Diagnostics(); // Report useful stuff
|
void Diagnostics(); // Report useful stuff
|
||||||
float ComputeCurrentCoordinate(int8_t drive,// Turn a DDA value back into a real world coordinate
|
float ComputeCurrentCoordinate(int8_t drive,// Turn a DDA value back into a real world coordinate
|
||||||
LookAhead* la, DDA* runningDDA);
|
LookAhead* la, DDA* runningDDA);
|
||||||
void SetStepHypotenuse(); // Set up the hypotenuse lengths for multiple axis steps, like step both X and Y at once
|
|
||||||
float Normalise(float v[], int8_t dimensions); // Normalise a vector to unit length
|
float Normalise(float v[], int8_t dimensions); // Normalise a vector to unit length
|
||||||
void Absolute(float v[], int8_t dimensions); // Put a vector in the positive hyperquadrant
|
void Absolute(float v[], int8_t dimensions); // Put a vector in the positive hyperquadrant
|
||||||
float Magnitude(const float v[], int8_t dimensions); // Return the length of a vector
|
float Magnitude(const float v[], int8_t dimensions); // Return the length of a vector
|
||||||
|
@ -262,7 +261,6 @@ class Move
|
||||||
float liveCoordinates[DRIVES + 1]; // The last endpoint that the machine moved to
|
float liveCoordinates[DRIVES + 1]; // The last endpoint that the machine moved to
|
||||||
float nextMove[DRIVES + 1]; // The endpoint of the next move to processExtra entry is for feedrate
|
float nextMove[DRIVES + 1]; // The endpoint of the next move to processExtra entry is for feedrate
|
||||||
float normalisedDirectionVector[DRIVES]; // Used to hold a unit-length vector in the direction of motion
|
float normalisedDirectionVector[DRIVES]; // Used to hold a unit-length vector in the direction of motion
|
||||||
float stepDistances[(1<<DRIVES)]; // The length of steps in different numbers of dimensions
|
|
||||||
long nextMachineEndPoints[DRIVES+1]; // The next endpoint in machine coordinates (i.e. steps)
|
long nextMachineEndPoints[DRIVES+1]; // The next endpoint in machine coordinates (i.e. steps)
|
||||||
float xBedProbePoints[NUMBER_OF_PROBE_POINTS]; // The X coordinates of the points on the bed at which to probe
|
float xBedProbePoints[NUMBER_OF_PROBE_POINTS]; // The X coordinates of the points on the bed at which to probe
|
||||||
float yBedProbePoints[NUMBER_OF_PROBE_POINTS]; // The Y coordinates of the points on the bed at which to probe
|
float yBedProbePoints[NUMBER_OF_PROBE_POINTS]; // The Y coordinates of the points on the bed at which to probe
|
||||||
|
@ -275,7 +273,7 @@ class Move
|
||||||
float tanXY, tanYZ, tanXZ; // Axis compensation - 90 degrees + angle gives angle between axes
|
float tanXY, tanYZ, tanXZ; // Axis compensation - 90 degrees + angle gives angle between axes
|
||||||
bool identityBedTransform; // Is the bed transform in operation?
|
bool identityBedTransform; // Is the bed transform in operation?
|
||||||
float xRectangle, yRectangle; // The side lengths of the rectangle used for second-degree bed compensation
|
float xRectangle, yRectangle; // The side lengths of the rectangle used for second-degree bed compensation
|
||||||
float lastZHit; // The last Z value hit by the probe
|
volatile float lastZHit; // The last Z value hit by the probe
|
||||||
bool zProbing; // Are we bed probing as well as moving?
|
bool zProbing; // Are we bed probing as well as moving?
|
||||||
float longWait; // A long time for things that need to be done occasionally
|
float longWait; // A long time for things that need to be done occasionally
|
||||||
};
|
};
|
||||||
|
@ -362,6 +360,7 @@ inline EndstopChecks LookAhead::EndStopsToCheck() const
|
||||||
return endStopsToCheck;
|
return endStopsToCheck;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is called from the step ISR. Any variables it modifies that are also read by code outside the ISR should be declared 'volatile'.
|
||||||
inline void LookAhead::SetDriveCoordinateAndZeroEndSpeed(float a, int8_t drive)
|
inline void LookAhead::SetDriveCoordinateAndZeroEndSpeed(float a, int8_t drive)
|
||||||
{
|
{
|
||||||
endPoint[drive] = EndPointToMachine(drive, a);
|
endPoint[drive] = EndPointToMachine(drive, a);
|
||||||
|
@ -603,7 +602,7 @@ inline float Move::SecondDegreeTransformZ(float x, float y) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// This is called from the step ISR. Any variables it modifies that are also read by code outside the ISR must be declared 'volatile'.
|
||||||
inline void Move::HitLowStop(int8_t drive, LookAhead* la, DDA* hitDDA)
|
inline void Move::HitLowStop(int8_t drive, LookAhead* la, DDA* hitDDA)
|
||||||
{
|
{
|
||||||
float hitPoint = platform->AxisMinimum(drive);
|
float hitPoint = platform->AxisMinimum(drive);
|
||||||
|
@ -642,6 +641,7 @@ inline void Move::HitLowStop(int8_t drive, LookAhead* la, DDA* hitDDA)
|
||||||
gCodes->SetAxisIsHomed(drive);
|
gCodes->SetAxisIsHomed(drive);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is called from the step ISR. Any variables it modifies that are also read by code outside the ISR must be declared 'volatile'.
|
||||||
inline void Move::HitHighStop(int8_t drive, LookAhead* la, DDA* hitDDA)
|
inline void Move::HitHighStop(int8_t drive, LookAhead* la, DDA* hitDDA)
|
||||||
{
|
{
|
||||||
la->SetDriveCoordinateAndZeroEndSpeed(platform->AxisMaximum(drive), drive);
|
la->SetDriveCoordinateAndZeroEndSpeed(platform->AxisMaximum(drive), drive);
|
||||||
|
|
14
Platform.cpp
14
Platform.cpp
|
@ -523,23 +523,27 @@ void Platform::Exit()
|
||||||
|
|
||||||
Compatibility Platform::Emulating() const
|
Compatibility Platform::Emulating() const
|
||||||
{
|
{
|
||||||
if(compatibility == reprapFirmware)
|
if (nvData.compatibility == reprapFirmware)
|
||||||
return me;
|
return me;
|
||||||
return compatibility;
|
return nvData.compatibility;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Platform::SetEmulating(Compatibility c)
|
void Platform::SetEmulating(Compatibility c)
|
||||||
{
|
{
|
||||||
if(c != me && c != reprapFirmware && c != marlin)
|
if (c != me && c != reprapFirmware && c != marlin)
|
||||||
{
|
{
|
||||||
Message(HOST_MESSAGE, "Attempt to emulate unsupported firmware.\n");
|
Message(HOST_MESSAGE, "Attempt to emulate unsupported firmware.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(c == reprapFirmware)
|
if (c == reprapFirmware)
|
||||||
{
|
{
|
||||||
c = me;
|
c = me;
|
||||||
}
|
}
|
||||||
compatibility = c;
|
if (c != nvData.compatibility)
|
||||||
|
{
|
||||||
|
nvData.compatibility = c;
|
||||||
|
WriteNvData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Platform::UpdateNetworkAddress(byte dst[4], const byte src[4])
|
void Platform::UpdateNetworkAddress(byte dst[4], const byte src[4])
|
||||||
|
|
|
@ -160,9 +160,9 @@ const float defaultThermistor25RS[HEATERS] = {10000.0, 100000.0, 100000.0, 10000
|
||||||
// This allows us to switch between PID and bang-bang using the M301 and M304 commands.
|
// This allows us to switch between PID and bang-bang using the M301 and M304 commands.
|
||||||
|
|
||||||
// We use method 2 (see above)
|
// We use method 2 (see above)
|
||||||
const float defaultPidKis[HEATERS] = {5.0 / HEAT_SAMPLE_TIME, 0.1 / HEAT_SAMPLE_TIME, 0.1 / HEAT_SAMPLE_TIME, 0.1 / HEAT_SAMPLE_TIME, 0.1 / HEAT_SAMPLE_TIME, 0.1 / HEAT_SAMPLE_TIME}; // Integral PID constants
|
const float defaultPidKis[HEATERS] = {5.0, 0.1, 0.1, 0.1, 0.1, 0.1}; // Integral PID constants
|
||||||
const float defaultPidKds[HEATERS] = {500.0 * HEAT_SAMPLE_TIME, 100 * HEAT_SAMPLE_TIME, 100 * HEAT_SAMPLE_TIME, 100 * HEAT_SAMPLE_TIME, 100 * HEAT_SAMPLE_TIME, 100 * HEAT_SAMPLE_TIME}; // Derivative PID constants
|
const float defaultPidKds[HEATERS] = {500.0, 100.0, 100.0, 100.0, 100.0, 100.0}; // Derivative PID constants
|
||||||
const float defaultPidKps[HEATERS] = {-1, 10.0, 10.0, 10.0, 10.0, 10.0}; // Proportional PID constants, negative values indicate use bang-bang instead of PID
|
const float defaultPidKps[HEATERS] = {-1.0, 10.0, 10.0, 10.0, 10.0, 10.0}; // Proportional PID constants, negative values indicate use bang-bang instead of PID
|
||||||
const float defaultPidKts[HEATERS] = {2.7, 0.25, 0.25, 0.25, 0.25, 0.25}; // approximate PWM value needed to maintain temperature, per degC above room temperature
|
const float defaultPidKts[HEATERS] = {2.7, 0.25, 0.25, 0.25, 0.25, 0.25}; // approximate PWM value needed to maintain temperature, per degC above room temperature
|
||||||
const float defaultPidKss[HEATERS] = {1.0, 0.9, 0.9, 0.9, 0.9, 0.9}; // PWM scaling factor, to allow for variation in heater power and supply voltage
|
const float defaultPidKss[HEATERS] = {1.0, 0.9, 0.9, 0.9, 0.9, 0.9}; // PWM scaling factor, to allow for variation in heater power and supply voltage
|
||||||
const float defaultFullBand[HEATERS] = {5.0, 30.0, 30.0, 30.0, 30.0, 30.0}; // errors larger than this cause heater to be on or off
|
const float defaultFullBand[HEATERS] = {5.0, 30.0, 30.0, 30.0, 30.0, 30.0}; // errors larger than this cause heater to be on or off
|
||||||
|
@ -691,7 +691,6 @@ private:
|
||||||
unsigned long lastTimeCall;
|
unsigned long lastTimeCall;
|
||||||
|
|
||||||
bool active;
|
bool active;
|
||||||
Compatibility compatibility;
|
|
||||||
uint32_t errorCodeBits;
|
uint32_t errorCodeBits;
|
||||||
|
|
||||||
void InitialiseInterrupts();
|
void InitialiseInterrupts();
|
||||||
|
|
|
@ -1071,7 +1071,7 @@ void Webserver::HttpInterpreter::GetStatusResponse(StringRef& response, uint8_t
|
||||||
response.cat("]");
|
response.cat("]");
|
||||||
|
|
||||||
// Send the speed and extruder override factors
|
// Send the speed and extruder override factors
|
||||||
response.catf(",\"sfactor\":%.2f,\"efactor:\":", gc->GetSpeedFactor() * 100.0);
|
response.catf(",\"sfactor\":%.2f,\"efactor\":", gc->GetSpeedFactor() * 100.0);
|
||||||
const float *extrusionFactors = gc->GetExtrusionFactors();
|
const float *extrusionFactors = gc->GetExtrusionFactors();
|
||||||
for (unsigned int i = 0; i < reprap.GetExtrudersInUse(); ++i)
|
for (unsigned int i = 0; i < reprap.GetExtrudersInUse(); ++i)
|
||||||
{
|
{
|
||||||
|
|
Reference in a new issue