comparison Discovery/Src/tMenuEditXtra.c @ 929:63c340abd70e Evo_2_23 tip

Add a line to the compass heading dive menu that shows the currently set heading to enable the diver to confirm it / add it to notes. Also add a log entry every time a new compass heading is set or the heading is cleared. And add a way to add compass headings to the log without changing the currently set heading - this was added after discussion with cave divers who are interested in recording headings when mapping out caves. From mikeller
author heinrichsweikamp
date Mon, 02 Dec 2024 11:16:10 +0100
parents 49ee233c7a74
children
comparison
equal deleted inserted replaced
928:9b7859554beb 929:63c340abd70e
314 314
315 315
316 316
317 static uint8_t OnAction_CompassHeadingClear(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) 317 static uint8_t OnAction_CompassHeadingClear(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
318 { 318 {
319 stateUsedWrite->diveSettings.compassHeading = 0; 319 clearCompassHeading();
320 320
321 exitMenuEdit_to_Home_with_Menu_Update(); 321 exitMenuEdit_to_Home_with_Menu_Update();
322 322
323 return EXIT_TO_HOME; 323 return EXIT_TO_HOME;
324 } 324 }
325 325
326 326
327 static uint8_t OnAction_CompassHeadingReset(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) 327 static uint8_t OnAction_CompassHeadingReset(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
328 { 328 {
329 stateUsedWrite->diveSettings.compassHeading = settingsGetPointer()->compassBearing; 329 setCompassHeading(settingsGetPointer()->compassBearing);
330
331 exitMenuEdit_to_Home_with_Menu_Update();
332
333 return EXIT_TO_HOME;
334 }
335
336
337 static uint8_t OnAction_CompassHeadingLog(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
338 {
339 logCompassHeading((uint16_t)stateUsed->lifeData.compass_heading);
330 340
331 exitMenuEdit_to_Home_with_Menu_Update(); 341 exitMenuEdit_to_Home_with_Menu_Update();
332 342
333 return EXIT_TO_HOME; 343 return EXIT_TO_HOME;
334 } 344 }
381 } 391 }
382 } else { 392 } else {
383 write_label_var(20, 800, ME_Y_LINE4, &FontT48, text); 393 write_label_var(20, 800, ME_Y_LINE4, &FontT48, text);
384 } 394 }
385 395
396 snprintf(text, 32, "%c%c", TXT_2BYTE, TXT2BYTE_Log);
397 if (!isRefresh) {
398 write_field_button(StMXTRA_CompassHeadingLog, 20, 800, ME_Y_LINE5, &FontT48, text);
399 } else {
400 tMenuEdit_refresh_field(StMXTRA_CompassHeadingLog);
401 }
402
403 if (headingIsSet) {
404 snprintf(text, 32, "%s%c%c (%03u`)", makeGrey(true), TXT_2BYTE, TXT2BYTE_Current, stateUsed->diveSettings.compassHeading);
405 write_label_var(20, 800, ME_Y_LINE6, &FontT48, text);
406 }
407
386 if (!isRefresh) { 408 if (!isRefresh) {
387 setEvent(StMXTRA_CompassHeading, (uint32_t)OnAction_CompassHeading); 409 setEvent(StMXTRA_CompassHeading, (uint32_t)OnAction_CompassHeading);
388 setEvent(StMXTRA_CompassHeadingClear, (uint32_t)OnAction_CompassHeadingClear); 410 setEvent(StMXTRA_CompassHeadingClear, (uint32_t)OnAction_CompassHeadingClear);
389 setEvent(StMXTRA_CompassHeadingReset, (uint32_t)OnAction_CompassHeadingReset); 411 setEvent(StMXTRA_CompassHeadingReset, (uint32_t)OnAction_CompassHeadingReset);
412 setEvent(StMXTRA_CompassHeadingLog, (uint32_t)OnAction_CompassHeadingLog);
390 } 413 }
391 414
392 write_buttonTextline(TXT2BYTE_ButtonBack, TXT2BYTE_ButtonEnter, TXT2BYTE_ButtonNext); 415 write_buttonTextline(TXT2BYTE_ButtonBack, TXT2BYTE_ButtonEnter, TXT2BYTE_ButtonNext);
393 } 416 }
394 417