Mercurial > public > ostc4
annotate Discovery/Src/tMenuXtra.c @ 425:86fcac4cc43a ImprovmentNVM_2
Added function to analyse the sampel ringbuffer:
The function will show 0 for used sectors, 4 for the sector currently in use and 5 for empty sectors. This allows identification of log sample index position and identification of a buffer corruption (more than 2 sectors have state 4)
The repair function writes dummy bytes to the end of the active buffer with the lower sector number. This decision is based on the fact that corruption results typically in a reset of index to buffer start address. After repair the writing will be continued using the hugher buffer marked as used.
author | ideenmodellierer |
---|---|
date | Sat, 15 Feb 2020 20:50:20 +0100 |
parents | 77de014928d6 |
children | 12f8745c8a94 |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Src/tMenuXtra.c | |
5 /// \brief Menu Xtra - Specials in Divemode like Reset Stopwatch | |
6 /// \author heinrichs weikamp gmbh | |
7 /// \date 02-Mar-2015 | |
8 /// | |
9 /// \details | |
10 /// | |
11 /// $Id$ | |
12 /////////////////////////////////////////////////////////////////////////////// | |
13 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh | |
14 /// | |
15 /// This program is free software: you can redistribute it and/or modify | |
16 /// it under the terms of the GNU General Public License as published by | |
17 /// the Free Software Foundation, either version 3 of the License, or | |
18 /// (at your option) any later version. | |
19 /// | |
20 /// This program is distributed in the hope that it will be useful, | |
21 /// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
23 /// GNU General Public License for more details. | |
24 /// | |
25 /// You should have received a copy of the GNU General Public License | |
26 /// along with this program. If not, see <http://www.gnu.org/licenses/>. | |
27 ////////////////////////////////////////////////////////////////////////////// | |
28 | |
29 /* Includes ------------------------------------------------------------------*/ | |
30 #include <stdio.h> | |
31 #include <string.h> | |
32 #include "tMenu.h" | |
33 #include "tStructure.h" | |
34 #include "tMenuXtra.h" | |
35 #include "text_multilanguage.h" | |
36 #include "data_central.h" | |
37 #include "simulation.h" | |
38 | |
39 /* Exported functions --------------------------------------------------------*/ | |
40 | |
41 uint32_t tMXtra_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext) | |
42 { | |
43 uint8_t textPointer; | |
44 | |
45 textPointer = 0; | |
46 *tab = 500; | |
47 *subtext = 0; | |
48 | |
49 if((line == 0) || (line == 1)) | |
50 { | |
51 text[textPointer++] = TXT_2BYTE; | |
52 text[textPointer++] = TXT2BYTE_ResetStopwatch; | |
53 } | |
54 strcpy(&text[textPointer],"\n\r"); | |
55 textPointer += 2; | |
56 /* | |
57 if((line == 0) || (line == 2)) | |
58 { | |
59 text[textPointer++] = TXT_2BYTE; | |
60 text[textPointer++] = TXT2BYTE_ResetAvgDepth; | |
61 } | |
62 strcpy(&text[textPointer],"\n\r"); | |
63 textPointer += 2; | |
64 */ | |
65 if((line == 0) || (line == 2)) | |
66 { | |
67 text[textPointer++] = TXT_2BYTE; | |
68 text[textPointer++] = TXT2BYTE_CompassHeading; | |
69 } | |
70 strcpy(&text[textPointer],"\n\r"); | |
71 textPointer += 2; | |
72 | |
73 if((line == 0) || (line == 3)) | |
74 { | |
75 text[textPointer++] = TXT_2BYTE; | |
76 text[textPointer++] = TXT2BYTE_SetMarker; | |
77 } | |
78 strcpy(&text[textPointer],"\n\r"); | |
79 textPointer += 2; | |
80 | |
81 if(is_stateUsedSetToSim()) | |
82 { | |
83 if((line == 0) || (line == 4)) | |
84 { | |
85 text[textPointer++] = TXT_2BYTE; | |
86 text[textPointer++] = TXT2BYTE_SimFollowDecoStops; | |
87 text[textPointer++] = ' '; | |
88 text[textPointer++] = ' '; | |
89 if(simulation_get_heed_decostops()) | |
90 text[textPointer++] = '\005'; | |
91 else | |
92 text[textPointer++] = '\006'; | |
93 } | |
94 strcpy(&text[textPointer],"\n\r"); | |
95 textPointer += 2; | |
96 } | |
347
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
38
diff
changeset
|
97 else |
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
38
diff
changeset
|
98 { |
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
38
diff
changeset
|
99 if((line == 0) || (line == 4)) /* end dive mode only used during real dives */ |
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
38
diff
changeset
|
100 { |
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
38
diff
changeset
|
101 text[textPointer++] = TXT_2BYTE; |
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
38
diff
changeset
|
102 text[textPointer++] = TXT2BYTE_EndDiveMode; |
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
38
diff
changeset
|
103 } |
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
38
diff
changeset
|
104 strcpy(&text[textPointer],"\n\r"); |
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
38
diff
changeset
|
105 textPointer += 2; |
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
38
diff
changeset
|
106 } |
38 | 107 |
108 return StMXTRA; | |
109 } | |
110 |