CirclingWind: eliminate attributes min_vector, max_vector
[xcsoar.git] / src / BatteryTimer.cpp
blob57caed422763bc1b0d2b06be5408f4386272aced
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 "BatteryTimer.hpp"
25 #include "Hardware/Battery.hpp"
26 #include "UIActions.hpp"
27 #include "LogFile.hpp"
28 #include "Simulator.hpp"
29 #include "Language/Language.hpp"
30 #include "Message.hpp"
32 void
33 BatteryTimer::Process()
35 #ifdef HAVE_BATTERY
36 // TODO feature: Trigger a GCE (Glide Computer Event) when
37 // switching to battery mode This can be used to warn users that
38 // power has been lost and you are now on battery power - ie:
39 // something else is wrong
41 UpdateBatteryInfo();
43 /* Battery status - simulator only - for safety of battery data
44 note: Simulator only - more important to keep running in your plane
47 // JMW, maybe this should be active always...
48 // we don't want the PDA to be completely depleted.
50 if (Power::External::Status == Power::External::OFF) {
51 if (is_simulator() && Power::Battery::RemainingPercentValid &&
52 Power::Battery::RemainingPercent < BATTERY_EXIT) {
53 LogFormat("Battery low exit...");
54 // TODO feature: Warning message on battery shutdown
55 UIActions::SignalShutdown(true);
56 } else {
57 if (Power::Battery::RemainingPercentValid &&
58 Power::Battery::RemainingPercent < BATTERY_WARNING) {
59 if (last_warning.CheckUpdate(BATTERY_REMINDER))
60 // TODO feature: Show the user what the batt status is.
61 Message::AddMessage(_("Battery low"));
62 } else {
63 last_warning.Reset();
67 #endif /* HAVE_BATTERY */