Pre-apply cosmetic changes to mixing
This commit is contained in:
@@ -25,12 +25,12 @@
|
||||
|
||||
#ifdef __AVR__
|
||||
#define MIXER_ACCU_SIGNED
|
||||
typedef uint8_t mixer_color_t;
|
||||
typedef uint8_t mixer_comp_t;
|
||||
typedef int8_t mixer_accu_t;
|
||||
#define COLOR_A_MASK 0x80
|
||||
#define COLOR_MASK 0x7F
|
||||
#else
|
||||
typedef uint_fast16_t mixer_color_t;
|
||||
typedef uint_fast16_t mixer_comp_t;
|
||||
typedef uint_fast16_t mixer_accu_t;
|
||||
#define COLOR_A_MASK 0x8000
|
||||
#define COLOR_MASK 0x7FFF
|
||||
@@ -56,31 +56,37 @@
|
||||
#define MIXER_STEPPER_LOOP(VAR) \
|
||||
for (uint_fast8_t VAR = 0; VAR < MIXING_STEPPERS; VAR++)
|
||||
|
||||
#define MIXER_BLOCK_DEFINITION mixer_color_t b_color[MIXING_STEPPERS]
|
||||
#define MIXER_BLOCK_FIELD mixer_comp_t b_color[MIXING_STEPPERS]
|
||||
#define MIXER_POPULATE_BLOCK() mixer.populate_block(block->b_color)
|
||||
#define MIXER_STEPPER_SETUP() mixer.stepper_setup(current_block->b_color)
|
||||
#define MIXER_STEPPER_SETUP() mixer.stepper_setup(current_block->b_color)
|
||||
|
||||
/**
|
||||
* @brief Mixer class
|
||||
* @details Contains data and behaviors for a Mixing Extruder
|
||||
*/
|
||||
class Mixer {
|
||||
public:
|
||||
|
||||
static void init(void); // Populate colors at boot time
|
||||
static void init();
|
||||
|
||||
static void reset_vtools();
|
||||
|
||||
// Used up to Planner level
|
||||
static void normalize(const uint8_t tool_index);
|
||||
FORCE_INLINE static uint8_t get_current_v_tool(void) { return selected_v_tool; }
|
||||
FORCE_INLINE static void T(const uint_fast8_t c) { selected_v_tool = c; }
|
||||
FORCE_INLINE static void set_M163_collector(const uint8_t c, const float f) { M163_collector[c] = f; }
|
||||
FORCE_INLINE static uint8_t get_current_vtool() { return selected_vtool; }
|
||||
FORCE_INLINE static void T(const uint_fast8_t c) { selected_vtool = c; }
|
||||
FORCE_INLINE static void set_collector(const uint8_t c, const float f) { collector[c] = f; }
|
||||
|
||||
// Used when dealing with blocks
|
||||
FORCE_INLINE static void populate_block(mixer_color_t b_color[]) {
|
||||
uint_fast8_t j = get_current_v_tool();
|
||||
FORCE_INLINE static void populate_block(mixer_comp_t b_color[]) {
|
||||
uint_fast8_t j = get_current_vtool();
|
||||
MIXER_STEPPER_LOOP(i) b_color[i] = color[j][i];
|
||||
}
|
||||
FORCE_INLINE static void stepper_setup(mixer_color_t b_color[]) { MIXER_STEPPER_LOOP(i) s_color[i] = b_color[i]; }
|
||||
FORCE_INLINE static void stepper_setup(mixer_comp_t b_color[]) { MIXER_STEPPER_LOOP(i) s_color[i] = b_color[i]; }
|
||||
|
||||
// Used in Stepper
|
||||
FORCE_INLINE static uint8_t get_stepper(void) { return runner; }
|
||||
FORCE_INLINE static uint8_t get_next_stepper(void) {
|
||||
FORCE_INLINE static uint8_t get_stepper() { return runner; }
|
||||
FORCE_INLINE static uint8_t get_next_stepper() {
|
||||
do {
|
||||
if (--runner < 0) runner = MIXING_STEPPERS - 1;
|
||||
accu[runner] += s_color[runner];
|
||||
@@ -100,14 +106,14 @@ class Mixer {
|
||||
private:
|
||||
|
||||
// Used up to Planner level
|
||||
static uint_fast8_t selected_v_tool;
|
||||
static float M163_collector[MIXING_STEPPERS];
|
||||
static mixer_color_t color[NR_MIXING_VIRTUAL_TOOLS][MIXING_STEPPERS];
|
||||
static uint_fast8_t selected_vtool;
|
||||
static float collector[MIXING_STEPPERS];
|
||||
static mixer_comp_t color[NR_MIXING_VIRTUAL_TOOLS][MIXING_STEPPERS];
|
||||
|
||||
// Used in Stepper
|
||||
static int_fast8_t runner;
|
||||
static mixer_color_t s_color[MIXING_STEPPERS];
|
||||
static mixer_accu_t accu[MIXING_STEPPERS];
|
||||
static int_fast8_t runner;
|
||||
static mixer_comp_t s_color[MIXING_STEPPERS];
|
||||
static mixer_accu_t accu[MIXING_STEPPERS];
|
||||
};
|
||||
|
||||
extern Mixer mixer;
|
||||
|
||||
Reference in New Issue
Block a user