mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-30 07:17:59 +00:00
🔧 Allow arbitrary BLOCK_BUFFER_SIZE
This commit is contained in:
parent
fb74caebb5
commit
ab8af7fa9c
@ -2526,7 +2526,6 @@
|
|||||||
// @section motion
|
// @section motion
|
||||||
|
|
||||||
// The number of linear moves that can be in the planner at once.
|
// The number of linear moves that can be in the planner at once.
|
||||||
// The value of BLOCK_BUFFER_SIZE must be a power of 2 (e.g., 8, 16, 32)
|
|
||||||
#if ALL(HAS_MEDIA, DIRECT_STEPPING)
|
#if ALL(HAS_MEDIA, DIRECT_STEPPING)
|
||||||
#define BLOCK_BUFFER_SIZE 8
|
#define BLOCK_BUFFER_SIZE 8
|
||||||
#elif HAS_MEDIA
|
#elif HAS_MEDIA
|
||||||
|
@ -706,7 +706,7 @@ void Max7219::idle_tasks() {
|
|||||||
|
|
||||||
#ifdef MAX7219_DEBUG_PLANNER_QUEUE
|
#ifdef MAX7219_DEBUG_PLANNER_QUEUE
|
||||||
static int16_t last_depth = 0;
|
static int16_t last_depth = 0;
|
||||||
const int16_t current_depth = (head - tail + BLOCK_BUFFER_SIZE) & (BLOCK_BUFFER_SIZE - 1) & 0xF;
|
const int16_t current_depth = BLOCK_MOD(head - tail + (BLOCK_BUFFER_SIZE)) & 0xF;
|
||||||
if (current_depth != last_depth) {
|
if (current_depth != last_depth) {
|
||||||
quantity16(MAX7219_DEBUG_PLANNER_QUEUE, last_depth, current_depth, &row_change_mask);
|
quantity16(MAX7219_DEBUG_PLANNER_QUEUE, last_depth, current_depth, &row_change_mask);
|
||||||
last_depth = current_depth;
|
last_depth = current_depth;
|
||||||
|
@ -310,7 +310,11 @@ typedef struct PlannerBlock {
|
|||||||
#define HAS_POSITION_FLOAT 1
|
#define HAS_POSITION_FLOAT 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BLOCK_MOD(n) ((n)&(BLOCK_BUFFER_SIZE-1))
|
#if IS_POWER_OF_2(BLOCK_BUFFER_SIZE)
|
||||||
|
#define BLOCK_MOD(n) ((n)&((BLOCK_BUFFER_SIZE)-1))
|
||||||
|
#else
|
||||||
|
#define BLOCK_MOD(n) ((n)%(BLOCK_BUFFER_SIZE))
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ENABLED(LASER_FEATURE)
|
#if ENABLED(LASER_FEATURE)
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -366,7 +370,7 @@ typedef struct {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(DISABLE_OTHER_EXTRUDERS)
|
#if ENABLED(DISABLE_OTHER_EXTRUDERS)
|
||||||
typedef uvalue_t(BLOCK_BUFFER_SIZE * 2) last_move_t;
|
typedef uvalue_t((BLOCK_BUFFER_SIZE) * 2) last_move_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(ARC_SUPPORT)
|
#if ENABLED(ARC_SUPPORT)
|
||||||
@ -780,7 +784,7 @@ class Planner {
|
|||||||
FORCE_INLINE static bool is_full() { return block_buffer_tail == next_block_index(block_buffer_head); }
|
FORCE_INLINE static bool is_full() { return block_buffer_tail == next_block_index(block_buffer_head); }
|
||||||
|
|
||||||
// Get count of movement slots free
|
// Get count of movement slots free
|
||||||
FORCE_INLINE static uint8_t moves_free() { return BLOCK_BUFFER_SIZE - 1 - movesplanned(); }
|
FORCE_INLINE static uint8_t moves_free() { return (BLOCK_BUFFER_SIZE) - 1 - movesplanned(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Planner::get_next_free_block
|
* Planner::get_next_free_block
|
||||||
|
Loading…
Reference in New Issue
Block a user