-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTotalityWaitPage.cpp
75 lines (71 loc) · 1.8 KB
/
TotalityWaitPage.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
* This file is part of the Eclipse2017 project. It is subject to the GPLv3
* license terms in the LICENSE file found in the top-level directory of this
* distribution and at
* https://github.com/jjackowski/eclipse2017/blob/master/LICENSE.
* No part of the Eclipse2017 project, including this file, may be copied,
* modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*
* Copyright (C) 2017 Jeff Jackowski
*/
#include "TotalityWaitPage.hpp"
using duds::hardware::devices::displays::clearTo;
using duds::hardware::devices::displays::move;
using duds::hardware::devices::displays::startLine;
Page::SelectionResponse TotalityWaitPage::select(
const DisplayInfo &di,
SelectionCause sc
) {
if (di.inTotality && ((sc == SelectUser) || (di.now < di.start))) {
return SelectPage;
}
return SkipPage;
}
void TotalityWaitPage::show(
const DisplayInfo &di,
duds::hardware::devices::displays::TextDisplayStream &tds
) {
Hms time(di.start);
tds << "Start" << clearTo(11, 1);
time.writeTime(tds);
if (di.start > di.now) {
tds << "Wait ";
time.set(di.start - di.now);
} else {
tds << "Over ";
time.set(di.now - di.end);
}
time.writeDuration(tds);
tds << startLine << "Duration ";
time.set(di.end - di.start);
time.writeDuration(tds);
tds << "\nTotal ";
dist = -1.0;
if (di.goodfix) {
showdist(di, tds);
}
}
void TotalityWaitPage::update(
const DisplayInfo &di,
duds::hardware::devices::displays::TextDisplayStream &tds
) {
if (di.totchg) {
show(di, tds);
} else {
tds << move(9, 2);
Hms time;
if (di.start > di.now) {
time.set(di.start - di.now);
} else {
time.set(di.now - di.end);
}
time.writeDuration(tds);
tds << startLine;
if (di.goodfix) {
tds << move(6, 0);
showdist(di, tds);
}
tds << move(12, 0);
}
}