From 7d679e01f0da1d9bca23e46b6624c986f9e79d9c Mon Sep 17 00:00:00 2001 From: FredericG Date: Sun, 27 Feb 2011 19:58:34 +0000 Subject: [PATCH] ET-174 Adapted ET OSD Drv to current GPS coordinate format git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2910 ebee16cc-31ac-478f-84a7-5cbb03baadba --- flight/Modules/Osd/OsdEtStd/OsdEtStd.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/flight/Modules/Osd/OsdEtStd/OsdEtStd.c b/flight/Modules/Osd/OsdEtStd/OsdEtStd.c index 674dd537b..b3d094c67 100644 --- a/flight/Modules/Osd/OsdEtStd/OsdEtStd.c +++ b/flight/Modules/Osd/OsdEtStd/OsdEtStd.c @@ -149,13 +149,16 @@ static void WriteToMsg32(uint8_t index, uint32_t value) WriteToMsg16(index + 2, value / 10000); } -static void SetCoord(uint8_t index, float coord) +static void SetCoord(uint8_t index, uint32_t coord) { - uint32_t deg = (uint32_t) coord; - float sec = (coord - deg) * 60; - WriteToMsg24(index, sec * 10000); +#define E7 10000000 + uint8_t deg = coord / E7; + float sec = (float)(coord - deg*E7) / ((float)E7/(60.0*10000)); + WriteToMsg8(index + 3, deg); + WriteToMsg24(index, sec); + } static void SetCourse(uint16_t dir)