Skip to content

Commit 8f8d05e

Browse files
author
ashelly
committed
Separate line numbers for limit pos and home pos.
1 parent 32863b3 commit 8f8d05e

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

gcode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ uint8_t gc_execute_line(char *line)
401401
// Check for valid line number N value.
402402
if (bit_istrue(value_words,bit(WORD_N))) {
403403
// Line number value cannot be less than zero (done) or greater than max line number.
404-
if (gc_block.values.n > MAX_LINE_NUMBER) { FAIL(STATUS_GCODE_INVALID_LINE_NUMBER); } // [Exceeds max line number]
404+
if (gc_block.values.n > LINENUMBER_MAX) { FAIL(STATUS_GCODE_INVALID_LINE_NUMBER); } // [Exceeds max line number]
405405
}
406406
// bit_false(value_words,bit(WORD_N)); // NOTE: Single-meaning value word. Set at end of error-checking.
407407

limits.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
#include "limits.h"
2929
#include "report.h"
3030

31-
#define HOMING_CYCLE_LINE_NUMBER MAX_LINE_NUMBER
31+
#define HOMING_ZERO_LINE_NUMBER (LINENUMBER_SPECIAL|0)
32+
#define HOMING_FINISHED_LINE_NUMBER (LINENUMBER_SPECIAL|1)
3233

3334
#define HOMING_AXIS_SEARCH_SCALAR 1.1 // Axis search distance multiplier. Must be > 1.
3435

@@ -193,7 +194,7 @@ void limits_go_home(uint8_t cycle_mask)
193194
} while (n_cycle-- > 0);
194195

195196
//force report of known position for compare to zero.
196-
linenumber_insert(HOMING_CYCLE_LINE_NUMBER);
197+
linenumber_insert(HOMING_ZERO_LINE_NUMBER);
197198
request_report_status(1);
198199
protocol_execute_runtime();
199200

@@ -223,7 +224,7 @@ void limits_go_home(uint8_t cycle_mask)
223224
plan_sync_position(); // Sync planner position to current machine position for pull-off move.
224225

225226
#ifdef USE_LINE_NUMBERS
226-
plan_buffer_line(target, min_seek_rate, false, HOMING_CYCLE_LINE_NUMBER); // Bypass mc_line(). Directly plan motion.
227+
plan_buffer_line(target, min_seek_rate, false, HOMING_FINISHED_LINE_NUMBER); // Bypass mc_line(). Directly plan motion.
227228
#else
228229
plan_buffer_line(target, min_seek_rate, false); // Bypass mc_line(). Directly plan motion.
229230
#endif

sim/simulator.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void init_simulator(float time_multiplier) {
7171
#ifdef ENABLE_SOFTWARE_DEBOUNCE
7272
wdt_vect = interrupt_WDT_vect;
7373
#endif
74-
pc_vect = interrupt_LIMIT_INT_vect;
74+
// pc_vect = interrupt_LIMIT_INT_vect;
7575

7676

7777
io_sim_init(port_monitors);

system.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,9 @@ void system_execute_startup(char *line);
116116

117117
// But We don't need such a big value, and we do need the high bit free
118118
//#define MAX_LINE_NUMBER 9999999
119-
#define MAX_LINE_NUMBER 0x7FFF
120119
#define LINENUMBER_EMPTY_BLOCK 0x8000 //the other bit, used as a flag
120+
#define LINENUMBER_SPECIAL 0x4000
121+
#define LINENUMBER_MAX (LINENUMBER_SPECIAL-1)
121122
typedef uint16_t linenumber_t; //resize back to int32 for bigger numbers
122123

123124

0 commit comments

Comments
 (0)