Revert "Device/Driver/LX: Add small delay after baud rate change"
[xcsoar.git] / test / src / RunWindComputer.cpp
blobeb9cc6391db79117e2c12ee22cc84032d9b50f26
1 /*
2 Copyright_License {
4 XCSoar Glide Computer - http://www.xcsoar.org/
5 Copyright (C) 2000-2013 The XCSoar Project
6 A detailed list of copyright holders can be found in the file "AUTHORS".
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #include "Computer/Wind/Computer.hpp"
25 #include "Computer/CirclingComputer.hpp"
26 #include "Computer/Settings.hpp"
27 #include "Formatter/TimeFormatter.hpp"
28 #include "OS/Args.hpp"
29 #include "DebugReplay.hpp"
31 #include <stdio.h>
33 int main(int argc, char **argv)
35 Args args(argc, argv, "DRIVER FILE");
36 DebugReplay *replay = CreateDebugReplay(args);
37 if (replay == NULL)
38 return EXIT_FAILURE;
40 args.ExpectEnd();
42 printf("# time wind_bearing (deg) wind_speed (m/s)\n");
44 GlidePolar glide_polar(fixed(0));
46 CirclingSettings circling_settings;
48 WindSettings wind_settings;
49 wind_settings.SetDefaults();
51 CirclingComputer circling_computer;
52 circling_computer.Reset();
54 WindComputer wind_computer;
55 wind_computer.Reset();
57 Validity last;
58 last.Clear();
60 while (replay->Next()) {
61 const MoreData &basic = replay->Basic();
62 const DerivedInfo &calculated = replay->Calculated();
64 circling_computer.TurnRate(replay->SetCalculated(),
65 basic, calculated.flight);
66 circling_computer.Turning(replay->SetCalculated(),
67 basic,
68 calculated.flight,
69 circling_settings);
71 wind_computer.Compute(wind_settings, glide_polar, basic,
72 replay->SetCalculated());
74 if (calculated.estimated_wind_available.Modified(last)) {
75 TCHAR time_buffer[32];
76 FormatTime(time_buffer, replay->Basic().time);
78 _tprintf(_T("%s %d %g\n"),
79 time_buffer, (int)calculated.estimated_wind.bearing.Degrees(),
80 (double)calculated.estimated_wind.norm);
83 last = calculated.estimated_wind_available;
86 delete replay;