endstop: Use "pin_value" instead of "pin" when querying endstop state
Now that enumerations are available, any variable named "pin" can only be used to describe a gpio pin. Rename the end_stop_state "pin" parameter to "pin_value". Also, rename "end_stop_query" command to "end_stop_query_state" to notify users to upgrade both host and mcu code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
ea0f231343
commit
746a378c18
|
@ -175,8 +175,8 @@ class MCU_endstop:
|
||||||
self._home_cmd = self._mcu.lookup_command(
|
self._home_cmd = self._mcu.lookup_command(
|
||||||
"end_stop_home oid=%c clock=%u sample_ticks=%u sample_count=%c"
|
"end_stop_home oid=%c clock=%u sample_ticks=%u sample_count=%c"
|
||||||
" rest_ticks=%u pin_value=%c", cq=cmd_queue)
|
" rest_ticks=%u pin_value=%c", cq=cmd_queue)
|
||||||
self._query_cmd = self._mcu.lookup_command("end_stop_query oid=%c",
|
self._query_cmd = self._mcu.lookup_command(
|
||||||
cq=cmd_queue)
|
"end_stop_query_state oid=%c", cq=cmd_queue)
|
||||||
self._mcu.register_msg(self._handle_end_stop_state, "end_stop_state"
|
self._mcu.register_msg(self._handle_end_stop_state, "end_stop_state"
|
||||||
, self._oid)
|
, self._oid)
|
||||||
def home_prepare(self):
|
def home_prepare(self):
|
||||||
|
@ -238,7 +238,7 @@ class MCU_endstop:
|
||||||
eventtime = self._mcu.monotonic()
|
eventtime = self._mcu.monotonic()
|
||||||
while self._check_busy(eventtime):
|
while self._check_busy(eventtime):
|
||||||
eventtime = self._mcu.pause(eventtime + 0.1)
|
eventtime = self._mcu.pause(eventtime + 0.1)
|
||||||
return self._last_state.get('pin', self._invert) ^ self._invert
|
return self._last_state.get('pin_value', self._invert) ^ self._invert
|
||||||
|
|
||||||
class MCU_digital_out:
|
class MCU_digital_out:
|
||||||
def __init__(self, mcu, pin_params):
|
def __init__(self, mcu, pin_params):
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Handling of end stops.
|
// Handling of end stops.
|
||||||
//
|
//
|
||||||
// Copyright (C) 2016,2017 Kevin O'Connor <kevin@koconnor.net>
|
// Copyright (C) 2016-2019 Kevin O'Connor <kevin@koconnor.net>
|
||||||
//
|
//
|
||||||
// This file may be distributed under the terms of the GNU GPLv3 license.
|
// This file may be distributed under the terms of the GNU GPLv3 license.
|
||||||
|
|
||||||
|
@ -134,18 +134,18 @@ end_stop_report(uint8_t oid, struct end_stop *e)
|
||||||
e->flags &= ~ESF_REPORT;
|
e->flags &= ~ESF_REPORT;
|
||||||
irq_enable();
|
irq_enable();
|
||||||
|
|
||||||
sendf("end_stop_state oid=%c homing=%c pin=%c"
|
sendf("end_stop_state oid=%c homing=%c pin_value=%c"
|
||||||
, oid, !!(eflags & ESF_HOMING), gpio_in_read(e->pin));
|
, oid, !!(eflags & ESF_HOMING), gpio_in_read(e->pin));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
command_end_stop_query(uint32_t *args)
|
command_end_stop_query_state(uint32_t *args)
|
||||||
{
|
{
|
||||||
uint8_t oid = args[0];
|
uint8_t oid = args[0];
|
||||||
struct end_stop *e = oid_lookup(oid, command_config_end_stop);
|
struct end_stop *e = oid_lookup(oid, command_config_end_stop);
|
||||||
end_stop_report(oid, e);
|
end_stop_report(oid, e);
|
||||||
}
|
}
|
||||||
DECL_COMMAND(command_end_stop_query, "end_stop_query oid=%c");
|
DECL_COMMAND(command_end_stop_query_state, "end_stop_query_state oid=%c");
|
||||||
|
|
||||||
void
|
void
|
||||||
end_stop_task(void)
|
end_stop_task(void)
|
||||||
|
|
Loading…
Reference in New Issue