Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVojtech Kral <vojtech@kral.hk>2018-07-24 18:42:12 +0300
committerbubnikv <bubnikv@gmail.com>2018-07-27 14:27:52 +0300
commita32bd17b752317450e35c398b61356cdbe13998d (patch)
treeee589896b5b849c5ab2596c78a9af6200bef4ca5 /xs/src/avrdude/avrdude-slic3r.cpp
parenta7eaf38853c1c804c4f4c7d5e30801f196713727 (diff)
FirmwareUpdater: MMU 2.0 / Caterina flashing
Diffstat (limited to 'xs/src/avrdude/avrdude-slic3r.cpp')
-rw-r--r--xs/src/avrdude/avrdude-slic3r.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/xs/src/avrdude/avrdude-slic3r.cpp b/xs/src/avrdude/avrdude-slic3r.cpp
index 030353413..4a7f22d6e 100644
--- a/xs/src/avrdude/avrdude-slic3r.cpp
+++ b/xs/src/avrdude/avrdude-slic3r.cpp
@@ -36,6 +36,7 @@ struct AvrDude::priv
std::string sys_config;
std::deque<std::vector<std::string>> args;
size_t current_args_set = 0;
+ bool cancelled = false;
RunFn run_fn;
MessageFn message_fn;
ProgressFn progress_fn;
@@ -141,11 +142,16 @@ AvrDude::Ptr AvrDude::run()
if (self->p) {
auto avrdude_thread = std::thread([self]() {
+ bool cancel = false;
+ int res = -1;
+
if (self->p->run_fn) {
- self->p->run_fn();
+ self->p->run_fn(*self);
}
- auto res = self->p->run();
+ if (! self->p->cancelled) {
+ res = self->p->run();
+ }
if (self->p->complete_fn) {
self->p->complete_fn(res, self->p->current_args_set);
@@ -160,7 +166,10 @@ AvrDude::Ptr AvrDude::run()
void AvrDude::cancel()
{
- ::avrdude_cancel();
+ if (p) {
+ p->cancelled = true;
+ ::avrdude_cancel();
+ }
}
void AvrDude::join()