moved I2C bus tests to the start, removed duplicate bus test

pull/127/head
alanbjohnston 5 years ago committed by GitHub
parent 5ad16f7710
commit 1414d7b7da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -23,6 +23,17 @@
int main(int argc, char * argv[]) { int main(int argc, char * argv[]) {
printf("Test bus 1\n");
fflush(stdout);
i2c_bus1 = (test_i2c_bus(1) != -1) ? ON : OFF;
printf("Test bus 3\n");
fflush(stdout);
i2c_bus3 = (test_i2c_bus(3) != -1) ? ON : OFF;
printf("Finished testing\n");
fflush(stdout);
sleep(2);
FILE * rpitx_restart = popen("sudo systemctl restart rpitx", "r"); FILE * rpitx_restart = popen("sudo systemctl restart rpitx", "r");
pclose(rpitx_restart); pclose(rpitx_restart);
@ -222,7 +233,7 @@ int main(int argc, char * argv[]) {
if (vB4) { if (vB4) {
map[BAT] = BUS; map[BAT] = BUS;
map[BUS] = BAT; map[BUS] = BAT;
snprintf(busStr, 10, "%d %d", test_i2c_bus(1), test_i2c_bus(0)); snprintf(busStr, 10, "%d %d", i2c_bus1, test_i2c_bus(0));
} else if (vB5) { } else if (vB5) {
map[MINUS_X] = MINUS_Y; map[MINUS_X] = MINUS_Y;
map[PLUS_Z] = MINUS_X; map[PLUS_Z] = MINUS_X;
@ -232,31 +243,17 @@ int main(int argc, char * argv[]) {
printf("/dev/i2c-11 is present\n\n"); printf("/dev/i2c-11 is present\n\n");
snprintf(busStr, 10, "%d %d", test_i2c_bus(1), test_i2c_bus(11)); snprintf(busStr, 10, "%d %d", test_i2c_bus(1), test_i2c_bus(11));
} else { } else {
snprintf(busStr, 10, "%d %d", test_i2c_bus(1), test_i2c_bus(3)); snprintf(busStr, 10, "%d %d", i2c_bus1, i2c_bus3);
} }
} else { } else {
map[BUS] = MINUS_Z; map[BUS] = MINUS_Z;
map[BAT] = BUS; map[BAT] = BUS;
map[PLUS_Z] = BAT; map[PLUS_Z] = BAT;
map[MINUS_Z] = PLUS_Z; map[MINUS_Z] = PLUS_Z;
snprintf(busStr, 10, "%d %d", test_i2c_bus(1), test_i2c_bus(0)); snprintf(busStr, 10, "%d %d", i2c_bus1, test_i2c_bus(0));
voltageThreshold = 8.0; voltageThreshold = 8.0;
} }
// test i2c buses
fflush(stdout);
//printf("Test bus 0\n");
//fflush(stdout);
//i2c_bus0 = (test_i2c_bus(0) != -1) ? ON : OFF;
printf("Test bus 1\n");
fflush(stdout);
i2c_bus1 = (test_i2c_bus(1) != -1) ? ON : OFF;
printf("Test bus 3\n");
fflush(stdout);
i2c_bus3 = (test_i2c_bus(3) != -1) ? ON : OFF;
printf("Finished testing\n");
fflush(stdout);
// check for camera // check for camera
// char cmdbuffer1[1000]; // char cmdbuffer1[1000];
FILE * file4 = popen("vcgencmd get_camera", "r"); FILE * file4 = popen("vcgencmd get_camera", "r");

Loading…
Cancel
Save

Powered by TurnKey Linux.