clang-format
This commit is contained in:
parent
0555376502
commit
528abcb8d8
|
|
@ -51,8 +51,7 @@ MMU2::MMU2()
|
||||||
, unloadFilamentStarted(false)
|
, unloadFilamentStarted(false)
|
||||||
, loadingToNozzle(false)
|
, loadingToNozzle(false)
|
||||||
, toolchange_counter(0)
|
, toolchange_counter(0)
|
||||||
, tmcFailures(0)
|
, tmcFailures(0) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MMU2::Start() {
|
void MMU2::Start() {
|
||||||
|
|
@ -226,11 +225,11 @@ bool MMU2::RetryIfPossible(uint16_t ec){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MMU2::VerifyFilamentEnteredPTFE()
|
bool MMU2::VerifyFilamentEnteredPTFE() {
|
||||||
{
|
|
||||||
planner_synchronize();
|
planner_synchronize();
|
||||||
|
|
||||||
if (WhereIsFilament() == FilamentState::NOT_PRESENT) return false;
|
if (WhereIsFilament() == FilamentState::NOT_PRESENT)
|
||||||
|
return false;
|
||||||
|
|
||||||
uint8_t fsensorState = 0;
|
uint8_t fsensorState = 0;
|
||||||
// MMU has finished its load, push the filament further by some defined constant length
|
// MMU has finished its load, push the filament further by some defined constant length
|
||||||
|
|
@ -238,8 +237,7 @@ bool MMU2::VerifyFilamentEnteredPTFE()
|
||||||
MoveE(MMU2_EXTRUDER_PTFE_LENGTH + MMU2_EXTRUDER_HEATBREAK_LENGTH - (logic.ExtraLoadDistance() - MMU2_FILAMENT_SENSOR_POSITION), MMU2_VERIFY_LOAD_TO_NOZZLE_FEED_RATE);
|
MoveE(MMU2_EXTRUDER_PTFE_LENGTH + MMU2_EXTRUDER_HEATBREAK_LENGTH - (logic.ExtraLoadDistance() - MMU2_FILAMENT_SENSOR_POSITION), MMU2_VERIFY_LOAD_TO_NOZZLE_FEED_RATE);
|
||||||
MoveE(-(MMU2_EXTRUDER_PTFE_LENGTH + MMU2_EXTRUDER_HEATBREAK_LENGTH - (logic.ExtraLoadDistance() - MMU2_FILAMENT_SENSOR_POSITION)), MMU2_VERIFY_LOAD_TO_NOZZLE_FEED_RATE);
|
MoveE(-(MMU2_EXTRUDER_PTFE_LENGTH + MMU2_EXTRUDER_HEATBREAK_LENGTH - (logic.ExtraLoadDistance() - MMU2_FILAMENT_SENSOR_POSITION)), MMU2_VERIFY_LOAD_TO_NOZZLE_FEED_RATE);
|
||||||
|
|
||||||
while(planner_any_moves())
|
while (planner_any_moves()) {
|
||||||
{
|
|
||||||
// Wait for move to finish and monitor the fsensor the entire time
|
// Wait for move to finish and monitor the fsensor the entire time
|
||||||
// A single 0 reading will set the bit.
|
// A single 0 reading will set the bit.
|
||||||
fsensorState |= (WhereIsFilament() == FilamentState::NOT_PRESENT);
|
fsensorState |= (WhereIsFilament() == FilamentState::NOT_PRESENT);
|
||||||
|
|
@ -247,8 +245,7 @@ bool MMU2::VerifyFilamentEnteredPTFE()
|
||||||
marlin_manage_inactivity(true);
|
marlin_manage_inactivity(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fsensorState)
|
if (fsensorState) {
|
||||||
{
|
|
||||||
IncrementLoadFails();
|
IncrementLoadFails();
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -484,7 +481,8 @@ bool MMU2::load_filament(uint8_t slot) {
|
||||||
|
|
||||||
struct LoadingToNozzleRAII {
|
struct LoadingToNozzleRAII {
|
||||||
MMU2 &mmu2;
|
MMU2 &mmu2;
|
||||||
explicit inline LoadingToNozzleRAII(MMU2 &mmu2):mmu2(mmu2){
|
explicit inline LoadingToNozzleRAII(MMU2 &mmu2)
|
||||||
|
: mmu2(mmu2) {
|
||||||
mmu2.loadingToNozzle = true;
|
mmu2.loadingToNozzle = true;
|
||||||
}
|
}
|
||||||
inline ~LoadingToNozzleRAII() {
|
inline ~LoadingToNozzleRAII() {
|
||||||
|
|
@ -557,7 +555,8 @@ void MMU2::Home(uint8_t mode){
|
||||||
}
|
}
|
||||||
|
|
||||||
void MMU2::SaveHotendTemp(bool turn_off_nozzle) {
|
void MMU2::SaveHotendTemp(bool turn_off_nozzle) {
|
||||||
if (mmu_print_saved & SavedState::Cooldown) return;
|
if (mmu_print_saved & SavedState::Cooldown)
|
||||||
|
return;
|
||||||
|
|
||||||
if (turn_off_nozzle && !(mmu_print_saved & SavedState::CooldownPending)) {
|
if (turn_off_nozzle && !(mmu_print_saved & SavedState::CooldownPending)) {
|
||||||
Disable_E0();
|
Disable_E0();
|
||||||
|
|
@ -795,8 +794,7 @@ StepStatus MMU2::LogicStep(bool reportErrors) {
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (reportErrors) {
|
if (reportErrors) {
|
||||||
switch (ss)
|
switch (ss) {
|
||||||
{
|
|
||||||
case CommandError:
|
case CommandError:
|
||||||
ReportError(logic.Error(), ErrorSourceMMU);
|
ReportError(logic.Error(), ErrorSourceMMU);
|
||||||
break;
|
break;
|
||||||
|
|
@ -921,8 +919,7 @@ void MMU2::ReportError(ErrorCode ec, ErrorSource res) {
|
||||||
&& mmu2Magic[3] == '2'
|
&& mmu2Magic[3] == '2'
|
||||||
&& mmu2Magic[4] == ':'
|
&& mmu2Magic[4] == ':'
|
||||||
&& strlen_constexpr(mmu2Magic) == 5,
|
&& strlen_constexpr(mmu2Magic) == 5,
|
||||||
"MMU2 logging prefix mismatch, must be updated at various spots"
|
"MMU2 logging prefix mismatch, must be updated at various spots");
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MMU2::ReportProgress(ProgressCode pc) {
|
void MMU2::ReportProgress(ProgressCode pc) {
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
#ifdef __AVR__
|
#ifdef __AVR__
|
||||||
#include "mmu2_protocol_logic.h"
|
#include "mmu2_protocol_logic.h"
|
||||||
typedef float feedRate_t;
|
typedef float feedRate_t;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include "protocol_logic.h"
|
#include "protocol_logic.h"
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,30 @@ void LogEchoEvent_P(const char *msg);
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
#define SERIAL_MMU2() { serialprintPGM(mmu2Magic); }
|
#define SERIAL_MMU2() \
|
||||||
|
{ serialprintPGM(mmu2Magic); }
|
||||||
|
|
||||||
#define MMU2_ECHO_MSGLN(S) do{ SERIAL_ECHO_START; SERIAL_MMU2(); SERIAL_ECHOLN(S); }while(0)
|
#define MMU2_ECHO_MSGLN(S) \
|
||||||
|
do { \
|
||||||
|
SERIAL_ECHO_START(); \
|
||||||
|
SERIAL_MMU2(); \
|
||||||
|
SERIAL_ECHOLN(S); \
|
||||||
|
} while (0)
|
||||||
#define MMU2_ERROR_MSGLN(S) MMU2_ECHO_MSGLN(S) //!@todo Decide MMU2 errors on serial line
|
#define MMU2_ERROR_MSGLN(S) MMU2_ECHO_MSGLN(S) //!@todo Decide MMU2 errors on serial line
|
||||||
#define MMU2_ECHO_MSGRPGM(S) do{ SERIAL_ECHO_START; SERIAL_MMU2(); SERIAL_ECHORPGM(S); }while(0)
|
#define MMU2_ECHO_MSGRPGM(S) \
|
||||||
|
do { \
|
||||||
|
SERIAL_ECHO_START(); \
|
||||||
|
SERIAL_MMU2(); \
|
||||||
|
SERIAL_ECHO(S); \
|
||||||
|
} while (0)
|
||||||
#define MMU2_ERROR_MSGRPGM(S) MMU2_ECHO_MSGRPGM(S) //!@todo Decide MMU2 errors on serial line
|
#define MMU2_ERROR_MSGRPGM(S) MMU2_ECHO_MSGRPGM(S) //!@todo Decide MMU2 errors on serial line
|
||||||
|
#define MMU2_ECHO_MSG(S) \
|
||||||
|
do { \
|
||||||
|
SERIAL_ECHO_START(); \
|
||||||
|
SERIAL_MMU2(); \
|
||||||
|
SERIAL_ECHO(S); \
|
||||||
|
} while (0)
|
||||||
|
#define MMU2_ERROR_MSG(S) MMU2_ECHO_MSG(S) //!@todo Decide MMU2 errors on serial line
|
||||||
|
|
||||||
#else // #ifndef UNITTEST
|
#else // #ifndef UNITTEST
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -526,8 +526,7 @@ ProtocolLogic::ProtocolLogic(MMU2Serial *uart, uint8_t extraLoadDistance, uint8_
|
||||||
, lastFSensor((uint8_t)WhereIsFilament())
|
, lastFSensor((uint8_t)WhereIsFilament())
|
||||||
, regIndex(0)
|
, regIndex(0)
|
||||||
, retryAttempts(MAX_RETRIES)
|
, retryAttempts(MAX_RETRIES)
|
||||||
, inAutoRetry(false)
|
, inAutoRetry(false) {
|
||||||
{
|
|
||||||
// @@TODO currently, I don't see a way of writing the initialization better :(
|
// @@TODO currently, I don't see a way of writing the initialization better :(
|
||||||
// I'd like to write something like: initRegs8 { extraLoadDistance, pulleySlowFeedrate }
|
// I'd like to write something like: initRegs8 { extraLoadDistance, pulleySlowFeedrate }
|
||||||
// avr-gcc seems to like such a syntax, ARM gcc doesn't
|
// avr-gcc seems to like such a syntax, ARM gcc doesn't
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue