Skip to content

Commit

Permalink
⛙ Merge w/Marlin
Browse files Browse the repository at this point in the history
  • Loading branch information
classicrocker883 committed Dec 22, 2023
2 parents b896a12 + ec7ab5a commit 776e11b
Show file tree
Hide file tree
Showing 9 changed files with 365 additions and 192 deletions.
11 changes: 6 additions & 5 deletions Marlin/src/core/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@
#define FORCE_INLINE __attribute__((always_inline)) inline
#define NO_INLINE __attribute__((noinline))
#define _UNUSED __attribute__((unused))
#define __O0 __attribute__((optimize("O0")))
#define __Os __attribute__((optimize("Os")))
#define __O1 __attribute__((optimize("O1")))
#define __O2 __attribute__((optimize("O2")))
#define __O3 __attribute__((optimize("O3")))
#define __O0 __attribute__((optimize("O0"))) // No optimization and less debug info
#define __Og __attribute__((optimize("Og"))) // Optimize the debugging experience
#define __Os __attribute__((optimize("Os"))) // Optimize for size
#define __O1 __attribute__((optimize("O1"))) // Try to reduce size and cycles; nothing that takes a lot of time to compile
#define __O2 __attribute__((optimize("O2"))) // Optimize even more
#define __O3 __attribute__((optimize("O3"))) // Optimize yet more

#define IS_CONSTEXPR(...) __builtin_constant_p(__VA_ARGS__) // Only valid solution with C++14. Should use std::is_constant_evaluated() in C++20 instead

Expand Down
47 changes: 27 additions & 20 deletions Marlin/src/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -2473,11 +2473,7 @@
#define COOLER_MAX_TARGET (COOLER_MAXTEMP - (COOLER_OVERSHOOT))
#endif

#if HAS_HEATED_BED || HAS_TEMP_CHAMBER
#define BED_OR_CHAMBER 1
#endif

#if HAS_TEMP_HOTEND || BED_OR_CHAMBER || HAS_TEMP_PROBE || HAS_TEMP_COOLER || HAS_TEMP_BOARD || HAS_TEMP_SOC
#if HAS_TEMP_HOTEND || HAS_HEATED_BED || HAS_TEMP_CHAMBER || HAS_TEMP_PROBE || HAS_TEMP_COOLER || HAS_TEMP_BOARD || HAS_TEMP_SOC
#define HAS_TEMP_SENSOR 1
#endif

Expand Down Expand Up @@ -2650,11 +2646,13 @@
#endif
#endif

// Print Cooling fans (limit)
/**
* Up to 12 PWM fans
*/
#ifdef NUM_M106_FANS
#define MAX_FANS NUM_M106_FANS
#else
#define MAX_FANS 8 // Max supported fans
#define MAX_FANS 12 // Max supported fans
#endif

#define _IS_E_AUTO(N,F) (PIN_EXISTS(E##N##_AUTO_FAN) && E##N##_AUTO_FAN_PIN == FAN##F##_PIN)
Expand Down Expand Up @@ -2689,21 +2687,30 @@
#if _HAS_FAN(7)
#define HAS_FAN7 1
#endif
#undef _NOT_E_AUTO
#undef _HAS_FAN

#if BED_OR_CHAMBER || HAS_FAN0
#define BED_OR_CHAMBER_OR_FAN 1
#if _HAS_FAN(8)
#define HAS_FAN8 1
#endif

/**
* Up to 8 PWM fans
*/
#ifndef FAN_INVERTING
#define FAN_INVERTING false
#if _HAS_FAN(9)
#define HAS_FAN9 1
#endif

#if HAS_FAN7
#if _HAS_FAN(10)
#define HAS_FAN10 1
#endif
#if _HAS_FAN(11)
#define HAS_FAN11 1
#endif
#undef _HAS_FAN
#undef _IS_E_AUTO

#if HAS_FAN11
#define FAN_COUNT 12
#elif HAS_FAN10
#define FAN_COUNT 11
#elif HAS_FAN9
#define FAN_COUNT 10
#elif HAS_FAN8
#define FAN_COUNT 9
#elif HAS_FAN7
#define FAN_COUNT 8
#elif HAS_FAN6
#define FAN_COUNT 7
Expand Down
22 changes: 13 additions & 9 deletions Marlin/src/lcd/dogm/dogm_Statusscreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
// Can also be overridden in Configuration_adv.h
// If you can afford it, try the 3-frame fan animation!
// Don't compile in the fan animation with no fan
#if !HAS_FAN0 || (HOTENDS == 5 || (HOTENDS == 4 && BED_OR_CHAMBER) || ALL(STATUS_COMBINE_HEATERS, HAS_HEATED_CHAMBER))
#if !HAS_FAN0 || (HOTENDS == 5 || (HOTENDS == 4 && (HAS_HEATED_BED || HAS_TEMP_CHAMBER)) || ALL(STATUS_COMBINE_HEATERS, HAS_HEATED_CHAMBER))
#undef STATUS_FAN_FRAMES
#elif !STATUS_FAN_FRAMES
#define STATUS_FAN_FRAMES 2
Expand Down Expand Up @@ -200,18 +200,22 @@
#undef STATUS_LOGO_WIDTH
#endif

#if !defined(STATUS_HEATERS_X) && ((HAS_HOTEND && STATUS_LOGO_WIDTH && BED_OR_CHAMBER_OR_FAN) || (HOTENDS >= 3 && !BED_OR_CHAMBER_OR_FAN))
#define _STATUS_HEATERS_X(H,S,N) ((LCD_PIXEL_WIDTH - (H * (S + N)) - (_EXTRA_WIDTH) + (STATUS_LOGO_WIDTH)) / 2)
#if STATUS_HOTEND1_WIDTH
#if HOTENDS > 2
#define STATUS_HEATERS_X _STATUS_HEATERS_X(HOTENDS, STATUS_HOTEND1_WIDTH, 6)
#ifndef STATUS_HEATERS_X
#define _BED_OR_CHAMBER_OR_FAN (HAS_HEATED_BED || HAS_TEMP_CHAMBER || HAS_FAN)
#if (HAS_HOTEND && STATUS_LOGO_WIDTH && _BED_OR_CHAMBER_OR_FAN) || (HOTENDS >= 3 && !_BED_OR_CHAMBER_OR_FAN)
#define _STATUS_HEATERS_X(H,S,N) ((LCD_PIXEL_WIDTH - (H * (S + N)) - (_EXTRA_WIDTH) + (STATUS_LOGO_WIDTH)) / 2)
#if STATUS_HOTEND1_WIDTH
#if HOTENDS > 2
#define STATUS_HEATERS_X _STATUS_HEATERS_X(HOTENDS, STATUS_HOTEND1_WIDTH, 6)
#else
#define STATUS_HEATERS_X _STATUS_HEATERS_X(HOTENDS, STATUS_HOTEND1_WIDTH, 4)
#endif
#else
#define STATUS_HEATERS_X _STATUS_HEATERS_X(HOTENDS, STATUS_HOTEND1_WIDTH, 4)
#define STATUS_HEATERS_X _STATUS_HEATERS_X(1, STATUS_HEATERS_WIDTH, 4)
#endif
#else
#define STATUS_HEATERS_X _STATUS_HEATERS_X(1, STATUS_HEATERS_WIDTH, 4)
#endif
#endif
#undef _BED_OR_CHAMBER_OR_FAN
#endif

//
Expand Down
69 changes: 35 additions & 34 deletions Marlin/src/module/planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,15 @@ void Planner::init() {
position.reset();
TERN_(HAS_POSITION_FLOAT, position_float.reset());
TERN_(IS_KINEMATIC, position_cart.reset());

previous_speed.reset();
previous_nominal_speed = 0;

TERN_(ABL_PLANAR, bed_level_matrix.set_to_identity());

clear_block_buffer();
delay_before_delivering = 0;

#if ENABLED(DIRECT_STEPPING)
last_page_step_rate = 0;
last_page_dir.reset();
Expand Down Expand Up @@ -1973,23 +1977,21 @@ bool Planner::_populate_block(
dm.hy = (dist.b > 0); // ...and Y
TERN_(HAS_Z_AXIS, dm.z = (dist.c > 0));
#endif
#if IS_CORE
#if CORE_IS_XY
dm.a = (dist.a + dist.b > 0); // Motor A direction
dm.b = (CORESIGN(dist.a - dist.b) > 0); // Motor B direction
#elif CORE_IS_XZ
dm.hx = (dist.a > 0); // Save the toolhead's true direction in X
dm.y = (dist.b > 0);
dm.hz = (dist.c > 0); // ...and Z
dm.a = (dist.a + dist.c > 0); // Motor A direction
dm.c = (CORESIGN(dist.a - dist.c) > 0); // Motor C direction
#elif CORE_IS_YZ
dm.x = (dist.a > 0);
dm.hy = (dist.b > 0); // Save the toolhead's true direction in Y
dm.hz = (dist.c > 0); // ...and Z
dm.b = (dist.b + dist.c > 0); // Motor B direction
dm.c = (CORESIGN(dist.b - dist.c) > 0); // Motor C direction
#endif
#if CORE_IS_XY
dm.a = (dist.a + dist.b > 0); // Motor A direction
dm.b = (CORESIGN(dist.a - dist.b) > 0); // Motor B direction
#elif CORE_IS_XZ
dm.hx = (dist.a > 0); // Save the toolhead's true direction in X
dm.y = (dist.b > 0);
dm.hz = (dist.c > 0); // ...and Z
dm.a = (dist.a + dist.c > 0); // Motor A direction
dm.c = (CORESIGN(dist.a - dist.c) > 0); // Motor C direction
#elif CORE_IS_YZ
dm.x = (dist.a > 0);
dm.hy = (dist.b > 0); // Save the toolhead's true direction in Y
dm.hz = (dist.c > 0); // ...and Z
dm.b = (dist.b + dist.c > 0); // Motor B direction
dm.c = (CORESIGN(dist.b - dist.c) > 0); // Motor C direction
#elif ENABLED(MARKFORGED_XY)
dm.a = (dist.a TERN(MARKFORGED_INVERSE, -, +) dist.b > 0); // Motor A direction
dm.b = (dist.b > 0); // Motor B direction
Expand Down Expand Up @@ -2093,23 +2095,21 @@ bool Planner::_populate_block(
dist_mm.head.y = dist.b * mm_per_step[B_AXIS];
TERN_(HAS_Z_AXIS, dist_mm.z = dist.c * mm_per_step[Z_AXIS]);
#endif
#if IS_CORE
#if CORE_IS_XY
dist_mm.a = (dist.a + dist.b) * mm_per_step[A_AXIS];
dist_mm.b = CORESIGN(dist.a - dist.b) * mm_per_step[B_AXIS];
#elif CORE_IS_XZ
dist_mm.head.x = dist.a * mm_per_step[A_AXIS];
dist_mm.y = dist.b * mm_per_step[Y_AXIS];
dist_mm.head.z = dist.c * mm_per_step[C_AXIS];
dist_mm.a = (dist.a + dist.c) * mm_per_step[A_AXIS];
dist_mm.c = CORESIGN(dist.a - dist.c) * mm_per_step[C_AXIS];
#elif CORE_IS_YZ
dist_mm.x = dist.a * mm_per_step[X_AXIS];
dist_mm.head.y = dist.b * mm_per_step[B_AXIS];
dist_mm.head.z = dist.c * mm_per_step[C_AXIS];
dist_mm.b = (dist.b + dist.c) * mm_per_step[B_AXIS];
dist_mm.c = CORESIGN(dist.b - dist.c) * mm_per_step[C_AXIS];
#endif
#if CORE_IS_XY
dist_mm.a = (dist.a + dist.b) * mm_per_step[A_AXIS];
dist_mm.b = CORESIGN(dist.a - dist.b) * mm_per_step[B_AXIS];
#elif CORE_IS_XZ
dist_mm.head.x = dist.a * mm_per_step[A_AXIS];
dist_mm.y = dist.b * mm_per_step[Y_AXIS];
dist_mm.head.z = dist.c * mm_per_step[C_AXIS];
dist_mm.a = (dist.a + dist.c) * mm_per_step[A_AXIS];
dist_mm.c = CORESIGN(dist.a - dist.c) * mm_per_step[C_AXIS];
#elif CORE_IS_YZ
dist_mm.x = dist.a * mm_per_step[X_AXIS];
dist_mm.head.y = dist.b * mm_per_step[B_AXIS];
dist_mm.head.z = dist.c * mm_per_step[C_AXIS];
dist_mm.b = (dist.b + dist.c) * mm_per_step[B_AXIS];
dist_mm.c = CORESIGN(dist.b - dist.c) * mm_per_step[C_AXIS];
#elif ENABLED(MARKFORGED_XY)
dist_mm.a = (dist.a TERN(MARKFORGED_INVERSE, +, -) dist.b) * mm_per_step[A_AXIS];
dist_mm.b = dist.b * mm_per_step[B_AXIS];
Expand Down Expand Up @@ -2543,6 +2543,7 @@ bool Planner::_populate_block(
#if DISABLED(S_CURVE_ACCELERATION)
block->acceleration_rate = (uint32_t)(accel * (float(1UL << 24) / (STEPPER_TIMER_RATE)));
#endif

#if ENABLED(LIN_ADVANCE)
block->la_advance_rate = 0;
block->la_scaling = 0;
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/module/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,9 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED);

// Init fans according to whether they're native PWM or Software PWM
#ifdef BOARD_OPENDRAIN_MOSFETS
#define _INIT_SOFT_FAN(P) OUT_WRITE_OD(P, FAN_INVERTING ? LOW : HIGH)
#define _INIT_SOFT_FAN(P) OUT_WRITE_OD(P, ENABLED(FAN_INVERTING) ? LOW : HIGH)
#else
#define _INIT_SOFT_FAN(P) OUT_WRITE(P, FAN_INVERTING ? LOW : HIGH)
#define _INIT_SOFT_FAN(P) OUT_WRITE(P, ENABLED(FAN_INVERTING) ? LOW : HIGH)
#endif
#if ENABLED(FAN_SOFT_PWM)
#define _INIT_FAN_PIN(P) _INIT_SOFT_FAN(P)
Expand Down Expand Up @@ -3832,7 +3832,7 @@ void Temperature::isr() {
static SoftPWM soft_pwm_controller;
#endif

#define WRITE_FAN(n, v) WRITE(FAN##n##_PIN, (v) ^ FAN_INVERTING)
#define WRITE_FAN(n, v) WRITE(FAN##n##_PIN, (v) ^ ENABLED(FAN_INVERTING))

#if DISABLED(SLOW_PWM_HEATERS)

Expand Down
21 changes: 20 additions & 1 deletion buildroot/share/PlatformIO/scripts/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,26 @@ def load_boards():
return ''

#
# Extract a schema from the current configuration files
# Extract the current configuration files in the form of a structured schema.
# Contains the full schema for the configuration files, not just the enabled options,
# Contains the current values of the options, not just data structure, so "schema" is a slight misnomer.
#
# The returned object is a nested dictionary with the following indexing:
#
# - schema[filekey][section][define_name] = define_info
#
# Where the define_info contains the following keyed fields:
# - section = The @section the define is in
# - name = The name of the define
# - enabled = True if the define is enabled (not commented out)
# - line = The line number of the define
# - sid = A serial ID for the define
# - value = The value of the define, if it has one
# - type = The type of the define, if it has one
# - requires = The conditions that must be met for the define to be enabled
# - comment = The comment for the define, if it has one
# - units = The units for the define, if it has one
# - options = The options for the define, if it has one
#
def extract():
# Load board names from boards.h
Expand Down
Loading

0 comments on commit 776e11b

Please sign in to comment.