aboutsummaryrefslogtreecommitdiffstats
path: root/src/endstop.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2017-03-05 15:00:15 -0500
committerKevin O'Connor <kevin@koconnor.net>2017-03-09 14:54:52 -0500
commita38437f378ece33cb762b482120be629c78d3540 (patch)
treea4a4ec60221aecbb3e41a5854f75bbaf629065d4 /src/endstop.c
parent8d6ecd9af87d3e0da312588bacb1c43332412107 (diff)
downloadkutter-a38437f378ece33cb762b482120be629c78d3540.tar.gz
kutter-a38437f378ece33cb762b482120be629c78d3540.tar.xz
kutter-a38437f378ece33cb762b482120be629c78d3540.zip
stepper: Introduce stepper_get_position command and remove from endstop.c
Move the logic to calculate and report the stepper's current position from endstop.c to stepper.c. This localizes the stepper code into stepper.c. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/endstop.c')
-rw-r--r--src/endstop.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/endstop.c b/src/endstop.c
index 3701f642..913bb466 100644
--- a/src/endstop.c
+++ b/src/endstop.c
@@ -42,7 +42,7 @@ void
command_config_end_stop(uint32_t *args)
{
struct end_stop *e = oid_alloc(args[0], command_config_end_stop, sizeof(*e));
- struct stepper *s = oid_lookup(args[3], command_config_stepper);
+ struct stepper *s = stepper_oid_lookup(args[3]);
e->time.func = end_stop_event;
e->stepper = s;
e->pin = gpio_in_setup(args[1], args[2]);
@@ -73,14 +73,12 @@ static void
end_stop_report(uint8_t oid, struct end_stop *e)
{
irq_disable();
- uint32_t position = stepper_get_position(e->stepper);
uint8_t eflags = e->flags;
e->flags &= ~ESF_REPORT;
irq_enable();
- sendf("end_stop_state oid=%c homing=%c pin=%c pos=%i"
- , oid, !!(eflags & ESF_HOMING), gpio_in_read(e->pin)
- , position - STEPPER_POSITION_BIAS);
+ sendf("end_stop_state oid=%c homing=%c pin=%c"
+ , oid, !!(eflags & ESF_HOMING), gpio_in_read(e->pin));
}
void