| 33 | |
| 34 | // Return true if the MCode in the GCodeBuffer should be queued. Caller has already checked that the command does not contain an expression. |
| 35 | /*static*/ bool GCodeQueue::ShouldQueueMCode(GCodeBuffer &gb) THROWS(GCodeException) |
| 36 | { |
| 37 | // Don't queue anything if no moves are being performed |
| 38 | if (reprap.GetMove().GetScheduledMoves() != reprap.GetMove().GetCompletedMoves()) |
| 39 | { |
| 40 | // None of the M codes we queue has a fractional command number |
| 41 | if (gb.GetCommandFraction() > 0) |
| 42 | { |
| 43 | return false; |
| 44 | } |
| 45 | |
| 46 | bool shouldQueue; |
| 47 | switch (gb.GetCommandNumber()) |
| 48 | { |
| 49 | case 3: // spindle or laser control |
| 50 | case 5: // spindle or laser control |
| 51 | // On laser devices we use these codes to set the default laser power for the next G1 command |
| 52 | shouldQueue = reprap.GetGCodes().GetMachineType() != MachineType::laser; |
| 53 | break; |
| 54 | |
| 55 | case 4: // spindle control |
| 56 | case 42: // set IO pin |
| 57 | case 106: // fan control |
| 58 | case 107: // fan off |
| 59 | case 104: // set temperatures and return immediately |
| 60 | case 140: // set bed temperature and return immediately |
| 61 | case 141: // set chamber temperature and return immediately |
| 62 | case 144: // bed standby |
| 63 | case 280: // set servo |
| 64 | case 300: // beep |
| 65 | case 568: // spindle or temperature control |
| 66 | shouldQueue = true; |
| 67 | break; |
| 68 | |
| 69 | case 117: // display message |
| 70 | { |
| 71 | // We need to call GetUnprecedentedString to ensure that if the string argument is not quoted, gb.DataLength() will return the correct value. |
| 72 | // We need to pass the correct length string buffer here because GetUnprecedentedString will throw if the string is too long for the buffer. |
| 73 | String<M117StringLength> dummy; |
| 74 | gb.GetUnprecedentedString(dummy.GetRef()); |
| 75 | } |
| 76 | shouldQueue = true; |
| 77 | break; |
| 78 | |
| 79 | #if SUPPORT_LED_STRIPS |
| 80 | case 150: // set LED colours |
| 81 | shouldQueue = !reprap.GetPlatform().GetLedStripManager().MustStopMovement(gb); // if it is going to call LockMovementAndWaitForStandstill then we mustn't queue it |
| 82 | break; |
| 83 | #endif |
| 84 | // A note about M291: |
| 85 | // - We cannot queue M291 messages that are blocking, i.e. with S2 or S3 parameter |
| 86 | // - If we queue non-blocking M291 messages then it can happen that if a non-blocking M291 is used and a little later a blocking M291 is used, |
| 87 | // then the blocking one gets displayed while the non-blocking one is still in the queue. Then the non-blocking one overwrites it, and the |
| 88 | // blocking one can no longer be acknowledged except by sending M292 manually. |
| 89 | // - Therefore we no longer queue any M291 commands. |
| 90 | case 291: |
| 91 | default: |
| 92 | return false; |
nothing calls this directly
no test coverage detected