Improve output

This commit is contained in:
heurist1 2021-11-01 22:51:06 +00:00
parent 8a4564f6f5
commit 79b24ebe13
4 changed files with 24 additions and 11 deletions

View File

@ -65,10 +65,12 @@ void RecentEntriesTable<AircraftRecentEntries>::draw(
(entry.hits <= 999 ? to_string_dec_uint(entry.hits, 4) : "999+") + " " +
entry.time_string;
#else
// SBT
entry_string +=
(entry.callsign[0]!=' ' ? entry.callsign + " " : to_string_hex(entry.ICAO_address, 6) + " ") +
to_string_dec_int(entry.pos.altitude,5) + " " +
to_string_dec_int(entry.velo.speed,3) + " " +
(entry.callsign[0]!=' ' ? entry.callsign + " " : to_string_hex(entry.ICAO_address, 6) + " ") +
to_string_dec_uint((unsigned int)((entry.pos.altitude+50)/100),4) +
to_string_dec_uint((unsigned int)entry.velo.speed,4) + " " +
to_string_dec_uint((unsigned int)(entry.amp*100),3) + " " +
(entry.hits <= 999 ? to_string_dec_uint(entry.hits, 3) + " " : "1k+ ") +
to_string_dec_uint(entry.age, 3);
#endif
@ -80,7 +82,7 @@ void RecentEntriesTable<AircraftRecentEntries>::draw(
);
if (entry.pos.valid)
painter.draw_bitmap(target_rect.location() + Point(15 * 8, 0), bitmap_target, target_color, style.background);
painter.draw_bitmap(target_rect.location() + Point(8 * 8, 0), bitmap_target, target_color, style.background);
}
void ADSBLogger::log_str(std::string& logline) {
@ -253,6 +255,12 @@ void ADSBRxView::on_frame(const ADSBFrameMessage * message) {
auto entry = find_or_create_entry(ICAO_address);
frame.set_rx_timestamp(datetime.minute() * 60 + datetime.second());
entry.reset_age();
if (entry.hits==0)
{
entry.amp = message->amp;
} else {
entry.amp = ((entry.amp*9.0f)+message->amp)/10.0f;
}
str_timestamp = to_string_datetime(datetime, HMS);
entry.set_time_string(str_timestamp);

View File

@ -76,6 +76,7 @@ struct AircraftRecentEntry {
uint16_t age_state { 1 };
uint32_t age { 0 };
float amp {0.0f};
adsb_pos pos { false, 0, 0, 0 };
adsb_vel velo { false, 0, 999, 0 };
ADSBFrame frame_pos_even { };
@ -269,10 +270,11 @@ private:
{ "Time", 8 }
#else
{ "ICAO/Call", 9 },
{ "Alt", 6 },
{ "Spd", 4 },
{ "Hits", 4 },
{ "Age", 4 }
{ "Lvl", 3 },
{ "Spd", 3 },
{ "Amp", 3 },
{ "Hit", 3 },
{ "Age", 3 }
#endif
} };
AircraftRecentEntries recent { };

View File

@ -56,7 +56,7 @@ void ADSBRXProcessor::execute(const buffer_c8_t& buffer) {
if (sample_count & 1) {
if (bit_count >= msgLen)
{
const ADSBFrameMessage message(frame);
const ADSBFrameMessage message(frame, amp);
shared_memory.application_queue.push(message);
decoding = false;
bit = (prev_mag > mag) ? 1 : 0;

View File

@ -376,13 +376,16 @@ public:
class ADSBFrameMessage : public Message {
public:
constexpr ADSBFrameMessage(
const adsb::ADSBFrame& frame
const adsb::ADSBFrame& frame,
const float amp
) : Message { ID::ADSBFrame },
frame { frame }
frame { frame },
amp(amp)
{
}
adsb::ADSBFrame frame;
float amp;
};
class AFSKDataMessage : public Message {