annotate Discovery/Src/tMenuCustom.c @ 571:91a8f9893e68

Reactivate compass parameter stored in NVM: The calibration parameters are stored in NVM but the automatic restore function during startup was no longer active. As result the compass needed to be calibration after every RTE update. In addition compass HW was detected at every startup causing some i2c "trouble" because of adressing not available devices. The compass HW info is now stored together with the calibration parameters to avoid i2C problems.
author Ideenmodellierer
date Wed, 25 Nov 2020 20:16:20 +0100
parents 531e7818b737
children fb5bb04ad914
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
506
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
1 ///////////////////////////////////////////////////////////////////////////////
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
2 /// -*- coding: UTF-8 -*-
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
3 ///
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
4 /// \file Discovery/Src/tMenuCustom.c
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
5 /// \brief Menu Custom - Provide access to custom view options
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
6 /// \author heinrichs weikamp gmbh
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
7 /// \date 25-Aug-2020
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
8 ///
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
9 /// \details
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
10 ///
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
11 /// $Id$
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
12 ///////////////////////////////////////////////////////////////////////////////
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
13 /// \par Copyright (c) 2014-2020 Heinrichs Weikamp gmbh
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
14 ///
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
15 /// This program is free software: you can redistribute it and/or modify
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
16 /// it under the terms of the GNU General Public License as published by
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
17 /// the Free Software Foundation, either version 3 of the License, or
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
18 /// (at your option) any later version.
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
19 ///
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
20 /// This program is distributed in the hope that it will be useful,
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
21 /// but WITHOUT ANY WARRANTY; without even the implied warranty of
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
22 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
23 /// GNU General Public License for more details.
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
24 ///
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
25 /// You should have received a copy of the GNU General Public License
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
26 /// along with this program. If not, see <http://www.gnu.org/licenses/>.
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
27 //////////////////////////////////////////////////////////////////////////////
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
28
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
29 /* Includes ------------------------------------------------------------------*/
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
30 #include <stdio.h>
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
31 #include <string.h>
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
32 #include "tMenu.h"
521
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
33 #include "tHome.h"
506
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
34 #include "tStructure.h"
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
35 #include "tMenuCustom.h"
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
36 #include "text_multilanguage.h"
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
37 #include "data_central.h"
521
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
38 #include "motion.h"
552
531e7818b737 Added menu structure to acces viewport calibration:
Ideenmodellierer
parents: 521
diff changeset
39 #include "gfx_fonts.h"
531e7818b737 Added menu structure to acces viewport calibration:
Ideenmodellierer
parents: 521
diff changeset
40 #include "tInfo.h"
531e7818b737 Added menu structure to acces viewport calibration:
Ideenmodellierer
parents: 521
diff changeset
41 #include "motion.h"
506
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
42
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
43
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
44 /* Exported functions --------------------------------------------------------*/
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
45
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
46 uint32_t tMCustom_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext)
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
47 {
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
48 uint8_t textPointer;
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
49
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
50 textPointer = 0;
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
51 *tab = 550;
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
52 *subtext = 0;
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
53
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
54 if((line == 0) || (line == 1))
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
55 {
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
56 text[textPointer++] = TXT_2BYTE;
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
57 text[textPointer++] = TXT2BYTE_Customviews;
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
58 }
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
59 text[textPointer++] = '\n';
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
60 text[textPointer++] = '\r';
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
61 text[textPointer] = 0;
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
62
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
63 if((line == 0) || (line == 2))
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
64 {
521
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
65 text[textPointer++] = TXT_2BYTE;
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
66 text[textPointer++] = TXT2BYTE_ExtraDisplay;
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
67 text[textPointer++] = ' ';
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
68 text[textPointer++] = ' ';
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
69 text[textPointer++] = TXT_2BYTE;
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
70
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
71 switch(settingsGetPointer()->extraDisplay)
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
72 {
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
73 /* BigFont */
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
74 case EXTRADISPLAY_BIGFONT:
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
75 text[textPointer++] = TXT2BYTE_ExtraBigFont;
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
76 break;
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
77 /* DecoGame */
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
78 case EXTRADISPLAY_DECOGAME:
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
79 text[textPointer++] = TXT2BYTE_ExtraDecoGame;
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
80 break;
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
81 /* none */
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
82 case EXTRADISPLAY_none:
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
83 text[textPointer++] = TXT2BYTE_ExtraNone;
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
84 break;
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
85
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
86 default:
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
87 snprintf(&text[textPointer++],2,"%u",settingsGetPointer()->extraDisplay);
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
88 break;
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
89 }
506
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
90 }
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
91 strcpy(&text[textPointer],"\n\r");
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
92 textPointer += 2;
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
93
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
94 if((line == 0) || (line == 3))
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
95 {
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
96 text[textPointer++] = TXT_2BYTE;
521
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
97 text[textPointer++] = TXT2BYTE_SelectCustomviews;
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
98 }
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
99 strcpy(&text[textPointer],"\n\r");
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
100 textPointer += 2;
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
101
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
102 if((line == 0) || (line == 4))
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
103 {
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
104 text[textPointer++] = TXT_2BYTE;
506
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
105 text[textPointer++] = TXT2BYTE_SelectBigFont;
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
106 }
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
107 strcpy(&text[textPointer],"\n\r");
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
108 textPointer += 2;
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
109
521
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
110 #ifdef ENABLE_MOTION_CONTROL
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
111 if((line == 0) || (line == 5))
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
112 {
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
113 /* MotionCtrl */
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
114 text[textPointer++] = TXT_2BYTE;
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
115 text[textPointer++] = TXT2BYTE_MotionCtrl;
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
116 text[textPointer++] = ' ';
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
117 text[textPointer++] = ' ';
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
118 text[textPointer++] = TXT_2BYTE;
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
119 switch(settingsGetPointer()->MotionDetection)
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
120 {
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
121 case MOTION_DETECT_OFF:
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
122 text[textPointer++] = TXT2BYTE_MoCtrlNone;
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
123 break;
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
124 case MOTION_DETECT_MOVE:
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
125 text[textPointer++] = TXT2BYTE_MoCtrlPitch;
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
126 break;
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
127 case MOTION_DETECT_SECTOR:
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
128 text[textPointer++] = TXT2BYTE_MoCtrlSector;
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
129 break;
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
130 case MOTION_DETECT_SCROLL:
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
131 text[textPointer++] = TXT2BYTE_MoCtrlScroll;
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
132 break;
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
133 default:
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
134 snprintf(&text[4],2,"%u",settingsGetPointer()->MotionDetection);
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
135 textPointer++;
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
136 break;
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
137 }
552
531e7818b737 Added menu structure to acces viewport calibration:
Ideenmodellierer
parents: 521
diff changeset
138 }
531e7818b737 Added menu structure to acces viewport calibration:
Ideenmodellierer
parents: 521
diff changeset
139
531e7818b737 Added menu structure to acces viewport calibration:
Ideenmodellierer
parents: 521
diff changeset
140 strcpy(&text[textPointer],"\n\r");
531e7818b737 Added menu structure to acces viewport calibration:
Ideenmodellierer
parents: 521
diff changeset
141 textPointer += 2;
531e7818b737 Added menu structure to acces viewport calibration:
Ideenmodellierer
parents: 521
diff changeset
142
531e7818b737 Added menu structure to acces viewport calibration:
Ideenmodellierer
parents: 521
diff changeset
143 if((line == 0) || (line == 6))
531e7818b737 Added menu structure to acces viewport calibration:
Ideenmodellierer
parents: 521
diff changeset
144 {
531e7818b737 Added menu structure to acces viewport calibration:
Ideenmodellierer
parents: 521
diff changeset
145 text[textPointer++] = TXT_2BYTE;
531e7818b737 Added menu structure to acces viewport calibration:
Ideenmodellierer
parents: 521
diff changeset
146 text[textPointer++] = TXT2BYTE_CalibView;
521
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
147 strcpy(&text[textPointer],"\n\r");
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
148 textPointer += 2;
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
149 }
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
150 #endif
e221cf762f45 Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents: 506
diff changeset
151
506
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
152 return StMCustom;
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
153 }
998529b3e142 Added new top level menu for customization of views
Ideenmodellierer
parents:
diff changeset
154