Add altitude filter [A] button to radar info bar
This commit is contained in:
@@ -31,9 +31,10 @@ namespace {
|
||||
};
|
||||
|
||||
struct Layout {
|
||||
int16_t cx, cy, radius;
|
||||
int16_t cx, cy, radius;
|
||||
Rect rangeBtn;
|
||||
Rect listBtn;
|
||||
Rect altBtn;
|
||||
Rect searchBtn;
|
||||
Rect helpBtn;
|
||||
int16_t infoTop;
|
||||
@@ -60,9 +61,10 @@ Layout computeLayout(int16_t top) {
|
||||
L.radius = min(maxRadiusByWidth, maxRadiusByHeight);
|
||||
L.cx = Config::SCREEN_WIDTH / 2;
|
||||
L.cy = top + L.radius + 6 + TOP_LABEL_MARGIN;
|
||||
L.rangeBtn = {(int16_t)(Config::SCREEN_WIDTH - 70), (int16_t)(L.infoTop + 4), 62, 22};
|
||||
L.listBtn = {(int16_t)(Config::SCREEN_WIDTH - 110), (int16_t)(L.infoTop + 4), 36, 22};
|
||||
L.searchBtn = {(int16_t)(Config::SCREEN_WIDTH - 150), (int16_t)(L.infoTop + 4), 36, 22};
|
||||
L.rangeBtn = {(int16_t)(Config::SCREEN_WIDTH - 72), (int16_t)(L.infoTop + 4), 64, 22};
|
||||
L.listBtn = {128, (int16_t)(L.infoTop + 4), 36, 22};
|
||||
L.altBtn = {88, (int16_t)(L.infoTop + 4), 36, 22};
|
||||
L.searchBtn = {48, (int16_t)(L.infoTop + 4), 36, 22};
|
||||
L.helpBtn = {8, (int16_t)(L.infoTop + 4), 36, 22};
|
||||
return L;
|
||||
}
|
||||
@@ -863,7 +865,11 @@ void render(TFT_eSPI& tft, int16_t top) {
|
||||
|
||||
if (SettingsStore::hideGroundVehicles() && a.category[0] == 'C') continue;
|
||||
|
||||
if (AirlineFilter::isHidden(a.callsign)) continue;
|
||||
if (AirlineFilter::isHidden(a.callsign)) continue;
|
||||
|
||||
uint8_t altMode = SettingsStore::altFilterIndex();
|
||||
if (altMode == 1 && a.altBaroFt >= (int32_t)Config::COLOR_LOW_ALT_THRESHOLD_FT) continue;
|
||||
if (altMode == 2 && a.altBaroFt < (int32_t)Config::COLOR_LOW_ALT_THRESHOLD_FT) continue;
|
||||
|
||||
visibleCount++;
|
||||
|
||||
@@ -944,14 +950,17 @@ lastPanel.valid = false;
|
||||
// Info-Bar Button-Leiste: [?] [S] [L] [50km]
|
||||
char rangeLabel[8];
|
||||
bool rangeMetric = LocationManager::useMetricUnits();
|
||||
if (rangeMetric) {
|
||||
if (rangeMetric) {
|
||||
snprintf(rangeLabel, sizeof(rangeLabel), "%.0fkm", rangeKm);
|
||||
} else {
|
||||
snprintf(rangeLabel, sizeof(rangeLabel), "%.0fnm", Units::kmToNm(rangeKm));
|
||||
}
|
||||
uint8_t altIdx = SettingsStore::altFilterIndex();
|
||||
const char* altLabels[] = {"All", "<10k", ">10k"};
|
||||
drawButton(tft, L.helpBtn, "?");
|
||||
drawButton(tft, L.searchBtn, "S");
|
||||
drawButton(tft, L.listBtn, "L");
|
||||
drawButton(tft, L.altBtn, altLabels[altIdx]);
|
||||
drawButton(tft, L.rangeBtn, rangeLabel);
|
||||
|
||||
drawLegend(tft, infoTop + 44);
|
||||
@@ -1100,11 +1109,17 @@ bool handleTap(TFT_eSPI& tft, int16_t x, int16_t y, int16_t top) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (L.listBtn.contains(x, y)) {
|
||||
if (L.listBtn.contains(x, y)) {
|
||||
bool hadSelection = runTable(tft, top);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (L.altBtn.contains(x, y)) {
|
||||
uint8_t idx = (SettingsStore::altFilterIndex() + 1) % Config::ALT_FILTER_COUNT;
|
||||
SettingsStore::setAltFilterIndex(idx);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (L.rangeBtn.contains(x, y)) {
|
||||
uint8_t idx = (SettingsStore::rangeIndex() + 1) % Config::RANGE_STEP_COUNT;
|
||||
SettingsStore::setRangeIndex(idx);
|
||||
@@ -1173,7 +1188,12 @@ bool runTable(TFT_eSPI& tft, int16_t top) {
|
||||
if (!table[i].valid) continue;
|
||||
if (table[i].distanceKm > rangeKm * 1.05f) continue;
|
||||
if (SettingsStore::hideGroundVehicles() && table[i].category[0] == 'C') continue;
|
||||
if (AirlineFilter::isHidden(table[i].callsign)) continue;
|
||||
if (AirlineFilter::isHidden(table[i].callsign)) continue;
|
||||
|
||||
uint8_t altMode = SettingsStore::altFilterIndex();
|
||||
if (altMode == 1 && table[i].altBaroFt >= (int32_t)Config::COLOR_LOW_ALT_THRESHOLD_FT) continue;
|
||||
if (altMode == 2 && table[i].altBaroFt < (int32_t)Config::COLOR_LOW_ALT_THRESHOLD_FT) continue;
|
||||
|
||||
snapshot[count++] = table[i];
|
||||
}
|
||||
AircraftTable::unlock();
|
||||
|
||||
Reference in New Issue
Block a user