comparison Discovery/Src/tMenuEditHardware.c @ 740:5078da3845c0

Added button lock after wakeup in surface mode: During setup of diveequipment the OSTC4 is sometimes operated unintended (e.g. while equipping the jaket). To avoid this it is now possible to activate a button lock in the button lock sensitivity menu. The OSTC4 will then wakeup as usuall but if the diver wants to oerate the menus he has to press the buttons in a certain order. The button to be pressed is indicated by a blue bar. The button lock is deactivated in dive mode.
author Ideenmodellierer
date Thu, 02 Feb 2023 17:35:38 +0100
parents 190e5814b2f5
children b392524753fb
comparison
equal deleted inserted replaced
739:4a6bffaa38b3 740:5078da3845c0
65 //uint8_t OnAction_O2_Source (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 65 //uint8_t OnAction_O2_Source (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
66 uint8_t OnAction_Sensor_Info (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 66 uint8_t OnAction_Sensor_Info (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
67 uint8_t OnAction_Sensor_Detect (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 67 uint8_t OnAction_Sensor_Detect (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
68 uint8_t OnAction_Button (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 68 uint8_t OnAction_Button (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
69 uint8_t OnAction_ButtonBalance (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 69 uint8_t OnAction_ButtonBalance (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
70 uint8_t OnAction_ButtonLock (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
70 // not required uint8_t OnAction_Bluetooth (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 71 // not required uint8_t OnAction_Bluetooth (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
71 72
72 /* Exported functions --------------------------------------------------------*/ 73 /* Exported functions --------------------------------------------------------*/
73 74
74 75
870 { 871 {
871 buttonBalanceText_helper(i,text); 872 buttonBalanceText_helper(i,text);
872 write_field_button(eventListButtonBalance[i],360,500,ME_Y_LINE4-(i*ME_Y_LINE_STEP),&FontT48,text); 873 write_field_button(eventListButtonBalance[i],360,500,ME_Y_LINE4-(i*ME_Y_LINE_STEP),&FontT48,text);
873 } 874 }
874 875
876 snprintf(text,32,"%c",TXT_ButtonLock);
877 write_field_on_off(StMHARD5_ButtonLock, 30, 95, ME_Y_LINE5, &FontT48, text, settingsGetPointer()->buttonLockActive);
875 878
876 setEvent(StMHARD5_Button1, (uint32_t)OnAction_Button); 879 setEvent(StMHARD5_Button1, (uint32_t)OnAction_Button);
877 880
878 for(int i=2;i>=0;i--) 881 for(int i=2;i>=0;i--)
879 { 882 {
880 setEvent(eventListButtonBalance[i], (uint32_t)OnAction_ButtonBalance); 883 setEvent(eventListButtonBalance[i], (uint32_t)OnAction_ButtonBalance);
881 } 884 }
882 885 setEvent(StMHARD5_ButtonLock, (uint32_t)OnAction_ButtonLock);
883 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); 886 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
884 } 887 }
885 888
886 889
887 void refresh_ButtonValuesFromPIC(void) 890 void refresh_ButtonValuesFromPIC(void)
895 text[3] = 0; 898 text[3] = 0;
896 write_topline(text); 899 write_topline(text);
897 900
898 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); 901 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
899 902
900 text[0] = '\020'; // '\031';
901 text[1] = TXT_2BYTE;
902 text[2] = TXT2BYTE_LowerIsLess;
903 text[3] = 0;
904 write_label_var( 20, 780, ME_Y_LINE5, &FontT42, text);
905
906 for(int i=0;i<3;i++) 903 for(int i=0;i<3;i++)
907 { 904 {
908 text[0] = TXT_2BYTE; 905 text[0] = TXT_2BYTE;
909 text[1] = TXT2BYTE_ButtonLeft+i; 906 text[1] = TXT2BYTE_ButtonLeft+i;
910 text[2] = 0; 907 text[2] = 0;
913 910
914 for(int i=0;i<3;i++) 911 for(int i=0;i<3;i++)
915 { 912 {
916 sens[i] = settingsHelperButtonSens_translate_hwOS_values_to_percentage(stateRealGetPointer()->lifeData.buttonPICdata[i]); 913 sens[i] = settingsHelperButtonSens_translate_hwOS_values_to_percentage(stateRealGetPointer()->lifeData.buttonPICdata[i]);
917 } 914 }
918 snprintf(text,64,"(%03u %03u %03u)",sens[2],sens[1],sens[0]); 915 snprintf(text,64,"\020\016\016%c%c \017 (%03u %03u %03u)",TXT_2BYTE,TXT2BYTE_LowerIsLess,sens[2],sens[1],sens[0]);
919 write_label_var( 20, 340, ME_Y_LINE6, &FontT42, text); 916 write_label_var( 20, 340, ME_Y_LINE6, &FontT42, text);
920 917
921 tMenuEdit_refresh_field(StMHARD5_Button1); 918 tMenuEdit_refresh_field(StMHARD5_Button1);
922 tMenuEdit_refresh_field(StMHARD5_ButtonBalance1); 919 tMenuEdit_refresh_field(StMHARD5_ButtonBalance1);
923 tMenuEdit_refresh_field(StMHARD5_ButtonBalance2); 920 tMenuEdit_refresh_field(StMHARD5_ButtonBalance2);
924 tMenuEdit_refresh_field(StMHARD5_ButtonBalance3); 921 tMenuEdit_refresh_field(StMHARD5_ButtonBalance3);
922 tMenuEdit_refresh_field(StMHARD5_ButtonLock);
925 } 923 }
926 924
927 925
928 uint8_t OnAction_Button(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) 926 uint8_t OnAction_Button(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
929 { 927 {
1005 tMenuEdit_newButtonText(eventListButtonBalance[idBalance],text); 1003 tMenuEdit_newButtonText(eventListButtonBalance[idBalance],text);
1006 } 1004 }
1007 1005
1008 return UNSPECIFIC_RETURN; 1006 return UNSPECIFIC_RETURN;
1009 } 1007 }
1008
1009 uint8_t OnAction_ButtonLock(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
1010 {
1011 SSettings *pSettings = settingsGetPointer();
1012
1013 if(pSettings->buttonLockActive)
1014 {
1015 pSettings->buttonLockActive = 0;
1016 tMenuEdit_set_on_off(editId, 0);
1017 }
1018 else
1019 {
1020 pSettings->buttonLockActive = 1;
1021 tMenuEdit_set_on_off(editId, 1);
1022 }
1023
1024 return UNSPECIFIC_RETURN;
1025 }