From fdbf97b1c605a2a477e5d163f09559bc8a0ccbcd Mon Sep 17 00:00:00 2001 From: Tony Corbett G0WFV Date: Sat, 2 Jul 2016 22:56:22 +0100 Subject: [PATCH 1/4] Fix DMR unable to log into master due to locale issues When system locale used commas as decimal points, writeConfig() was sending an invalid config string to the master. --- DMRIPSC.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/DMRIPSC.cpp b/DMRIPSC.cpp index 4bad24b..db72784 100644 --- a/DMRIPSC.cpp +++ b/DMRIPSC.cpp @@ -466,6 +466,7 @@ bool CDMRIPSC::writeConfig() ::memcpy(buffer + 0U, "RPTC", 4U); ::memcpy(buffer + 4U, m_id, 4U); + setlocale(LC_ALL,"C"); ::sprintf(buffer + 8U, "%-8.8s%09u%09u%02u%02u%08f%09f%03d%-20.20s%-19.19s%c%-124.124s%-40.40s%-40.40s", m_callsign.c_str(), m_rxFrequency, m_txFrequency, m_power, m_colorCode, m_latitude, m_longitude, m_height, m_location.c_str(), m_description.c_str(), slots, m_url.c_str(), m_version, software); From c97f9d4801b4c4363a6f73d478af575dd40ef9b8 Mon Sep 17 00:00:00 2001 From: Tony Corbett Date: Sat, 2 Jul 2016 23:48:00 +0100 Subject: [PATCH 2/4] Fix date/time formats broken with login fix --- DMRIPSC.cpp | 2 +- HD44780.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DMRIPSC.cpp b/DMRIPSC.cpp index db72784..eddf37c 100644 --- a/DMRIPSC.cpp +++ b/DMRIPSC.cpp @@ -466,7 +466,7 @@ bool CDMRIPSC::writeConfig() ::memcpy(buffer + 0U, "RPTC", 4U); ::memcpy(buffer + 4U, m_id, 4U); - setlocale(LC_ALL,"C"); +// setlocale(LC_ALL,"C"); ::sprintf(buffer + 8U, "%-8.8s%09u%09u%02u%02u%08f%09f%03d%-20.20s%-19.19s%c%-124.124s%-40.40s%-40.40s", m_callsign.c_str(), m_rxFrequency, m_txFrequency, m_power, m_colorCode, m_latitude, m_longitude, m_height, m_location.c_str(), m_description.c_str(), slots, m_url.c_str(), m_version, software); diff --git a/HD44780.cpp b/HD44780.cpp index c900b33..23f44c4 100644 --- a/HD44780.cpp +++ b/HD44780.cpp @@ -752,7 +752,7 @@ void CHD44780::clockInt(unsigned int ms) Time = localtime(¤tTime); } - setlocale(LC_ALL,""); + setlocale(LC_TIME,""); strftime(m_buffer1, 128, "%X", Time); // Time strftime(m_buffer2, 128, "%x", Time); // Date From c0bb3cdc205bb09f3d5bc1adfeed7c7f0d295b99 Mon Sep 17 00:00:00 2001 From: Tony Corbett Date: Sat, 2 Jul 2016 23:50:33 +0100 Subject: [PATCH 3/4] Remove code no longer needed after applying fixes --- DMRIPSC.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/DMRIPSC.cpp b/DMRIPSC.cpp index eddf37c..4bad24b 100644 --- a/DMRIPSC.cpp +++ b/DMRIPSC.cpp @@ -466,7 +466,6 @@ bool CDMRIPSC::writeConfig() ::memcpy(buffer + 0U, "RPTC", 4U); ::memcpy(buffer + 4U, m_id, 4U); -// setlocale(LC_ALL,"C"); ::sprintf(buffer + 8U, "%-8.8s%09u%09u%02u%02u%08f%09f%03d%-20.20s%-19.19s%c%-124.124s%-40.40s%-40.40s", m_callsign.c_str(), m_rxFrequency, m_txFrequency, m_power, m_colorCode, m_latitude, m_longitude, m_height, m_location.c_str(), m_description.c_str(), slots, m_url.c_str(), m_version, software); From b565400b2437118df3a3727744bfe993d9f653a2 Mon Sep 17 00:00:00 2001 From: Tony Corbett G0WFV Date: Sun, 3 Jul 2016 00:14:31 +0100 Subject: [PATCH 4/4] Propagate locale fix to Nextion displays --- Nextion.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Nextion.cpp b/Nextion.cpp index 4d74c38..3a36803 100644 --- a/Nextion.cpp +++ b/Nextion.cpp @@ -246,7 +246,7 @@ void CNextion::clockInt(unsigned int ms) else Time = ::localtime(¤tTime); - setlocale(LC_ALL,""); + setlocale(LC_TIME,""); char text[50U]; strftime(text, 50, "t2.txt=\"%x %X\"", Time); sendCommand(text);