Skip to content

Commit

Permalink
1.37v7
Browse files Browse the repository at this point in the history
- patching extrusion multi to use error sum
- saving rom space
  • Loading branch information
Nibbels committed Oct 11, 2017
1 parent 2704206 commit e840416
Show file tree
Hide file tree
Showing 12 changed files with 308 additions and 174 deletions.
23 changes: 12 additions & 11 deletions Repetier/Commands.cpp
Expand Up @@ -331,18 +331,19 @@ void Commands::changeFeedrateMultiply(int factor)
} // changeFeedrateMultiply


void Commands::changeFlowateMultiply(int factor)
void Commands::changeFlowrateMultiply(float factorpercent)
{
if(factor<25) factor = 25;
if(factor>200) factor = 200;
Printer::extrudeMultiply = factor;

if( Printer::debugInfo() )
{
Com::printFLN(Com::tFlowMultiply,factor);
}
if(factorpercent < 25.0f) factorpercent = 25.0f;
if(factorpercent > 200.0f) factorpercent = 200.0f;
Printer::extrudeMultiply = static_cast<int>(factorpercent);
//if(Extruder::current->diameter <= 0)
Printer::extrusionFactor = 0.01f * static_cast<float>(factorpercent);
//else
// Printer::extrusionFactor = 0.01f * static_cast<float>(factor) * 4.0f / (Extruder::current->diameter * Extruder::current->diameter * 3.141592654f);

} // changeFlowateMultiply
Com::printFLN(Com::tFlowMultiply,factorpercent);
} // changeFlowrateMultiply


#if FAN_PIN>-1 && FEATURE_FAN_CONTROL
Expand Down Expand Up @@ -1661,7 +1662,7 @@ void Commands::executeGCode(GCode *com)
}
case 221: // M221 - S<Extrusion flow multiplier in percent>
{
changeFlowateMultiply(com->getS(100));
changeFlowrateMultiply(static_cast<float>(com->getS(100)));
break;
}

Expand Down
2 changes: 1 addition & 1 deletion Repetier/Commands.h
Expand Up @@ -36,7 +36,7 @@ class Commands
static void adjustFanMode(uint8_t output_mode = 0);
#endif // FAN_PIN>-1 && FEATURE_FAN_CONTROL
static void changeFeedrateMultiply(int factorInPercent);
static void changeFlowateMultiply(int factorInPercent);
static void changeFlowrateMultiply(float factorInPercent);
static void reportPrinterUsage();
static void emergencyStop();
static void checkFreeMemory();
Expand Down
5 changes: 4 additions & 1 deletion Repetier/Communication.cpp
Expand Up @@ -79,6 +79,7 @@ FSTRINGVALUE(Com::tSlash,"/")
FSTRINGVALUE(Com::tSpaceSlash," /")
FSTRINGVALUE(Com::tSpeedMultiply,"SpeedMultiply:")
FSTRINGVALUE(Com::tFlowMultiply,"FlowMultiply:")
FSTRINGVALUE(Com::tPrintingIsInProcessError, "Error: printing is in progress")
FSTRINGVALUE(Com::tFanspeed,"Fanspeed:")
FSTRINGVALUE(Com::tPrintedFilament,"Printed filament:")
FSTRINGVALUE(Com::tPrintingTime,"Printing time:")
Expand Down Expand Up @@ -113,7 +114,9 @@ FSTRINGVALUE(Com::tCommaSpeedEqual,", speed=")
FSTRINGVALUE(Com::tEEPROMUpdated,"EEPROM updated")
FSTRINGVALUE(Com::tLinearLColon,"linear L:")
FSTRINGVALUE(Com::tQuadraticKColon," quadratic K:")

FSTRINGVALUE(Com::tscanHeatBed,"scanHeatBed(): ")
FSTRINGVALUE(Com::tscanWorkPart,"scanWorkPart(): ")
FSTRINGVALUE(Com::tAutoMatrixLeveling,"Auto-Matrix-Leveling @X:")
#if FEATURE_SERVICE_INTERVAL
FSTRINGVALUE(Com::tPrintedFilamentService,"Printed filament since last Service:")
FSTRINGVALUE(Com::tPrintingTimeService,"Printing time since last Service:")
Expand Down
4 changes: 4 additions & 0 deletions Repetier/Communication.h
Expand Up @@ -80,6 +80,7 @@ class Com
FSTRINGVAR(tColon)
FSTRINGVAR(tSpeedMultiply)
FSTRINGVAR(tFlowMultiply)
FSTRINGVAR(tPrintingIsInProcessError)
FSTRINGVAR(tFanspeed)
FSTRINGVAR(tPrintedFilament)
FSTRINGVAR(tPrintingTime)
Expand Down Expand Up @@ -116,6 +117,9 @@ class Com
FSTRINGVAR(tLinearLColon)
FSTRINGVAR(tQuadraticKColon)
FSTRINGVAR(tEEPROMUpdated)
FSTRINGVAR(tscanHeatBed)
FSTRINGVAR(tscanWorkPart)
FSTRINGVAR(tAutoMatrixLeveling)

#if FEATURE_SERVICE_INTERVAL
FSTRINGVAR(tPrintedFilamentService)
Expand Down
2 changes: 1 addition & 1 deletion Repetier/Constants.h
Expand Up @@ -20,7 +20,7 @@
#define CONSTANTS_H


#define REPETIER_VERSION "RF.01.37v6.Mod"
#define REPETIER_VERSION "RF.01.37v7.Mod"
#define UI_PRINTER_COMPANY "Conrad Community"
#define UI_VERSION_STRING "V " REPETIER_VERSION

Expand Down
3 changes: 3 additions & 0 deletions Repetier/Extruder.cpp
Expand Up @@ -431,6 +431,9 @@ void Extruder::selectExtruderById(uint8_t extruderId)
Printer::extruderOffset[X_AXIS] = -Extruder::current->xOffset*Printer::invAxisStepsPerMM[X_AXIS];
Printer::extruderOffset[Y_AXIS] = -Extruder::current->yOffset*Printer::invAxisStepsPerMM[Y_AXIS];
Printer::extruderOffset[Z_AXIS] = -Extruder::current->zOffset*Printer::invAxisStepsPerMM[Z_AXIS];

//uncomment when inserting diameter for hotend x // Commands::changeFlowrateMultiply(static_cast<float>(Printer::extrudeMultiply)); // needed to adjust extrusionFactor to possibly different diameter

if(Printer::areAxisHomed())
{
float oldfeedrate = Printer::feedrate;
Expand Down
31 changes: 14 additions & 17 deletions Repetier/Printer.cpp
Expand Up @@ -90,6 +90,8 @@ float Printer::minMM[3];
float Printer::feedrate; ///< Last requested feedrate.
int Printer::feedrateMultiply; ///< Multiplier for feedrate in percent (factor 1 = 100)
int Printer::extrudeMultiply; ///< Flow multiplier in percdent (factor 1 = 100)
float Printer::extrudeMultiplyError = 0;
float Printer::extrusionFactor = 1.0;
float Printer::maxJerk; ///< Maximum allowed jerk in mm/s
float Printer::maxZJerk; ///< Maximum allowed jerk in z direction in mm/s
float Printer::extruderOffset[3]; ///< offset for different extruder positions.
Expand Down Expand Up @@ -606,27 +608,26 @@ uint8_t Printer::setDestinationStepsFromGCode(GCode *com)
{
if(
#if MIN_EXTRUDER_TEMP > 30
Extruder::current->tempControl.currentTemperatureC<MIN_EXTRUDER_TEMP ||
Extruder::current->tempControl.currentTemperatureC < MIN_EXTRUDER_TEMP ||
#endif // MIN_EXTRUDER_TEMP > 30

fabs(p - queuePositionLastSteps[E_AXIS]) > EXTRUDE_MAXLENGTH * axisStepsPerMM[E_AXIS])
{
p = 0;
}
fabs(com->E) * extrusionFactor > EXTRUDE_MAXLENGTH)
{
p = 0;
}
queuePositionTargetSteps[E_AXIS] = queuePositionLastSteps[E_AXIS] + p;

}
else
{
if(
#if MIN_EXTRUDER_TEMP > 30
Extruder::current->tempControl.currentTemperatureC<MIN_EXTRUDER_TEMP ||
Extruder::current->tempControl.currentTemperatureC < MIN_EXTRUDER_TEMP ||
#endif // MIN_EXTRUDER_TEMP > 30

fabs(p - queuePositionLastSteps[E_AXIS]) > EXTRUDE_MAXLENGTH * axisStepsPerMM[E_AXIS])
{
queuePositionLastSteps[E_AXIS] = p;
}
fabs(p - queuePositionLastSteps[E_AXIS]) * extrusionFactor > EXTRUDE_MAXLENGTH * axisStepsPerMM[E_AXIS])
{
queuePositionLastSteps[E_AXIS] = p;
}
queuePositionTargetSteps[E_AXIS] = p;
}
}
Expand All @@ -638,17 +639,13 @@ uint8_t Printer::setDestinationStepsFromGCode(GCode *com)
if(com->hasF())
{
if(unitIsInches)
feedrate = com->F * 0.0042333f * (float)feedrateMultiply; // Factor is 25.5/60/100
feedrate = com->F * (float)feedrateMultiply * 0.0042333f; // Factor is 25.5/60/100
else
feedrate = com->F * 0.00016666666f * (float)feedrateMultiply;
feedrate = com->F * (float)feedrateMultiply * 0.00016666666f;
}

if(!Printer::isPositionAllowed(x,y,z))
{
if( Printer::debugErrors() )
{
//Com::printFLN( PSTR( "We should not be here." ) );
}
queuePositionLastSteps[E_AXIS] = queuePositionTargetSteps[E_AXIS];
return false; // ignore move
}
Expand Down
2 changes: 2 additions & 0 deletions Repetier/Printer.h
Expand Up @@ -101,6 +101,8 @@ class Printer
static float feedrate; // Last requested feedrate.
static int feedrateMultiply; // Multiplier for feedrate in percent (factor 1 = 100)
static int extrudeMultiply; // Flow multiplier in percdent (factor 1 = 100)
static float extrudeMultiplyError; //< Accumulated error during extrusion
static float extrusionFactor; //< Extrusion multiply factor
static float maxJerk; // Maximum allowed jerk in mm/s
static float maxZJerk; // Maximum allowed jerk in z direction in mm/s
static float extruderOffset[3]; // offset for different extruder positions.
Expand Down

0 comments on commit e840416

Please sign in to comment.