Skip to content

Commit

Permalink
Fixed left padding of the decimal part of the numbers.
Browse files Browse the repository at this point in the history
  • Loading branch information
teixeluis committed Jun 24, 2021
1 parent 93ce2b0 commit 22e8add
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
8 changes: 4 additions & 4 deletions firmware/application/apps/ui_adsb_rx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,10 @@ void ADSBRxView::on_frame(const ADSBFrameMessage * message) {
entry.set_info_string(str_info);
logentry+=log_info + " ";

// we only want to update the details view if the frame
// we received has the same ICAO address, i.e. belongs to
// the same aircraft:
if(send_updates && details_view->get_current_entry().ICAO_address == ICAO_address) {
// we only want to update the details view if the frame
// we received has the same ICAO address, i.e. belongs to
// the same aircraft:
details_view->update(entry);
}
}
Expand All @@ -263,8 +263,8 @@ void ADSBRxView::on_frame(const ADSBFrameMessage * message) {
" Hdg:" + to_string_dec_uint(entry.velo.heading) +
" Spd: "+ to_string_dec_int(entry.velo.speed);

// same here:
if (send_updates && details_view->get_current_entry().ICAO_address == ICAO_address) {
// same here:
details_view->update(entry);
}
}
Expand Down
2 changes: 1 addition & 1 deletion firmware/application/string_format.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ std::string to_string_decimal(float decimal, int8_t precision) {
fractional_part = -fractional_part;
}

result = to_string_dec_int(integer_part) + "." + to_string_dec_uint(fractional_part, precision);
result = to_string_dec_int(integer_part) + "." + to_string_dec_uint(fractional_part, precision, '0');

return result;
}
Expand Down
4 changes: 3 additions & 1 deletion firmware/common/adsb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ int cpr_NL_approx(float lat) {
int cpr_NL(float lat) {
// TODO prove that the approximate function is good
// enough for the precision we need. Uncomment if
// that is true:
// that is true. No performance penalty was noticed
// from testing, but if you find it might be an issue,
// switch to cpr_NL_approx() instead:

//return cpr_NL_approx(lat);

Expand Down

0 comments on commit 22e8add

Please sign in to comment.