From 1ff9b81630a4670488c204bb7584b21235fd346c Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Wed, 7 Jul 2021 16:35:50 +0200 Subject: [PATCH] Rename PulseGen::Move to PlanMoveTo Make Motion and PulseGen intentionally very similar. --- src/modules/pulse_gen.cpp | 2 +- src/modules/pulse_gen.h | 9 ++++++--- tests/unit/modules/pulse_gen/test_pulse_gen.cpp | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/modules/pulse_gen.cpp b/src/modules/pulse_gen.cpp index 6fe2ba1..a06400d 100644 --- a/src/modules/pulse_gen.cpp +++ b/src/modules/pulse_gen.cpp @@ -85,7 +85,7 @@ void PulseGen::CalculateTrapezoid(block_t *block, steps_t entry_speed, steps_t e block->final_rate = final_rate; } -bool PulseGen::Move(pos_t target, steps_t feed_rate) { +bool PulseGen::PlanMoveTo(pos_t target, steps_t feed_rate) { // Prepare to set up new block if (block_index.full()) return false; diff --git a/src/modules/pulse_gen.h b/src/modules/pulse_gen.h index 219acbd..7c6edb5 100644 --- a/src/modules/pulse_gen.h +++ b/src/modules/pulse_gen.h @@ -28,9 +28,12 @@ public: /// Set acceleration for the axis void SetAcceleration(steps_t accel) { acceleration = accel; } - /// Plan a single move (can only be executed when not Full()) - /// @returns True if the move has been planned - bool Move(pos_t x, steps_t feed_rate); + /// Enqueue a single move in steps starting and ending at zero speed with maximum + /// feedrate. Moves can only be enqueued if the axis is not Full(). + /// @param pos target position + /// @param feedrate maximum feedrate + /// @returns true if the move has been enqueued + bool PlanMoveTo(pos_t pos, steps_t feedrate); /// stop whatever moves are being done void AbortPlannedMoves(); diff --git a/tests/unit/modules/pulse_gen/test_pulse_gen.cpp b/tests/unit/modules/pulse_gen/test_pulse_gen.cpp index c0b2deb..c6cba8d 100644 --- a/tests/unit/modules/pulse_gen/test_pulse_gen.cpp +++ b/tests/unit/modules/pulse_gen/test_pulse_gen.cpp @@ -20,7 +20,7 @@ TEST_CASE("pulse_gen::basic", "[pulse_gen]") { for (int accel = 100; accel <= 5000; accel *= 2) { PulseGen pg(10, accel); - pg.Move(100000, 10000); + pg.PlanMoveTo(100000, 10000); unsigned long ts = 0; st_timer_t next;