Sync MK3<->MK4 MMU2 mmu2_mk4.cpp formatting

This commit is contained in:
D.R.racer 2023-09-11 12:49:30 +02:00 committed by DRracer
parent be5523187b
commit 7db7250773
1 changed files with 6 additions and 4 deletions

View File

@ -115,7 +115,7 @@ void MMU2::ResetX0() {
logic.ResetMMU(); // Send soft reset logic.ResetMMU(); // Send soft reset
} }
void MMU2::ResetX42(){ void MMU2::ResetX42() {
logic.ResetMMU(42); logic.ResetMMU(42);
} }
@ -927,7 +927,7 @@ void MMU2::execute_extruder_sequence(const E_Step *sequence, uint8_t steps) {
planner_synchronize(); planner_synchronize();
const E_Step *step = sequence; const E_Step *step = sequence;
for (uint8_t i = steps; i ; --i) { for (uint8_t i = steps; i > 0; --i) {
extruder_move(pgm_read_float(&(step->extrude)), pgm_read_float(&(step->feedRate))); extruder_move(pgm_read_float(&(step->extrude)), pgm_read_float(&(step->feedRate)));
step++; step++;
} }
@ -980,6 +980,7 @@ void MMU2::ReportError(ErrorCode ec, ErrorSource res) {
IncrementMMUFails(); IncrementMMUFails();
// check if it is a "power" failure - we consider TMC-related errors as power failures // check if it is a "power" failure - we consider TMC-related errors as power failures
// clang-format off
static constexpr uint16_t tmcMask = static constexpr uint16_t tmcMask =
( (uint16_t)ErrorCode::TMC_IOIN_MISMATCH ( (uint16_t)ErrorCode::TMC_IOIN_MISMATCH
| (uint16_t)ErrorCode::TMC_RESET | (uint16_t)ErrorCode::TMC_RESET
@ -988,6 +989,7 @@ void MMU2::ReportError(ErrorCode ec, ErrorSource res) {
| (uint16_t)ErrorCode::TMC_OVER_TEMPERATURE_WARN | (uint16_t)ErrorCode::TMC_OVER_TEMPERATURE_WARN
| (uint16_t)ErrorCode::TMC_OVER_TEMPERATURE_ERROR | (uint16_t)ErrorCode::TMC_OVER_TEMPERATURE_ERROR
| (uint16_t)ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION ) & 0x7fffU; // skip the top bit | (uint16_t)ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION ) & 0x7fffU; // skip the top bit
// clang-format on
static_assert(tmcMask == 0x7e00); // just make sure we fail compilation if any of the TMC error codes change static_assert(tmcMask == 0x7e00); // just make sure we fail compilation if any of the TMC error codes change
if ((uint16_t)ec & tmcMask) { // @@TODO can be optimized to uint8_t operation if ((uint16_t)ec & tmcMask) { // @@TODO can be optimized to uint8_t operation
@ -1000,7 +1002,7 @@ void MMU2::ReportError(ErrorCode ec, ErrorSource res) {
if (!mmu2.RetryIfPossible(ec)) { if (!mmu2.RetryIfPossible(ec)) {
// If retry attempts are all used up // If retry attempts are all used up
// or if 'Retry' operation is not available // or if 'Retry' operation is not available
// raise the MMU error sceen and wait for user input // raise the MMU error screen and wait for user input
ReportErrorHook((CommandInProgress)logic.CommandInProgress(), ec, uint8_t(lastErrorSource)); ReportErrorHook((CommandInProgress)logic.CommandInProgress(), ec, uint8_t(lastErrorSource));
} }