From b11a967171e5257314ffbd690196ef1fa064fb8b Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Wed, 16 Sep 2020 13:28:11 +0100 Subject: [PATCH] Reformat the latitude and longitude values. --- DMRGateway.cpp | 8 ++------ DMRNetwork.cpp | 2 +- Version.h | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/DMRGateway.cpp b/DMRGateway.cpp index 1924a07..9b88831 100644 --- a/DMRGateway.cpp +++ b/DMRGateway.cpp @@ -2360,13 +2360,9 @@ unsigned int CDMRGateway::getConfig(const std::string& name, unsigned char* buff { assert(buffer != NULL); - char latitude[20U]; float lat = m_conf.getInfoLatitude(); - ::sprintf(latitude, "%08f", lat); - char longitude[20U]; float lon = m_conf.getInfoLongitude(); - ::sprintf(longitude, "%09f", lon); int height = m_conf.getInfoHeight(); if (height > 999) @@ -2376,9 +2372,9 @@ unsigned int CDMRGateway::getConfig(const std::string& name, unsigned char* buff std::string description = m_conf.getInfoDescription(); std::string url = m_conf.getInfoURL(); - ::sprintf((char*)buffer, "%8.8s%9.9s%9.9s%2.2s%2.2s%8.8s%9.9s%03d%-20.20s%-19.19s%c%-124.124s%40.40s%40.40s", + ::sprintf((char*)buffer, "%8.8s%9.9s%9.9s%2.2s%2.2s%+08.4f%+09.4f%03d%-20.20s%-19.19s%c%-124.124s%40.40s%40.40s", m_config + 0U, m_config + 8U, m_config + 17U, m_config + 26U, m_config + 28U, - latitude, longitude, height, location.c_str(), + lat, lon, height, location.c_str(), description.c_str(), m_config[30U], url.c_str(), m_config + 31U, m_config + 71U); m_callsign = std::string((char*)m_config + 0U, 8U); diff --git a/DMRNetwork.cpp b/DMRNetwork.cpp index 6e5e90c..f503441 100644 --- a/DMRNetwork.cpp +++ b/DMRNetwork.cpp @@ -279,7 +279,7 @@ bool CDMRNetwork::writeHomePosition(float latitude, float longitude) ::memcpy(buffer + 4U, m_id, 4U); - ::sprintf(buffer + 8U, "%08f%09f", latitude, longitude); + ::sprintf(buffer + 8U, "%+08.4f%+09.4f", latitude, longitude); return write((unsigned char*)buffer, 25U); } diff --git a/Version.h b/Version.h index 98f60b7..f564069 100644 --- a/Version.h +++ b/Version.h @@ -19,6 +19,6 @@ #if !defined(VERSION_H) #define VERSION_H -const char* VERSION = "20200909"; +const char* VERSION = "20200916"; #endif