Skip to content

Commit 7a84401

Browse files
authored
Merge pull request #241 from wasatch-dev/satlist
Cosmetic Fixes Preparing for 4.27 Release
2 parents a1c2d83 + 73bb133 commit 7a84401

5 files changed

Lines changed: 61 additions & 35 deletions

File tree

ESPHamClock/HamClock.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -413,11 +413,11 @@ typedef enum {
413413
X(PLOT_CH_ADIF, "ADIF") \
414414
X(PLOT_CH_AURORA, "Aurora") \
415415
X(PLOT_CH_DXPEDS, "DXPeditions") \
416-
X(PLOT_CH_DST, "Disturbance") \
416+
X(PLOT_CH_DST, "Disturbance") \
417417
X(PLOT_CH_STORMS, "Storms") \
418-
X(PLOT_CH_ACTIVENETS, "Active_Nets") \
419-
X(PLOT_CH_LAUNCHES, "Launches") \
420-
X(PLOT_CH_HFCOND, "HF_Bands") \
418+
X(PLOT_CH_ACTIVENETS, "Nets") \
419+
X(PLOT_CH_LAUNCHES, "Launches") \
420+
X(PLOT_CH_HFCOND, "HF_Bands") \
421421
X(PLOT_CH_VHFCOND, "VHF_Cond")
422422

423423
#define X(a,b) a, // expands PLOTNAMES to each enum and comma

ESPHamClock/activenets.cpp

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
*
99
* NetName,Frequency,Band,Mode,NetControl,Checkins,Logger,Started
1010
*
11-
* Each net is drawn as two lines: the net name in a large font with a smaller
12-
* supporting line beneath it (frequency, band, mode, net control, check-ins).
11+
* Each net is drawn as two lines in a small font: the net name (bright white)
12+
* with a dimmer supporting line beneath it (frequency, band, mode, check-ins).
1313
* The Logger column is intentionally not displayed.
1414
*/
1515

@@ -48,7 +48,7 @@ typedef struct {
4848
} ActiveNetEntry;
4949

5050
static ActiveNetEntry *anets; // malloced list, count in an_ss.n_data
51-
static char subtitle[40]; // count / freshness line under the title
51+
static char subtitle[40]; // credit line under the title
5252
static ScrollState an_ss; // scrolling context
5353

5454
/* free the anets[] list and reset count.
@@ -114,7 +114,7 @@ static void anGeometry (const SBox &box, int &block_dy, int &name_base_off,
114114
{
115115
int n_asc, n_h, i_asc, i_h;
116116

117-
selectFontStyle (LIGHT_FONT, SMALL_FONT);
117+
selectFontStyle (LIGHT_FONT, FAST_FONT);
118118
fontVMetrics (n_asc, n_h);
119119
selectFontStyle (LIGHT_FONT, FAST_FONT);
120120
fontVMetrics (i_asc, i_h);
@@ -143,7 +143,7 @@ static void drawActiveNetsPane (const SBox &box)
143143
tft.setCursor (box.x + (box.w-tw)/2, box.y + PANETITLE_H);
144144
tft.print (title);
145145

146-
// subtitle (count / freshness)
146+
// subtitle (credit line, like the Launches pane)
147147
selectFontStyle (LIGHT_FONT, FAST_FONT);
148148
tft.setTextColor (AN_COLOR);
149149
uint16_t sw = getTextWidth (subtitle);
@@ -174,8 +174,8 @@ static void drawActiveNetsPane (const SBox &box)
174174
int r = an_ss.getDisplayRow (i);
175175
uint16_t bt = y0 + r*block_dy; // top of this net's block
176176

177-
// net name -- the largest text
178-
selectFontStyle (LIGHT_FONT, SMALL_FONT);
177+
// net name -- still the brighter (white) of the two lines, but same small font as info
178+
selectFontStyle (LIGHT_FONT, FAST_FONT);
179179
tft.setTextColor (AN_NAME_COLOR);
180180
uint16_t w = getTextWidth (an.name);
181181
tft.setCursor (box.x + (box.w-w)/2, bt + name_base_off);
@@ -273,12 +273,17 @@ static void scrubToFit (char *line, const SBox &box)
273273
}
274274

275275
/* build the supporting info line for one net from its CSV fields.
276-
* format: "<freq> <band> <mode> - <n> ckins", omitting empty pieces.
276+
* format: "<freq> <band> <mode>", omitting empty pieces.
277277
* uses only ASCII so it renders correctly in the small CP437-based font.
278+
* N.B. check-in count is intentionally NOT included here -- it's still recorded
279+
* in ActiveNetEntry.chk and shown in the hover popup (see anFillInfo()).
278280
*/
279281
static void buildInfoLine (char *out, size_t out_l, const char *freq, const char *band,
280282
const char *mode, const char *ncs, const char *chk)
281283
{
284+
(void) ncs; // not shown on the pane (kept for popup via caller)
285+
(void) chk; // not shown on the pane (kept for popup via caller)
286+
282287
out[0] = '\0';
283288
size_t used = 0;
284289

@@ -294,14 +299,6 @@ static void buildInfoLine (char *out, size_t out_l, const char *freq, const char
294299
AN_APP_SP (band);
295300
AN_APP_SP (mode);
296301

297-
// net control, set off with a dash
298-
//if (ncs && ncs[0] && used < out_l)
299-
// used += snprintf (out+used, out_l-used, "%sNCS %s", used ? " - " : "", ncs);
300-
301-
// check-in count
302-
if (chk && chk[0] && used < out_l)
303-
used += snprintf (out+used, out_l-used, "%s%s ckins", used ? " - " : "", chk);
304-
305302
#undef AN_APP_SP
306303
}
307304

@@ -374,12 +371,11 @@ static bool retrieveActiveNets (const SBox &box)
374371
char info[200];
375372
buildInfoLine (info, sizeof(info), freq, band, mode, ncs, chk);
376373

377-
// scrub each to fit
374+
// scrub each to fit (both now render in FAST_FONT)
378375
char nbuf[200];
379376
quietStrncpy (nbuf, name, sizeof(nbuf));
380-
selectFontStyle (LIGHT_FONT, SMALL_FONT);
381-
scrubToFit (nbuf, box);
382377
selectFontStyle (LIGHT_FONT, FAST_FONT);
378+
scrubToFit (nbuf, box);
383379
scrubToFit (info, box);
384380

385381
// append to anets[]
@@ -409,9 +405,8 @@ static bool retrieveActiveNets (const SBox &box)
409405

410406
fclose (fp);
411407

412-
// build subtitle
413-
snprintf (subtitle, sizeof(subtitle), "%d active net%s", an_ss.n_data,
414-
an_ss.n_data == 1 ? "" : "s");
408+
// build subtitle -- credit line, same spot/style as the Launches pane's credit
409+
snprintf (subtitle, sizeof(subtitle), "Credit: NetLogger.org");
415410

416411
an_ss.scrollToNewest();
417412

ESPHamClock/earthsat.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3401,10 +3401,20 @@ static void showSkyView (SatState &s)
34013401
float daz = az - az_offset;
34023402
while (daz > 180) daz -= 360;
34033403
while (daz < -180) daz += 360;
3404-
return (int)(sky_x + sky_w/2 + daz * px_per_az + 0.5F);
3404+
int x = (int)(sky_x + sky_w/2 + daz * px_per_az + 0.5F);
3405+
// clamp -- callers may feed in extreme az (eg satellite trail) that would
3406+
// otherwise map to a pixel outside the frame buffer
3407+
if (x < 0) x = 0;
3408+
else if (x > (int)tft.width()-1) x = tft.width()-1;
3409+
return x;
34053410
};
34063411
auto el2y = [&](float el) -> int {
3407-
return (int)(hz_y - el * px_per_el + 0.5F);
3412+
int y = (int)(hz_y - el * px_per_el + 0.5F);
3413+
// clamp -- eg a satellite trail point well below the horizon (el near -90)
3414+
// would otherwise map to a pixel outside the frame buffer
3415+
if (y < 0) y = 0;
3416+
else if (y > (int)tft.height()-1) y = tft.height()-1;
3417+
return y;
34083418
};
34093419

34103420
// Trailing track — record last _SKY_TRAIL_MAX positions (az/el/sunlit)

ESPHamClock/hurricane.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ static void drawStormsPane (const SBox &box)
259259
// so if a full-width centered title would reach under it, shift the title left to clear it.
260260
selectFontStyle (LIGHT_FONT, SMALL_FONT);
261261
tft.setTextColor (STORM_COLOR_TITLE);
262-
const char *title = "Tropical Wx";
262+
const char *title = "Trop Wx";
263263
uint16_t tw = getTextWidth (title);
264264
uint16_t avail_r = box.w > STORM_TITLE_RSV ? box.w - STORM_TITLE_RSV : box.w; // right limit
265265
uint16_t tx = box.w > tw ? (box.w - tw)/2 : 2; // ideal centered x
@@ -783,7 +783,7 @@ static void runStormsPaneMenu (const SBox &box)
783783
};
784784

785785
MenuItem mitems[STM_N];
786-
mitems[STM_TITLE] = {MENU_LABEL, false, 0, 2, "Tropical Wx", 0};
786+
mitems[STM_TITLE] = {MENU_LABEL, false, 0, 2, "Trop Wx", 0};
787787
mitems[STM_NHC] = {MENU_TOGGLE, false, 1, 2, "Open NHC page", 0};
788788

789789
uint16_t menu_x = BOX_IS_PANE_0(box) ? box.x + 3 : box.x + 10;

ESPHamClock/launches.cpp

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ static const char launches_fn[] = "launches.txt";
5757
// ---------------------------------------------------------------------------
5858

5959
#define LAUNCH_TITLE_DY PANETITLE_H // pane title baseline
60+
#define LAUNCH_TITLE_RSV 28 // reserve at right so title clears the scroll-arrow control
6061
#define LAUNCH_CREDITS_DY SUBTITLE_Y0 // source credit line
6162
#define LAUNCH_START_DY LISTING_Y0 // first entry name baseline
6263
#define LAUNCH_ROW_H 24 // total height of one 2-line entry (px)
@@ -177,20 +178,29 @@ static void drawLaunchesPane (const SBox &box)
177178

178179
prepPlotBox (box);
179180

180-
// ---- Title ----
181+
// ---- Title -- centered, but kept clear of the scroll-arrow control in the top-right
182+
// corner. That control always erases a band at the right edge (even when the arrows
183+
// are inactive), so if a full-width centered title would reach under it, shift left.
181184
selectFontStyle (LIGHT_FONT, SMALL_FONT);
182185
tft.setTextColor (LAUNCH_TITLE_COLOR);
183186
static const char *title = "Launches";
184187
uint16_t tw = getTextWidth (title);
185-
tft.setCursor (box.x + (box.w - tw) / 2, box.y + LAUNCH_TITLE_DY);
188+
uint16_t avail_r = box.w > LAUNCH_TITLE_RSV ? box.w - LAUNCH_TITLE_RSV : box.w; // right limit
189+
uint16_t tx = box.w > tw ? (box.w - tw)/2 : 2; // ideal centered x
190+
if (tx + tw > avail_r) // would hit arrows
191+
tx = avail_r > tw ? avail_r - tw : 2; // shift left to clear
192+
tft.setCursor (box.x + tx, box.y + LAUNCH_TITLE_DY);
186193
tft.print (title);
187194

188195
// ---- Credit ----
189196
selectFontStyle (LIGHT_FONT, FAST_FONT);
190197
tft.setTextColor (LAUNCH_TITLE_COLOR);
191-
uint16_t cw = getTextWidth (launch_credit);
198+
char credit_copy[80];
199+
quietStrncpy (credit_copy, launch_credit, sizeof(credit_copy));
200+
maxStringW (credit_copy, box.w - 4);
201+
uint16_t cw = getTextWidth (credit_copy);
192202
tft.setCursor (box.x + (box.w - cw) / 2, box.y + LAUNCH_CREDITS_DY);
193-
tft.print (launch_credit);
203+
tft.print (credit_copy);
194204

195205
// ---- Entries ----
196206
selectFontStyle (LIGHT_FONT, FAST_FONT);
@@ -305,7 +315,7 @@ static bool runLaunchMenu (const SCoord &s, const SBox &box)
305315
MenuItem mitems[] = {
306316
{lname_mft, false, 0, indent, lname, 0},
307317
{webpage_mft, false, 1, indent, "Open web page", 0},
308-
{credit_mft, false, 2, indent, "Launch Library 2 site", 0},
318+
{credit_mft, false, 2, indent, "Launch Lib 2", 0},
309319
};
310320
const int n_mi = NARRAY(mitems);
311321

@@ -435,6 +445,17 @@ static bool retrieveLaunches (const SBox &box)
435445
}
436446
chompString (line1);
437447
launch_credit = strdup (line1);
448+
449+
// shorten "Library" -> "Lib" so eg "Credit: Launch Library 2" becomes
450+
// "Credit: Launch Lib 2" -- fits the narrower panes without truncation
451+
{
452+
char *lib = strstr (launch_credit, "Library");
453+
if (lib) {
454+
memmove (lib+3, lib+7, strlen(lib+7)+1); // shift tail (+ NUL) left over "rary"
455+
memcpy (lib, "Lib", 3);
456+
}
457+
}
458+
438459
ok = true; // at minimum we got the credit line
439460

440461
// ---- Three lines per launch ----

0 commit comments

Comments
 (0)