From d728af2833b82c46f2c9337ed445a2fb9a350654 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 8 Aug 2020 18:28:17 -0400 Subject: [PATCH] set i2cdetect timeout to 3 sec --- afsk/telem.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/afsk/telem.c b/afsk/telem.c index a58aada4..6ed54319 100644 --- a/afsk/telem.c +++ b/afsk/telem.c @@ -136,16 +136,14 @@ struct SensorConfig config_sensor(char *bus, int address, int milliAmps) { int pos = strlen(bus) / sizeof(bus[0]) - 1; // printf("Bus size %d \n", pos); // printf("Bus value %d \n", atoi(&bus[pos])); - char command[50] = "timeout 5 i2cdetect -y "; + char command[50] = "timeout 3 i2cdetect -y "; strcat (command, &bus[pos]); FILE *i2cdetect = popen(command, "r"); -/* + while (fgets(result, 128, i2cdetect) != NULL) { ; // printf("result: %s", result); } -*/ - fgets(result, 128, i2cdetect); int error = pclose(i2cdetect)/256; // printf("%s error: %d \n", &command, error);