Mercurial > public > ostc4
comparison Discovery/Src/tMenuEditHardware.c @ 993:df052f0347fb GasConsumption
Add settings that have been missing in the bluetooth API:
flip display
compass declination
(mikeller)
| author | heinrichsweikamp |
|---|---|
| date | Fri, 25 Apr 2025 08:26:03 +0200 |
| parents | 57b82ae99969 |
| children | ac25c35a3c97 |
comparison
equal
deleted
inserted
replaced
| 990:d63584d6428d | 993:df052f0347fb |
|---|---|
| 32 | 32 |
| 33 #include "externCPU2bootloader.h" | 33 #include "externCPU2bootloader.h" |
| 34 #include "gfx_fonts.h" | 34 #include "gfx_fonts.h" |
| 35 #include "ostc.h" | 35 #include "ostc.h" |
| 36 #include "tCCR.h" | 36 #include "tCCR.h" |
| 37 #include "tMenuEdit.h" | |
| 38 #include "tHome.h" | |
| 39 #include "tInfo.h" | |
| 40 #include "tInfoLog.h" | |
| 41 #include "tInfoSensor.h" | |
| 42 #include "tComm.h" | 37 #include "tComm.h" |
| 43 #include "data_exchange_main.h" | 38 #include "data_exchange_main.h" |
| 44 | 39 |
| 45 | |
| 46 extern void tM_build_pages(void); | |
| 47 | 40 |
| 48 /* Private function prototypes -----------------------------------------------*/ | 41 /* Private function prototypes -----------------------------------------------*/ |
| 49 void openEdit_Bluetooth(void); | 42 void openEdit_Bluetooth(void); |
| 50 void openEdit_Compass(void); | 43 void openEdit_Compass(void); |
| 51 void openEdit_O2Sensors(void); | 44 void openEdit_O2Sensors(void); |
| 133 | 126 |
| 134 void openEdit_FlipDisplay(void) | 127 void openEdit_FlipDisplay(void) |
| 135 { | 128 { |
| 136 /* does not work like this resetEnterPressedToStateBeforeButtonAction(); */ | 129 /* does not work like this resetEnterPressedToStateBeforeButtonAction(); */ |
| 137 | 130 |
| 138 SSettings *pSettings = settingsGetPointer(); | 131 bool oldValue = settingsGetPointer()->FlipDisplay; |
| 139 | 132 |
| 140 if(pSettings->FlipDisplay == 0) | 133 setFlipDisplay(!oldValue); |
| 141 { | |
| 142 pSettings->FlipDisplay = 1; | |
| 143 } | |
| 144 else | |
| 145 { | |
| 146 pSettings->FlipDisplay = 0; | |
| 147 } | |
| 148 /* reinit all views */ | |
| 149 tHome_init(); | |
| 150 tI_init(); | |
| 151 tM_init(); | |
| 152 tMenuEdit_init(); | |
| 153 tInfoLog_init(); | |
| 154 tM_build_pages(); | |
| 155 GFX_build_logo_frame(); | |
| 156 GFX_build_hw_background_frame(); | |
| 157 | 134 |
| 158 exitEditWithUpdate(); | 135 exitEditWithUpdate(); |
| 159 exitMenuEdit_to_Home(); | 136 exitMenuEdit_to_Home(); |
| 160 } | 137 } |
| 161 | 138 |
| 170 case ACTION_BUTTON_ENTER_FINAL: | 147 case ACTION_BUTTON_ENTER_FINAL: |
| 171 { | 148 { |
| 172 int32_t compassDeclinationDeg; | 149 int32_t compassDeclinationDeg; |
| 173 evaluateNewString(editId, (uint32_t *)&compassDeclinationDeg, NULL, NULL, NULL); | 150 evaluateNewString(editId, (uint32_t *)&compassDeclinationDeg, NULL, NULL, NULL); |
| 174 | 151 |
| 175 if (compassDeclinationDeg > 99) { | 152 if (compassDeclinationDeg > MAX_COMPASS_DECLINATION_DEG) { |
| 176 compassDeclinationDeg = 99; | 153 compassDeclinationDeg = MAX_COMPASS_DECLINATION_DEG; |
| 177 } else if (compassDeclinationDeg < -99) { | 154 } else if (compassDeclinationDeg < -MAX_COMPASS_DECLINATION_DEG) { |
| 178 compassDeclinationDeg = -99; | 155 compassDeclinationDeg = -MAX_COMPASS_DECLINATION_DEG; |
| 179 } | 156 } |
| 180 | 157 |
| 181 settings->compassDeclinationDeg = compassDeclinationDeg; | 158 settings->compassDeclinationDeg = compassDeclinationDeg; |
| 182 | 159 |
| 183 tMenuEdit_newInput(editId, ((input_u)compassDeclinationDeg).uint32, 0, 0, 0); | 160 tMenuEdit_newInput(editId, ((input_u)compassDeclinationDeg).uint32, 0, 0, 0); |
