diff --git a/global.h b/global.h index 29f2261..0ec02ee 100644 --- a/global.h +++ b/global.h @@ -35,7 +35,7 @@ #define PROGRAM_NAME "DSRemote" -#define PROGRAM_VERSION "0.34_1702041507" +#define PROGRAM_VERSION "0.34_1702162027" #define MAX_PATHLEN 4096 diff --git a/interface.cpp b/interface.cpp index 6f64b77..2407dd7 100644 --- a/interface.cpp +++ b/interface.cpp @@ -3077,15 +3077,7 @@ void UI_Mainwindow::autoButtonClicked() tmc_write(":AUT"); - qApp->processEvents(); - - usleep(20000); - - qApp->processEvents(); - - sleep(2); - - get_device_settings(); + get_device_settings(7); scrn_timer->start(devparms.screentimerival); } diff --git a/mainwindow.cpp b/mainwindow.cpp index 3cd54aa..b0ee406 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -568,7 +568,7 @@ void UI_Mainwindow::closeEvent(QCloseEvent *cl_event) } -int UI_Mainwindow::get_device_settings() +int UI_Mainwindow::get_device_settings(int delay) { int chn; @@ -578,6 +578,7 @@ int UI_Mainwindow::get_device_settings() read_settings_thread rd_set_thrd; rd_set_thrd.set_device(device); + rd_set_thrd.set_delay(delay); rd_set_thrd.set_devparm_ptr(&devparms); rd_set_thrd.start(); diff --git a/mainwindow.h b/mainwindow.h index aeadc6a..7eca52c 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -242,6 +242,7 @@ private: double get_stepsize_divide_by_1000(double); inline unsigned char reverse_bitorder_8(unsigned char); inline unsigned int reverse_bitorder_32(unsigned int); + int get_device_settings(int delay=0); private slots: @@ -261,7 +262,6 @@ private slots: void open_connection(); void close_connection(); void open_settings_dialog(); - int get_device_settings(); void save_screen_waveform(); void get_deep_memory_waveform(); void save_screenshot(); diff --git a/read_settings_thread.cpp b/read_settings_thread.cpp index f8cffc5..77d837c 100644 --- a/read_settings_thread.cpp +++ b/read_settings_thread.cpp @@ -38,6 +38,14 @@ read_settings_thread::read_settings_thread() err_num = -1; devparms = NULL; + + delay = 0; +} + + +void read_settings_thread::set_delay(int val) +{ + delay = val; } @@ -79,6 +87,11 @@ void read_settings_thread::run() devparms->activechannel = -1; + if(delay > 0) + { + sleep(delay); + } + for(chn=0; chnchannel_cnt; chn++) { sprintf(str, ":CHAN%i:BWL?", chn + 1); diff --git a/read_settings_thread.h b/read_settings_thread.h index b773045..52f7060 100644 --- a/read_settings_thread.h +++ b/read_settings_thread.h @@ -57,6 +57,7 @@ public: void set_devparm_ptr(struct device_settings *); int get_error_num(void); void get_error_str(char *); + void set_delay(int); private: @@ -65,7 +66,7 @@ private: char err_str[4096]; - int err_num; + int err_num, delay; void run(); }; diff --git a/tmc_dev.c b/tmc_dev.c index 9e61893..de4486d 100644 --- a/tmc_dev.c +++ b/tmc_dev.c @@ -147,7 +147,10 @@ int tmcdev_write(struct tmcdev *dev, const char *cmd) printf("tmc_dev write: %s", buf); } - if(!strncmp(buf, "*RST", 4)) qry = 1; + if((!strncmp(buf, "*RST", 4)) || (!strncmp(buf, ":AUT", 4))) + { + qry = 1; + } n = write(dev->fd, buf, strlen(buf));