Mercurial > public > ostc4
comparison Discovery/Src/tMenuSystem.c @ 981:c6c781a2e85b default
Merge into default
| author | heinrichsweikamp |
|---|---|
| date | Tue, 11 Feb 2025 18:12:00 +0100 |
| parents | 44599695df41 |
| children | ac25c35a3c97 |
comparison
equal
deleted
inserted
replaced
| 871:f7318457df4d | 981:c6c781a2e85b |
|---|---|
| 28 | 28 |
| 29 /* Includes ------------------------------------------------------------------*/ | 29 /* Includes ------------------------------------------------------------------*/ |
| 30 #include "tMenu.h" | 30 #include "tMenu.h" |
| 31 #include "tMenuSystem.h" | 31 #include "tMenuSystem.h" |
| 32 #include "tHome.h" // for enum CUSTOMVIEWS and init_t7_compass() | 32 #include "tHome.h" // for enum CUSTOMVIEWS and init_t7_compass() |
| 33 #include "t7.h" | |
| 33 | 34 |
| 34 static uint8_t customviewsSubpage = 0; | 35 static uint8_t customviewsSubpage = 0; |
| 35 | 36 |
| 36 /* Private function prototypes -----------------------------------------------*/ | 37 /* Private function prototypes -----------------------------------------------*/ |
| 37 char customview_TXT2BYTE_helper(uint8_t customViewId); | 38 char customview_TXT2BYTE_helper(uint8_t customViewId); |
| 46 uint32_t tMSystem_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext) | 47 uint32_t tMSystem_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext) |
| 47 { | 48 { |
| 48 SSettings *data; | 49 SSettings *data; |
| 49 int i; | 50 int i; |
| 50 uint8_t textPointer; | 51 uint8_t textPointer; |
| 51 uint8_t dateFormat; | |
| 52 uint8_t RTEhigh, RTElow; | 52 uint8_t RTEhigh, RTElow; |
| 53 RTC_DateTypeDef Sdate; | 53 RTC_DateTypeDef Sdate; |
| 54 RTC_TimeTypeDef Stime; | 54 RTC_TimeTypeDef Stime; |
| 55 const SDiveState * pStateReal = stateRealGetPointer(); | 55 const SDiveState * pStateReal = stateRealGetPointer(); |
| 56 | 56 |
| 57 data = settingsGetPointer(); | 57 data = settingsGetPointer(); |
| 58 textPointer = 0; | 58 textPointer = 0; |
| 59 *tab = 300; | 59 *tab = 300; |
| 60 *subtext = 0; | 60 *subtext = 0; |
| 61 char tmpString[15]; | |
| 61 | 62 |
| 62 resetLineMask(StMSYS); | 63 resetLineMask(StMSYS); |
| 63 | 64 |
| 64 // dive mode | 65 // dive mode |
| 65 if(actual_menu_content != MENU_SURFACE) | 66 if(actual_menu_content != MENU_SURFACE) |
| 125 if((line == 0) || (line == 1)) | 126 if((line == 0) || (line == 1)) |
| 126 { | 127 { |
| 127 translateDate(pStateReal->lifeData.dateBinaryFormat, &Sdate); | 128 translateDate(pStateReal->lifeData.dateBinaryFormat, &Sdate); |
| 128 translateTime(pStateReal->lifeData.timeBinaryFormat, &Stime); | 129 translateTime(pStateReal->lifeData.timeBinaryFormat, &Stime); |
| 129 | 130 |
| 130 dateFormat = data->date_format; | 131 text[textPointer++] = TXT_Date; |
| 131 | 132 getStringOfFormat_DDMMYY(tmpString,15); |
| 132 textPointer += snprintf(&text[textPointer], 40, | 133 textPointer += snprintf(&text[textPointer], 40,"\016\016 %s ",tmpString); |
| 133 "Date" | 134 convertStringOfDate_DDMMYY(tmpString,15,Sdate.Date, Sdate.Month, Sdate.Year); |
| 134 "\016\016" | 135 textPointer += snprintf(&text[textPointer], 40,"\017\t%s ",tmpString); |
| 135 " " | |
| 136 ); | |
| 137 | |
| 138 if(dateFormat == DDMMYY) | |
| 139 { | |
| 140 textPointer += snprintf(&text[textPointer], 40, | |
| 141 "DDMMYY" | |
| 142 "\017" | |
| 143 "\t" | |
| 144 "%02d-%02d-%02d" | |
| 145 " " | |
| 146 , Sdate.Date, Sdate.Month, 2000 + Sdate.Year | |
| 147 ); | |
| 148 } | |
| 149 else | |
| 150 if(dateFormat == MMDDYY) | |
| 151 { | |
| 152 textPointer += snprintf(&text[textPointer], 40, | |
| 153 "MMDDYY" | |
| 154 "\017" | |
| 155 "\t" | |
| 156 "%02d-%02d-%02d" | |
| 157 " " | |
| 158 ,Sdate.Month, Sdate.Date, 2000 + Sdate.Year | |
| 159 ); | |
| 160 } | |
| 161 else | |
| 162 if(dateFormat == YYMMDD) | |
| 163 { | |
| 164 textPointer += snprintf(&text[textPointer], 40, | |
| 165 "YYMMDD" | |
| 166 "\017" | |
| 167 "\t" | |
| 168 "%02d-%02d-%02d" | |
| 169 " " | |
| 170 , 2000 + Sdate.Year, Sdate.Month, Sdate.Date | |
| 171 ); | |
| 172 } | |
| 173 | 136 |
| 174 textPointer += snprintf(&text[textPointer], 60, | 137 textPointer += snprintf(&text[textPointer], 60, |
| 175 "%02d:%02d:%02d" | 138 "%02d:%02d:%02d" |
| 176 "\n\r" | 139 "\n\r" |
| 177 ,Stime.Hours, Stime.Minutes, Stime.Seconds | 140 ,Stime.Hours, Stime.Minutes, Stime.Seconds |
| 181 { | 144 { |
| 182 strcpy(&text[textPointer],"\n\r"); | 145 strcpy(&text[textPointer],"\n\r"); |
| 183 textPointer += 2; | 146 textPointer += 2; |
| 184 } | 147 } |
| 185 | 148 |
| 186 if (line == 0 || line == 2) { | 149 if (line == 0 || line == 2) |
| 187 textPointer += snprintf(&text[textPointer], 21, "%c%c\t%u:%02u \016\016[m:ss]\017\n\r", TXT_2BYTE, TXT2BYTE_Timer, data->timerDurationS / 60, data->timerDurationS % 60); | 150 { |
| 188 } else { | 151 if(t7_customview_disabled(CVIEW_Timer)) |
| 152 { | |
| 153 text[textPointer++] = '\031'; /* change text color */ | |
| 154 textPointer += snprintf(&text[textPointer], 21, "%c%c\t%u:%02u \016\016[m:ss]\017\n\r", TXT_2BYTE, TXT2BYTE_Timer, data->timerDurationS / 60, data->timerDurationS % 60); | |
| 155 disableLine(StMSYS_Timer); | |
| 156 text[textPointer++] = '\020'; /* restore text color */ | |
| 157 } | |
| 158 else | |
| 159 { | |
| 160 textPointer += snprintf(&text[textPointer], 21, "%c%c\t%u:%02u \016\016[m:ss]\017\n\r", TXT_2BYTE, TXT2BYTE_Timer, data->timerDurationS / 60, data->timerDurationS % 60); | |
| 161 } | |
| 162 } else | |
| 163 { | |
| 189 textPointer += snprintf(&text[textPointer], 3, "\n\r"); | 164 textPointer += snprintf(&text[textPointer], 3, "\n\r"); |
| 190 } | 165 } |
| 191 | 166 |
| 192 if((line == 0) || (line == 3)) | 167 if((line == 0) || (line == 3)) |
| 193 { | 168 { |
| 301 strcpy(&text[textPointer],"\n\r"); | 276 strcpy(&text[textPointer],"\n\r"); |
| 302 textPointer += 2; | 277 textPointer += 2; |
| 303 | 278 |
| 304 return StMSYS; | 279 return StMSYS; |
| 305 } | 280 } |
| 306 | 281 void tMSystem_checkLineStatus(void) |
| 282 { | |
| 283 uint8_t localLineMask = 0; | |
| 284 uint8_t lineMask = getLineMask(StMSYS); | |
| 285 | |
| 286 if(t7_customview_disabled(CVIEW_Timer)) | |
| 287 { | |
| 288 localLineMask |= 1 << 2; | |
| 289 } | |
| 290 if(lineMask != localLineMask) | |
| 291 { | |
| 292 updateMenu(); | |
| 293 } | |
| 294 } | |
| 307 | 295 |
| 308 /* Private functions ---------------------------------------------------------*/ | 296 /* Private functions ---------------------------------------------------------*/ |
