Mercurial > public > ostc4
comparison Discovery/Src/t3.c @ 838:aed39d19269c Evo_2_23
Added T3 autofocus for Gas list:
An automatic switch to the gaslist will now happen in case a better gas is available or in case the current gas is not breathable (ppo2 HIGH/LOW). From the gaslist view a new gas may be selected view quickmenu or switching to the common gas selection tab.
author | Ideenmodellierer |
---|---|
date | Fri, 05 Jan 2024 16:01:22 +0100 |
parents | 18946846b95b |
children | 70092f552f5a |
comparison
equal
deleted
inserted
replaced
837:18946846b95b | 838:aed39d19269c |
---|---|
1966 return snprintf(text, size, "%c%3i'", colour, currentTimerMinutes); | 1966 return snprintf(text, size, "%c%3i'", colour, currentTimerMinutes); |
1967 } else { | 1967 } else { |
1968 return snprintf(text, size, "%c%u\016\016%%\017", colour, currentTimerMinutes * 100 / settingsGetPointer()->scrubberData[settings->scubberActiveId].TimerMax); | 1968 return snprintf(text, size, "%c%u\016\016%%\017", colour, currentTimerMinutes * 100 / settingsGetPointer()->scrubberData[settings->scubberActiveId].TimerMax); |
1969 } | 1969 } |
1970 } | 1970 } |
1971 | |
1972 uint8_t t3_HandleAFGaslist() | |
1973 { | |
1974 static uint8_t debounce = 0; | |
1975 static uint8_t lastState = AF_VIEW_NOCHANGE; | |
1976 uint8_t detectionState = AF_VIEW_NOCHANGE; | |
1977 | |
1978 if((stateUsed->warnings.betterGas) /* switch if better gas is available or depending on ppo2 if in OC mode */ | |
1979 || ((stateUsed->diveSettings.diveMode == DIVEMODE_OC) && ((stateUsed->warnings.ppO2Low) || (stateUsed->warnings.ppO2High)))) | |
1980 { | |
1981 if(debounce < 10) | |
1982 { | |
1983 debounce++; | |
1984 } | |
1985 else | |
1986 { | |
1987 detectionState = AF_VIEW_ACTIVATED; | |
1988 } | |
1989 } | |
1990 else | |
1991 { | |
1992 if(debounce > 0) | |
1993 { | |
1994 debounce--; | |
1995 } | |
1996 else | |
1997 { | |
1998 detectionState = AF_VIEW_DEACTIVATED; | |
1999 } | |
2000 } | |
2001 if(detectionState) /* no state change => return 0 */ | |
2002 { | |
2003 if((detectionState == lastState)) | |
2004 { | |
2005 detectionState = AF_VIEW_NOCHANGE; | |
2006 } | |
2007 else | |
2008 { | |
2009 lastState = detectionState; | |
2010 } | |
2011 } | |
2012 | |
2013 return detectionState; | |
2014 } | |
2015 | |
1971 void t3_handleAutofocus(void) | 2016 void t3_handleAutofocus(void) |
1972 { | 2017 { |
1973 static uint8_t returnView = CVIEW_T3_END; | 2018 static uint8_t returnView = CVIEW_T3_END; |
1974 | 2019 |
1975 if(stateUsed->diveSettings.activeAFViews & (1 << CVIEW_T3_Navigation)) | 2020 if(stateUsed->diveSettings.activeAFViews & (1 << CVIEW_T3_Navigation)) |
1988 break; | 2033 break; |
1989 default: | 2034 default: |
1990 break; | 2035 break; |
1991 } | 2036 } |
1992 } | 2037 } |
1993 } | 2038 if(stateUsed->diveSettings.activeAFViews & (1 << CVIEW_T3_GasList)) |
2039 { | |
2040 switch(t3_HandleAFGaslist()) | |
2041 { | |
2042 case AF_VIEW_ACTIVATED: returnView = t3_selection_customview; | |
2043 t3_select_customview(CVIEW_T3_GasList); | |
2044 | |
2045 break; | |
2046 case AF_VIEW_DEACTIVATED: if((returnView != CVIEW_T3_END) && (t3_selection_customview == CVIEW_T3_GasList)) | |
2047 { | |
2048 t3_select_customview(returnView); | |
2049 returnView = CVIEW_T3_END; | |
2050 } | |
2051 break; | |
2052 default: | |
2053 break; | |
2054 } | |
2055 } | |
2056 } |