|
@ -60,39 +60,40 @@ |
|
|
*/ |
|
|
*/ |
|
|
void GcodeSuite::M106() { |
|
|
void GcodeSuite::M106() { |
|
|
const uint8_t pfan = parser.byteval('P', _ALT_P); |
|
|
const uint8_t pfan = parser.byteval('P', _ALT_P); |
|
|
|
|
|
if (pfan >= _CNT_P) return; |
|
|
|
|
|
#if REDUNDANT_PART_COOLING_FAN |
|
|
|
|
|
if (pfan == REDUNDANT_PART_COOLING_FAN) return; |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
if (pfan < _CNT_P) { |
|
|
#if ENABLED(EXTRA_FAN_SPEED) |
|
|
|
|
|
const uint16_t t = parser.intval('T'); |
|
|
#if ENABLED(EXTRA_FAN_SPEED) |
|
|
if (t > 0) return thermalManager.set_temp_fan_speed(pfan, t); |
|
|
const uint16_t t = parser.intval('T'); |
|
|
#endif |
|
|
if (t > 0) return thermalManager.set_temp_fan_speed(pfan, t); |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
const uint16_t dspeed = parser.seen_test('A') ? thermalManager.fan_speed[active_extruder] : 255; |
|
|
const uint16_t dspeed = parser.seen_test('A') ? thermalManager.fan_speed[active_extruder] : 255; |
|
|
|
|
|
|
|
|
uint16_t speed = dspeed; |
|
|
uint16_t speed = dspeed; |
|
|
|
|
|
|
|
|
// Accept 'I' if temperature presets are defined
|
|
|
// Accept 'I' if temperature presets are defined
|
|
|
#if PREHEAT_COUNT |
|
|
#if PREHEAT_COUNT |
|
|
const bool got_preset = parser.seenval('I'); |
|
|
const bool got_preset = parser.seenval('I'); |
|
|
if (got_preset) speed = ui.material_preset[_MIN(parser.value_byte(), PREHEAT_COUNT - 1)].fan_speed; |
|
|
if (got_preset) speed = ui.material_preset[_MIN(parser.value_byte(), PREHEAT_COUNT - 1)].fan_speed; |
|
|
#else |
|
|
#else |
|
|
constexpr bool got_preset = false; |
|
|
constexpr bool got_preset = false; |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
if (!got_preset && parser.seenval('S')) |
|
|
if (!got_preset && parser.seenval('S')) |
|
|
speed = parser.value_ushort(); |
|
|
speed = parser.value_ushort(); |
|
|
|
|
|
|
|
|
TERN_(FOAMCUTTER_XYUV, speed *= 2.55); // Get command in % of max heat
|
|
|
TERN_(FOAMCUTTER_XYUV, speed *= 2.55); // Get command in % of max heat
|
|
|
|
|
|
|
|
|
// Set speed, with constraint
|
|
|
// Set speed, with constraint
|
|
|
thermalManager.set_fan_speed(pfan, speed); |
|
|
thermalManager.set_fan_speed(pfan, speed); |
|
|
|
|
|
|
|
|
TERN_(LASER_SYNCHRONOUS_M106_M107, planner.buffer_sync_block(BLOCK_FLAG_SYNC_FANS)); |
|
|
TERN_(LASER_SYNCHRONOUS_M106_M107, planner.buffer_sync_block(BLOCK_FLAG_SYNC_FANS)); |
|
|
|
|
|
|
|
|
if (TERN0(DUAL_X_CARRIAGE, idex_is_duplicating())) // pfan == 0 when duplicating
|
|
|
if (TERN0(DUAL_X_CARRIAGE, idex_is_duplicating())) // pfan == 0 when duplicating
|
|
|
thermalManager.set_fan_speed(1 - pfan, speed); |
|
|
thermalManager.set_fan_speed(1 - pfan, speed); |
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/**
|
|
|
/**
|
|
@ -101,6 +102,9 @@ void GcodeSuite::M106() { |
|
|
void GcodeSuite::M107() { |
|
|
void GcodeSuite::M107() { |
|
|
const uint8_t pfan = parser.byteval('P', _ALT_P); |
|
|
const uint8_t pfan = parser.byteval('P', _ALT_P); |
|
|
if (pfan >= _CNT_P) return; |
|
|
if (pfan >= _CNT_P) return; |
|
|
|
|
|
#if REDUNDANT_PART_COOLING_FAN |
|
|
|
|
|
if (pfan == REDUNDANT_PART_COOLING_FAN) return; |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
thermalManager.set_fan_speed(pfan, 0); |
|
|
thermalManager.set_fan_speed(pfan, 0); |
|
|
|
|
|
|
|
|