From c865bb0fd64af811d6b68233ba1c313c1429488c Mon Sep 17 00:00:00 2001 From: Micke Prag Date: Thu, 16 Oct 2008 13:18:21 +0000 Subject: [PATCH] Don't sleep if the function returned an error --- telldus-core/tdtool/main.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/telldus-core/tdtool/main.cpp b/telldus-core/tdtool/main.cpp index 056de9b6..3c322430 100644 --- a/telldus-core/tdtool/main.cpp +++ b/telldus-core/tdtool/main.cpp @@ -111,7 +111,9 @@ void switch_device( bool turnOn, char *device ) { printf("Turning %s device: %i %s - %s\n", (turnOn ? "on" : "off"), deviceId, name, errorString); free(name); free(errorString); - sleep(1); + if (retval == TELLSTICK_SUCCESS) { + sleep(1); + } } void dim_device( char *device, int level ) { @@ -131,7 +133,9 @@ void dim_device( char *device, int level ) { printf("Dimming device: %i %s to %i - %s\n", deviceId, name, level, errorString); free(name); free(errorString); - sleep(1); + if (retval == TELLSTICK_SUCCESS) { + sleep(1); + } } void bell_device( char *device ) { @@ -147,7 +151,9 @@ void bell_device( char *device ) { printf("Sending bell to: %i %s - %s\n", deviceId, name, errorString); free(name); free(errorString); - sleep(1); + if (retval == TELLSTICK_SUCCESS) { + sleep(1); + } } int main(int argc, char **argv)