How to enable software control for extruder fan in G code? November 19, 2016 06:40PM |
Registered: 7 years ago Posts: 21 |
Re: How to enable software control for extruder fan in G code? November 25, 2016 11:43AM |
Registered: 8 years ago Posts: 552 |
#if FAN_COUNT > 0 /** * M106: Set Fan Speed * * S Speed between 0-255 * P Fan index, if more than one fan */ inline void gcode_M106() { uint16_t s = code_seen('S') ? code_value_ushort() : 255, p = code_seen('P') ? code_value_ushort() : 0; NOMORE(s, 255); if (p < FAN_COUNT) fanSpeeds[p] = s; } /** * M107: Fan Off */ inline void gcode_M107() { uint16_t p = code_seen('P') ? code_value_ushort() : 0; if (p < FAN_COUNT) fanSpeeds[p] = 0; } #endif // FAN_COUNT > 0 /** * M145: Set the heatup state for a material in the LCD menu * S (0=PLA, 1=ABS) * H * B * F */ inline void gcode_M145() { int8_t material = code_seen('S') ? (int8_t)code_value_int() : 0; if (material < 0 || material > 1) { SERIAL_ERROR_START; SERIAL_ERRORLNPGM(MSG_ERR_MATERIAL_INDEX); } else { int v; switch (material) { case 0: if (code_seen('H')) { v = code_value_int(); plaPreheatHotendTemp = constrain(v, EXTRUDE_MINTEMP, HEATER_0_MAXTEMP - 15); } if (code_seen('F')) { v = code_value_int(); plaPreheatFanSpeed = constrain(v, 0, 255); } #if TEMP_SENSOR_BED != 0 if (code_seen('B')) { v = code_value_int(); plaPreheatHPBTemp = constrain(v, BED_MINTEMP, BED_MAXTEMP - 15); } #endif break; case 1: if (code_seen('H')) { v = code_value_int(); absPreheatHotendTemp = constrain(v, EXTRUDE_MINTEMP, HEATER_0_MAXTEMP - 15); } if (code_seen('F')) { v = code_value_int(); absPreheatFanSpeed = constrain(v, 0, 255); } #if TEMP_SENSOR_BED != 0 if (code_seen('B')) { v = code_value_int(); absPreheatHPBTemp = constrain(v, BED_MINTEMP, BED_MAXTEMP - 15); } #endif break; } } }