From 045f749eb54e64d63538485e4589bc4a6fd65907 Mon Sep 17 00:00:00 2001 From: Teuniz Date: Sat, 29 May 2021 11:12:53 +0200 Subject: [PATCH] Fix communication failure when pressing the "Auto" button" when using LAN connection. --- global.h | 2 +- read_settings_thread.cpp | 7 ++++++- tmc_lan.c | 5 ++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/global.h b/global.h index 7d6e1b6..a6344e0 100644 --- a/global.h +++ b/global.h @@ -35,7 +35,7 @@ #define PROGRAM_NAME "DSRemote" -#define PROGRAM_VERSION "0.37_2105291013" +#define PROGRAM_VERSION "0.37_2105291112" #define MAX_PATHLEN 1024 diff --git a/read_settings_thread.cpp b/read_settings_thread.cpp index 777b4b8..ee427ba 100644 --- a/read_settings_thread.cpp +++ b/read_settings_thread.cpp @@ -79,6 +79,8 @@ void read_settings_thread::run() char str[512]=""; + struct timespec rqtp; + err_num = -1; if(device == NULL) return; @@ -89,7 +91,10 @@ void read_settings_thread::run() if(delay > 0) { - sleep(delay); + rqtp.tv_nsec = 0; + rqtp.tv_sec = delay; + + while(nanosleep(&rqtp, &rqtp)) {}; } for(chn=0; chnchannel_cnt; chn++) diff --git a/tmc_lan.c b/tmc_lan.c index d314db6..275b3b0 100644 --- a/tmc_lan.c +++ b/tmc_lan.c @@ -306,7 +306,10 @@ int tmclan_write(struct tmcdev *tmc_device __attribute__ ((unused)), const char printf("tmc_lan write: %s", buf); } - if(!strncmp(buf, "*RST", 4)) qry = 1; + if((!strncmp(buf, "*RST", 4)) || (!strncmp(buf, ":AUT", 4))) + { + qry = 1; + } n = tmclan_send(buf);