From 2999b9ade286b828c9ef9eb1a56910ec7d7b68ee Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 11 Sep 2019 16:04:36 -0400 Subject: [PATCH] initialized ret and checked tempSensor before using, commented out str printf --- afsk/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/afsk/main.c b/afsk/main.c index fe60ad91..87c108e7 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -124,6 +124,8 @@ int main(void) { } else { tempSensor = wiringPiI2CSetupInterface("/dev/i2c-3", 0x48); + if (wiringPiI2CReadReg16(tempSensor, 0) < 0) + tempSensor = -1; } // fprintf(stderr,"tempSensor: %d \n",tempSensor); @@ -239,7 +241,7 @@ int main(void) { { char cmdbuffer[1000]; strcat(str,footer_str); - fprintf("String to execute: %s\n", str); +// fprintf("String to execute: %s\n", str); FILE* file2 = popen(str, "r"); fgets(cmdbuffer, 999, file2); pclose(file2);