From e77391f8b29192e7aa0f7682b4d912d3794928be Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 8 Aug 2020 18:12:27 -0400 Subject: [PATCH] detects problems with I2C bus wiring --- afsk/telem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/afsk/telem.c b/afsk/telem.c index 4025767c..3b852c93 100644 --- a/afsk/telem.c +++ b/afsk/telem.c @@ -136,7 +136,7 @@ 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 2 i2cdetect -y "; + char command[50] = "timeout 5 i2cdetect -y "; strcat (command, &bus[pos]); FILE *i2cdetect = popen(command, "r"); while (fgets(result, 128, i2cdetect) != NULL) { @@ -234,7 +234,7 @@ int main(int argc, char *argv[]) { if (digitalRead(26) != HIGH) { printf("vB5 Present\n"); - sensor[PLUS_X] = config_sensor("/dev/i2c-0", 0x40, 400); // added error + sensor[PLUS_X] = config_sensor("/dev/i2c-1", 0x40, 400); sensor[PLUS_Y] = config_sensor("/dev/i2c-1", 0x41, 400); sensor[BUS] = config_sensor("/dev/i2c-1", 0x45, 400); sensor[BAT] = config_sensor("/dev/i2c-1", 0x44, 400);