annotate Discovery/Src/tInfoLog.c @ 625:028d8f3a9410

Switch Sector / Scroll detection to vector implementation: The vector implementation is mor robust against influences of roll and yaw to the pitch angle. To improve the performance the old sector based implementation has been replaced. In addition after entering focus state the roll angle is ignored. To improve readability and due to removal of some no longer needed function codes, function names have been updated
author Ideenmodellierer
date Mon, 08 Feb 2021 21:35:46 +0100
parents 280c11153080
children b9d4baa4f6fa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1 ///////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2 /// -*- coding: UTF-8 -*-
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 /// \file Discovery/Src/tInfoLog.c
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 /// \brief Main Template file for Menu Page Deco
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 /// \author heinrichs weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 /// \date 31-July-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 /// \details
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 /// $Id$
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 ///////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 /// This program is free software: you can redistribute it and/or modify
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16 /// it under the terms of the GNU General Public License as published by
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 /// the Free Software Foundation, either version 3 of the License, or
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 /// (at your option) any later version.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20 /// This program is distributed in the hope that it will be useful,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 /// but WITHOUT ANY WARRANTY; without even the implied warranty of
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 /// GNU General Public License for more details.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25 /// You should have received a copy of the GNU General Public License
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26 /// along with this program. If not, see <http://www.gnu.org/licenses/>.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
27 //////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29 /* Includes ------------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30 #include "tInfoLog.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 #include "gfx_fonts.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33 #include "logbook.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34 #include "show_logbook.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35 #include "tHome.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36 #include "tInfo.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37 #include "tMenu.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38 #include "unit.h"
452
b90ddf57f7f1 Added compile variant enabling the reset of profile sample information:
ideenmodellierer
parents: 186
diff changeset
39 #include "externLogbookFlash.h"
b90ddf57f7f1 Added compile variant enabling the reset of profile sample information:
ideenmodellierer
parents: 186
diff changeset
40 #include "configuration.h"
594
280c11153080 Added compile switch for new T3 View Profile
Ideenmodellierer
parents: 590
diff changeset
41 #include "logbook_miniLive.h"
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 /* Exported variables --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45 /* Private types -------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48 uint8_t page;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49 uint8_t line;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50 uint8_t linesAvailableForPage;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51 uint8_t modeFlipPages;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52 uint8_t maxpages;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53 } SInfoLogMemory;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55 /* Private variables ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56 GFX_DrawCfgScreen INFOLOGscreen;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57 GFX_DrawCfgScreen *pMenuCursor, *pMenuCursorDesignSolo;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 GFX_DrawCfgWindow INFOLOGwindow;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 SInfoLogMemory infolog;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 /* Private function prototypes -----------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63 void tInfoLog_BuildAndShowNextPage(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 void tInfoLog_nextLine(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 void showLog(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 void showNextLogPage(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 void stepBackInfo(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 void stepForwardInfo(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69 void showLogExit(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 void tInfoLog_init(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 INFOLOGscreen.FBStartAdress = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75 INFOLOGscreen.ImageHeight = 480;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 INFOLOGscreen.ImageWidth = 800;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77 INFOLOGscreen.LayerIndex = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79 INFOLOGwindow.Image = &INFOLOGscreen;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 INFOLOGwindow.WindowNumberOfTextLines = 6;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81 INFOLOGwindow.WindowLineSpacing = 65;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 INFOLOGwindow.WindowTab = 400;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83 INFOLOGwindow.WindowX0 = 20;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84 INFOLOGwindow.WindowX1 = 779;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 38
diff changeset
85 if(!settingsGetPointer()->FlipDisplay)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 38
diff changeset
86 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 38
diff changeset
87 INFOLOGwindow.WindowY0 = 4 + 25;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 38
diff changeset
88 INFOLOGwindow.WindowY1 = 390 + 25;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 38
diff changeset
89 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 38
diff changeset
90 else
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 38
diff changeset
91 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 38
diff changeset
92 INFOLOGwindow.WindowY0 = 479 - 390;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 38
diff changeset
93 INFOLOGwindow.WindowY1 = 479 - 25;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 38
diff changeset
94 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 void openInfoLogLastDive(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100 infolog.page = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101 SLogbookHeader logbookHeader;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 if(logbook_getHeader(0,&logbookHeader))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 set_globalState(StILOGSHOW); // all the rest with zeros
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105 infolog.page = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106 infolog.line = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107 show_logbook_test(1, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110 openLog(0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114 void openLog(_Bool recallKeepPage)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
115 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
116 if(recallKeepPage && infolog.page)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117 infolog.page--;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119 infolog.page = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121 infolog.modeFlipPages = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122 set_globalState_Log_Page(infolog.page);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 infolog.maxpages = (logbook_getNumberOfHeaders() + 5) / 6;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124 tInfoLog_BuildAndShowNextPage();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
126 pMenuCursor = get_PointerMenuCursorScreen();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127 pMenuCursorDesignSolo = get_PointerMenuCursorDesignSoloScreen();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129 change_CLUT_entry(CLUT_MenuLineSelectedSides, CLUT_InfoPageLogbook);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130 change_CLUT_entry(CLUT_MenuLineSelectedSeperator, CLUT_InfoPageLogbook);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132 //GFX_ResetLayer(TOP_LAYER);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133 //GFX_ResetLayer(BACKGRD_LAYER);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135 if(infolog.page == 255)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136 GFX_SetFrameBottom((INFOLOGscreen.FBStartAdress), 0, 0, 800, 480);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139 // very old: GFX_SetFrameBottom((pMenuCursor->FBStartAdress), 0, 0, 800, 390);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 // no, set cursor to firt line instead with tInfoLog_nextLine() GFX_SetFrameBottom((pMenuCursorDesignSolo->FBStartAdress), 0, 25, 800, 390);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 tInfoLog_nextLine();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146 void sendActionToInfoLogList(uint8_t sendAction)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148 switch(sendAction)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
149 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150 case ACTION_BUTTON_ENTER:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151 stepForwardInfo();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
153 case ACTION_BUTTON_NEXT:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
154
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
155 if(infolog.modeFlipPages)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157 tInfoLog_BuildAndShowNextPage();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
158 // GFX_SetFrameBottom((pMenuCursor->FBStartAdress), 0, 25, 800, 390);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
160 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
161 tInfoLog_nextLine();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163 case ACTION_TIMEOUT:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164 case ACTION_MODE_CHANGE:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
165 case ACTION_BUTTON_BACK:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
166 stepBackInfo();
186
f11f0bf6ef2d cleanup: remove obsolete code, make static, etc.
Jan Mulder <jlmulder@xs4all.nl>
parents: 110
diff changeset
167 break;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168 default:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
169 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
170 case ACTION_IDLE_TICK:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
171 case ACTION_IDLE_SECOND:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
172 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
173 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
174 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
175
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
176
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
177 void sendActionToInfoLogShow(uint8_t sendAction)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
178 {
594
280c11153080 Added compile switch for new T3 View Profile
Ideenmodellierer
parents: 590
diff changeset
179 #ifdef ENABLE_T3_PROFILE_VIEW
280c11153080 Added compile switch for new T3 View Profile
Ideenmodellierer
parents: 590
diff changeset
180 uint8_t stepBack;
280c11153080 Added compile switch for new T3 View Profile
Ideenmodellierer
parents: 590
diff changeset
181 #endif
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
182 switch(sendAction)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
183 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
184 case ACTION_BUTTON_ENTER:
594
280c11153080 Added compile switch for new T3 View Profile
Ideenmodellierer
parents: 590
diff changeset
185 #ifdef ENABLE_T3_PROFILE_VIEW
280c11153080 Added compile switch for new T3 View Profile
Ideenmodellierer
parents: 590
diff changeset
186 if(getActiveLogPage() == 1)
280c11153080 Added compile switch for new T3 View Profile
Ideenmodellierer
parents: 590
diff changeset
187 {
280c11153080 Added compile switch for new T3 View Profile
Ideenmodellierer
parents: 590
diff changeset
188 stepBack = (6 * (infolog.page - 1)) + infolog.line - 1;
280c11153080 Added compile switch for new T3 View Profile
Ideenmodellierer
parents: 590
diff changeset
189 prepareReplayLog(stepBack);
280c11153080 Added compile switch for new T3 View Profile
Ideenmodellierer
parents: 590
diff changeset
190 updateReplayIncdicator(&INFOLOGscreen);
280c11153080 Added compile switch for new T3 View Profile
Ideenmodellierer
parents: 590
diff changeset
191 }
280c11153080 Added compile switch for new T3 View Profile
Ideenmodellierer
parents: 590
diff changeset
192 #endif
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
193 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
194 case ACTION_BUTTON_NEXT:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
195 showNextLogPage();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
196 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
197 case ACTION_TIMEOUT:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
198 case ACTION_MODE_CHANGE:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
199 case ACTION_BUTTON_BACK:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
200 if(get_globalState() == StILOGSHOW) // no page nor line
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
201 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
202 openLog(1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
203 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
204 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
205 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
206 showLogExit();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
207 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
208 show_logbook_exit();
186
f11f0bf6ef2d cleanup: remove obsolete code, make static, etc.
Jan Mulder <jlmulder@xs4all.nl>
parents: 110
diff changeset
209 break;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
210 default:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
211 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
212 case ACTION_IDLE_TICK:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
213 case ACTION_IDLE_SECOND:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
214 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
215 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
216 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
217
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
218
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
219 /* Private functions ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
220
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
221 void exitLog(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
222 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
223 //set_globalState_tHome();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
224 exitInfo();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
225 releaseFrame(15,INFOLOGscreen.FBStartAdress);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
226 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
227
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
228
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
229 void stepBackInfo(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
230 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
231 if(infolog.modeFlipPages == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
232 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
233 infolog.line = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
234 infolog.modeFlipPages = 1;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 38
diff changeset
235
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 38
diff changeset
236 if(!settingsGetPointer()->FlipDisplay)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 38
diff changeset
237 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 38
diff changeset
238 GFX_SetFrameBottom(pMenuCursorDesignSolo->FBStartAdress, 0, 25, 800, 390);
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 38
diff changeset
239 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 38
diff changeset
240 else
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 38
diff changeset
241 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 38
diff changeset
242 GFX_SetFrameBottom(pMenuCursorDesignSolo->FBStartAdress, 0, 65, 800, 390);
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 38
diff changeset
243 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 38
diff changeset
244
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
245 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
246 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
247 exitLog();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
248 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
249
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
250
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
251 void stepForwardInfo(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
252 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
253 if(infolog.modeFlipPages == 1)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
254 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
255 tInfoLog_nextLine();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
256 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
257 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
258 showLog();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
259 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
260
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
261
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
262 void tInfoLog_BuildAndShowNextPage(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
263 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
264 char text[MAX_PAGE_TEXTSIZE];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
265 uint16_t textPointer = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
266 SLogbookHeader logbookHeader;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
267 // uint16_t divetime = logbookHeader.diveTimeMinutes;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
268 // uint16_t maxDepth = logbookHeader.maxDepth/100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
269 int i = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
270 uint8_t date[2], month,day;
567
1c95f811967c -Add 12HR Time Support
izzni
parents: 525
diff changeset
271 char timeSuffix;
1c95f811967c -Add 12HR Time Support
izzni
parents: 525
diff changeset
272 uint8_t hours;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
273
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
274 if(INFOLOGscreen.FBStartAdress)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
275 releaseFrame(15,INFOLOGscreen.FBStartAdress);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
276 INFOLOGscreen.FBStartAdress = getFrame(15);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
277
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
278 infolog.page += 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
279 infolog.linesAvailableForPage = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
280
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
281 if((infolog.page < 1) || (infolog.page > 43)) /* max with 256 entries */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
282 infolog.page = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
283
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
284
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
285 text[0] = '\001';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
286 text[1] = TXT_Logbook;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
287 text[2] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
288 gfx_write_topline_simple(&INFOLOGscreen, text, CLUT_InfoPageLogbook);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
289
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
290 *text = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
291 if(!logbook_getHeader((infolog.page - 1) * 6,&logbookHeader))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
292 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
293 infolog.page = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
294 if(!logbook_getHeader((infolog.page - 1) * 6,&logbookHeader))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
295 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
296 infolog.page = 255;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
297 infolog.linesAvailableForPage = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
298 text[0] = TXT_LogbookEmpty;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
299 text[1] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
300 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
301 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
302
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
303 if((*text == 0) && (infolog.maxpages > 1))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
304 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
305 snprintf(text,8, "\002" "%u/%u", infolog.page, infolog.maxpages);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
306 gfx_write_topline_simple(&INFOLOGscreen, text, CLUT_InfoPageLogbook);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
307 *text = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
308 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
309
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
310 if(*text == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
311 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
312 infolog.line = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
313 textPointer = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
314 if(settingsGetPointer()->date_format == DDMMYY)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
315 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
316 day = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
317 month = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
318 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
319 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
320 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
321 day = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
322 month = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
323 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
324 for(i = 0; i < 6; i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
325 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
326 if(i)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
327 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
328 if(!logbook_getHeader(((infolog.page - 1) * 6) + i, &logbookHeader))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
329 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
330 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
331 infolog.linesAvailableForPage += 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
332 uint16_t divetime = logbookHeader.diveTimeMinutes;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
333 uint16_t maxDepthMeter = logbookHeader.maxDepth/100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
334 uint16_t maxDepthSubmeter = (logbookHeader.maxDepth - maxDepthMeter * 100)/10;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
335 uint16_t number = ((infolog.page - 1) * 6) + i + 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
336 if(settingsGetPointer()->logbookOffset)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
337 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
338 if(number <= settingsGetPointer()->logbookOffset)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
339 number = settingsGetPointer()->logbookOffset + 1 - number;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
340 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
341 date[day] = logbookHeader.dateDay;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
342 date[month] = logbookHeader.dateMonth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
343
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
344 text[textPointer++] = '\034';// monospaced space large size mode
525
1f557e5f4b5a Change color ID used in strings for light grey:
Ideenmodellierer
parents: 469
diff changeset
345 textPointer += snprintf(&text[textPointer], 20,"\031%04u \020", number);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
346 /* if(number < 1000)
525
1f557e5f4b5a Change color ID used in strings for light grey:
Ideenmodellierer
parents: 469
diff changeset
347 textPointer += snprintf(&text[textPointer], 20,"\031%2u \020", number);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
348 else
525
1f557e5f4b5a Change color ID used in strings for light grey:
Ideenmodellierer
parents: 469
diff changeset
349 textPointer += snprintf(&text[textPointer], 20,"\031\016\016%3u \017\020", number);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
350 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
351 textPointer += snprintf(&text[textPointer], 20,"%02d.%02d ",date[0],date[1]);
567
1c95f811967c -Add 12HR Time Support
izzni
parents: 525
diff changeset
352
1c95f811967c -Add 12HR Time Support
izzni
parents: 525
diff changeset
353 if (settingsGetPointer()->amPMTime)
1c95f811967c -Add 12HR Time Support
izzni
parents: 525
diff changeset
354 {
1c95f811967c -Add 12HR Time Support
izzni
parents: 525
diff changeset
355 if (logbookHeader.timeHour > 11)
1c95f811967c -Add 12HR Time Support
izzni
parents: 525
diff changeset
356 {
1c95f811967c -Add 12HR Time Support
izzni
parents: 525
diff changeset
357 timeSuffix = 'P';
1c95f811967c -Add 12HR Time Support
izzni
parents: 525
diff changeset
358 }
1c95f811967c -Add 12HR Time Support
izzni
parents: 525
diff changeset
359 else
1c95f811967c -Add 12HR Time Support
izzni
parents: 525
diff changeset
360 {
1c95f811967c -Add 12HR Time Support
izzni
parents: 525
diff changeset
361 timeSuffix = 'A';
1c95f811967c -Add 12HR Time Support
izzni
parents: 525
diff changeset
362 }
1c95f811967c -Add 12HR Time Support
izzni
parents: 525
diff changeset
363
1c95f811967c -Add 12HR Time Support
izzni
parents: 525
diff changeset
364 if (logbookHeader.timeHour % 12 == 0)
1c95f811967c -Add 12HR Time Support
izzni
parents: 525
diff changeset
365 {
1c95f811967c -Add 12HR Time Support
izzni
parents: 525
diff changeset
366 hours = 12;
1c95f811967c -Add 12HR Time Support
izzni
parents: 525
diff changeset
367 }
1c95f811967c -Add 12HR Time Support
izzni
parents: 525
diff changeset
368 else
1c95f811967c -Add 12HR Time Support
izzni
parents: 525
diff changeset
369 {
1c95f811967c -Add 12HR Time Support
izzni
parents: 525
diff changeset
370 hours = (logbookHeader.timeHour % 12);
1c95f811967c -Add 12HR Time Support
izzni
parents: 525
diff changeset
371 }
1c95f811967c -Add 12HR Time Support
izzni
parents: 525
diff changeset
372
1c95f811967c -Add 12HR Time Support
izzni
parents: 525
diff changeset
373 textPointer += snprintf(&text[textPointer], 20,"%02d:%02d\016\016%cM\017", hours,logbookHeader.timeMinute, timeSuffix);
1c95f811967c -Add 12HR Time Support
izzni
parents: 525
diff changeset
374 }
1c95f811967c -Add 12HR Time Support
izzni
parents: 525
diff changeset
375 else
1c95f811967c -Add 12HR Time Support
izzni
parents: 525
diff changeset
376 {
1c95f811967c -Add 12HR Time Support
izzni
parents: 525
diff changeset
377 textPointer += snprintf(&text[textPointer], 20,"%02d:%02d ",logbookHeader.timeHour,logbookHeader.timeMinute);
1c95f811967c -Add 12HR Time Support
izzni
parents: 525
diff changeset
378 }
1c95f811967c -Add 12HR Time Support
izzni
parents: 525
diff changeset
379
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
380 switch(logbookHeader.decoModel)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
381 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
382 case 1:
570
701ead8dddab Try to reduce legth of log entry string:
Ideenmodellierer
parents: 567
diff changeset
383 if(!settingsGetPointer()->nonMetricalSystem) /* safe space to avoid cursor overlap */
701ead8dddab Try to reduce legth of log entry string:
Ideenmodellierer
parents: 567
diff changeset
384 {
701ead8dddab Try to reduce legth of log entry string:
Ideenmodellierer
parents: 567
diff changeset
385 if(settingsGetPointer()->amPMTime)
701ead8dddab Try to reduce legth of log entry string:
Ideenmodellierer
parents: 567
diff changeset
386 {
701ead8dddab Try to reduce legth of log entry string:
Ideenmodellierer
parents: 567
diff changeset
387 textPointer += snprintf(&text[textPointer],20,"\016\016 GF \017");
701ead8dddab Try to reduce legth of log entry string:
Ideenmodellierer
parents: 567
diff changeset
388 }
701ead8dddab Try to reduce legth of log entry string:
Ideenmodellierer
parents: 567
diff changeset
389 else
701ead8dddab Try to reduce legth of log entry string:
Ideenmodellierer
parents: 567
diff changeset
390 {
701ead8dddab Try to reduce legth of log entry string:
Ideenmodellierer
parents: 567
diff changeset
391 textPointer += snprintf(&text[textPointer],20,"\016\016GF \017");
701ead8dddab Try to reduce legth of log entry string:
Ideenmodellierer
parents: 567
diff changeset
392 }
701ead8dddab Try to reduce legth of log entry string:
Ideenmodellierer
parents: 567
diff changeset
393 }
701ead8dddab Try to reduce legth of log entry string:
Ideenmodellierer
parents: 567
diff changeset
394 else
701ead8dddab Try to reduce legth of log entry string:
Ideenmodellierer
parents: 567
diff changeset
395 {
701ead8dddab Try to reduce legth of log entry string:
Ideenmodellierer
parents: 567
diff changeset
396 textPointer += snprintf(&text[textPointer],20,"\016\016 GF \017");
701ead8dddab Try to reduce legth of log entry string:
Ideenmodellierer
parents: 567
diff changeset
397 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
398 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
399 case 2:
590
eecb52ab1fce Align VPM tag in log list to be at same position as GF tag:
Ideenmodellierer
parents: 570
diff changeset
400 textPointer += snprintf(&text[textPointer],20,"\016\016VPM\017");
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
401 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
402 default:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
403 textPointer += snprintf(&text[textPointer],20,"\016\016 * \017");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
404 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
405 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
406
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
407 if(settingsGetPointer()->nonMetricalSystem)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
408 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
409 float maxDepthFeet = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
410 maxDepthFeet = unit_depth_float(((float)logbookHeader.maxDepth)/100);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
411 textPointer += snprintf(&text[textPointer], 20,"%3.0f\016\016ft\017 ", maxDepthFeet);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
412 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
413 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
414 {
570
701ead8dddab Try to reduce legth of log entry string:
Ideenmodellierer
parents: 567
diff changeset
415 textPointer += snprintf(&text[textPointer], 20,"%3d.%d\016\016m \017", maxDepthMeter,maxDepthSubmeter);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
416 }
567
1c95f811967c -Add 12HR Time Support
izzni
parents: 525
diff changeset
417 textPointer += snprintf(&text[textPointer], 20,"%3d\016\016min\017\n\r", divetime);
1c95f811967c -Add 12HR Time Support
izzni
parents: 525
diff changeset
418
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
419 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
420 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
421 GFX_write_string(&FontT48, &INFOLOGwindow, text,1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
422
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
423 if(infolog.linesAvailableForPage > 1)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
424 tInfo_write_buttonTextline(&INFOLOGscreen, TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
425 else if(infolog.page == 255)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
426 tInfo_write_buttonTextline(&INFOLOGscreen, TXT2BYTE_ButtonBack,0,0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
427 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
428 tInfo_write_buttonTextline(&INFOLOGscreen, TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
429
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
430 GFX_SetFrameTop(INFOLOGscreen.FBStartAdress);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
431 set_globalState_Log_Page(infolog.page);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
432 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
433
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
434
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
435 void tInfoLog_nextLine(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
436 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
437 if(infolog.linesAvailableForPage == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
438 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
439
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
440 infolog.line += 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
441 if(infolog.line > infolog.linesAvailableForPage)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
442 infolog.line = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
443
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
444 infolog.modeFlipPages = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
445
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 38
diff changeset
446 if(!settingsGetPointer()->FlipDisplay)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 38
diff changeset
447 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 38
diff changeset
448 GFX_SetFrameBottom((pMenuCursor->FBStartAdress) + 65*2*(infolog.line - 1), 0, 25, 800, 390);
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 38
diff changeset
449 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 38
diff changeset
450 else
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 38
diff changeset
451 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 38
diff changeset
452 GFX_SetFrameBottom((pMenuCursor->FBStartAdress)+ (390 - 65 *(infolog.line)) *2, 0, 480-390-25, 800, 390);
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 38
diff changeset
453 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
454 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
455
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
456
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
457 void showLogExit(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
458 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
459 GFX_SetFrameTop(INFOLOGscreen.FBStartAdress);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
460 GFX_SetFrameBottom((pMenuCursor->FBStartAdress) + 65*2*(infolog.line - 1), 0, 25, 800, 390);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
461 set_globalState_Log_Page(infolog.page);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
462 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
463
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
464
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
465 void showLog(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
466 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
467 uint8_t stepBack;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
468
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
469 if(infolog.page == 255)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
470 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
471
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
472 stepBack = (6 * (infolog.page - 1)) + infolog.line - 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
473 //build_logbook_test();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
474 show_logbook_test(1, stepBack);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
475 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
476
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
477
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
478 void showNextLogPage(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
479 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
480 uint8_t stepBack;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
481
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
482 if(infolog.page == 255)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
483 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
484
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
485 stepBack = (6 * (infolog.page - 1)) + infolog.line - 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
486 //build_logbook_test();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
487 show_logbook_test(0, stepBack);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
488 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
489