Conversation
An out-of-range P/E only printed a line in the log and the program went on with an output that never switches. Refuse the command instead (EMCMOT_COMMAND_INVALID_PARAMS + reportError), so task stops the program.
|
One suggestion on the stop cases and one housekeeping note. The test should run programs with if not dout(1):
fail("%s: the line before it did not run (motion.digital-out-01 clear)" % bad)(output 1 also needs clearing between loop iterations, it latches.) Verified on this branch: with these changes the test passes, and without the motion fix it still fails. Commit authorship. The second commit ( |
Add tests/m62-m68-range: with num_dio=4 and num_aio=4, M64 P3 and M68 E3 still work, M64 P4, M65 P10 and M68 E4 are refused with an error, and a program stops exactly at M64 P10, M62 P10 or M67 E7: the line before it runs, neither the next line nor the following move does. Document in m-code.adoc that an out-of-range P- or E-word is an error.
4639e6d to
7e8a9ef
Compare
|
Thanks for the AUTO_RUN hint, you're right: 1 makes task skip line 1. I applied all three changes (AUTO_RUN 0, the dout(1) check before the bad line, clearing output 1 between cases) to the test commit, and both commits are now authored by me. Ran it on an ubuntu:24.04 uspace build of this branch: tests/m62-m68-range passes; with only the motion/command.c change reverted it fails (12 failures: the error text, and the line and move after the bad one still run). |
grandixximo
left a comment
There was a problem hiding this comment.
Perfect, thanks. All three changes in and both commits clean. LGTM.
M62-M65andM67/M68with an output number that motion does not have (P/E>=num_dio/num_aio) are not treated as errors today:M64/M65/M68(immediate):emcmotDioWrite()/emcmotAioWrite()printERROR: index out of rangeand return, but the command status is OK, so task carries on and the program keeps running with an output that never switches.M62/M63/M67(synchronized): the bad index goes into the TP queue and is dropped silently; there is no message at all.This PR refuses
EMCMOT_SET_DOUT/EMCMOT_SET_AOUTinemcmotCommandHandlerwhen the index is out of range: it reports an error naming the word and the configured count and setsEMCMOT_COMMAND_INVALID_PARAMS, sousrmotWriteEmcmotCommand()fails and task stops the program at that line. Valid outputs are unchanged.Reproduce
motmod ... num_dio=4 num_aio=4, then runBefore:
ERROR: index out of range, 10 not in [0..4]in the log, thenmotion.digital-out-02goes high and X moves to 1 (withM62 P10orM67 E7 Q1in place ofM64 P10: no message at all, same result).After:
M62-M65 P10: no such digital output (num_dio=4), the program stops;digital-out-02stays low and X stays at 0.Tests
New
tests/m62-m68-range(python UI,num_dio=4,num_aio=4):M64 P3andM68 E3 Q2.5still work;M64 P4,M65 P10,M68 E4 Q1are refused with an error; a program stops atM64 P10,M62 P10andM67 E7 Q1and neither the next line nor the following move runs. It fails on master (12 checks) and passes with this change.Full
scripts/runtests tests/on Debian trixie, RIP uspace: no new failures (the only failures are the display-dependentpyvcpandui-smoke/*, the same as on master in that environment).Docs
docs/src/gcode/m-code.adoc: one sentence each for M62-M65, M67 and M68 that an out-of-range output number is an error and stops the program.Note:
emcmot_command_t.outis anunsigned char, so a P-word of 256 or more still wraps around before it reaches motion; that is left for a separate change.