X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=ao-bringup%2Ftest-baro;h=2116dce4c750b0d357ebcb31b009f1d51ca6dcd3;hp=45d7ccac4e483fa5923683df05609e3ccb44d71f;hb=c14cfb1436c988eb0a0d26d7c4d83aeccecbc8a3;hpb=9cb10d73fee0e3f36c778fd2a9c9992b87669fe2 diff --git a/ao-bringup/test-baro b/ao-bringup/test-baro index 45d7ccac..2116dce4 100755 --- a/ao-bringup/test-baro +++ b/ao-bringup/test-baro @@ -36,28 +36,6 @@ void flush_input(file f) { } } -string[*] settings(file f) { - string[...] x = {}; - - flush_input(f); - fprintf (f, "c s\nv\n"); - flush(f); - for (;;) { - string l = File::fgets(f); - x[dim(x)] = l; - if (String::index(l, "software-version") == 0) - break; - } - return x; -} - -string[*] find_setting(string[*] s, string match) { - for (int i = 0; i < dim(s); i++) - if (String::index(s[i], match) == 0) - return String::wordsplit(s[i], " "); - return (string[*]) {}; -} - string[*] baro(file f) { string[...] x = {}; @@ -65,7 +43,11 @@ string[*] baro(file f) { fprintf (f, "B\n"); flush(f); for (;;) { - string l = File::fgets(f); + string l = timed_read(f, 1000); + if (l == "") { + File::fprintf(stderr, "read timedout\n"); + exit(1); + } x[dim(x)] = l; if (String::index(l, "Altitude:") == 0) break;