From 742f10d9acc28e127e1ad7a9b946ff90e55ed46f Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Mon, 17 Aug 2020 20:39:01 -0400 Subject: [PATCH] Update telem.c --- afsk/telem.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/afsk/telem.c b/afsk/telem.c index b37a7233..8e08914e 100644 --- a/afsk/telem.c +++ b/afsk/telem.c @@ -157,19 +157,21 @@ struct SensorConfig config_sensor(char *bus, int address, int milliAmps) { char str[100]; strcpy (str, bus); - char *ch; + char *buss; const char dash[2] = "-"; - ch = strtok(str, dash); - printf("ch: %s\n", ch); - ch = strtok(NULL, dash); - printf("ch: %s\n", ch); + buss = strtok(str, dash); +// printf("buss: %s\n", buss); + buss = strtok(NULL, dash); +// printf("bus: %s\n", buss); char result[128]; 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 10 i2cdetect -y "; - strcat (command, &bus[pos]); +// strcat (command, &bus[pos]); + strcat (command, buss); + printf("Command: %s \n", command); FILE *i2cdetect = popen(command, "r"); while (fgets(result, 128, i2cdetect) != NULL) { @@ -191,7 +193,7 @@ struct SensorConfig config_sensor(char *bus, int address, int milliAmps) { char pythonv[100] = "python3 /home/pi/CubeSatSim/python/voltage.py "; char pythoni[100] = "python3 /home/pi/CubeSatSim/python/current.py "; - strcat (pythonv, &bus[pos]); + strcat (pythonv, buss); strcat (pythonv, spacev); char addr[10]; snprintf( addr, 10, "%x", address ); @@ -201,7 +203,7 @@ struct SensorConfig config_sensor(char *bus, int address, int milliAmps) { printf("V Command: %s \n", data.commandv); char spacei[] = " 0x"; - strcat (pythoni, &bus[pos]); + strcat (pythoni, buss); strcat (pythoni, spacei); strcat (pythoni, addr); strcpy (data.commandi, pythoni);