mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-07 22:22:21 -04:00
Fixes to the log and screen rendering of the geo coordinates.
This commit is contained in:
parent
2ceb49e4f2
commit
97349b06ef
2 changed files with 37 additions and 6 deletions
|
@ -20,6 +20,7 @@
|
|||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
|
||||
#include "ui_adsb_rx.hpp"
|
||||
#include "ui_alphanum.hpp"
|
||||
|
||||
|
@ -233,14 +234,38 @@ void ADSBRxView::on_frame(const ADSBFrameMessage * message) {
|
|||
entry.set_frame_pos(frame, raw_data[6] & 4);
|
||||
|
||||
if (entry.pos.valid) {
|
||||
std::string latitude_str(8, '\0');
|
||||
std::string longitude_str(8, '\0');
|
||||
|
||||
int written = std::snprintf(&latitude_str[0], latitude_str.size(), "%.2f", entry.pos.latitude);
|
||||
latitude_str.resize(written);
|
||||
|
||||
written = std::snprintf(&longitude_str[0], longitude_str.size(), "%.2f", entry.pos.longitude);
|
||||
longitude_str.resize(written);
|
||||
|
||||
str_info = "Alt:" + to_string_dec_int(entry.pos.altitude) +
|
||||
" Lat:" + to_string_dec_int(entry.pos.latitude) +
|
||||
"." + to_string_dec_int((int)abs(entry.pos.latitude * 1000) % 100, 2, '0') +
|
||||
" Lon:" + to_string_dec_int(entry.pos.longitude) +
|
||||
"." + to_string_dec_int((int)abs(entry.pos.longitude * 1000) % 100, 2, '0');
|
||||
|
||||
" Lat:" + latitude_str +
|
||||
" Lon:" + longitude_str;
|
||||
|
||||
// printing the coordinates in the log file with more
|
||||
// resolution, as we are not constrained by screen
|
||||
// real estate there:
|
||||
|
||||
latitude_str.resize(13, '\0');
|
||||
longitude_str.resize(13, '\0');
|
||||
|
||||
written = std::snprintf(&latitude_str[0], latitude_str.size(), "%.7f", entry.pos.latitude);
|
||||
latitude_str.resize(written);
|
||||
|
||||
written = std::snprintf(&longitude_str[0], longitude_str.size(), "%.7f", entry.pos.longitude);
|
||||
longitude_str.resize(written);
|
||||
|
||||
std::string log_info = "Alt:" + to_string_dec_int(entry.pos.altitude) +
|
||||
" Lat:" + latitude_str +
|
||||
" Lon:" + longitude_str;
|
||||
|
||||
entry.set_info_string(str_info);
|
||||
logentry+=str_info+ " ";
|
||||
logentry+=log_info + " ";
|
||||
|
||||
if (send_updates)
|
||||
details_view->update(entry);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue