Skip to content

Commit

Permalink
Remove play/pause
Browse files Browse the repository at this point in the history
rename pause to kill
use kill functionality if old pause button enabled
refactor to rename pause to kill
  • Loading branch information
wolfmanjm committed Nov 13, 2015
1 parent d901843 commit 35e7b15
Show file tree
Hide file tree
Showing 29 changed files with 104 additions and 348 deletions.
4 changes: 2 additions & 2 deletions ConfigSamples/FirePick.delta/config
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,8 @@ zprobe.probe_height 5 # how much above be
#leveling-strategy.delta-calibration.enable true # basic delta calibration
#leveling-strategy.delta-calibration.radius 100 # the probe radius

# Pause button
pause_button_enable true #
# Kill button
kill_button_enable true #

# Panel
panel.enable false # set to true to enable the panel code
Expand Down
2 changes: 0 additions & 2 deletions src/libs/Kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "modules/robot/Robot.h"
#include "modules/robot/Stepper.h"
#include "modules/robot/Conveyor.h"
#include "modules/robot/Pauser.h"

#include <malloc.h>
#include <array>
Expand Down Expand Up @@ -141,7 +140,6 @@ Kernel::Kernel(){
this->add_module( this->robot = new Robot() );
this->add_module( this->stepper = new Stepper() );
this->add_module( this->conveyor = new Conveyor() );
this->add_module( this->pauser = new Pauser() );

this->planner = new Planner();

Expand Down
2 changes: 0 additions & 2 deletions src/libs/Kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class Config;
class Module;
class Conveyor;
class SlowTicker;
class Pauser;
class SerialConsole;
class StreamOutputPool;
class GcodeDispatch;
Expand Down Expand Up @@ -56,7 +55,6 @@ class Kernel {
Planner* planner;
Config* config;
Conveyor* conveyor;
Pauser* pauser;

int debug;
SlowTicker* slow_ticker;
Expand Down
2 changes: 0 additions & 2 deletions src/libs/Module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ const ModuleCallback kernel_callback_functions[NUMBER_OF_DEFINED_EVENTS] = {
&Module::on_speed_change,
&Module::on_block_begin,
&Module::on_block_end,
&Module::on_play,
&Module::on_pause,
&Module::on_idle,
&Module::on_second_tick,
&Module::on_get_public_data,
Expand Down
4 changes: 0 additions & 4 deletions src/libs/Module.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ enum _EVENT_ENUM {
ON_SPEED_CHANGE,
ON_BLOCK_BEGIN,
ON_BLOCK_END,
ON_PLAY,
ON_PAUSE,
ON_IDLE,
ON_SECOND_TICK,
ON_GET_PUBLIC_DATA,
Expand Down Expand Up @@ -53,8 +51,6 @@ class Module
virtual void on_speed_change(void *) {};
virtual void on_block_begin(void *) {};
virtual void on_block_end(void *) {};
virtual void on_play(void *) {};
virtual void on_pause(void *) {};
virtual void on_idle(void *) {};
virtual void on_second_tick(void *) {};
virtual void on_get_public_data(void *) {};
Expand Down
1 change: 0 additions & 1 deletion src/libs/SlowTicker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ using namespace std;
#include "StepTicker.h"
#include "libs/Hook.h"
#include "modules/robot/Conveyor.h"
#include "Pauser.h"
#include "Gcode.h"

#include <mri.h>
Expand Down
20 changes: 2 additions & 18 deletions src/libs/StepperMotor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ void StepperMotor::init()
// register this motor with the step ticker, and get its index in that array and bit position
this->index= THEKERNEL->step_ticker->register_motor(this);
this->moving = false;
this->paused = false;
this->fx_counter = 0;
this->fx_ticks_per_step = 0xFFFFF000UL; // some big number so we don't start stepping before it is set
this->stepped = 0;
Expand Down Expand Up @@ -115,10 +114,10 @@ void StepperMotor::signal_move_finished()
this->is_move_finished = false;
}

// This is just a way not to check for ( !this->moving || this->paused || this->fx_ticks_per_step == 0 ) at every tick()
// This is just a way not to check for ( !this->moving || this->fx_ticks_per_step == 0 ) at every tick()
void StepperMotor::update_exit_tick()
{
if( !this->moving || this->paused || this->steps_to_move == 0 ) {
if( !this->moving || this->steps_to_move == 0 ) {
// No more ticks will be recieved and no more events from StepTicker
THEKERNEL->step_ticker->remove_motor_from_active_list(this);
} else {
Expand Down Expand Up @@ -188,21 +187,6 @@ StepperMotor* StepperMotor::set_speed( float speed )
return this;
}

// Pause this stepper motor
void StepperMotor::pause()
{
this->paused = true;
this->update_exit_tick();
}

// Unpause this stepper motor
void StepperMotor::unpause()
{
this->paused = false;
this->update_exit_tick();
}


void StepperMotor::change_steps_per_mm(float new_steps)
{
steps_per_mm = new_steps;
Expand Down
3 changes: 0 additions & 3 deletions src/libs/StepperMotor.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ class StepperMotor {
StepperMotor* set_speed( float speed );
void set_moved_last_block(bool flg) { last_step_tick_valid= flg; }
void update_exit_tick();
void pause();
void unpause();

float get_steps_per_second() const { return steps_per_second; }
float get_steps_per_mm() const { return steps_per_mm; }
Expand Down Expand Up @@ -97,7 +95,6 @@ class StepperMotor {
struct {
bool direction:1;
volatile bool is_move_finished:1; // Whether the move just finished
bool paused:1;
volatile bool moving:1;
bool last_step_tick_valid:1; // set if the last step tick time is valid (ie the motor moved last block)
};
Expand Down
4 changes: 2 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "modules/utils/configurator/Configurator.h"
#include "modules/utils/currentcontrol/CurrentControl.h"
#include "modules/utils/player/Player.h"
#include "modules/utils/pausebutton/PauseButton.h"
#include "modules/utils/killbutton/KillButton.h"
#include "modules/utils/PlayLed/PlayLed.h"
#include "modules/utils/panel/Panel.h"
#include "libs/Network/uip/Network.h"
Expand Down Expand Up @@ -131,7 +131,7 @@ void init() {
kernel->add_module( new SimpleShell() );
kernel->add_module( new Configurator() );
kernel->add_module( new CurrentControl() );
kernel->add_module( new PauseButton() );
kernel->add_module( new KillButton() );
kernel->add_module( new PlayLed() );
kernel->add_module( new Endstops() );
kernel->add_module( new Player() );
Expand Down
1 change: 0 additions & 1 deletion src/modules/communication/GcodeDispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

#include "libs/Kernel.h"
#include "utils/Gcode.h"
#include "Pauser.h"
#include "libs/nuts_bolts.h"
#include "modules/robot/Conveyor.h"
#include "libs/SerialMessage.h"
Expand Down
66 changes: 0 additions & 66 deletions src/modules/robot/Pauser.cpp

This file was deleted.

24 changes: 0 additions & 24 deletions src/modules/robot/Pauser.h

This file was deleted.

24 changes: 1 addition & 23 deletions src/modules/robot/Stepper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ using namespace std;
Stepper::Stepper()
{
this->current_block = NULL;
this->paused = false;
this->force_speed_update = false;
this->halted= false;
}
Expand All @@ -47,8 +46,6 @@ void Stepper::on_module_loaded()
this->register_for_event(ON_BLOCK_END);
this->register_for_event(ON_GCODE_EXECUTE);
this->register_for_event(ON_GCODE_RECEIVED);
this->register_for_event(ON_PLAY);
this->register_for_event(ON_PAUSE);
this->register_for_event(ON_HALT);

// Get onfiguration
Expand All @@ -70,25 +67,6 @@ void Stepper::on_config_reload(void *argument)
this->turn_enable_pins_off();
}

// When the play/pause button is set to pause, or a module calls the ON_PAUSE event
void Stepper::on_pause(void *argument)
{
this->paused = true;
THEKERNEL->robot->alpha_stepper_motor->pause();
THEKERNEL->robot->beta_stepper_motor->pause();
THEKERNEL->robot->gamma_stepper_motor->pause();
}

// When the play/pause button is set to play, or a module calls the ON_PLAY event
void Stepper::on_play(void *argument)
{
// TODO: Re-compute the whole queue for a cold-start
this->paused = false;
THEKERNEL->robot->alpha_stepper_motor->unpause();
THEKERNEL->robot->beta_stepper_motor->unpause();
THEKERNEL->robot->gamma_stepper_motor->unpause();
}

void Stepper::on_halt(void *argument)
{
if(argument == nullptr) {
Expand Down Expand Up @@ -234,7 +212,7 @@ uint32_t Stepper::stepper_motor_finished_move(uint32_t dummy)
void Stepper::trapezoid_generator_tick(void)
{
// Do not do the accel math for nothing
if(this->current_block && !this->paused && this->main_stepper->moving ) {
if(this->current_block && this->main_stepper->moving ) {

// Store this here because we use it a lot down there
uint32_t current_steps_completed = this->main_stepper->stepped;
Expand Down
3 changes: 0 additions & 3 deletions src/modules/robot/Stepper.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ class Stepper : public Module
void on_block_end(void *argument);
void on_gcode_received(void *argument);
void on_gcode_execute(void *argument);
void on_play(void *argument);
void on_pause(void *argument);
void on_halt(void *argument);

void trapezoid_generator_reset();
Expand All @@ -47,7 +45,6 @@ class Stepper : public Module
struct {
bool enable_pins_status:1;
bool force_speed_update:1;
bool paused:1;
bool halted:1;
};

Expand Down
1 change: 0 additions & 1 deletion src/modules/tools/endstops/Endstops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "PublicDataRequest.h"
#include "EndstopsPublicAccess.h"
#include "StreamOutputPool.h"
#include "Pauser.h"
#include "StepTicker.h"
#include "BaseSolution.h"

Expand Down
21 changes: 2 additions & 19 deletions src/modules/tools/extruder/Extruder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ Extruder::Extruder( uint16_t config_identifier, bool single )
this->absolute_mode = true;
this->milestone_absolute_mode = true;
this->enabled = false;
this->paused = false;
this->single_config = single;
this->identifier = config_identifier;
this->retracted = false;
Expand Down Expand Up @@ -125,8 +124,6 @@ void Extruder::on_module_loaded()
this->register_for_event(ON_BLOCK_END);
this->register_for_event(ON_GCODE_RECEIVED);
this->register_for_event(ON_GCODE_EXECUTE);
this->register_for_event(ON_PLAY);
this->register_for_event(ON_PAUSE);
this->register_for_event(ON_HALT);
this->register_for_event(ON_SPEED_CHANGE);
this->register_for_event(ON_GET_PUBLIC_DATA);
Expand Down Expand Up @@ -293,20 +290,6 @@ void Extruder::on_set_public_data(void *argument)
}
}

// When the play/pause button is set to pause, or a module calls the ON_PAUSE event
void Extruder::on_pause(void *argument)
{
this->paused = true;
this->stepper_motor->pause();
}

// When the play/pause button is set to play, or a module calls the ON_PLAY event
void Extruder::on_play(void *argument)
{
this->paused = false;
this->stepper_motor->unpause();
}

void Extruder::on_gcode_received(void *argument)
{
Gcode *gcode = static_cast<Gcode *>(argument);
Expand Down Expand Up @@ -668,7 +651,7 @@ uint32_t Extruder::rate_increase() const
void Extruder::acceleration_tick(void)
{
// Avoid trying to work when we really shouldn't ( between blocks or re-entry )
if(!this->enabled || this->mode != SOLO || this->current_block == NULL || !this->stepper_motor->is_moving() || this->paused ) {
if(!this->enabled || this->mode != SOLO || this->current_block == NULL || !this->stepper_motor->is_moving() ) {
return;
}

Expand All @@ -688,7 +671,7 @@ void Extruder::acceleration_tick(void)
void Extruder::on_speed_change( void *argument )
{
// Avoid trying to work when we really shouldn't ( between blocks or re-entry )
if(!this->enabled || this->current_block == NULL || this->paused || this->mode != FOLLOW || !this->stepper_motor->is_moving()) {
if(!this->enabled || this->current_block == NULL || this->mode != FOLLOW || !this->stepper_motor->is_moving()) {
return;
}

Expand Down

0 comments on commit 35e7b15

Please sign in to comment.