diff --git a/Configuration.h b/Configuration.h index 57b81df..51bb5ac 100644 --- a/Configuration.h +++ b/Configuration.h @@ -24,7 +24,7 @@ Licence: GPL #define CONFIGURATION_H #define NAME "RepRapFirmware" -#define VERSION "0.57p-dc42" +#define VERSION "0.57q-dc42" #define DATE "2014-02-24" #define LAST_AUTHOR "dc42" diff --git a/GCodes.cpp b/GCodes.cpp index 5fbc2e8..2165c2d 100644 --- a/GCodes.cpp +++ b/GCodes.cpp @@ -59,7 +59,9 @@ void GCodes::Init() gCodeLetters = GCODE_LETTERS; distanceScale = 1.0; for (int8_t i = 0; i < DRIVES - AXES; i++) + { lastPos[i] = 0.0; + } fileBeingPrinted = NULL; fileToPrint = NULL; fileBeingWritten = NULL; @@ -85,6 +87,7 @@ void GCodes::Init() longWait = platform->Time(); dwellTime = longWait; axisIsHomed[X_AXIS] = axisIsHomed[Y_AXIS] = axisIsHomed[Z_AXIS] = false; + fanMaxPwm = 1.0; } void GCodes::doFilePrint(GCodeBuffer* gb) @@ -1580,8 +1583,16 @@ bool GCodes::ActOnGcode(GCodeBuffer *gb) break; case 106: // Fan on or off + if (gb->Seen('P')) + { + // slic3r and Cura expect PWM values to go from 0 to 255, but we expect PWM value to go from 0.0 to 1.0. + // So I've added a P parameter to allow the top end of the range to be set, so we can be compatible with those programs. + fanMaxPwm = fmax(gb->GetFValue(), 1.0); + } if (gb->Seen('S')) - platform->CoolingFan(gb->GetFValue()); + { + platform->CoolingFan(fmax(gb->GetFValue(), 0.0)/fanMaxPwm); + } break; case 107: // Fan off - deprecated diff --git a/GCodes.h b/GCodes.h index 3419b9f..4cacf31 100644 --- a/GCodes.h +++ b/GCodes.h @@ -118,8 +118,8 @@ class GCodes bool SendConfigToLine(); void WriteHTMLToFile(char b, GCodeBuffer *gb); bool OffsetAxes(GCodeBuffer *gb); - int8_t Heater(int8_t head) const; + Platform* platform; bool active; Webserver* webserver; @@ -166,6 +166,7 @@ class GCodes bool zProbesSet; float longWait; bool axisIsHomed[3]; // these record which of the axes have been homed + float fanMaxPwm; // the M106 S value that represents 100% fan speed }; //***************************************************************************************************** diff --git a/Platform.h b/Platform.h index 7387897..f21dea1 100644 --- a/Platform.h +++ b/Platform.h @@ -133,7 +133,7 @@ Licence: GPL #define TEMP_INTERVAL 0.122 // secs - check and control temperatures this often #define STANDBY_TEMPERATURES {ABS_ZERO, ABS_ZERO} // We specify one for the bed, though it's not needed #define ACTIVE_TEMPERATURES {ABS_ZERO, ABS_ZERO} -#define COOLING_FAN_PIN 34 +#define COOLING_FAN_PIN X6 #define HEAT_ON 0 // 0 for inverted heater (eg Duet v0.6) 1 for not (e.g. Duet v0.4) #define AD_RANGE 1023.0//16383 // The A->D converter that measures temperatures gives an int this big as its max value @@ -899,7 +899,8 @@ inline void Platform::CoolingFan(float speed) { if(coolingFanPin < 0) return; - analogWrite(coolingFanPin, (uint8_t)(speed*255.0)); + // The cooling fan output pin gets inverted + analogWriteNonDue(coolingFanPin, (uint32_t)((1.0 - speed)*255.0)); } //inline void Platform::SetHeatOn(int8_t ho) diff --git a/Release/RepRapFirmware-057q-dc42.bin b/Release/RepRapFirmware-057q-dc42.bin new file mode 100644 index 0000000..3fdc8b1 Binary files /dev/null and b/Release/RepRapFirmware-057q-dc42.bin differ