Mercurial > public > ostc4
annotate Discovery/Src/tMenuCustom.c @ 538:b1eee27cd02b
BugFix firmware downgrade to version with less settings:
If a downgrade to a firmware version using less setting parameter were done then the settings had been reset to the default values. Root cause was that only increased number of settings was accepted by the read function. Because the layout of the setting structure is fixed (only bytes attached, no change in the order of data values) a downgrade just discarding the no longer used settings is possible => Updated read function to handle reduction of setting parameters.
author | Ideenmodellierer |
---|---|
date | Sat, 10 Oct 2020 13:51:44 +0200 |
parents | e221cf762f45 |
children | 531e7818b737 |
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" |
506
998529b3e142
Added new top level menu for customization of views
Ideenmodellierer
parents:
diff
changeset
|
39 |
998529b3e142
Added new top level menu for customization of views
Ideenmodellierer
parents:
diff
changeset
|
40 |
998529b3e142
Added new top level menu for customization of views
Ideenmodellierer
parents:
diff
changeset
|
41 /* Exported functions --------------------------------------------------------*/ |
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 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
|
44 { |
998529b3e142
Added new top level menu for customization of views
Ideenmodellierer
parents:
diff
changeset
|
45 uint8_t textPointer; |
998529b3e142
Added new top level menu for customization of views
Ideenmodellierer
parents:
diff
changeset
|
46 |
998529b3e142
Added new top level menu for customization of views
Ideenmodellierer
parents:
diff
changeset
|
47 textPointer = 0; |
998529b3e142
Added new top level menu for customization of views
Ideenmodellierer
parents:
diff
changeset
|
48 *tab = 550; |
998529b3e142
Added new top level menu for customization of views
Ideenmodellierer
parents:
diff
changeset
|
49 *subtext = 0; |
998529b3e142
Added new top level menu for customization of views
Ideenmodellierer
parents:
diff
changeset
|
50 |
998529b3e142
Added new top level menu for customization of views
Ideenmodellierer
parents:
diff
changeset
|
51 if((line == 0) || (line == 1)) |
998529b3e142
Added new top level menu for customization of views
Ideenmodellierer
parents:
diff
changeset
|
52 { |
998529b3e142
Added new top level menu for customization of views
Ideenmodellierer
parents:
diff
changeset
|
53 text[textPointer++] = TXT_2BYTE; |
998529b3e142
Added new top level menu for customization of views
Ideenmodellierer
parents:
diff
changeset
|
54 text[textPointer++] = TXT2BYTE_Customviews; |
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++] = '\n'; |
998529b3e142
Added new top level menu for customization of views
Ideenmodellierer
parents:
diff
changeset
|
57 text[textPointer++] = '\r'; |
998529b3e142
Added new top level menu for customization of views
Ideenmodellierer
parents:
diff
changeset
|
58 text[textPointer] = 0; |
998529b3e142
Added new top level menu for customization of views
Ideenmodellierer
parents:
diff
changeset
|
59 |
998529b3e142
Added new top level menu for customization of views
Ideenmodellierer
parents:
diff
changeset
|
60 if((line == 0) || (line == 2)) |
998529b3e142
Added new top level menu for customization of views
Ideenmodellierer
parents:
diff
changeset
|
61 { |
521
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
62 text[textPointer++] = TXT_2BYTE; |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
63 text[textPointer++] = TXT2BYTE_ExtraDisplay; |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
64 text[textPointer++] = ' '; |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
65 text[textPointer++] = ' '; |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
66 text[textPointer++] = TXT_2BYTE; |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
67 |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
68 switch(settingsGetPointer()->extraDisplay) |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
69 { |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
70 /* BigFont */ |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
71 case EXTRADISPLAY_BIGFONT: |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
72 text[textPointer++] = TXT2BYTE_ExtraBigFont; |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
73 break; |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
74 /* DecoGame */ |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
75 case EXTRADISPLAY_DECOGAME: |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
76 text[textPointer++] = TXT2BYTE_ExtraDecoGame; |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
77 break; |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
78 /* none */ |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
79 case EXTRADISPLAY_none: |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
80 text[textPointer++] = TXT2BYTE_ExtraNone; |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
81 break; |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
82 |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
83 default: |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
84 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
|
85 break; |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
86 } |
506
998529b3e142
Added new top level menu for customization of views
Ideenmodellierer
parents:
diff
changeset
|
87 } |
998529b3e142
Added new top level menu for customization of views
Ideenmodellierer
parents:
diff
changeset
|
88 strcpy(&text[textPointer],"\n\r"); |
998529b3e142
Added new top level menu for customization of views
Ideenmodellierer
parents:
diff
changeset
|
89 textPointer += 2; |
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 if((line == 0) || (line == 3)) |
998529b3e142
Added new top level menu for customization of views
Ideenmodellierer
parents:
diff
changeset
|
92 { |
998529b3e142
Added new top level menu for customization of views
Ideenmodellierer
parents:
diff
changeset
|
93 text[textPointer++] = TXT_2BYTE; |
521
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
94 text[textPointer++] = TXT2BYTE_SelectCustomviews; |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
95 } |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
96 strcpy(&text[textPointer],"\n\r"); |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
97 textPointer += 2; |
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 if((line == 0) || (line == 4)) |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
100 { |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
101 text[textPointer++] = TXT_2BYTE; |
506
998529b3e142
Added new top level menu for customization of views
Ideenmodellierer
parents:
diff
changeset
|
102 text[textPointer++] = TXT2BYTE_SelectBigFont; |
998529b3e142
Added new top level menu for customization of views
Ideenmodellierer
parents:
diff
changeset
|
103 } |
998529b3e142
Added new top level menu for customization of views
Ideenmodellierer
parents:
diff
changeset
|
104 strcpy(&text[textPointer],"\n\r"); |
998529b3e142
Added new top level menu for customization of views
Ideenmodellierer
parents:
diff
changeset
|
105 textPointer += 2; |
998529b3e142
Added new top level menu for customization of views
Ideenmodellierer
parents:
diff
changeset
|
106 |
521
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
107 #ifdef ENABLE_MOTION_CONTROL |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
108 if((line == 0) || (line == 5)) |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
109 { |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
110 /* MotionCtrl */ |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
111 text[textPointer++] = TXT_2BYTE; |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
112 text[textPointer++] = TXT2BYTE_MotionCtrl; |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
113 text[textPointer++] = ' '; |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
114 text[textPointer++] = ' '; |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
115 text[textPointer++] = TXT_2BYTE; |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
116 switch(settingsGetPointer()->MotionDetection) |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
117 { |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
118 case MOTION_DETECT_OFF: |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
119 text[textPointer++] = TXT2BYTE_MoCtrlNone; |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
120 break; |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
121 case MOTION_DETECT_MOVE: |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
122 text[textPointer++] = TXT2BYTE_MoCtrlPitch; |
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_SECTOR: |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
125 text[textPointer++] = TXT2BYTE_MoCtrlSector; |
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_SCROLL: |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
128 text[textPointer++] = TXT2BYTE_MoCtrlScroll; |
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 default: |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
131 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
|
132 textPointer++; |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
133 break; |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
134 } |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
135 strcpy(&text[textPointer],"\n\r"); |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
136 textPointer += 2; |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
137 } |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
138 #endif |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
506
diff
changeset
|
139 |
506
998529b3e142
Added new top level menu for customization of views
Ideenmodellierer
parents:
diff
changeset
|
140 return StMCustom; |
998529b3e142
Added new top level menu for customization of views
Ideenmodellierer
parents:
diff
changeset
|
141 } |
998529b3e142
Added new top level menu for customization of views
Ideenmodellierer
parents:
diff
changeset
|
142 |