comparison Discovery/Src/tMenuEditSetpoint.c @ 650:5f0d3dce5ef4

Automatik setpoint change: In previous versions a better set point was suggested by the OSTC but had to be confirmed using the quick menu functionality. To improve usability an option has been added to the setpoint menu which allows the selection of automatically setpoint changes. If activated the OSTC will automatically switch to the setpoint in case the matching depth is passed.
author Ideenmodellierer
date Mon, 19 Apr 2021 20:19:32 +0200
parents 4532953ac1a0
children f6212495f34f
comparison
equal deleted inserted replaced
649:60162a939c06 650:5f0d3dce5ef4
189 // uint8_t active, 189 // uint8_t active,
190 char text[70]; 190 char text[70];
191 uint8_t textPointer; 191 uint8_t textPointer;
192 uint16_t y_line; 192 uint16_t y_line;
193 193
194 set_globalState_Menu_Line(line); 194 if(line < 6)
195 195 {
196 resetMenuEdit(CLUT_MenuPageGasSP); 196 set_globalState_Menu_Line(line);
197 197
198 spId = line; 198 resetMenuEdit(CLUT_MenuPageGasSP);
199 editSetpointPage.spID = spId; 199
200 SSettings *data = settingsGetPointer(); 200 spId = line;
201 editSetpointPage.pSetpointLine = data->setpoint; 201 editSetpointPage.spID = spId;
202 202 SSettings *data = settingsGetPointer();
203 setpoint_cbar = editSetpointPage.pSetpointLine[spId].setpoint_cbar; 203 editSetpointPage.pSetpointLine = data->setpoint;
204 depthDeco = editSetpointPage.pSetpointLine[spId].depth_meter; 204
205 //active = editSetpointPage.pSetpointLine[spId].note.ub.active; 205 setpoint_cbar = editSetpointPage.pSetpointLine[spId].setpoint_cbar;
206 first = editSetpointPage.pSetpointLine[spId].note.ub.first; 206 depthDeco = editSetpointPage.pSetpointLine[spId].depth_meter;
207 207 //active = editSetpointPage.pSetpointLine[spId].note.ub.active;
208 sp_high = setpoint_cbar / 100; 208 first = editSetpointPage.pSetpointLine[spId].note.ub.first;
209 209
210 strcpy(text, "\001" "Setpoint #0 X"); 210 sp_high = setpoint_cbar / 100;
211 text[11] += spId; 211
212 text[13] = TXT_Setpoint_Edit; 212 strcpy(text, "\001" "Setpoint #0 X");
213 write_topline(text); 213 text[11] += spId;
214 214 text[13] = TXT_Setpoint_Edit;
215 215 write_topline(text);
216 y_line = ME_Y_LINE_BASE + (line * ME_Y_LINE_STEP); 216
217 217
218 textPointer = 0; 218 y_line = ME_Y_LINE_BASE + (line * ME_Y_LINE_STEP);
219 text[textPointer++] = 'S'; 219
220 text[textPointer++] = 'P'; 220 textPointer = 0;
221 text[textPointer++] = '0' + spId; 221 text[textPointer++] = 'S';
222 text[textPointer++] = ' '; 222 text[textPointer++] = 'P';
223 text[textPointer++] = ' '; 223 text[textPointer++] = '0' + spId;
224 224 text[textPointer++] = ' ';
225 if(first == 0) 225 text[textPointer++] = ' ';
226 strcpy(&text[textPointer++],"\177"); 226
227 227 if(first == 0)
228 textPointer += snprintf(&text[textPointer], 60,\ 228 strcpy(&text[textPointer++],"\177");
229 "* " 229
230 " " 230 textPointer += snprintf(&text[textPointer], 60,\
231 "\016\016" 231 "* "
232 " bar" 232 " "
233 "\017" 233 "\016\016"
234 "\034" 234 " bar"
235 " " 235 "\017"
236 "\016\016" 236 "\034"
237 " " 237 " "
238 "\017" 238 "\016\016"
239 " " 239 " "
240 "\016\016" 240 "\017"
241 "meter" 241 " "
242 "\017" 242 "\016\016"
243 "\035" 243 "meter"
244 "\n\r" 244 "\017"
245 ); 245 "\035"
246 write_label_var( 20, 800, y_line, &FontT48, text); 246 "\n\r"
247 247 );
248 write_field_udigit(StMSP_ppo2_setting, 160, 800, y_line, &FontT48, "#.## ###", (uint32_t)sp_high, (uint32_t)(setpoint_cbar - (100 * sp_high)), depthDeco, 0); 248 write_label_var( 20, 800, y_line, &FontT48, text);
249 setEvent(StMSP_ppo2_setting, (uint32_t)OnAction_SP_Setpoint); 249
250 startEdit(); 250 write_field_udigit(StMSP_ppo2_setting, 160, 800, y_line, &FontT48, "#.## ###", (uint32_t)sp_high, (uint32_t)(setpoint_cbar - (100 * sp_high)), depthDeco, 0);
251 setEvent(StMSP_ppo2_setting, (uint32_t)OnAction_SP_Setpoint);
252 startEdit();
253 }
254 else
255 {
256 SSettings *pSettings = settingsGetPointer();
257
258 if(pSettings->autoSetpoint == 0)
259 {
260 pSettings->autoSetpoint = 1;
261 }
262 else
263 {
264 pSettings->autoSetpoint = 0;
265 }
266 exitMenuEdit_to_Menu_with_Menu_Update_do_not_write_settings_for_this_only();
267 }
251 } 268 }
252 } 269 }
253 270
254 static uint8_t OnAction_SP_Setpoint(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) 271 static uint8_t OnAction_SP_Setpoint(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
255 { 272 {