Reformat the latitude and longitude values.

This commit is contained in:
Jonathan Naylor
2020-09-16 13:28:11 +01:00
parent 8101f4d8e6
commit b11a967171
3 changed files with 4 additions and 8 deletions

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -19,6 +19,6 @@
#if !defined(VERSION_H)
#define VERSION_H
const char* VERSION = "20200909";
const char* VERSION = "20200916";
#endif