Prusa-MMU-Private
PrusaMultiMaterialUpgradev3firmwareforMK3SMK4
Classes | Typedefs | Enumerations | Variables
config Namespace Reference

Define Debug mode to add additional serial output. More...

Classes

struct  AxisConfig
 Axis configuration data. More...
 
struct  AxisLimits
 Phisical limits for an axis. More...
 

Typedefs

typedef AxisLimits< Millimeter > PulleyLimits
 Pulley axis limits.
 
typedef AxisLimits< Millimeter > SelectorLimits
 Selector axis limits.
 
typedef AxisLimits< Degree > IdlerLimits
 Idler axis limits.
 

Enumerations

enum  MRes : uint8_t {
  MRes_256 = 0 , MRes_128 = 1 , MRes_64 = 2 , MRes_32 = 3 ,
  MRes_16 = 4 , MRes_8 = 5 , MRes_4 = 6 , MRes_2 = 7 ,
  MRes_1 = 8
}
 Available microstepping resolutions.
 
enum  Axis : uint8_t { Pulley , Selector , Idler , _Axis_Last = Idler }
 List of available axes.
 

Variables

static constexpr uint8_t NUM_AXIS = Axis::_Axis_Last + 1
 Number of available axes.
 
static constexpr const uint8_t toolCount = 5U
 
static constexpr const uint16_t fsensorDebounceMs = 2
 
static constexpr uint16_t ledBlinkPeriodMs = 1024U
 
static constexpr const uint16_t findaDebounceMs = 100
 
static constexpr const uint8_t buttonCount = 3
 number of buttons currently supported
 
static constexpr const uint16_t buttonsDebounceMs = 20
 tuned with a pack of highly trained monkeys :)
 
static constexpr const uint16_t buttonADCLimits [buttonCount][2] = { { 0, 50 }, { 80, 100 }, { 160, 180 } }
 
static constexpr const uint16_t buttonADCMaxValue = 1023
 used in unit tests
 
static constexpr const uint8_t buttonsADCIndex = 5
 ADC index of buttons input.
 
static constexpr const uint8_t VCCADCIndex = 30
 ADC index of scaled VCC input.
 
static constexpr const uint16_t VCCADCThreshold = 274
 
static constexpr const uint8_t VCCADCReadCnt = 10
 Number of ADC reads to perform, only the last one being used. More...
 
static constexpr uint8_t dropSegments = 0
 Do not plan moves equal or shorter than the requested steps.
 
static constexpr uint16_t maxStepFrequency = 40000
 Max step frequency 40KHz.
 
static constexpr uint16_t minStepRate = 120
 Minimum stepping rate 120Hz.
 
static constexpr uint8_t blockBufferSize = 4
 Size for the motion planner block buffer size.
 
static constexpr uint8_t stepTimerFrequencyDivider = 8
 Step timer frequency divider (F = F_CPU / divider)
 
static constexpr uint16_t stepTimerQuantum = 256
 
static constexpr uint8_t feedToBondtechMaxRetries = 2
 Max retries of FeedToBondtech used in LoadFilament.
 
static constexpr U_mm pulleyToCuttingEdge = 33.0_mm
 Distances.
 
static constexpr U_mm filamentMinLoadedToMMU = 20.0_mm
 
static constexpr U_mm ejectFromCuttingEdge = 40.0_mm
 Limit of retraction.
 
static constexpr U_mm cuttingEdgeRetract = 5.0_mm
 Eject should ignore FilamentMinLoadedToMMU and retract.
 
static constexpr U_mm cuttingEdgeToFinda = 18.5_mm
 Cutting retraction distance (filament should be flush with outlet)
 
static constexpr U_mm findaTriggerDistance = 4.5_mm
 Cutting edge to FINDA MMU side -1mm tolerance should be ~18.5. FINDA shouldn't trigger here.
 
static constexpr U_mm cuttingEdgeToFindaMidpoint = 22.85_mm
 FINDA trigger distance +1.0_mm tolerance.
 
static constexpr U_mm findaToCoupler = 12.0_mm
 Cutting edge to Midpoint of FINDA should be 22.85_mm.
 
static constexpr U_mm couplerToBowden = 3.5_mm
 FINDA Coupler side to coupler screw.
 
static constexpr U_mm defaultBowdenLength = 360.0_mm
 FINDA Coupler screw to bowden mmu side (in coupling).
 
static constexpr U_mm minimumBowdenLength = 341.0_mm
 ~360.0_mm - Default Bowden length.
 
static constexpr U_mm maximumBowdenLength = 1000.0_mm
 ~341.0_mm - Minimum bowden length.
 
static constexpr U_mm feedToFinda = cuttingEdgeToFindaMidpoint + filamentMinLoadedToMMU
 ~1000.0_mm - Maximum bowden length.
 
static constexpr U_mm maximumFeedToFinda = feedToFinda + 20.0_mm
 allow for some safety margin to load to FINDA
 
static constexpr U_mm pulleyHelperMove = 10.0_mm
 Helper move for Load/Unload error states - when the MMU should slowly move the filament a bit.
 
static constexpr U_mm cutLength = 8.0_mm
 
static constexpr U_mm fsensorToNozzle = 30.0_mm
 ~20mm from MK4's filament sensor through extruder gears into nozzle
 
static constexpr U_mm fsensorToNozzleAvoidGrind = 5.0_mm
 
static constexpr U_mm fsensorUnloadCheckDistance = 40.0_mm
 Check the state of FSensor after this amount of filament got (hopefully) pulled out while unloading.
 
static constexpr AxisConfig pulley
 Begin: Pulley axis configuration. More...
 
static constexpr PulleyLimits pulleyLimits
 Pulley motion limits. More...
 
static constexpr U_mm_s pulleyUnloadFeedrate = 95._mm_s
 
static constexpr U_mm_s pulleyLoadFeedrate = 95._mm_s
 
static constexpr U_mm_s pulleySlowFeedrate = 20._mm_s
 
static constexpr AxisConfig selector
 End: Pulley axis configuration. More...
 
static constexpr uint8_t selectorCutIRun = 40
 660mA
 
static constexpr SelectorLimits selectorLimits
 Selector motion limits. More...
 
static constexpr U_mm SelectorSlotDistance = 14.0_mm
 
static constexpr U_mm SelectorOffsetFromMax = 1.0_mm
 Selector distance between two slots.
 
static constexpr U_mm SelectorOffsetFromMin = 75.5_mm
 Selector offset from home max to slot 0.
 
static constexpr U_mm selectorSlotPositions [toolCount+1]
 Selector offset from home min to slot 0. More...
 
static constexpr U_mm_s selectorFeedrate = 45._mm_s
 
static constexpr U_mm_s selectorHomingFeedrate = 30._mm_s
 
static constexpr AxisConfig idler
 End: Selector configuration. More...
 
static constexpr IdlerLimits idlerLimits
 Idler motion limits. More...
 
static constexpr U_deg IdlerSlotDistance = 40.0_deg
 
static constexpr U_deg IdlerOffsetFromHome = 18.0_deg
 Idler distance between two slots.
 
static constexpr U_deg idlerSlotPositions [toolCount+1]
 Idler offset from home to slots. More...
 
static constexpr U_deg idlerIntermediateSlotPositions [toolCount+1]
 Intermediate positions for Idler's slots: 0-4 are the real ones, the 5th index is the idle position. More...
 
static constexpr U_deg idlerParkPositionDelta = -IdlerSlotDistance + 5.0_deg / 2
 
static constexpr U_deg_s idlerFeedrate = 300._deg_s
 
static constexpr U_deg_s idlerHomingFeedrate = 265._deg_s
 
static constexpr uint32_t tmc2130_coolStepThreshold = 450
 End: Idler configuration. More...
 
static constexpr uint32_t tmc2130_PWM_AMPL = 240
 
static constexpr uint32_t tmc2130_PWM_GRAD = 4
 
static constexpr uint32_t tmc2130_PWM_FREQ = 0
 
static constexpr uint32_t tmc2130_PWM_AUTOSCALE = 1
 
static constexpr uint32_t tmc2130_freewheel = 1
 

Detailed Description

Define Debug mode to add additional serial output.

Enable DEBUG_LOGIC to compile debugging and error messages (beware of code base size ;) ) for the logic layer Enable DEBUG_MODULES to compile debugging and error messages (beware of code base size ;) ) for the modules layer Enable DEBUG_HAL to compile debugging and error messages (beware of code base size ;) ) for the HAL layer Wrangler for assorted compile-time configuration and constants.

Variable Documentation

◆ filamentMinLoadedToMMU

constexpr U_mm config::filamentMinLoadedToMMU = 20.0_mm
staticconstexpr

33.0_mm /// Pulley to cutting edge. Case 1: FINDA working: This should be the max retraction after FINDA un-triggers. Case 2: FINDA not working: calculate retraction from printer to this point.

◆ idler

constexpr AxisConfig config::idler
staticconstexpr
Initial value:
= {
.dirOn = true,
.mRes = MRes_16,
.iRun = 31,
.iHold = 5,
.stealth = false,
.stepsPerUnit = (200 * 16 / 360.),
.sg_thrs = 7,
}

End: Selector configuration.

Begin: Idler configuration

◆ idlerIntermediateSlotPositions

constexpr U_deg config::idlerIntermediateSlotPositions[toolCount+1]
staticconstexpr
Initial value:
= {
IdlerOffsetFromHome + 4.75F * IdlerSlotDistance,
IdlerOffsetFromHome + 3.75F * IdlerSlotDistance,
IdlerOffsetFromHome + 2.75F * IdlerSlotDistance,
IdlerOffsetFromHome + 1.75F * IdlerSlotDistance,
IdlerOffsetFromHome + 0.75F * IdlerSlotDistance,
}
static constexpr U_deg IdlerOffsetFromHome
Idler distance between two slots.
Definition: config.h:204

Intermediate positions for Idler's slots: 0-4 are the real ones, the 5th index is the idle position.

◆ idlerLimits

constexpr IdlerLimits config::idlerLimits
staticconstexpr
Initial value:
= {
.lenght = 225.0_deg,
.jerk = 0.1_deg_s,
.accel = 500.0_deg_s2,
}

Idler motion limits.

◆ idlerSlotPositions

constexpr U_deg config::idlerSlotPositions[toolCount+1]
staticconstexpr
Initial value:
= {
IdlerOffsetFromHome + 5 * IdlerSlotDistance,
IdlerOffsetFromHome + 4 * IdlerSlotDistance,
IdlerOffsetFromHome + 3 * IdlerSlotDistance,
IdlerOffsetFromHome + 2 * IdlerSlotDistance,
IdlerOffsetFromHome + 1 * IdlerSlotDistance,
}

Idler offset from home to slots.

Absolute positions for Idler's slots: 0-4 are the real ones, the 5th index is the idle position Home ccw with 5th idler bearing facing selector

◆ ledBlinkPeriodMs

constexpr uint16_t config::ledBlinkPeriodMs = 1024U
staticconstexpr

The complete period of LED's blinking (i.e. ON and OFF together) Beware - in order to keep the blink periods "handle" millis overflow seamlessly keep the period a power of 2 (i.e. 256, 512, 1024). If you don't, one of the LED unit tests will fail.

◆ pulley

constexpr AxisConfig config::pulley
staticconstexpr
Initial value:
= {
.dirOn = false,
.mRes = MRes_8,
.iRun = 13,
.iHold = 0,
.stealth = false,
.stepsPerUnit = (200 * 8 / 19.147274),
.sg_thrs = 8,
}

Begin: Pulley axis configuration.

◆ pulleyLimits

constexpr PulleyLimits config::pulleyLimits
staticconstexpr
Initial value:
= {
.lenght = 1000.0_mm,
.jerk = 4.0_mm_s,
.accel = 800.0_mm_s2,
}

Pulley motion limits.

◆ pulleyLoadFeedrate

constexpr U_mm_s config::pulleyLoadFeedrate = 95._mm_s
staticconstexpr

120mm_s is too much, the printer cannot send the status of fsensor that fast and false fsensor_not_triggered errors start to occur

◆ selector

constexpr AxisConfig config::selector
staticconstexpr
Initial value:
= {
.dirOn = true,
.mRes = MRes_8,
.iRun = 31,
.iHold = 0,
.stealth = false,
.stepsPerUnit = (200 * 8 / 8.),
.sg_thrs = 3,
}

End: Pulley axis configuration.

Begin: Selector configuration

◆ selectorLimits

constexpr SelectorLimits config::selectorLimits
staticconstexpr
Initial value:
= {
.lenght = 75.0_mm,
.jerk = 1.0_mm_s,
.accel = 200.0_mm_s2,
}

Selector motion limits.

◆ selectorSlotPositions

constexpr U_mm config::selectorSlotPositions[toolCount+1]
staticconstexpr
Initial value:
= {
SelectorOffsetFromMax + 0 * SelectorSlotDistance,
SelectorOffsetFromMax + 1 * SelectorSlotDistance,
SelectorOffsetFromMax + 2 * SelectorSlotDistance,
SelectorOffsetFromMax + 3 * SelectorSlotDistance,
SelectorOffsetFromMax + 4 * SelectorSlotDistance,
SelectorOffsetFromMax + 5 * SelectorSlotDistance
}
static constexpr U_mm SelectorOffsetFromMax
Selector distance between two slots.
Definition: config.h:156

Selector offset from home min to slot 0.

slots 0-4 are the real ones, the 5th is the farthest parking positions selector.dirOn = true = Home at max: selector hits left side of the MMU body selector.dirOn = false = Home at min: selector POM nut hit the selector motor

◆ stepTimerQuantum

constexpr uint16_t config::stepTimerQuantum = 256
staticconstexpr

Smallest stepping ISR scheduling slice (T = 1 / (F_CPU / divider) * quantum) 25us is the max frequency interval per maxStepFrequency attainable for a single axis while accelerating: with 3 axes this yields a required minimum of 75us

◆ tmc2130_coolStepThreshold

constexpr uint32_t config::tmc2130_coolStepThreshold = 450
staticconstexpr

End: Idler configuration.

step-based 20bit uint

◆ tmc2130_freewheel

constexpr uint32_t config::tmc2130_freewheel = 1
staticconstexpr

Freewheel options for standstill: 0: Normal operation (IHOLD is supplied to the motor at standstill) 1: Freewheeling (as if the driver was disabled, no braking except for detent torque) 2: Coil shorted using LS drivers (stronger passive braking) 3: Coil shorted using HS drivers (weaker passive braking)

◆ toolCount

constexpr const uint8_t config::toolCount = 5U
staticconstexpr

Max number of extruders/tools/slots Beware - if you change this, the EEPROM structure will become invalid and no migration procedures have been implemented. So if you really have to change this, erase your EEPROM content then.

◆ VCCADCReadCnt

constexpr const uint8_t config::VCCADCReadCnt = 10
staticconstexpr

Number of ADC reads to perform, only the last one being used.

We are measuring the bandgap voltage, Vb=1.1V. To compute the threshold value: VAL = 1125.3 / AVCC So for AVCC=4.1V, you get VAL=274.46

◆ VCCADCThreshold

constexpr const uint16_t config::VCCADCThreshold = 274
staticconstexpr

ADC value for triggering the UV_VCC error