|
| 1 | +// Copyright 2011 Jonán C. Martín |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +#include "errorcodes.hpp" |
| 16 | + |
| 17 | +// Reg exp for Notepad++'s Ctrl-H (Search & Replace): |
| 18 | +// >>(\#define)( )([A-Z\_]+)([ ]+[0-9]+[ ]+//[ ])([A-Za-z0-9 \'\(\)\,\.=]+)<< |
| 19 | +// >> case \3: return "\5";<< |
| 20 | + |
| 21 | +const char * errcode_meaning(int errorno) |
| 22 | +{ |
| 23 | + switch (errorno) |
| 24 | + { |
| 25 | + /*********************************************************************** |
| 26 | + * COMMAND ERRORS |
| 27 | + ***********************************************************************/ |
| 28 | + |
| 29 | + case INV_CMD: return "Invalid command"; |
| 30 | + case PAR_OUT: return "Parameter out of bounds"; |
| 31 | + case MIS_PAR: return "Missing parameter"; |
| 32 | + case NO_DLIM: return "Expected delimiter not seen"; |
| 33 | + case TOO_MNY: return "Command string too long"; |
| 34 | + case TP_ACTV: return "The teach pendant is active or busy"; |
| 35 | + |
| 36 | + /*********************************************************************** |
| 37 | + * COMMUNICATION ERRORS |
| 38 | + ***********************************************************************/ |
| 39 | + |
| 40 | + case HST_OVF: return "Host input buffer overflow"; |
| 41 | + case HST_TMO: return "Host USART timed out"; |
| 42 | + case HST_ERR: return "Host USART error (framing, parity, etc.)"; |
| 43 | + case TP_OVF: return "Teach pendant input buffer overflow"; |
| 44 | + case TP_TMO: return "Teach pendant USART timed out"; |
| 45 | + case TP_ERRO: return "Teach pendant USART error (framing, parity, etc.)"; |
| 46 | + case TP_OVRN: return "Teach pendant USART overrun"; |
| 47 | + case HST_OVR: return "Host USART overrun"; |
| 48 | + |
| 49 | + /*********************************************************************** |
| 50 | + * DIAGNOSTIC ERRORS |
| 51 | + ***********************************************************************/ |
| 52 | + |
| 53 | + case BAD_RAM: return "Bad RAM location"; |
| 54 | + case TP_ERR: return "Teach pendant returned diagnostic error"; |
| 55 | + case NO_TP: return "Teach pendant not present"; |
| 56 | + |
| 57 | + /*********************************************************************** |
| 58 | + * TEACH PENDANT PROGRAM ERRORS |
| 59 | + ***********************************************************************/ |
| 60 | + |
| 61 | + case LAB_ERR: return "Missing label"; |
| 62 | + case NO_PGRM: return "No program in memory"; |
| 63 | + case MEM_FUL: return "Insufficient teach pendant memory"; |
| 64 | + case EPM_FUL: return "Insufficient EEPROM memory"; |
| 65 | + case RPL_ERR: return "Can't replace first record"; |
| 66 | + case PROGRAM: return "A pendant program already exists"; |
| 67 | + |
| 68 | + /*********************************************************************** |
| 69 | + * EXECUTION ERRORS |
| 70 | + ***********************************************************************/ |
| 71 | + |
| 72 | + case HRD_ERR: return "Hard home routine failed"; |
| 73 | + case NO_HARD: return "Hard home not set"; |
| 74 | + case NO_SOFT: return "Soft home not set"; |
| 75 | + case AR_OVFL: return "Arithmetic overflow"; |
| 76 | + case TRG_ERR: return "Trig function return error"; |
| 77 | + case STK_ERR: return "Error stack overflow"; |
| 78 | + case BUSY: return "Still executing a trapezoidal move"; |
| 79 | + case NO_MOTR: return "Inactive motor referenced"; |
| 80 | + case MOV_DAT: return "Insufficient move data (velocity or acceleration = 0)"; |
| 81 | + case BAD_MOD: return "Improper motor mode for command"; |
| 82 | + case NO_A_SW: return "Limit switch A not found"; |
| 83 | + case NO_B_SW: return "Limit switch B not found"; |
| 84 | + case NO_C_SW: return "Limit switch C not found"; |
| 85 | + case NO_D_SW: return "Limit switch D not found"; |
| 86 | + case NO_E_SW: return "Limit switch E not found"; |
| 87 | + case NO_F_SW: return "Limit switch F not found"; |
| 88 | + case NO_G_SW: return "Limit switch G not found"; |
| 89 | + case NO_H_SW: return "Limit switch H not found"; |
| 90 | + case IMODE: return "Interpolation move out of bounds"; |
| 91 | + case POS_OUT: return "XYZ position out of bounds"; |
| 92 | + case STK_A_S: return "Limit switch A stuck"; |
| 93 | + case STK_B_S: return "Limit switch B stuck"; |
| 94 | + case STK_C_S: return "Limit switch C stuck"; |
| 95 | + case STK_D_S: return "Limit switch D stuck"; |
| 96 | + case STK_E_S: return "Limit switch E stuck"; |
| 97 | + case STK_F_S: return "Limit switch F stuck"; |
| 98 | + case STK_G_S: return "Limit switch G stuck"; |
| 99 | + case STK_H_S: return "Limit switch H stuck"; |
| 100 | + case INV_RBT: return "Invalid robot type specifier"; |
| 101 | + case INV_MOT: return "Invalid motor specifier"; |
| 102 | + case INV_CTL: return "Invalid controller type"; |
| 103 | + case INV_PND: return "Invalid pendant mode"; |
| 104 | + case STOP: return "Emergency stop"; |
| 105 | + case INV_XYZ: return "Invalid xyz specifier"; |
| 106 | + case XYZ_PAR: return "Invalid xyz parameter"; |
| 107 | + |
| 108 | + /*********************************************************************** |
| 109 | + * MOTOR ERRORS |
| 110 | + ***********************************************************************/ |
| 111 | + |
| 112 | + case A_STALL: return "Motor A stalled"; |
| 113 | + case B_STALL: return "Motor B stalled"; |
| 114 | + case C_STALL: return "Motor C stalled"; |
| 115 | + case D_STALL: return "Motor D stalled"; |
| 116 | + case E_STALL: return "Motor E stalled"; |
| 117 | + case F_STALL: return "Motor F stalled"; |
| 118 | + case G_STALL: return "Motor G stalled"; |
| 119 | + case H_STALL: return "Motor H stalled"; |
| 120 | + case A_CURLIM: return "Motor A's current limit circuit was activated"; |
| 121 | + case B_CURLIM: return "Motor B's current limit circuit was activated"; |
| 122 | + case C_CURLIM: return "Motor C's current limit circuit was activated"; |
| 123 | + case D_CURLIM: return "Motor D's current limit circuit was activated"; |
| 124 | + case E_CURLIM: return "Motor E's current limit circuit was activated"; |
| 125 | + case F_CURLIM: return "Motor F's current limit circuit was activated"; |
| 126 | + case G_CURLIM: return "Motor G's current limit circuit was activated"; |
| 127 | + case H_CURLIM: return "Motor H's current limit circuit was activated"; |
| 128 | + case I_CURLIM: return "Aux Port 1's current limit circuit was activated"; |
| 129 | + case J_CURLIM: return "Aux Port 2's current limit circuit was activated"; |
| 130 | + |
| 131 | + default: return "Unknown error code"; |
| 132 | + } |
| 133 | +} |
0 commit comments