/* errors.h - 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 . */ #ifndef _ERRORS_H_ #define _ERRORS_H_ #include // Define grblHAL status codes. Valid values (0-255) // Code 0 - 38 is equal to legacy Grbl codes typedef enum { Status_OK = 0, Status_ExpectedCommandLetter = 1, Status_BadNumberFormat = 2, Status_InvalidStatement = 3, Status_NegativeValue = 4, Status_HomingDisabled = 5, Status_SettingStepPulseMin = 6, Status_SettingReadFail = 7, Status_IdleError = 8, Status_SystemGClock = 9, Status_SoftLimitError = 10, Status_Overflow = 11, Status_MaxStepRateExceeded = 12, Status_CheckDoor = 13, Status_LineLengthExceeded = 14, Status_TravelExceeded = 15, Status_InvalidJogCommand = 16, Status_SettingDisabledLaser = 17, Status_Reset = 18, Status_NonPositiveValue = 19, Status_GcodeUnsupportedCommand = 20, Status_GcodeModalGroupViolation = 21, Status_GcodeUndefinedFeedRate = 22, Status_GcodeCommandValueNotInteger = 23, Status_GcodeAxisCommandConflict = 24, Status_GcodeWordRepeated = 25, Status_GcodeNoAxisWords = 26, Status_GcodeInvalidLineNumber = 27, Status_GcodeValueWordMissing = 28, Status_GcodeUnsupportedCoordSys = 29, Status_GcodeG53InvalidMotionMode = 30, Status_GcodeAxisWordsExist = 31, Status_GcodeNoAxisWordsInPlane = 32, Status_GcodeInvalidTarget = 33, Status_GcodeArcRadiusError = 34, Status_GcodeNoOffsetsInPlane = 35, Status_GcodeUnusedWords = 36, Status_GcodeG43DynamicAxisError = 37, Status_GcodeIllegalToolTableEntry = 38, Status_GcodeValueOutOfRange = 39, Status_GcodeToolChangePending = 40, Status_GcodeSpindleNotRunning = 41, Status_GcodeIllegalPlane = 42, Status_GcodeMaxFeedRateExceeded = 43, Status_GcodeRPMOutOfRange = 44, Status_LimitsEngaged = 45, Status_HomingRequired = 46, Status_GCodeToolError = 47, Status_ValueWordConflict = 48, Status_SelfTestFailed = 49, Status_EStop = 50, Status_MotorFault = 51, Status_SettingValueOutOfRange = 52, Status_SettingDisabled = 53, Status_GcodeInvalidRetractPosition = 54, Status_IllegalHomingConfiguration = 55, Status_GCodeCoordSystemLocked = 56, Status_UnexpectedDemarcation = 57, Status_AuxiliaryPortUnavailable = 58, Status_SDMountError = 60, Status_FileReadError = 61, Status_FsFailedOpenDir = 62, Status_FSDirNotFound = 63, Status_SDNotMounted = 64, Status_FsNotMounted = 65, Status_FsReadOnly = 66, Status_BTInitError = 70, // Status_ExpressionUknownOp = 71, Status_ExpressionDivideByZero = 72, Status_ExpressionArgumentOutOfRange = 73, Status_ExpressionInvalidArgument = 74, Status_ExpressionSyntaxError = 75, Status_ExpressionInvalidResult = 76, Status_AuthenticationRequired = 77, Status_AccessDenied = 78, Status_NotAllowedCriticalEvent = 79, Status_FlowControlNotExecutingMacro = 80, Status_FlowControlSyntaxError = 81, Status_FlowControlStackOverflow = 82, Status_FlowControlOutOfMemory = 83, Status_FileOpenFailed = 84, Status_FsFormatFailed = 85, Status_AuxiliaryPortUnusable = 86, Status_StatusMax = Status_AuxiliaryPortUnusable, Status_UserException = 253, Status_Handled, // For internal use only Status_Unhandled // For internal use only } __attribute__ ((__packed__)) status_code_t; typedef struct { status_code_t id; const char *description; } status_detail_t; typedef struct error_details { const uint16_t n_errors; const status_detail_t *errors; struct error_details *next; } error_details_t; typedef error_details_t *(*on_get_errors_ptr)(void); error_details_t *errors_get_details (void); const char *errors_get_description (status_code_t id); void errors_register (error_details_t *details); #endif