comparison Discovery/Src/tMenuEditHardware.c @ 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 b9f699d2e3d0
comparison
equal deleted inserted replaced
708:7e3bf2c0cd40 709:c799151670d5
239 } 239 }
240 240
241 241
242 uint8_t OnAction_Bearing (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) 242 uint8_t OnAction_Bearing (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
243 { 243 {
244 settingsGetPointer()->compassBearing = (int16_t)stateUsed->lifeData.compass_heading; 244 if((int16_t)stateUsed->lifeData.compass_heading != -1)
245 {
246 settingsGetPointer()->compassBearing = (int16_t)stateUsed->lifeData.compass_heading;
247 }
248 else
249 {
250 settingsGetPointer()->compassBearing = 0;
251 }
252
245 if(settingsGetPointer()->compassBearing == 0) 253 if(settingsGetPointer()->compassBearing == 0)
246 settingsGetPointer()->compassBearing = 360; 254 settingsGetPointer()->compassBearing = 360;
247 return UPDATE_AND_EXIT_TO_MENU; 255 return UPDATE_AND_EXIT_TO_MENU;
248 } 256 }
249 257