bdring / FluidNC

The next generation of motion control firmware
Other
1.63k stars 387 forks source link

Alarm 14 may not be cleared if an axis is not set to home #1228

Closed banana-legs closed 5 months ago

banana-legs commented 6 months ago

Wiki Search Terms

homing

Controller Board

ESP32 test rig

Machine Description

Single stepper and a switch test rig for test, but problem could occur on any machine.

Input Circuits

No response

Configuration file

board: "ESP32 test rig"
name: "ESP32 test rig 20240520"

stepping:
  engine: RMT
  idle_ms: 255
  pulse_us: 4.0
  dir_delay_us: 6
  disable_delay_us: 10

axes:
  shared_stepper_disable_pin: gpio.13:high
  x:
    steps_per_mm: 200.000
    max_rate_mm_per_min: 3000.000
    acceleration_mm_per_sec2: 200.000
    max_travel_mm: 100
    soft_limits: false
    homing:
      cycle: 1
      allow_single_axis: true
      positive_direction: false
      mpos_mm: 0.000
      feed_mm_per_min: 50.000
      seek_mm_per_min: 300.000
      settle_ms: 250
      seek_scaler: 1.100
      feed_scaler: 1.100

    motor0:
      limit_neg_pin: NO_PIN
      limit_pos_pin: NO_PIN
      limit_all_pin: gpio.26:low
      hard_limits: true
      pulloff_mm: 1.000
      standard_stepper:
        step_pin: gpio.33
        direction_pin: gpio.32
        disable_pin: NO_PIN

  a:
    steps_per_mm: 106.667
    max_rate_mm_per_min: 720.000
    acceleration_mm_per_sec2: 20.000
    max_travel_mm: 360.000
    soft_limits: false
    homing:
      cycle: -1
      allow_single_axis: true
      positive_direction: true
      mpos_mm: 0.000
      feed_mm_per_min: 50.000
      seek_mm_per_min: 200.000
      settle_ms: 250
      seek_scaler: 1.100
      feed_scaler: 1.100

    motor0:
      limit_neg_pin: NO_PIN
      limit_pos_pin: NO_PIN
      limit_all_pin: NO_PIN
      hard_limits: false
      pulloff_mm: 1.000
      standard_stepper:
        step_pin: gpio.2
        direction_pin: gpio.15
        disable_pin: NO_PIN

start:
  must_home: true
  check_limits: true

Startup Messages

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1184
load:0x40078000,len:13220
ho 0 tail 12 room 4
load:0x40080400,len:3028
entry 0x400805e4
[MSG:INFO: uart_channel0 created]
[MSG:RST]
[MSG:INFO: FluidNC v3.7.17 https://github.com/bdring/FluidNC]
[MSG:INFO: Compiled with ESP32 SDK:v4.4.4]
[MSG:INFO: Local filesystem type is littlefs]
[MSG:INFO: Configuration file:config.yaml]
[MSG:DBG: Running after-parse tasks]
[MSG:DBG: Checking configuration]
[MSG:INFO: Machine ESP32 test rig 20240520]
[MSG:INFO: Board ESP32 test rig]
[MSG:DBG: SPI not defined]
[MSG:DBG: See http://wiki.fluidnc.com/en/config/sd_card#sdfallbackcs-access-sd-without-a-config-file]
[MSG:INFO: Stepping:RMT Pulse:4us Dsbl Delay:10us Dir Delay:6us Idle Delay:255ms]
[MSG:INFO: Axis count 4]
[MSG:INFO: Shared stepper disable gpio.13]
[MSG:INFO: Axis X (0.000,100.000)]
[MSG:INFO:   Motor0]
[MSG:INFO:     standard_stepper Step:gpio.33 Dir:gpio.32 Disable:NO_PIN]
[MSG:INFO:  X All Limit gpio.26:low]
[MSG:INFO: Axis Y (-1000.000,0.000)]
[MSG:INFO:   Motor0]
[MSG:INFO: Axis Z (-1000.000,0.000)]
[MSG:INFO:   Motor0]
[MSG:INFO: Axis A (-360.000,0.000)]
[MSG:INFO:   Motor0]
[MSG:INFO:     standard_stepper Step:gpio.2 Dir:gpio.15 Disable:NO_PIN]
[MSG:INFO: Kinematic system: Cartesian]
[MSG:INFO: Using spindle NoSpindle]
[MSG:INFO: STA SSID is not set]
[MSG:INFO: AP SSID FluidNC IP 192.168.0.1 mask 255.255.255.0 channel 1]
[MSG:INFO: AP started]
[MSG:INFO: WiFi on]
[MSG:INFO: Captive Portal Started]
[MSG:INFO: HTTP started on port 80]
[MSG:INFO: Telnet started on port 23]

Grbl 3.7 [FluidNC v3.7.17 (wifi) '$' for help]
[MSG:INFO: ALARM: Unhomed]
ALARM:14
[MSG:DBG:  X All Limit 0]

?
<Alarm|MPos:0.000,0.000,0.000,0.000|FS:0,0|WCO:10.000,0.000,0.000,0.000>

$h
[MSG:DBG: Homing Cycle X]
[MSG:DBG: Homing nextPhase FastApproach]
[MSG:DBG: Starting from 0.000,0.000,0.000]
[MSG:DBG: Planned move to -110.000,0.000,0.000 @ 300.000]
[MSG:DBG:  X All Limit 1]
[MSG:DBG: Homing limited X]
[MSG:DBG: Homing nextPhase Pulloff0]
[MSG:DBG: Starting from -11.705,0.000,0.000]
[MSG:DBG: Planned move to -10.705,0.000,0.000 @ 50.000]
[MSG:DBG:  X All Limit 0]
[MSG:DBG: CycleStop Pulloff0]
[MSG:DBG: Homing nextPhase SlowApproach]
[MSG:DBG: Starting from -10.705,0.000,0.000]
[MSG:DBG: Planned move to -11.805,0.000,0.000 @ 50.000]
[MSG:DBG:  X All Limit 1]
[MSG:DBG: Homing limited X]
[MSG:DBG: Homing nextPhase Pulloff1]
[MSG:DBG: Starting from -11.685,0.000,0.000]
[MSG:DBG: Planned move to -10.685,0.000,0.000 @ 50.000]
[MSG:DBG:  X All Limit 0]
[MSG:DBG: CycleStop Pulloff1]
[MSG:DBG: Homing nextPhase Pulloff2]
[MSG:DBG: mpos was -10.685,0.000,0.000]
[MSG:Homed:X]
[MSG:DBG: mpos becomes 0.000,0.000,0.000]
[MSG:DBG: mpos transformed 0.000,0.000,0.000]
[MSG:DBG: Homing done]
ok

?
<Alarm|MPos:0.000,0.000,0.000,0.000|FS:0,0|Ov:100,100,100>

User Interface Software

fluidterm, but will occur with all senders.

What happened?

If the system is configured with some axes set to home, and at least one axis with the homing cycle set -1, and must_home set to true, then the controller correctly starts with Alarm 14 set as the system is not homed, but Alarm 14 does not get cleared after $h has been done.

The problem arises on my machine when I have a rotary axis installed as the A axis has no homing switch and I configure the offset position manually (hence needing the cycle to be -1).

As an aside problem, as Alarm 14 remains triggered after homing, the motors are disabled (even though idle_ms is set to 255, but that is a separate issue), and my heavy Z axis can sag and lose position :(

I checked through the code and found the homing flag was not always being cleared when a '-1' was used, so have been compiling in a work-around by adding into homing.cpp a new line so that line 470 changes from:

clear_bitnum(axisMask, axis);

to clear_bitnum(axisMask, axis); set_axis_homed(axis);

which resolves the problem with the Alarm 14 not being cleared. I am not sure if it is the best way to solve it, but it does seem to work and I have not noticed any adverse issues so far.

GCode File

No response

Other Information

No response

banana-legs commented 5 months ago

I have run tests on my machine with 3.7.18 and Alarm 14 is operating correctly now, many thanks. This issue can be closed now.