X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=src%2Fkalman%2Fload_csv.5c;h=7c6c286ecc54ccd5a04b13bf1a9d1168fe7b333f;hp=15e831664c8b2b05b19e4a86f72a8b011b4a9198;hb=1085ec5d57e0ed5d132f2bbdac1a0b6a32c0ab4a;hpb=20427ae4965f756aac0cedc5179a1c45b9a781f2 diff --git a/src/kalman/load_csv.5c b/src/kalman/load_csv.5c index 15e83166..7c6c286e 100644 --- a/src/kalman/load_csv.5c +++ b/src/kalman/load_csv.5c @@ -3,7 +3,8 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -31,6 +32,7 @@ namespace load_csv { real time; real height; real acceleration; + real pressure; } record_t; public record_t parse_record(file f, real accel_scale) { @@ -40,16 +42,28 @@ namespace load_csv { int time_off = 4; int height_off = 11; int accel_off = 8; - if (string_to_integer(data[0]) == 2) { + int pres_off = 9; + switch (string_to_integer(data[0])) { + case 2: time_off = 4; accel_off = 9; + pres_off = 10; height_off = 12; + break; + case 5: + time_off = 4; + accel_off = 10; + pres_off = 11; + height_off = 13; + break; } return (record_t) { .done = false, - .time = string_to_real(data[time_off]), - .height = imprecise(string_to_real(data[height_off])), - .acceleration = imprecise(string_to_real(data[accel_off]) * accel_scale) }; + .time = string_to_real(data[time_off]), + .height = imprecise(string_to_real(data[height_off])), + .acceleration = imprecise(string_to_real(data[accel_off]) * accel_scale), + .pressure = imprecise(string_to_real(data[pres_off])) + }; } public void dump(file f) {