Files
grblHAL/alarms.c
Terje Io 64c35930c7 Refactored offset handling, for improved readability and in preparation for rotation support.
Added experimental support for G66 (modal macro call) and G67 (end modal macro call).
Made axis letter to axis/motor assignment for axes ABCUVW freely changeable at compile time.
Fix for some G65 arguments being incorrectly validated for normal use (sign, range).
Added repeat support to G65 macro call via the optional L parameter word.
Changed default setting for ABC-axes to rotary.
Changed defaults for jerk settings to 10x acceleration settings.
Disabled jerk for jog, probe and spindle synchronized motion.
Added _active_probe system parameter, returns -1 if no probe inputs available.
Minor bug fix, G5.1 and G33.1 motion commands were not coverted to the correct string equivalent in $G output.
2026-01-25 07:51:44 +01:00

86 lines
3.9 KiB
C

/*
alarms.c -
Part of grblHAL
Copyright (c) 2017-2025 Terje Io
Copyright (c) 2011-2016 Sungeun K. Jeon for Gnea Research LLC
Copyright (c) 2009-2011 Simen Svale Skogsrud
grblHAL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
grblHAL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with grblHAL. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#include "grbl.h"
#include "core_handlers.h"
PROGMEM static const alarm_detail_t alarm_detail[] = {
{ Alarm_HardLimit, "Hard limit has been triggered. Machine position is likely lost due to sudden halt. Re-homing is highly recommended." },
{ Alarm_SoftLimit, "Soft limit alarm. G-code motion target exceeds machine travel. Machine position retained. Alarm may be safely unlocked." },
{ Alarm_AbortCycle, "Reset/E-stop while in motion. Machine position is likely lost due to sudden halt. Re-homing is highly recommended." },
{ Alarm_ProbeFailInitial, "Probe fail. Probe is not in the expected initial state before starting probe cycle when G38.2 and G38.3 is not triggered and G38.4 and G38.5 is triggered." },
{ Alarm_ProbeFailContact, "Probe fail. Probe did not contact the workpiece within the programmed travel for G38.2 and G38.4." },
{ Alarm_HomingFailReset, "Homing fail. The active homing cycle was reset." },
{ Alarm_HomingFailDoor, "Homing fail. Safety door was opened during homing cycle." },
{ Alarm_FailPulloff, "Homing fail. Pull off travel failed to clear limit switch. Try increasing pull-off setting or check wiring." },
{ Alarm_HomingFailApproach, "Homing fail. Could not find limit switch within search distances. Try increasing max travel, decreasing pull-off distance, or check wiring." },
{ Alarm_EStop, "EStop asserted. Clear and reset" },
{ Alarm_HomingRequired, "Homing required. Execute homing command ($H) to continue." },
{ Alarm_LimitsEngaged, "Limit switch engaged. Clear before continuing." },
{ Alarm_ProbeProtect, "Probe protection triggered. Clear before continuing." },
{ Alarm_Spindle, "Spindle at speed timeout. Clear before continuing." },
{ Alarm_HomingFailAutoSquaringApproach, "Homing fail. Could not find second limit switch for auto squared axis within search distances. Try increasing max travel, decreasing pull-off distance, or check wiring." },
{ Alarm_SelftestFailed, "Power on selftest (POS) failed." },
{ Alarm_MotorFault, "Motor fault." },
{ Alarm_HomingFail, "Homing fail. Bad configuration." },
{ Alarm_ModbusException, "Modbus exception. Timeout or message error." },
{ Alarm_ExpanderException, "I/O expander communication failed." },
{ Alarm_NVS_Failed, "Non Volatile Storage (EEPROM) failure." }
};
static alarm_details_t details = {
.alarms = alarm_detail,
.n_alarms = sizeof(alarm_detail) / sizeof(alarm_detail_t)
};
static alarm_details_t *alarms = &details;
void alarms_register (alarm_details_t *details)
{
alarms->next = details;
alarms = details;
}
alarm_details_t *alarms_get_details (void)
{
return &details;
}
const char *alarms_get_description (alarm_code_t id)
{
uint_fast16_t n_alarms;
const char *description = NULL;
alarm_details_t *details = grbl.on_get_alarms();
do {
if((n_alarms = details->n_alarms)) do {
if(details->alarms[--n_alarms].id == id)
description = details->alarms[n_alarms].description;
} while(description == NULL && n_alarms);
} while(description == NULL && (details = details->next));
return description;
}