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:
David Crocker 2014-08-24 22:49:01 +01:00
parent 13f2ab5bfd
commit 3520c24546
8 changed files with 25 additions and 54 deletions

View file

@ -24,8 +24,8 @@ Licence: GPL
#define CONFIGURATION_H
#define NAME "RepRapFirmware"
#define VERSION "0.78k-dc42"
#define DATE "2014-08-18"
#define VERSION "0.78m-dc42"
#define DATE "2014-08-24"
#define AUTHORS "reprappro, dc42, zpl"
// Other firmware that we might switch to be compatible with.

View file

@ -1563,7 +1563,7 @@ void GCodes::SetPidParameters(GCodeBuffer *gb, int heater, StringRef& reply)
else
{
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;

View file

@ -229,12 +229,13 @@ void PID::Spin()
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;
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;
lastTemperature = temperature;

View file

@ -103,8 +103,6 @@ void Move::Init()
lastMove->Release();
liveCoordinates[DRIVES] = platform->HomeFeedRate(slow);
SetStepHypotenuse();
currentFeedrate = -1.0;
SetIdentityTransform();
@ -405,35 +403,6 @@ bool Move::GetCurrentUserPosition(float m[])
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
// possible.
@ -1150,6 +1119,8 @@ void DDA::Start()
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()
{
if(!active)

8
Move.h
View file

@ -202,7 +202,6 @@ class Move
void Diagnostics(); // Report useful stuff
float ComputeCurrentCoordinate(int8_t drive,// Turn a DDA value back into a real world coordinate
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
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
@ -262,7 +261,6 @@ class Move
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 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)
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
@ -275,7 +273,7 @@ class Move
float tanXY, tanYZ, tanXZ; // Axis compensation - 90 degrees + angle gives angle between axes
bool identityBedTransform; // Is the bed transform in operation?
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?
float longWait; // A long time for things that need to be done occasionally
};
@ -362,6 +360,7 @@ inline EndstopChecks LookAhead::EndStopsToCheck() const
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)
{
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)
{
float hitPoint = platform->AxisMinimum(drive);
@ -642,6 +641,7 @@ inline void Move::HitLowStop(int8_t drive, LookAhead* la, DDA* hitDDA)
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)
{
la->SetDriveCoordinateAndZeroEndSpeed(platform->AxisMaximum(drive), drive);

View file

@ -523,23 +523,27 @@ void Platform::Exit()
Compatibility Platform::Emulating() const
{
if(compatibility == reprapFirmware)
if (nvData.compatibility == reprapFirmware)
return me;
return compatibility;
return nvData.compatibility;
}
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");
return;
}
if(c == reprapFirmware)
if (c == reprapFirmware)
{
c = me;
}
compatibility = c;
if (c != nvData.compatibility)
{
nvData.compatibility = c;
WriteNvData();
}
}
void Platform::UpdateNetworkAddress(byte dst[4], const byte src[4])

View file

@ -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.
// 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 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 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 defaultPidKis[HEATERS] = {5.0, 0.1, 0.1, 0.1, 0.1, 0.1}; // Integral 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.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 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
@ -691,7 +691,6 @@ private:
unsigned long lastTimeCall;
bool active;
Compatibility compatibility;
uint32_t errorCodeBits;
void InitialiseInterrupts();

View file

@ -1071,7 +1071,7 @@ void Webserver::HttpInterpreter::GetStatusResponse(StringRef& response, uint8_t
response.cat("]");
// 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();
for (unsigned int i = 0; i < reprap.GetExtrudersInUse(); ++i)
{