Support for injected commands V1
AbandonedPublic

Authored by rizzitello on Feb 25 2018, 4:18 AM.

Details

Summary

Solve: T7746

Diff Face off. Only one can be merged.

Both D10814 and D11024 provide the same features in a different ways.

This is QString Version

Test Plan

Test File:

Diff Detail

Repository
R232 AtCore
Branch
injectCommands
Lint
No Linters Available
Unit
No Unit Test Coverage
There are a very large number of changes, so older changes are hidden. Show Older Changes
rizzitello added inline comments.Feb 25 2018, 4:23 AM
src/atcore.cpp
564

These seam to do nothing but make atcore crash if the print thread changes the Temp.
Tested Controls Work fine.

574

Same as the other one

laysrodrigues added inline comments.Feb 26 2018, 12:02 AM
src/printthread.cpp
99

This shouldn't be the same as the one below?

laysrodrigues accepted this revision.Feb 27 2018, 12:50 PM
This revision is now accepted and ready to land.Feb 27 2018, 12:50 PM
patrickelectric requested changes to this revision.Mar 1 2018, 2:48 AM
patrickelectric added inline comments.
src/atcore.cpp
519

Why is this related ?

574

Gdb

src/printthread.h
120

Why special commands and not normal gcode ?

This revision now requires changes to proceed.Mar 1 2018, 2:48 AM
rizzitello added inline comments.Mar 1 2018, 3:03 AM
src/atcore.cpp
519

doing the post pause before making the state paused helps keep our states more consistant and provides safer base for injections.

src/printthread.h
120

These commands are ment to call atcore functions not just strictly single gcodes. For instance there is no way to pause a job via a gcode (unless its on an sd card)

rizzitello added inline comments.Mar 1 2018, 3:07 AM
src/atcore.cpp
574

These calls are no needed . so i didn't bother to look in to why it crashed. I did check to be sure that the temps are being set correctly .

patrickelectric added inline comments.Mar 1 2018, 3:13 AM
src/printthread.cpp
168

Qstring.simplify

175

Why remove ?

177

We should support gcode in cases that the function is gcode available

rizzitello updated this revision to Diff 28309.Mar 1 2018, 4:07 AM

less code

rizzitello marked an inline comment as done.Mar 1 2018, 4:07 AM
rizzitello updated this revision to Diff 28487.Mar 3 2018, 3:03 PM
  • Better documents
  • Support resume
  • safer handling of args
rizzitello edited the test plan for this revision. (Show Details)Mar 3 2018, 4:46 PM
rizzitello retitled this revision from Support for injected commands to Support for injected commands V1.Mar 4 2018, 4:57 PM
rizzitello edited the summary of this revision. (Show Details)
rizzitello updated this revision to Diff 28611.Mar 4 2018, 5:17 PM
rizzitello edited the summary of this revision. (Show Details)
  • Change to ';-'
rizzitello edited the test plan for this revision. (Show Details)Mar 4 2018, 5:18 PM
rizzitello updated this revision to Diff 28652.Mar 5 2018, 1:27 AM
  • Clean doxygen text
rizzitello updated this revision to Diff 28655.Mar 5 2018, 1:42 AM
  • doxyupdate
rizzitello edited the test plan for this revision. (Show Details)Mar 5 2018, 1:43 AM

Please mark the comments as 'done' when they are done so it's easier to review, there's too many comments on the code (phabricator ones) right now.

rizzitello marked 9 inline comments as done.Mar 7 2018, 2:54 PM
rizzitello added a comment.EditedMar 7 2018, 3:21 PM

I +1 this over D11024:

The main thing is the parser version adds two new includes one member to the private pointer and the string verison has no new includes no no private pointer members . This version is simplier code. It may be safer due to how command and strings are handled by qt (maybe equal)

rizzitello marked 2 inline comments as done.Mar 7 2018, 4:04 PM
patrickelectric requested changes to this revision.Mar 12 2018, 12:04 PM
patrickelectric added inline comments.
src/printthread.cpp
138

why not if (d->cline.startsWith(QStringLiteral(";-"))) { in the first if ?

164

can be QString& ?

175

If a command set the printer to pause state, it'll not be possible to inject more codes ? Right ?

176

You should create a função do decode all this functions, the BCS is to create a class to handle this part of decode, validation, documentation, code functions and etc.

src/printthread.h
108

why this \n ?
I never saw that in doxy doc.

This revision now requires changes to proceed.Mar 12 2018, 12:04 PM
rizzitello marked an inline comment as done.Mar 12 2018, 12:24 PM
rizzitello added inline comments.
src/printthread.cpp
138

All comments in gcode start with ; so those need to be handled and that case will be much more common. many slicers like have post command comments

G28 ; Send home command

164

No because we do not want to change the sent command as its used in elsewhere as a full line

175

injected commands will be injected while the print job is paused.

176

This is the function to decode all the functions.. they are documented in the code for this function.

rizzitello marked an inline comment as done.Mar 12 2018, 12:27 PM
rizzitello added inline comments.
src/printthread.cpp
176

Documented in the header for this function.

rizzitello marked 4 inline comments as done.Mar 12 2018, 3:30 PM
rizzitello added inline comments.
src/printthread.h
108

Force new lines :D

rizzitello marked 2 inline comments as done.Mar 12 2018, 3:37 PM
rizzitello updated this revision to Diff 29352.Mar 12 2018, 8:21 PM
rizzitello marked an inline comment as done.
  • rebase
  • patricks suggestion for bools
rizzitello marked 4 inline comments as done.Mar 12 2018, 8:25 PM
patrickelectric requested changes to this revision.Mar 14 2018, 2:43 AM
patrickelectric added inline comments.
src/printthread.cpp
138

The first one should be startswith

175

How is that possible ? Because the state will be pause and print thread will stop.

This revision now requires changes to proceed.Mar 14 2018, 2:43 AM
rizzitello added inline comments.Mar 14 2018, 11:48 AM
src/printthread.cpp
138

Every line that contains ; needs to be resized to remove comments many slicerswill do things like G28 ; home all so it make the contains if get hit alot more so i put it first then the other inside as it makes it more readable and the most common case is first..

The other way would be.

if (d->cline.startsWith(QStringLiteral(";-"))) {
    injectCommand(d-cline);
}

if (d->cline.contains(QChar::fromLatin1(';'))) {
    d->cline.resize(d->cline.indexOf(QChar::fromLatin1(';')));
}
175

Because it has been designed in such a way.

If we are reading a gcode file (i.e printing) if we hit a line that starts with ;- we read it and send it to injectCommand this will push the command out to the printer. I have added in our pause state a check for ;- and if seen it will call nextLine() and send the injectedCommand to the printer. The print job is paused but the injectedCommands are still pushed. this lets you move the head out of the way and then do heat so you can change the filiment without resuming first or sending heat before pause. This also give the user more freedom to put the injected commands before or after an injected pause. Due to how this is made there is no much of a chance of the user triggering this by accident. Pressing pause on the gui will pause the job the only thing that changes is if they press pause on a line starting with ;- that will be send to the buffer while paused...

src/printthread.cpp
98–102

This line will not occur, because of:

if (d->cline.contains(QChar::fromLatin1(';'))) {
    if (d->cline.startsWith(QStringLiteral(";-"))) {
        injectCommand(d->cline);
    }
    d->cline.resize(d->cline.indexOf(QChar::fromLatin1(';')));
}
d->cline = d->cline.simplified();

The resize will happen after the injectCommand, the result will be a empty line. Please, correct me if I'm wrong.

rizzitello added inline comments.Mar 14 2018, 12:52 PM
src/printthread.cpp
98–102

this only ensures that if we are paused (not busy then changed to pause by injected command thats all the ther check is for) we still can process ;- lines.

rizzitello marked 6 inline comments as done.Mar 14 2018, 7:37 PM
rizzitello updated this revision to Diff 29528.Mar 14 2018, 8:19 PM
  • ;- before ;
  • use ref for inject command
patrickelectric accepted this revision.Mar 14 2018, 8:21 PM
This revision is now accepted and ready to land.Mar 14 2018, 8:21 PM
rizzitello abandoned this revision.Mar 17 2018, 3:12 AM

D11024 was landed.