Smoother manual control movements
This commit is contained in:
parent
37ecc61d06
commit
9febb10bd7
4 changed files with 12 additions and 6 deletions
|
@ -58,6 +58,9 @@ sub new {
|
||||||
$canvas->interactive(1);
|
$canvas->interactive(1);
|
||||||
$canvas->on_move(sub {
|
$canvas->on_move(sub {
|
||||||
my ($pos) = @_;
|
my ($pos) = @_;
|
||||||
|
|
||||||
|
# delete any pending commands to get a smoother movement
|
||||||
|
$self->purge_queue(1);
|
||||||
$self->abs_xy_move($pos);
|
$self->abs_xy_move($pos);
|
||||||
});
|
});
|
||||||
$bed_sizer->Add($canvas, 0, wxEXPAND | wxRIGHT, 3);
|
$bed_sizer->Add($canvas, 0, wxEXPAND | wxRIGHT, 3);
|
||||||
|
|
|
@ -172,16 +172,19 @@ GCodeSender::resume_queue()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
GCodeSender::purge_queue()
|
GCodeSender::purge_queue(bool priority)
|
||||||
{
|
{
|
||||||
boost::lock_guard<boost::mutex> l(this->queue_mutex);
|
boost::lock_guard<boost::mutex> l(this->queue_mutex);
|
||||||
{
|
|
||||||
// clear queue
|
|
||||||
std::queue<std::string> empty;
|
std::queue<std::string> empty;
|
||||||
|
if (priority) {
|
||||||
|
// clear priority queue
|
||||||
|
std::swap(this->priqueue, empty);
|
||||||
|
} else {
|
||||||
|
// clear queue
|
||||||
std::swap(this->queue, empty);
|
std::swap(this->queue, empty);
|
||||||
}
|
|
||||||
this->queue_paused = false;
|
this->queue_paused = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// purge log and return its contents
|
// purge log and return its contents
|
||||||
std::vector<std::string>
|
std::vector<std::string>
|
||||||
|
|
|
@ -28,7 +28,7 @@ class GCodeSender : private boost::noncopyable {
|
||||||
size_t queue_size() const;
|
size_t queue_size() const;
|
||||||
void pause_queue();
|
void pause_queue();
|
||||||
void resume_queue();
|
void resume_queue();
|
||||||
void purge_queue();
|
void purge_queue(bool priority = false);
|
||||||
std::vector<std::string> purge_log();
|
std::vector<std::string> purge_log();
|
||||||
std::string getT() const;
|
std::string getT() const;
|
||||||
std::string getB() const;
|
std::string getB() const;
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
void send(std::string s, bool priority = false);
|
void send(std::string s, bool priority = false);
|
||||||
void pause_queue();
|
void pause_queue();
|
||||||
void resume_queue();
|
void resume_queue();
|
||||||
void purge_queue();
|
void purge_queue(bool priority = false);
|
||||||
std::vector<std::string> purge_log();
|
std::vector<std::string> purge_log();
|
||||||
std::string getT();
|
std::string getT();
|
||||||
std::string getB();
|
std::string getB();
|
||||||
|
|
Loading…
Reference in a new issue