// © RiceMotion ( Robert Carl Rice ) 2012-2016 - All rights reserved


// This software makes use of tools and libraries obtained from open source projects or released for

// use by relevant hardware manufactures. However, this software is NOT a part of any open source project.

// It is released only on a "need to know" basis for beta testers of the "RiceCNC Interpolation Engine".

// Recipents of this source code must respect the confidential nature of this software and prevent any

// distribution that could result in counterfeit copies of the "RiceCNC Interpolation Engine".


// © RiceMotion ( Robert Carl Rice ) 2012-2016 - All rights reserved

#include <ProbingSplineCommand.h>

#include <Machine.h>

#include <MachineCommands.h>

#include <Axis.h>

#include <SysTick.h>

#include <MainCommands.h>

#include "InterpolationTimer.h"

#include <Probe.h>


const char ProbingSplineCommand::myName[] =

     "ProbingSpline";


const char*

     ProbingSplineCommand::name() {


     return

          myName; };


// Initializer

ProbingSplineCommand::ProbingSplineCommand(

     char*          data,

     Axis*          firstMachineAxis,

     String*          msgPtr  )


:     Spline(

     data,

     firstMachineAxis,

     msgPtr ) {


     probeStop     = false; };



bool // This method performs program position linear and Bezier interpolation

     ProbingSplineCommand::execute(

          Machine* machine ) {


     if ( ! machine->probe )

          return

               true;


     if ( machine->probe->probeStop() ) {

          probeStop     = true;


          return

               true; };


     return

          Spline::execute( machine ); };



void

     ProbingSplineCommand::report(

          Machine*     machine,

          String*          msgPtr ) {


     machine->reportSplineCompleted(

          &stepControl,

          msgPtr );


     if ( aborting )

          *msgPtr     += " Aborted";


     if ( ! machine->probe )

          *msgPtr     += " P0";


     else if ( ! probeStop )

          *msgPtr     += " P1";


     else if ( stepControl.t )

          *msgPtr     += " P2";


     else

          *msgPtr     += " P3";


     *msgPtr     += "\n"; };