Mercurial > public > ostc4
changeset 709:c799151670d5
Bugfix compass bearing:
In previous version an invalid value was set in case the bearing was set without compass calibration. Rootcause was that the bearing -1 is received in case the compase is not calibrated. This has been fixed by setting bearing to 0 (360) in that case.
author | Ideenmodellierer |
---|---|
date | Tue, 08 Nov 2022 21:13:14 +0100 |
parents | 7e3bf2c0cd40 |
children | 8adf9b8fc7fa |
files | Discovery/Src/tMenuEditHardware.c |
diffstat | 1 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/Discovery/Src/tMenuEditHardware.c Thu Nov 03 20:44:51 2022 +0100 +++ b/Discovery/Src/tMenuEditHardware.c Tue Nov 08 21:13:14 2022 +0100 @@ -241,7 +241,15 @@ uint8_t OnAction_Bearing (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) { - settingsGetPointer()->compassBearing = (int16_t)stateUsed->lifeData.compass_heading; + if((int16_t)stateUsed->lifeData.compass_heading != -1) + { + settingsGetPointer()->compassBearing = (int16_t)stateUsed->lifeData.compass_heading; + } + else + { + settingsGetPointer()->compassBearing = 0; + } + if(settingsGetPointer()->compassBearing == 0) settingsGetPointer()->compassBearing = 360; return UPDATE_AND_EXIT_TO_MENU;