#include <Dwell.h>
#include <Machine.h>
#include <Axis.h>
#include <Timers.h>
#include <MachineCommands.h>
const char Dwell::myName[] =
"Dwell";
const char*
Dwell::name() {
return
myName; };
Dwell::Dwell( char* data ) {
float dwell = 0.0; // seconds
sscanf( data, "%f", &dwell );
dwellTime = dwell * 1000000; // convert to microseconds
pathTime = 0;
continueExecution = false; };
bool
Dwell::execute( Machine* machine ) {
if ( continueExecution )
return
true;
if ( pathTime == 0 )
pathTime = SysTick::microSecondTimer;
if ( machine->isSeekingPosition() ) { // Wait for axes to go idle
pathTime = SysTick::microSecondTimer;
return
false; };
return
SysTick::microSecondTimer - pathTime >= dwellTime; };
void
Dwell::reportInterpolationStatus(
Machine* machine,
String* msgPtr ) {
*msgPtr += INTERPOLATOR_DWELLING; };
void
Dwell::continueInterpolation( Machine* machine ) {
continueExecution = true; };
void
Dwell::report(
Machine* machine,
String* msgPtr ) {
machine->reportInterpolationStatus( msgPtr ); };