Mercurial > public > ostc4
comparison Discovery/Src/tMenuEditSystem.c @ 387:0dbb74be972f
Merged in Ideenmodellierer/ostc4/MotionDetection (pull request #34)
MotionDetection
author | heinrichsweikamp <bitbucket@heinrichsweikamp.com> |
---|---|
date | Sun, 24 Nov 2019 15:46:58 +0000 |
parents | 427ae9f8e28e |
children | ebc2b571a0b9 |
comparison
equal
deleted
inserted
replaced
358:c6a084d1433f | 387:0dbb74be972f |
---|---|
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 "tMenu.h" | 38 #include "tMenu.h" |
39 #include "tMenuEdit.h" | 39 #include "tMenuEdit.h" |
40 #include "tMenuSystem.h" | 40 #include "tMenuSystem.h" |
41 #include "Motion.h" | |
41 #include "t7.h" | 42 #include "t7.h" |
42 | 43 |
43 /* uncomment to activate debug view option */ | 44 |
45 #define CV_SUBPAGE_MAX (2u) /* max number of customer view selection pages */ | |
44 /*#define HAVE_DEBUG_VIEW */ | 46 /*#define HAVE_DEBUG_VIEW */ |
45 | |
46 /* Private variables ---------------------------------------------------------*/ | |
47 static uint8_t infoPage = 0; | 47 static uint8_t infoPage = 0; |
48 | 48 |
49 /* Private function prototypes -----------------------------------------------*/ | 49 /* Private function prototypes -----------------------------------------------*/ |
50 void openEdit_DateTime(void); | 50 void openEdit_DateTime(void); |
51 void openEdit_Language(void); | 51 void openEdit_Language(void); |
80 uint8_t OnAction_CViewTimeout (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 80 uint8_t OnAction_CViewTimeout (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
81 uint8_t OnAction_CViewStandard (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 81 uint8_t OnAction_CViewStandard (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
82 uint8_t OnAction_CornerTimeout (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 82 uint8_t OnAction_CornerTimeout (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
83 uint8_t OnAction_CornerStandard(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 83 uint8_t OnAction_CornerStandard(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
84 uint8_t OnAction_ExtraDisplay (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 84 uint8_t OnAction_ExtraDisplay (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
85 uint8_t OnAction_MotionCtrl (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
85 | 86 |
86 uint8_t OnAction_Exit (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 87 uint8_t OnAction_Exit (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
87 uint8_t OnAction_Confirm (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 88 uint8_t OnAction_Confirm (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
88 uint8_t OnAction_RebootRTE (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 89 uint8_t OnAction_RebootRTE (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
89 uint8_t OnAction_ResetDeco (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 90 uint8_t OnAction_ResetDeco (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
152 | 153 |
153 /* Private functions ---------------------------------------------------------*/ | 154 /* Private functions ---------------------------------------------------------*/ |
154 | 155 |
155 void openEdit_CustomviewDivemode(uint8_t line) | 156 void openEdit_CustomviewDivemode(uint8_t line) |
156 { | 157 { |
158 static uint8_t customviewsSubpage = 0; | |
157 SSettings *pSettings = settingsGetPointer(); | 159 SSettings *pSettings = settingsGetPointer(); |
158 extern _Bool WriteSettings; | 160 extern _Bool WriteSettings; |
159 | 161 char text[MAX_PAGE_TEXTSIZE]; |
160 pSettings->cv_configuration ^= 1 << (cv_changelist[line-1]); | 162 uint16_t tabPosition; |
161 WriteSettings = 1; | 163 uint32_t id; |
162 exitMenuEdit_to_Menu_with_Menu_Update(); | 164 |
165 | |
166 if((line == 6) || (cv_changelist[customviewsSubpage * 5 + line-1] == CVIEW_END)) /* select next set of views */ | |
167 { | |
168 customviewsSubpage++; | |
169 if(customviewsSubpage == CV_SUBPAGE_MAX) | |
170 { | |
171 customviewsSubpage = 0; | |
172 } | |
173 set_CustomsviewsSubpage(customviewsSubpage); | |
174 /* rebuild the selection page with the next set of customer views */ | |
175 id = tMSystem_refresh(0, text, &tabPosition, NULL); | |
176 tM_build_page(id, text, tabPosition, NULL); | |
177 openMenu(0); | |
178 } | |
179 else | |
180 { | |
181 pSettings->cv_configuration ^= 1 << (cv_changelist[customviewsSubpage * 5 + line-1]); | |
182 if(t7_GetEnabled_customviews() == 0) | |
183 { | |
184 pSettings->cv_configuration ^= (1 << CVIEW_noneOrDebug); | |
185 } | |
186 WriteSettings = 1; | |
187 InitMotionDetection(); /* consider new view setup for view selection by motion */ | |
188 exitMenuEdit_to_Menu_with_Menu_Update(); | |
189 } | |
163 } | 190 } |
164 | 191 |
165 | 192 |
166 void openEdit_DateTime(void) | 193 void openEdit_DateTime(void) |
167 { | 194 { |
742 | 769 |
743 write_field_button(StMSYS4_CornerTimeout, 400, 700, ME_Y_LINE3, &FontT48, ""); | 770 write_field_button(StMSYS4_CornerTimeout, 400, 700, ME_Y_LINE3, &FontT48, ""); |
744 write_field_button(StMSYS4_CornerStandard, 400, 700, ME_Y_LINE4, &FontT48, ""); | 771 write_field_button(StMSYS4_CornerStandard, 400, 700, ME_Y_LINE4, &FontT48, ""); |
745 | 772 |
746 write_field_button(StMSYS4_ExtraDisplay, 400, 700, ME_Y_LINE5, &FontT48, ""); | 773 write_field_button(StMSYS4_ExtraDisplay, 400, 700, ME_Y_LINE5, &FontT48, ""); |
774 write_field_button(StMSYS4_MotionCtrl, 400, 700, ME_Y_LINE6, &FontT48, ""); | |
747 | 775 |
748 setEvent(StMSYS4_CViewTimeout, (uint32_t)OnAction_CViewTimeout); | 776 setEvent(StMSYS4_CViewTimeout, (uint32_t)OnAction_CViewTimeout); |
749 setEvent(StMSYS4_CViewStandard, (uint32_t)OnAction_CViewStandard); | 777 setEvent(StMSYS4_CViewStandard, (uint32_t)OnAction_CViewStandard); |
750 | 778 |
751 setEvent(StMSYS4_CornerTimeout, (uint32_t)OnAction_CornerTimeout); | 779 setEvent(StMSYS4_CornerTimeout, (uint32_t)OnAction_CornerTimeout); |
752 setEvent(StMSYS4_CornerStandard, (uint32_t)OnAction_CornerStandard); | 780 setEvent(StMSYS4_CornerStandard, (uint32_t)OnAction_CornerStandard); |
753 | 781 |
754 setEvent(StMSYS4_ExtraDisplay, (uint32_t)OnAction_ExtraDisplay); | 782 setEvent(StMSYS4_ExtraDisplay, (uint32_t)OnAction_ExtraDisplay); |
783 setEvent(StMSYS4_MotionCtrl, (uint32_t)OnAction_MotionCtrl); | |
755 } | 784 } |
756 | 785 |
757 | 786 |
758 void refresh_Customviews(void) | 787 void refresh_Customviews(void) |
759 { | 788 { |
910 snprintf(&text[4],2,"%u",settingsGetPointer()->extraDisplay); | 939 snprintf(&text[4],2,"%u",settingsGetPointer()->extraDisplay); |
911 break; | 940 break; |
912 } | 941 } |
913 text[6] = 0; | 942 text[6] = 0; |
914 write_label_var( 30, 700, ME_Y_LINE5, &FontT48, text); | 943 write_label_var( 30, 700, ME_Y_LINE5, &FontT48, text); |
944 | |
945 | |
946 /* MotionCtrl */ | |
947 text[0] = TXT_2BYTE; | |
948 text[1] = TXT2BYTE_MotionCtrl; | |
949 text[2] = ' '; | |
950 text[3] = ' '; | |
951 text[4] = TXT_2BYTE; | |
952 switch(settingsGetPointer()->MotionDetection) | |
953 { | |
954 case MOTION_DETECT_OFF: | |
955 text[5] = TXT2BYTE_MoCtrlNone; | |
956 break; | |
957 case MOTION_DETECT_MOVE: | |
958 text[5] = TXT2BYTE_MoCtrlPitch; | |
959 break; | |
960 case MOTION_DETECT_SECTOR: | |
961 text[5] = TXT2BYTE_MoCtrlSector; | |
962 break; | |
963 case MOTION_DETECT_SCROLL: | |
964 text[5] = TXT2BYTE_MoCtrlScroll; | |
965 break; | |
966 default: | |
967 snprintf(&text[4],2,"%u",settingsGetPointer()->MotionDetection); | |
968 break; | |
969 } | |
970 text[6] = 0; | |
971 write_label_var( 30, 700, ME_Y_LINE6, &FontT48, text); | |
915 | 972 |
916 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | 973 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); |
917 } | 974 } |
918 | 975 |
919 | 976 |
1048 } | 1105 } |
1049 settingsGetPointer()->extraDisplay = newValue; | 1106 settingsGetPointer()->extraDisplay = newValue; |
1050 return UNSPECIFIC_RETURN; | 1107 return UNSPECIFIC_RETURN; |
1051 } | 1108 } |
1052 | 1109 |
1110 | |
1111 uint8_t OnAction_MotionCtrl (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1112 { | |
1113 uint8_t newValue; | |
1114 switch(settingsGetPointer()->MotionDetection) | |
1115 { | |
1116 case MOTION_DETECT_OFF: | |
1117 newValue = MOTION_DETECT_MOVE; | |
1118 break; | |
1119 case MOTION_DETECT_MOVE: | |
1120 newValue = MOTION_DETECT_SECTOR; | |
1121 break; | |
1122 case MOTION_DETECT_SECTOR: | |
1123 newValue = MOTION_DETECT_SCROLL; | |
1124 break; | |
1125 case MOTION_DETECT_SCROLL: | |
1126 newValue = MOTION_DETECT_OFF; | |
1127 break; | |
1128 default: | |
1129 newValue = MOTION_DETECT_OFF; | |
1130 break; | |
1131 } | |
1132 settingsGetPointer()->MotionDetection = newValue; | |
1133 InitMotionDetection(); | |
1134 return UNSPECIFIC_RETURN; | |
1135 } | |
1053 | 1136 |
1054 void openEdit_Information(void) | 1137 void openEdit_Information(void) |
1055 { | 1138 { |
1056 char text[70]; | 1139 char text[70]; |
1057 | 1140 |