Mercurial > public > ostc4
diff Discovery/Src/data_exchange_main.c @ 778:74253a41cf80
Zusammenf?hren
author | heinrichsweikamp |
---|---|
date | Mon, 22 May 2023 09:15:09 +0200 |
parents | 45b8f3c2acce |
children | e40790a67165 |
line wrap: on
line diff
--- a/Discovery/Src/data_exchange_main.c Mon May 22 09:14:27 2023 +0200 +++ b/Discovery/Src/data_exchange_main.c Mon May 22 09:15:09 2023 +0200 @@ -1096,11 +1096,19 @@ pStateReal->lifeData.surface_time_seconds = (int32_t)dataIn.data[dataIn.boolTimeData].surfacetime_seconds; pStateReal->lifeData.compass_heading = dataIn.data[dataIn.boolCompassData].compass_heading; - if(settingsGetPointer()->FlipDisplay) /* consider that diver is targeting into the opposite direction */ - { - pStateReal->lifeData.compass_heading -= 180.0; - if (pStateReal->lifeData.compass_heading < 0) pStateReal->lifeData.compass_heading +=360.0; - } + if (pStateReal->lifeData.compass_heading != -1) { + if (pSettings->FlipDisplay) { /* consider that diver is targeting into the opposite direction */ + pStateReal->lifeData.compass_heading -= 180.0; + } + + if (pSettings->compassDeclinationDeg != 0) { + pStateReal->lifeData.compass_heading = pStateReal->lifeData.compass_heading + pSettings->compassDeclinationDeg - 360.0; + } + + while (pStateReal->lifeData.compass_heading < 0) { + pStateReal->lifeData.compass_heading += 360.0; + } + } pStateReal->lifeData.compass_roll = dataIn.data[dataIn.boolCompassData].compass_roll; pStateReal->lifeData.compass_pitch = dataIn.data[dataIn.boolCompassData].compass_pitch;