comparison Discovery/Src/tMenuEditXtra.c @ 272:74a8296a2318 write-from-sim

cleanup: simplify stateUsed usage Get rid of some local stateUsed pointers used to differentiate between normal dive and simulator mode. Simply use the (properly set) global data for this. Its rather useless to do this test on countless locations. Trivial cleanup. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author Jan Mulder <jlmulder@xs4all.nl>
date Sat, 27 Apr 2019 12:27:46 +0200
parents 5f11787b4f42
children ba229a012ac7
comparison
equal deleted inserted replaced
271:1303747b5ba2 272:74a8296a2318
119 } 119 }
120 120
121 121
122 uint8_t OnAction_CompassHeading (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) 122 uint8_t OnAction_CompassHeading (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
123 { 123 {
124 if(is_stateUsedSetToSim()) 124 stateUsedWrite->diveSettings.compassHeading = (uint16_t)stateUsed->lifeData.compass_heading;
125 stateSimGetPointerWrite()->diveSettings.compassHeading = (uint16_t)stateUsed->lifeData.compass_heading;
126 else
127 stateRealGetPointerWrite()->diveSettings.compassHeading = (uint16_t)stateUsed->lifeData.compass_heading;
128 exitMenuEdit_to_Home_with_Menu_Update(); 125 exitMenuEdit_to_Home_with_Menu_Update();
129 return EXIT_TO_HOME; 126 return EXIT_TO_HOME;
130 } 127 }
131
132
133 /*
134 uint8_t digitContentNew;
135 uint32_t newHeading;
136
137 if(action == ACTION_BUTTON_ENTER)
138 {
139 return digitContent;
140 }
141 if(action == ACTION_BUTTON_ENTER_FINAL)
142 {
143 evaluateNewString(editId, &newHeading, 0, 0, 0);
144 if(newHeading > 359)
145 newHeading = 0;
146
147 if(is_stateUsedSetToSim())
148 stateSimGetPointerWrite()->diveSettings.compassHeading = newHeading;
149 else
150 stateRealGetPointerWrite()->diveSettings.compassHeading = newHeading;
151 exitMenuEdit_to_Home_with_Menu_Update();
152 return EXIT_TO_HOME;
153 }
154 if(action == ACTION_BUTTON_NEXT)
155 {
156 digitContentNew = digitContent + 1;
157 if((digitNumber == 0) && (digitContentNew > '3'))
158 digitContentNew = '0';
159 else
160 if(digitContentNew > '9')
161 digitContentNew = '0';
162 return digitContentNew;
163 }
164 if(action == ACTION_BUTTON_BACK)
165 {
166 digitContentNew = digitContent - 1;
167 if((digitNumber == 0) && (digitContentNew < '0'))
168 digitContentNew = '3';
169 else
170 if(digitContentNew < '0')
171 digitContentNew = '9';
172 return digitContentNew;
173 }
174
175 return EXIT_TO_MENU;
176 */