cleanup after dealing with bus 11 properly and using python read

pull/55/head
alanbjohnston 6 years ago committed by GitHub
parent 742f10d9ac
commit 469a2bfbef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -99,13 +99,13 @@ struct SensorData read_sensor_data(struct SensorConfig sensor) {
pclose(file);
data.voltage = atof(cmdbuffer);
printf("voltage: %s \n", cmdbuffer);
// printf("voltage: %s \n", cmdbuffer);
file = popen(sensor.commandi, "r");
fgets(cmdbuffer, 1000, file);
pclose(file);
printf("current: %s \n", cmdbuffer);
// printf("current: %s \n", cmdbuffer);
data.current = atof(cmdbuffer);
@ -171,7 +171,7 @@ struct SensorConfig config_sensor(char *bus, int address, int milliAmps) {
char command[50] = "timeout 10 i2cdetect -y ";
// strcat (command, &bus[pos]);
strcat (command, buss);
printf("Command: %s \n", command);
// printf("Command: %s \n", command);
FILE *i2cdetect = popen(command, "r");
while (fgets(result, 128, i2cdetect) != NULL) {
@ -200,7 +200,7 @@ struct SensorConfig config_sensor(char *bus, int address, int milliAmps) {
strcat (pythonv, addr);
strcpy (data.commandv, pythonv);
printf("V Command: %s \n", data.commandv);
// printf("V Command: %s \n", data.commandv);
char spacei[] = " 0x";
strcat (pythoni, buss);
@ -208,7 +208,7 @@ struct SensorConfig config_sensor(char *bus, int address, int milliAmps) {
strcat (pythoni, addr);
strcpy (data.commandi, pythoni);
printf("V Command: %s \n", data.commandi);
// printf("V Command: %s \n", data.commandi);
/*
data.fd = wiringPiI2CSetupInterface(bus, address);

Loading…
Cancel
Save

Powered by TurnKey Linux.