|
@@ -60,39 +60,40 @@
|
60
|
60
|
*/
|
61
|
61
|
void GcodeSuite::M106() {
|
62
|
62
|
const uint8_t pfan = parser.byteval('P', _ALT_P);
|
|
63
|
+ if (pfan >= _CNT_P) return;
|
|
64
|
+ #if REDUNDANT_PART_COOLING_FAN
|
|
65
|
+ if (pfan == REDUNDANT_PART_COOLING_FAN) return;
|
|
66
|
+ #endif
|
63
|
67
|
|
64
|
|
- if (pfan < _CNT_P) {
|
65
|
|
-
|
66
|
|
- #if ENABLED(EXTRA_FAN_SPEED)
|
67
|
|
- const uint16_t t = parser.intval('T');
|
68
|
|
- if (t > 0) return thermalManager.set_temp_fan_speed(pfan, t);
|
69
|
|
- #endif
|
|
68
|
+ #if ENABLED(EXTRA_FAN_SPEED)
|
|
69
|
+ const uint16_t t = parser.intval('T');
|
|
70
|
+ if (t > 0) return thermalManager.set_temp_fan_speed(pfan, t);
|
|
71
|
+ #endif
|
70
|
72
|
|
71
|
|
- const uint16_t dspeed = parser.seen_test('A') ? thermalManager.fan_speed[active_extruder] : 255;
|
|
73
|
+ const uint16_t dspeed = parser.seen_test('A') ? thermalManager.fan_speed[active_extruder] : 255;
|
72
|
74
|
|
73
|
|
- uint16_t speed = dspeed;
|
|
75
|
+ uint16_t speed = dspeed;
|
74
|
76
|
|
75
|
|
- // Accept 'I' if temperature presets are defined
|
76
|
|
- #if PREHEAT_COUNT
|
77
|
|
- const bool got_preset = parser.seenval('I');
|
78
|
|
- if (got_preset) speed = ui.material_preset[_MIN(parser.value_byte(), PREHEAT_COUNT - 1)].fan_speed;
|
79
|
|
- #else
|
80
|
|
- constexpr bool got_preset = false;
|
81
|
|
- #endif
|
|
77
|
+ // Accept 'I' if temperature presets are defined
|
|
78
|
+ #if PREHEAT_COUNT
|
|
79
|
+ const bool got_preset = parser.seenval('I');
|
|
80
|
+ if (got_preset) speed = ui.material_preset[_MIN(parser.value_byte(), PREHEAT_COUNT - 1)].fan_speed;
|
|
81
|
+ #else
|
|
82
|
+ constexpr bool got_preset = false;
|
|
83
|
+ #endif
|
82
|
84
|
|
83
|
|
- if (!got_preset && parser.seenval('S'))
|
84
|
|
- speed = parser.value_ushort();
|
|
85
|
+ if (!got_preset && parser.seenval('S'))
|
|
86
|
+ speed = parser.value_ushort();
|
85
|
87
|
|
86
|
|
- TERN_(FOAMCUTTER_XYUV, speed *= 2.55); // Get command in % of max heat
|
|
88
|
+ TERN_(FOAMCUTTER_XYUV, speed *= 2.55); // Get command in % of max heat
|
87
|
89
|
|
88
|
|
- // Set speed, with constraint
|
89
|
|
- thermalManager.set_fan_speed(pfan, speed);
|
|
90
|
+ // Set speed, with constraint
|
|
91
|
+ thermalManager.set_fan_speed(pfan, speed);
|
90
|
92
|
|
91
|
|
- TERN_(LASER_SYNCHRONOUS_M106_M107, planner.buffer_sync_block(BLOCK_FLAG_SYNC_FANS));
|
|
93
|
+ TERN_(LASER_SYNCHRONOUS_M106_M107, planner.buffer_sync_block(BLOCK_FLAG_SYNC_FANS));
|
92
|
94
|
|
93
|
|
- if (TERN0(DUAL_X_CARRIAGE, idex_is_duplicating())) // pfan == 0 when duplicating
|
94
|
|
- thermalManager.set_fan_speed(1 - pfan, speed);
|
95
|
|
- }
|
|
95
|
+ if (TERN0(DUAL_X_CARRIAGE, idex_is_duplicating())) // pfan == 0 when duplicating
|
|
96
|
+ thermalManager.set_fan_speed(1 - pfan, speed);
|
96
|
97
|
}
|
97
|
98
|
|
98
|
99
|
/**
|
|
@@ -101,6 +102,9 @@ void GcodeSuite::M106() {
|
101
|
102
|
void GcodeSuite::M107() {
|
102
|
103
|
const uint8_t pfan = parser.byteval('P', _ALT_P);
|
103
|
104
|
if (pfan >= _CNT_P) return;
|
|
105
|
+ #if REDUNDANT_PART_COOLING_FAN
|
|
106
|
+ if (pfan == REDUNDANT_PART_COOLING_FAN) return;
|
|
107
|
+ #endif
|
104
|
108
|
|
105
|
109
|
thermalManager.set_fan_speed(pfan, 0);
|
106
|
110
|
|