mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-25 07:34:05 -06:00
irq: Prefer irq_disable/enable instead of irq_save/restore in cmds/tasks
Task and command handlers always run with irqs enabled, so it is not necessary to save/restore the irq state when disabling irqs in these handlers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
4fcf5a31f5
commit
9dd101c26f
4 changed files with 13 additions and 13 deletions
|
@ -7,7 +7,7 @@
|
|||
#include <stddef.h> // offsetof
|
||||
#include "basecmd.h" // alloc_oid
|
||||
#include "board/gpio.h" // struct gpio
|
||||
#include "board/irq.h" // irq_save
|
||||
#include "board/irq.h" // irq_disable
|
||||
#include "command.h" // DECL_COMMAND
|
||||
#include "sched.h" // struct timer
|
||||
#include "stepper.h" // stepper_stop
|
||||
|
@ -73,11 +73,11 @@ DECL_COMMAND(command_end_stop_home,
|
|||
static void
|
||||
end_stop_report(uint8_t oid, struct end_stop *e)
|
||||
{
|
||||
uint8_t flag = irq_save();
|
||||
irq_disable();
|
||||
uint32_t position = stepper_get_position(e->stepper);
|
||||
uint8_t eflags = e->flags;
|
||||
e->flags &= ~ESF_REPORT;
|
||||
irq_restore(flag);
|
||||
irq_enable();
|
||||
|
||||
sendf("end_stop_state oid=%c homing=%c pin=%c pos=%i"
|
||||
, oid, !!(eflags & ESF_HOMING), gpio_in_read(e->pin)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue