comparison Discovery/Src/tMenuEditSystem.c @ 368:50ea68c7a153 MotionDetection

Added menu item for motion detection. There are several possibility to use motion detection for user action input. To select of the a new menu entry has been added to the Sys2 =>Custom View Menu (Variables in german)
author ideenmodellierer
date Tue, 13 Aug 2019 21:10:46 +0200
parents 26c874cdde0d
children 7b981f8bdd41
comparison
equal deleted inserted replaced
367:e309f78f89a5 368:50ea68c7a153
34 #include "gfx_fonts.h" 34 #include "gfx_fonts.h"
35 #include "ostc.h" 35 #include "ostc.h"
36 #include "settings.h" // for getLicence() 36 #include "settings.h" // for getLicence()
37 #include "tHome.h" // for enum CUSTOMVIEWS and init_t7_compass() 37 #include "tHome.h" // for enum CUSTOMVIEWS and init_t7_compass()
38 #include "tMenuEdit.h" 38 #include "tMenuEdit.h"
39 #include "Motion.h"
39 40
40 /* Private variables ---------------------------------------------------------*/ 41 /* Private variables ---------------------------------------------------------*/
41
42 uint8_t infoPage = 0; 42 uint8_t infoPage = 0;
43 43
44 /* Private function prototypes -----------------------------------------------*/ 44 /* Private function prototypes -----------------------------------------------*/
45 void openEdit_DateTime(void); 45 void openEdit_DateTime(void);
46 void openEdit_Language(void); 46 void openEdit_Language(void);
75 uint8_t OnAction_CViewTimeout (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 75 uint8_t OnAction_CViewTimeout (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
76 uint8_t OnAction_CViewStandard (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 76 uint8_t OnAction_CViewStandard (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
77 uint8_t OnAction_CornerTimeout (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 77 uint8_t OnAction_CornerTimeout (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
78 uint8_t OnAction_CornerStandard(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 78 uint8_t OnAction_CornerStandard(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
79 uint8_t OnAction_ExtraDisplay (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 79 uint8_t OnAction_ExtraDisplay (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
80 uint8_t OnAction_MotionCtrl (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
80 81
81 uint8_t OnAction_Exit (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 82 uint8_t OnAction_Exit (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
82 uint8_t OnAction_Confirm (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 83 uint8_t OnAction_Confirm (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
83 uint8_t OnAction_RebootRTE (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 84 uint8_t OnAction_RebootRTE (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
84 uint8_t OnAction_ResetDeco (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 85 uint8_t OnAction_ResetDeco (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
730 731
731 write_field_button(StMSYS4_CViewTimeout, 400, 700, ME_Y_LINE1, &FontT48, ""); 732 write_field_button(StMSYS4_CViewTimeout, 400, 700, ME_Y_LINE1, &FontT48, "");
732 write_field_button(StMSYS4_CViewStandard, 400, 700, ME_Y_LINE2, &FontT48, ""); 733 write_field_button(StMSYS4_CViewStandard, 400, 700, ME_Y_LINE2, &FontT48, "");
733 734
734 write_field_button(StMSYS4_CornerTimeout, 400, 700, ME_Y_LINE3, &FontT48, ""); 735 write_field_button(StMSYS4_CornerTimeout, 400, 700, ME_Y_LINE3, &FontT48, "");
735 write_field_button(StMSYS4_CornerStandard, 400, 700, ME_Y_LINE4, &FontT48, ""); 736 write_field_button(StMSYS4_CornerStandard, 400, 700, ME_Y_LINE4, &FontT48, "");
736 737
737 write_field_button(StMSYS4_ExtraDisplay, 400, 700, ME_Y_LINE5, &FontT48, ""); 738 write_field_button(StMSYS4_ExtraDisplay, 400, 700, ME_Y_LINE5, &FontT48, "");
739 write_field_button(StMSYS4_MotionCtrl, 400, 700, ME_Y_LINE6, &FontT48, "");
738 740
739 setEvent(StMSYS4_CViewTimeout, (uint32_t)OnAction_CViewTimeout); 741 setEvent(StMSYS4_CViewTimeout, (uint32_t)OnAction_CViewTimeout);
740 setEvent(StMSYS4_CViewStandard, (uint32_t)OnAction_CViewStandard); 742 setEvent(StMSYS4_CViewStandard, (uint32_t)OnAction_CViewStandard);
741 743
742 setEvent(StMSYS4_CornerTimeout, (uint32_t)OnAction_CornerTimeout); 744 setEvent(StMSYS4_CornerTimeout, (uint32_t)OnAction_CornerTimeout);
743 setEvent(StMSYS4_CornerStandard, (uint32_t)OnAction_CornerStandard); 745 setEvent(StMSYS4_CornerStandard, (uint32_t)OnAction_CornerStandard);
744 746
745 setEvent(StMSYS4_ExtraDisplay, (uint32_t)OnAction_ExtraDisplay); 747 setEvent(StMSYS4_ExtraDisplay, (uint32_t)OnAction_ExtraDisplay);
748 setEvent(StMSYS4_MotionCtrl, (uint32_t)OnAction_MotionCtrl);
746 } 749 }
747 750
748 751
749 void refresh_Customviews(void) 752 void refresh_Customviews(void)
750 { 753 {
901 snprintf(&text[4],2,"%u",settingsGetPointer()->extraDisplay); 904 snprintf(&text[4],2,"%u",settingsGetPointer()->extraDisplay);
902 break; 905 break;
903 } 906 }
904 text[6] = 0; 907 text[6] = 0;
905 write_label_var( 30, 700, ME_Y_LINE5, &FontT48, text); 908 write_label_var( 30, 700, ME_Y_LINE5, &FontT48, text);
909
910
911 /* MotionCtrl */
912 text[0] = TXT_2BYTE;
913 text[1] = TXT2BYTE_MotionCtrl;
914 text[2] = ' ';
915 text[3] = ' ';
916 text[4] = TXT_2BYTE;
917 switch(settingsGetPointer()->MotionDetection)
918 {
919 case MOTION_DETECT_OFF:
920 text[5] = TXT2BYTE_MoCtrlNone;
921 break;
922 case MOTION_DETECT_MOVE:
923 text[5] = TXT2BYTE_MoCtrlPitch;
924 break;
925 case MOTION_DETECT_SECTOR:
926 text[5] = TXT2BYTE_MoCtrlSector;
927 break;
928 default:
929 snprintf(&text[4],2,"%u",settingsGetPointer()->MotionDetection);
930 break;
931 }
932 text[6] = 0;
933 write_label_var( 30, 700, ME_Y_LINE6, &FontT48, text);
906 934
907 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); 935 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
908 } 936 }
909 937
910 938
1039 } 1067 }
1040 settingsGetPointer()->extraDisplay = newValue; 1068 settingsGetPointer()->extraDisplay = newValue;
1041 return UNSPECIFIC_RETURN; 1069 return UNSPECIFIC_RETURN;
1042 } 1070 }
1043 1071
1072
1073 uint8_t OnAction_MotionCtrl (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
1074 {
1075 uint8_t newValue;
1076 switch(settingsGetPointer()->MotionDetection)
1077 {
1078 case 0:
1079 newValue = 1;
1080 break;
1081 case 1:
1082 newValue = 2;
1083 break;
1084 case 2:
1085 newValue = 0;
1086 break;
1087 default:
1088 newValue = 0;
1089 break;
1090 }
1091 settingsGetPointer()->MotionDetection = newValue;
1092 return UNSPECIFIC_RETURN;
1093 }
1044 1094
1045 void openEdit_Information(void) 1095 void openEdit_Information(void)
1046 { 1096 {
1047 char text[70]; 1097 char text[70];
1048 1098