Extend M106/M107 for better laser module support (#16082)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
Martijn Bosgraaf
2021-03-24 18:21:11 +01:00
committed by GitHub
parent 3ae892bf91
commit 30e7e2c276
14 changed files with 189 additions and 89 deletions

View File

@ -28,6 +28,10 @@
#include "../../module/motion.h"
#include "../../module/temperature.h"
#if ENABLED(LASER_SYNCHRONOUS_M106_M107)
#include "../../module/planner.h"
#endif
#if PREHEAT_COUNT
#include "../../lcd/marlinui.h"
#endif
@ -82,6 +86,8 @@ void GcodeSuite::M106() {
// Set speed, with constraint
thermalManager.set_fan_speed(pfan, speed);
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
thermalManager.set_fan_speed(1 - pfan, speed);
}
@ -92,12 +98,14 @@ void GcodeSuite::M106() {
*/
void GcodeSuite::M107() {
const uint8_t pfan = parser.byteval('P', _ALT_P);
if (pfan < _CNT_P) {
thermalManager.set_fan_speed(pfan, 0);
if (pfan >= _CNT_P) return;
if (TERN0(DUAL_X_CARRIAGE, idex_is_duplicating())) // pfan == 0 when duplicating
thermalManager.set_fan_speed(1 - pfan, 0);
}
thermalManager.set_fan_speed(pfan, 0);
if (TERN0(DUAL_X_CARRIAGE, idex_is_duplicating())) // pfan == 0 when duplicating
thermalManager.set_fan_speed(1 - pfan, 0);
TERN_(LASER_SYNCHRONOUS_M106_M107, planner.buffer_sync_block(BLOCK_FLAG_SYNC_FANS));
}
#endif // HAS_FAN