Skip to content

Commit 417e723

Browse files
Replaced LUDL with ASI error codes
1 parent 1e9f530 commit 417e723

File tree

1 file changed

+69
-47
lines changed

1 file changed

+69
-47
lines changed

microscope/controllers/asi.py

Lines changed: 69 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -71,50 +71,72 @@
7171
# Error codes are dumped to the screen with the last error code shown first using the ‘DU Y‘
7272
# command. The table below lists the meanings of the error codes as of this publication.
7373
# Error Number* Error Description
74-
# 1-9 OVERTIME – RECOVERABLE. Error caused by competing tasks using the
75-
# microprocessor.
76-
# 10-12 OVERSHOT – Move overshot the target; happens frequently, not really an error.
77-
# 15 NEGATIVE LOG – Negative number for Log conversion.
78-
# 20-22 AXIS DEAD – FATAL. No movement for 100 cycles; axis halted.
79-
# 24 ENCODER_ERROR
80-
# 30-32 EMERGENCY STOP – FATAL. Getting further from the target; axis halted.
81-
# 34 UPPER LIMIT – Upper Limit reached. (axis unspecific)
82-
# 35 LOWER LIMIT – Lower Limit reached. (axis unspecific)
83-
# 40-42 PULSE PARAMETER VALUES OUT OF RANGE – code error.
84-
# 44 FINISH SPEED CLAMP – Reached the maximum allowed move-finishing speed.
85-
# 45 ADC_LOCK_OOR – Out-of-range error on ADC input.
86-
# 46 ADC_FOLLOW_ERR – Error attempting to follow an analog ADC input.
87-
# 50-52 ENCODER ERROR OVERFLOW – FATAL. Error term so large that move intent is
88-
# indiscernible; axis halted.
89-
# 55 EPROM NO LOAD – Saved-settings on EPROM not loaded, compile date mismatch.
90-
# 60-62 ADJUST-MOVE ERROR – Failed to clear ‘M’ soon enough. FATAL
91-
# 85 SCAN LOST PULSES – During a scan, missing pulses were detected.
92-
# 86 SCAN INCOMPLETE – During a scan, terminated before completing the row.
93-
# 90-92 ERROR_LARGE – RECOVERABLE. Error large. Motor set to FULL SPEED; hope to
94-
# catch up.
95-
# 100-102 INDEX NOT FOUND
96-
# 140 PIEZO WRITE DAC – Error writing to the piezo DAC.
97-
# 141 PIEZO READ DAC – Error reading from piezo DAC
98-
# 142 PIEZO READ POS
99-
# 143 PIEZO WRITE POS
100-
# 144 PIEZO MOVE ERR
101-
# 145 PIEZO READ POS1
102-
# 146 PIEZO INIT
103-
# 147 PIEZO POS ERROR
104-
# 148 Autofocus 200um safety limit Encountered
105-
# 149 I2C_BAD_BUSY ERROR
106-
107-
# 173 I2C_AXIS_ENABLE_ERR1
108-
# 174 I2C_AXIS_ENABLE_ERR2
109-
# 175 I2C_AXIS_MUTE1_ERR
110-
# 176 I2C_AXIS_MUTE2_ERR
111-
112-
# 203 I2C_NACK_ERROR
113-
# 205 ERR_TTL_MISMATCH I2C bus error.
114-
# 255 10 MINUTE CLOCK – Provides time reference for error dump list.
115-
116-
# 300 Autofocus Scan failed due to insufficient contrast
117-
# 302 Clutch Disengaged, Engage clutch to do Autofocus
74+
ASI_ERRORS = {
75+
0: "No Error",
76+
1: "OVERTIME - RECOVERABLE. Error caused by competing tasks using the microprocessor.",
77+
2: "OVERTIME - RECOVERABLE. Error caused by competing tasks using the microprocessor.",
78+
3: "OVERTIME - RECOVERABLE. Error caused by competing tasks using the microprocessor.",
79+
4: "OVERTIME - RECOVERABLE. Error caused by competing tasks using the microprocessor.",
80+
5: "OVERTIME - RECOVERABLE. Error caused by competing tasks using the microprocessor.",
81+
6: "OVERTIME - RECOVERABLE. Error caused by competing tasks using the microprocessor.",
82+
7: "OVERTIME - RECOVERABLE. Error caused by competing tasks using the microprocessor.",
83+
8: "OVERTIME - RECOVERABLE. Error caused by competing tasks using the microprocessor.",
84+
9: "OVERTIME - RECOVERABLE. Error caused by competing tasks using the microprocessor.",
85+
10: "OVERSHOT - Move overshot the target; happens frequently, not really an error.",
86+
11: "OVERSHOT - Move overshot the target; happens frequently, not really an error.",
87+
12: "OVERSHOT - Move overshot the target; happens frequently, not really an error.",
88+
15: "NEGATIVE LOG - Negative number for Log conversion.",
89+
20: "AXIS DEAD - FATAL. No movement for 100 cycles; axis halted.",
90+
21: "AXIS DEAD - FATAL. No movement for 100 cycles; axis halted.",
91+
22: "AXIS DEAD - FATAL. No movement for 100 cycles; axis halted.",
92+
24: "ENCODER_ERROR",
93+
30: "EMERGENCY STOP - FATAL. Getting further from the target; axis halted.",
94+
31: "EMERGENCY STOP - FATAL. Getting further from the target; axis halted.",
95+
32: "EMERGENCY STOP - FATAL. Getting further from the target; axis halted.",
96+
34: "UPPER LIMIT - Upper Limit reached. (axis unspecific)",
97+
35: "LOWER LIMIT - Lower Limit reached. (axis unspecific)",
98+
40: "PULSE PARAMETER VALUES OUT OF RANGE - code error.",
99+
41: "PULSE PARAMETER VALUES OUT OF RANGE - code error.",
100+
42: "PULSE PARAMETER VALUES OUT OF RANGE - code error.",
101+
44: "FINISH SPEED CLAMP - Reached the maximum allowed move-finishing speed.",
102+
45: "ADC_LOCK_OOR - Out-of-range error on ADC input.",
103+
46: "ADC_FOLLOW_ERR - Error attempting to follow an analog ADC input.",
104+
50: "ENCODER ERROR OVERFLOW - FATAL. Error term so large that move intent is indiscernible; axis halted.",
105+
51: "ENCODER ERROR OVERFLOW - FATAL. Error term so large that move intent is indiscernible; axis halted.",
106+
52: "ENCODER ERROR OVERFLOW - FATAL. Error term so large that move intent is indiscernible; axis halted.",
107+
55: "EPROM NO LOAD - Saved-settings on EPROM not loaded, compile date mismatch.",
108+
60: "ADJUST-MOVE ERROR - Failed to clear ‘M’ soon enough. FATAL",
109+
61: "ADJUST-MOVE ERROR - Failed to clear ‘M’ soon enough. FATAL",
110+
62: "ADJUST-MOVE ERROR - Failed to clear ‘M’ soon enough. FATAL",
111+
85: "SCAN LOST PULSES - During a scan, missing pulses were detected.",
112+
86: "SCAN INCOMPLETE - During a scan, terminated before completing the row.",
113+
90: "ERROR_LARGE - RECOVERABLE. Error large. Motor set to FULL SPEED; hope to catch up.",
114+
91: "ERROR_LARGE - RECOVERABLE. Error large. Motor set to FULL SPEED; hope to catch up.",
115+
92: "ERROR_LARGE - RECOVERABLE. Error large. Motor set to FULL SPEED; hope to catch up.",
116+
100: "INDEX NOT FOUND",
117+
101: "INDEX NOT FOUND",
118+
102: "INDEX NOT FOUND",
119+
140: "PIEZO WRITE DAC - Error writing to the piezo DAC.",
120+
141: "PIEZO READ DAC - Error reading from piezo DAC",
121+
142: "PIEZO READ POS",
122+
143: "PIEZO WRITE POS",
123+
144: "PIEZO MOVE ERR",
124+
145: "PIEZO READ POS1",
125+
146: "PIEZO INIT",
126+
147: "PIEZO POS ERROR",
127+
148: "Autofocus 200um safety limit Encountered",
128+
149: "I2C_BAD_BUSY ERROR",
129+
173: "I2C_AXIS_ENABLE_ERR1",
130+
174: "I2C_AXIS_ENABLE_ERR2",
131+
175: "I2C_AXIS_MUTE1_ERR",
132+
176: "I2C_AXIS_MUTE2_ERR",
133+
203: "I2C_NACK_ERROR",
134+
205: "ERR_TTL_MISMATCH I2C bus error.",
135+
255: "10 MINUTE CLOCK - Provides time reference for error dump list.",
136+
300: "Autofocus Scan failed due to insufficient contrast",
137+
302: "Clutch Disengaged, Engage clutch to do Autofocus",
138+
}
139+
118140

119141
# Status bits for an axis
120142

@@ -245,7 +267,7 @@ def read_multiline(self):
245267
# this is an error string
246268
error = line[2:].strip()
247269
raise (
248-
f"ASI controller error: {error},{LUDL_ERRORS[error]}"
270+
f"ASI controller error: {error},{ASI_ERRORS[error]}"
249271
)
250272
return output
251273

@@ -328,7 +350,7 @@ def get_absolute_position(self, axis: int) -> float:
328350
axis_name = self._axis_mapper[axis]
329351
position = self.get_command(bytes(f"WHERE {axis_name}", "ascii"))
330352
if position[3:4] == b"N":
331-
print(f"Error: {position} : {LUDL_ERRORS[int(position[4:6])]}")
353+
print(f"Error: {position} : {ASI_ERRORS[int(position[4:6])]}")
332354
else:
333355
return float(position.strip()[2:])
334356

@@ -454,7 +476,7 @@ def _get_setting(self, command, axis, dtype):
454476
# this is an error string
455477
error = answer[2:]
456478
raise Exception(
457-
f"ASI controller error: {error},{LUDL_ERRORS[error]}"
479+
f"ASI controller error: {error},{ASI_ERRORS[error]}"
458480
)
459481
else:
460482
raise Exception(f"ASI controller error: {answer}")

0 commit comments

Comments
 (0)