Mercurial > public > ostc4
comparison Discovery/Src/tMenuEditGasOC.c @ 344:3f09b283d993 FlightMode_Improvment
Removed not used wireless menu items
The support for wireless interface was removed some time ago. Menu structure was still present and is now also removed to get rid of dead code
author | ideenmodellierer |
---|---|
date | Tue, 01 Oct 2019 19:58:58 +0200 |
parents | ba229a012ac7 |
children | a9c195be907e |
comparison
equal
deleted
inserted
replaced
343:c9d217b110cc | 344:3f09b283d993 |
---|---|
42 uint8_t mod; | 42 uint8_t mod; |
43 uint8_t ccr; | 43 uint8_t ccr; |
44 uint8_t setpoint; | 44 uint8_t setpoint; |
45 } SEditGasPage; | 45 } SEditGasPage; |
46 | 46 |
47 #define MAX_SENDER_AT_ONCE 5 | |
48 | 47 |
49 /* Private variables ---------------------------------------------------------*/ | 48 /* Private variables ---------------------------------------------------------*/ |
50 SEditGasPage editGasPage; | 49 SEditGasPage editGasPage; |
51 | 50 |
52 uint16_t wirelessSender[MAX_SENDER_AT_ONCE]; | |
53 | |
54 /* Private function prototypes -----------------------------------------------*/ | 51 /* Private function prototypes -----------------------------------------------*/ |
55 void create_text_with_u8(char *text, const char *text1, uint8_t inputU8, const char *text2); | 52 void create_text_with_u8(char *text, const char *text1, uint8_t inputU8, const char *text2); |
56 | 53 |
57 void openEdit_Gas(uint8_t line, uint8_t ccr); | 54 void openEdit_Gas(uint8_t line, uint8_t ccr); |
58 void openEdit_GasType(void); | 55 void openEdit_GasType(void); |
59 void openEdit_Wireless(void); | |
60 | 56 |
61 void openEdit_DiveGasSelect(uint8_t line, uint8_t ccr); | 57 void openEdit_DiveGasSelect(uint8_t line, uint8_t ccr); |
62 void openEdit_SpecialDiveGasMenu(uint8_t ccr); | 58 void openEdit_SpecialDiveGasMenu(uint8_t ccr); |
63 void openEdit_DiveGasSelect_Subroutine(uint8_t line, uint8_t ccr); | 59 void openEdit_DiveGasSelect_Subroutine(uint8_t line, uint8_t ccr); |
64 | 60 |
68 uint8_t OnAction_Mix (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 64 uint8_t OnAction_Mix (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
69 uint8_t OnAction_GasType (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 65 uint8_t OnAction_GasType (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
70 uint8_t OnAction_ChangeDepth (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 66 uint8_t OnAction_ChangeDepth (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
71 uint8_t OnAction_SetToMOD (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 67 uint8_t OnAction_SetToMOD (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
72 uint8_t OnAction_BottleSize (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 68 uint8_t OnAction_BottleSize (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
73 uint8_t OnAction_Wireless (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
74 | 69 |
75 uint8_t OnAction_First (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 70 uint8_t OnAction_First (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
76 uint8_t OnAction_Deco (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 71 uint8_t OnAction_Deco (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
77 uint8_t OnAction_Travel (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 72 uint8_t OnAction_Travel (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
78 uint8_t OnAction_Inactive (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 73 uint8_t OnAction_Inactive (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
79 | |
80 uint8_t OnAction_WirelessID (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
81 uint8_t OnAction_NoWireless (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
82 | 74 |
83 uint8_t OnAction_DM_Active (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 75 uint8_t OnAction_DM_Active (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
84 uint8_t OnAction_DM_Mix (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 76 uint8_t OnAction_DM_Mix (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
85 | 77 |
86 /* | 78 /* |
342 | 334 |
343 | 335 |
344 /* surface mode */ | 336 /* surface mode */ |
345 void openEdit_Gas(uint8_t line, uint8_t ccr) | 337 void openEdit_Gas(uint8_t line, uint8_t ccr) |
346 { | 338 { |
347 uint8_t gasID, oxygen, helium, depthDeco, active, first, depthMOD, deco, travel, inactive;//, bottleSizeLiter;, bottleWirelessStatus; | 339 uint8_t gasID, oxygen, helium, depthDeco, active, first, depthMOD, deco, travel, inactive;//, bottleSizeLiter; |
348 //uint16_t bottleWirelessId;//, bottleWirelessIdSmall; | |
349 | 340 |
350 char text[32]; | 341 char text[32]; |
351 char textMOD[32]; | 342 char textMOD[32]; |
352 uint8_t txtptr; | 343 uint8_t txtptr; |
353 | 344 |
383 first = editGasPage.pGasLine[gasID].note.ub.first; | 374 first = editGasPage.pGasLine[gasID].note.ub.first; |
384 deco = editGasPage.pGasLine[gasID].note.ub.deco; | 375 deco = editGasPage.pGasLine[gasID].note.ub.deco; |
385 travel = editGasPage.pGasLine[gasID].note.ub.travel; | 376 travel = editGasPage.pGasLine[gasID].note.ub.travel; |
386 | 377 |
387 //bottleSizeLiter = editGasPage.pGasLine[gasID].bottle_size_liter; | 378 //bottleSizeLiter = editGasPage.pGasLine[gasID].bottle_size_liter; |
388 // bottleWirelessStatus = editGasPage.pGasLine[gasID].bottle_wireless_status; | |
389 //bottleWirelessId = editGasPage.pGasLine[gasID].bottle_wireless_id; | |
390 //bottleWirelessIdSmall = bottleWirelessId & 0x0F; | |
391 | 379 |
392 if(active) | 380 if(active) |
393 inactive = 0; | 381 inactive = 0; |
394 else | 382 else |
395 inactive = 1; | 383 inactive = 1; |
485 text[txtptr++] = TXT2BYTE_Bottle; | 473 text[txtptr++] = TXT2BYTE_Bottle; |
486 text[txtptr++] = 0; | 474 text[txtptr++] = 0; |
487 write_label_var( 20 ,800, ME_Y_LINE5, &FontT48, text); | 475 write_label_var( 20 ,800, ME_Y_LINE5, &FontT48, text); |
488 write_field_2digit(StMOG_Bottle, 600, 710, ME_Y_LINE5, &FontT48,"## ltr", (uint32_t)bottleSizeLiter, 0, 0, 0); | 476 write_field_2digit(StMOG_Bottle, 600, 710, ME_Y_LINE5, &FontT48,"## ltr", (uint32_t)bottleSizeLiter, 0, 0, 0); |
489 | 477 |
490 txtptr = 0; | |
491 text[txtptr++] = TXT_2BYTE; | |
492 text[txtptr++] = TXT2BYTE_WirelessSender; | |
493 text[txtptr++] = ' '; | |
494 if(!bottleWirelessId) | |
495 text[txtptr++] = '\021'; | |
496 txtptr += snprintf(&text[txtptr],20,"%u (%04X)",bottleWirelessIdSmall, bottleWirelessId); | |
497 write_field_button(StMOG_Wireless, 20, 710, ME_Y_LINE6, &FontT48, text); | |
498 */ | 478 */ |
499 stop_cursor_fields(); | 479 stop_cursor_fields(); |
500 | 480 |
501 textMOD[0] = '#'; | 481 textMOD[0] = '#'; |
502 textMOD[1] = '#'; | 482 textMOD[1] = '#'; |
520 setEvent(StMOG_ChangeDepth, (uint32_t)OnAction_ChangeDepth); | 500 setEvent(StMOG_ChangeDepth, (uint32_t)OnAction_ChangeDepth); |
521 setEvent(StMOG_SetToMOD, (uint32_t)OnAction_SetToMOD); | 501 setEvent(StMOG_SetToMOD, (uint32_t)OnAction_SetToMOD); |
522 } | 502 } |
523 /* | 503 /* |
524 setEvent(StMOG_Bottle, (uint32_t)OnAction_BottleSize); | 504 setEvent(StMOG_Bottle, (uint32_t)OnAction_BottleSize); |
525 setEvent(StMOG_Wireless, (uint32_t)OnAction_Wireless); | |
526 */ | 505 */ |
527 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | 506 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); |
528 } | 507 } |
529 } | 508 } |
530 | 509 |
603 uint8_t OnAction_GasType(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | 582 uint8_t OnAction_GasType(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
604 { | 583 { |
605 openEdit_GasType(); | 584 openEdit_GasType(); |
606 return UNSPECIFIC_RETURN; | 585 return UNSPECIFIC_RETURN; |
607 } | 586 } |
608 | |
609 void openEdit_Wireless(void) | |
610 { | |
611 uint8_t gasID, wirelessSenderAvailable, isNotMatched, isMatchedWithThis, wirelessSenderActive[MAX_SENDER_AT_ONCE], senderCount, isInList; //, wirelessStatus; | |
612 uint16_t wirelessId, wirelessSenderIdSmall, wirelessIdTemp; | |
613 char text[32]; | |
614 uint8_t txtptr; | |
615 | |
616 if(editGasPage.ccr) | |
617 { | |
618 resetMenuEdit(CLUT_MenuPageGasCC); | |
619 setBackMenu((uint32_t)openEdit_GasCC, editGasPage.gasID - NUM_OFFSET_DILUENT, 5); | |
620 } | |
621 else | |
622 { | |
623 resetMenuEdit(CLUT_MenuPageGasOC); | |
624 setBackMenu((uint32_t)openEdit_GasOC, editGasPage.gasID, 5); | |
625 } | |
626 | |
627 gasID = editGasPage.gasID; | |
628 wirelessId = editGasPage.pGasLine[gasID].bottle_wireless_id; | |
629 // wirelessStatus = editGasPage.pGasLine[gasID].bottle_wireless_status; | |
630 | |
631 | |
632 /* header */ | |
633 int i = 0; | |
634 if(gasID >= 10) | |
635 { | |
636 i = 1; | |
637 strcpy(text, "\001" "Gas #10 X"); | |
638 } | |
639 else | |
640 strcpy(text, "\001" "Gas #0 X"); | |
641 | |
642 if(editGasPage.ccr) | |
643 text[8+i] = TXT_Diluent_Gas_Edit; | |
644 else | |
645 text[8+i] = TXT_OC_Gas_Edit; | |
646 | |
647 if(gasID >= 10) | |
648 text[6+i] += gasID - 10; | |
649 else | |
650 text[6+i] += gasID; | |
651 write_topline(text); | |
652 | |
653 senderCount = 0; | |
654 wirelessSenderAvailable = 0; | |
655 if(wirelessId) | |
656 { | |
657 wirelessSender[senderCount] = wirelessId; | |
658 wirelessSenderActive[senderCount] = 0; | |
659 wirelessSenderAvailable++; | |
660 senderCount++; | |
661 } | |
662 | |
663 for(int i=0;i<4;i++) | |
664 { | |
665 if((stateUsed->lifeData.wireless_data[i].ageInMilliSeconds) && (stateUsed->lifeData.wireless_data[i].ageInMilliSeconds <= 60000) && ((stateUsed->lifeData.wireless_data[i].data[1] & 0x0F) != 0)) | |
666 { | |
667 wirelessIdTemp = stateUsed->lifeData.wireless_data[i].data[0] * 256; | |
668 wirelessIdTemp += stateUsed->lifeData.wireless_data[i].data[1]; | |
669 if(wirelessId && (wirelessId == wirelessIdTemp)) | |
670 wirelessSenderActive[0] = 1; | |
671 else | |
672 { | |
673 isInList = 0; | |
674 for(int j=0;j<wirelessSenderAvailable;j++) | |
675 { | |
676 if(wirelessSender[j] == wirelessIdTemp) | |
677 { | |
678 isInList = 1; | |
679 break; | |
680 } | |
681 } | |
682 if(!isInList) | |
683 { | |
684 wirelessSender[senderCount] = wirelessIdTemp; | |
685 wirelessSenderActive[senderCount] = 1; | |
686 wirelessSenderAvailable++; | |
687 senderCount++; | |
688 } | |
689 } | |
690 } | |
691 } | |
692 | |
693 if(wirelessSenderAvailable > MAX_SENDER_AT_ONCE) | |
694 wirelessSenderAvailable = MAX_SENDER_AT_ONCE; | |
695 | |
696 isNotMatched = 1; | |
697 | |
698 for(int i=0;i<wirelessSenderAvailable;i++) | |
699 { | |
700 wirelessSenderIdSmall = wirelessSender[i] & 0x0F; | |
701 | |
702 txtptr = 0; | |
703 if(!wirelessSenderActive[i]) | |
704 text[txtptr++] = '\021'; | |
705 txtptr += snprintf(&text[txtptr],10,"%u (%04X)",wirelessSenderIdSmall, wirelessSender[i]); | |
706 | |
707 if(wirelessId == wirelessSender[i]) | |
708 { | |
709 isMatchedWithThis = 1; | |
710 isNotMatched = 0; | |
711 } | |
712 else | |
713 { | |
714 isMatchedWithThis = 0; | |
715 for(int j=1; j <= 2*NUM_GASES; j++) | |
716 { | |
717 if((gasID != j) && (settingsGetPointer()->gas[j].bottle_wireless_id == wirelessSender[i])) | |
718 { | |
719 txtptr += snprintf(&text[txtptr],20," used by Gas #%i",i); | |
720 break; | |
721 } | |
722 } | |
723 } | |
724 write_field_on_off(StMOG_Transmitter1 + i, 30, 710, ME_Y_LINE1 + (i * ME_Y_LINE_STEP), &FontT48, text, isMatchedWithThis); | |
725 } | |
726 | |
727 | |
728 txtptr = 0; | |
729 text[txtptr++] = TXT_2BYTE; | |
730 text[txtptr++] = TXT2BYTE_WirelessDisconnect; | |
731 text[txtptr++] = 0; | |
732 write_field_on_off(StMOG_NoTransmitter, 30, 400, ME_Y_LINE6, &FontT48, text, isNotMatched); | |
733 | |
734 // setEvent has to be _after_ all fields are written | |
735 for(int i=0;i<wirelessSenderAvailable;i++) | |
736 setEvent(StMOG_Transmitter1 + i, (uint32_t)OnAction_WirelessID); | |
737 | |
738 setEvent(StMOG_NoTransmitter, (uint32_t)OnAction_NoWireless); | |
739 } | |
740 | |
741 | |
742 uint8_t OnAction_Wireless(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
743 { | |
744 openEdit_Wireless(); | |
745 return UNSPECIFIC_RETURN; | |
746 } | |
747 | |
748 | |
749 uint8_t OnAction_WirelessID (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
750 { | |
751 if((editId < StMOG_Transmitter1) || (editId > StMOG_Transmitter5)) | |
752 return UNSPECIFIC_RETURN; | |
753 | |
754 uint8_t line, isMatched; | |
755 | |
756 line = editId - StMOG_Transmitter1; | |
757 | |
758 | |
759 if(editGasPage.pGasLine[editGasPage.gasID].bottle_wireless_id == wirelessSender[line]) | |
760 isMatched = 1; | |
761 else | |
762 isMatched = 0; | |
763 | |
764 editGasPage.pGasLine[editGasPage.gasID].bottle_wireless_id = wirelessSender[line]; | |
765 // editGasPage.pGasLine[editGasPage.gasID].bottle_wireless_status = 0; | |
766 | |
767 for(int i=0;i<5;i++) | |
768 { | |
769 if((StMOG_Transmitter1 + i) != editId) | |
770 tMenuEdit_set_on_off(StMOG_Transmitter1 + i, 0); | |
771 } | |
772 tMenuEdit_set_on_off(editId, 1); | |
773 tMenuEdit_set_on_off(StMOG_NoTransmitter, 0); | |
774 | |
775 if(!isMatched) | |
776 return UPDATE_DIVESETTINGS; | |
777 else | |
778 return UPDATE_AND_EXIT_TO_MENU; | |
779 } | |
780 | |
781 | |
782 uint8_t OnAction_NoWireless (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
783 { | |
784 uint8_t isNotMatched; | |
785 | |
786 if(editGasPage.pGasLine[editGasPage.gasID].bottle_wireless_id == 0) | |
787 isNotMatched = 1; | |
788 else | |
789 isNotMatched = 1; | |
790 | |
791 editGasPage.pGasLine[editGasPage.gasID].bottle_wireless_id = 0; | |
792 // editGasPage.pGasLine[editGasPage.gasID].bottle_wireless_status = 0; | |
793 | |
794 tMenuEdit_set_on_off(StMOG_Transmitter1, 0); | |
795 tMenuEdit_set_on_off(StMOG_Transmitter2, 0); | |
796 tMenuEdit_set_on_off(StMOG_Transmitter3, 0); | |
797 tMenuEdit_set_on_off(StMOG_Transmitter4, 0); | |
798 tMenuEdit_set_on_off(StMOG_Transmitter5, 0); | |
799 tMenuEdit_set_on_off(StMOG_NoTransmitter, 1); | |
800 | |
801 if(!isNotMatched) | |
802 return UPDATE_DIVESETTINGS; | |
803 else | |
804 return UPDATE_AND_EXIT_TO_MENU; | |
805 } | |
806 | |
807 | 587 |
808 uint8_t OnAction_Mix(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | 588 uint8_t OnAction_Mix(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
809 { | 589 { |
810 uint8_t digitContentNew; | 590 uint8_t digitContentNew; |
811 uint32_t newOxygen, newHelium; | 591 uint32_t newOxygen, newHelium; |