From 966b0bdc1b34d2b7c8b08db36ab03564d59acbcb Mon Sep 17 00:00:00 2001 From: "Rich O." Date: Tue, 3 Nov 2026 08:37:52 -0500 Subject: [PATCH] palm-client: app icon from meshcore-visor-hair.svg (tools/make_icon.sh); background check status on Preferences The alarm now stays set while the app is open (checks skip) and is set as soon as the interval changes; each check records what it got to, shown as 'Last 8:11 no radio, next 8:16'. --- palm-client/Makefile | 2 +- palm-client/resources/icon/large1.bmp | Bin 0 -> 150 bytes palm-client/resources/icon/large4.bmp | Bin 0 -> 470 bytes palm-client/resources/icon/large8.bmp | Bin 0 -> 1782 bytes palm-client/resources/icon/small1.bmp | Bin 0 -> 98 bytes palm-client/resources/icon/small4.bmp | Bin 0 -> 190 bytes palm-client/resources/icon/small8.bmp | Bin 0 -> 1222 bytes palm-client/resources/visormesh.rcp | 4 +- palm-client/src/bgcheck.c | 105 +++++++++++++++++++++++--- palm-client/src/bgcheck.h | 8 +- palm-client/src/main.c | 1 - palm-client/src/resources.h | 1 + palm-client/src/sounds.c | 21 +++++- palm-client/tools/make_icon.sh | 31 ++++++++ 14 files changed, 153 insertions(+), 20 deletions(-) create mode 100644 palm-client/resources/icon/large1.bmp create mode 100644 palm-client/resources/icon/large4.bmp create mode 100644 palm-client/resources/icon/large8.bmp create mode 100644 palm-client/resources/icon/small1.bmp create mode 100644 palm-client/resources/icon/small4.bmp create mode 100644 palm-client/resources/icon/small8.bmp create mode 100755 palm-client/tools/make_icon.sh diff --git a/palm-client/Makefile b/palm-client/Makefile index 86ddeb0..4cb0555 100644 --- a/palm-client/Makefile +++ b/palm-client/Makefile @@ -60,7 +60,7 @@ build/$(APP)-sections.o: build/$(APP)-sections.s build/$(APP): $(OBJS) build/$(APP)-sections.o build/$(APP)-sections.ld $(CC) $(CFLAGS) -o $@ $(OBJS) build/$(APP)-sections.o build/$(APP)-sections.ld -build/res.stamp: resources/$(APP).rcp src/resources.h resources/smallfont.nfnt resources/largefont.nfnt resources/emoji.bin | build +build/res.stamp: resources/$(APP).rcp src/resources.h resources/smallfont.nfnt resources/largefont.nfnt resources/emoji.bin resources/icon/*.bmp | build rm -rf build/res && mkdir -p build/res $(PILRC) -q -I src $< build/res touch $@ diff --git a/palm-client/resources/icon/large1.bmp b/palm-client/resources/icon/large1.bmp new file mode 100644 index 0000000000000000000000000000000000000000..6d00430abf439ccf97d5de7e6e341a3550ef91d3 GIT binary patch literal 150 zcmXAeu?@md3`8AfK-82}jDQ59rL;tq1sK9xFhlf*U=k)sLrFvYIR8BB?peCa?P)6~ z>7eYDoigZ(d+)V2Ql$V4v&eeO#|h5w$j1w|*T|f~$H>pjqMbIexJS0e&xU~7T^8 literal 0 HcmV?d00001 diff --git a/palm-client/resources/icon/large4.bmp b/palm-client/resources/icon/large4.bmp new file mode 100644 index 0000000000000000000000000000000000000000..394af7877f2011430757631183c6588a7743ef39 GIT binary patch literal 470 zcmZ?ry~fA@24z4}1BexXSPY068CZZM149B-9>f-aVo6C!23=iUhQh)^hTz~}hKUm= zGHl(tmErX1(+vOr|7ZC7_b8P)RuoWPUS0|nU`z*cfS?Gbz#Rvl z#mU7QVk zV+c@Eg~+G4hK7c^xHu_kL-<>PTrh}2<7Yzn)6$^w=@5SPvaqz&u&~gy?GS!>RmQ5V UyR*_}wL|&k?d8*!m+uDi092WjV*mgE literal 0 HcmV?d00001 diff --git a/palm-client/resources/icon/large8.bmp b/palm-client/resources/icon/large8.bmp new file mode 100644 index 0000000000000000000000000000000000000000..1940e1c37f48e9fec5d309b4d1f438305414fb79 GIT binary patch literal 1782 zcmeHHTT2vS7=G5BT%Fz3S=U{2#+lu99A{@|a(4T6XU7NvNfM$938WyrD6zT;sv9qY zAgGHp0_hBaPz2G52qWl>(upXjtf=TJQc{A@3cRszR;5|@FZl4i2fpWd-*@J{_}Vu8 zDMtYo10-n{rxvB=K?U`|qq0JncODw3>3l7cbv0;?RD;MOT6Gmoi40_+5vJ9Nmew6u z)6s{njT^9MdpGv&-ie+qo6&A%5LhH);~k2<2f3--lD$q6`Hq=A-U@_QoY|{ z?w^L(^8wkxZ&-VI0@lf|XuCa$_B&H(zxNAW*T>QO@CUY@_=LTqlgJMY@{jG^eP#uoE( z6UShMucETD!slZcFuql$dqJkaaa^RXfC$I=%DD#F&A0F?ixA<2qWZ?VXgFN!ARMM` zsFp9{TSB2wjRP91t3#pMaJ13g-{g5-D1at>v_4!DX?64Im>849m?+Umk0=On%gyH` zK@#b`7!wLQF(%t?-j?NrAWEX-=mbYs^m+Mw&Q42d*)+v?LNX=EOyu0HII-r_=3=9DHRT2CE literal 0 HcmV?d00001 diff --git a/palm-client/resources/icon/small4.bmp b/palm-client/resources/icon/small4.bmp new file mode 100644 index 0000000000000000000000000000000000000000..7448bc00a102e7c9a7713f90241348deaedd324f GIT binary patch literal 190 zcmZ?r-Nyg{Wk5;;i1~q-6NniZSb!u0g9n&|5CT97giA|H8Pe0!8A3ur7^J188D`9w z!O+{=%dmR&YKALUt}y)n|DWNmuBK{omhgF@^b2DSW~49=;W8JueFGnmYL%%I=%fFWnjR)&Cy z_Zh-x9bxd<{e~fA?;D2jrOz4C<~(IcI{1d6qppf!=EOdRnNz1QESfc)Va3Av46Bzc zVpx9bGsE@=Ul^{w{lW16|9^%LKmH)QZj?P50;3^7hY(OyRFnc+!zc@6Dl!1EBnvAW zn*_5oj4vf2DJ?6*ir`Di%1BE~z|{+}bMWx6GYP=d^Kx-=a&mDA!uXpurgeAlarm = true; + BgSchedule(); /* first, so a failed check doesn't end the chain */ if (!FindSelf(&card, &id)) return; if (SysCurAppDatabase(&curCard, &curId) == errNone) { if (curId == id) - return; /* the app is open; it sets the alarm again when it exits */ + return; /* the app is open and checks for itself */ DmDatabaseInfo(curCard, curId, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &creator); } - BgSchedule(); /* first, so a failed check doesn't end the chain */ - if (creator == sysFileCSync) - return; /* HotSync has the USB port */ - if (SysAppLaunch(card, id, sysAppLaunchFlagNewGlobals, VM_LAUNCH_BGCHECK, &kinds, &result) != errNone || - !kinds) + if (creator == sysFileCSync) { + WriteStatus(VM_BG_HOTSYNC, errNone, 0); /* HotSync has the USB port */ + return; + } + WriteStatus(VM_BG_LAUNCHING, errNone, 0); /* BgCheckRun overwrites it */ + err = SysAppLaunch(card, id, sysAppLaunchFlagNewGlobals, VM_LAUNCH_BGCHECK, &kinds, &result); + if (err != errNone) + WriteStatus(VM_BG_LAUNCH_ERR, err, 0); + if (err != errNone || !kinds) return; FtrGet(VM_CREATOR, VM_FTR_BG_KINDS, &shown); FtrSet(VM_CREATOR, VM_FTR_BG_KINDS, shown | kinds); @@ -140,16 +171,66 @@ UInt16 BgCheckRun(void) { UInt16 kinds, n; + Err err; + AppLoadPrefs(); - if (SessionConnectLight() == errNone) { + err = SessionConnectLight(); + if (err == errNone) { for (n = 0; n < VM_BG_SYNC_ROUNDS && SessionMessageWaiting(); n++) SessionSyncMessages(); SessionDisconnect(); } kinds = SessionTakeSounds() & SoundsEnabledKinds(); SoundsNotify(kinds, NULL); + WriteStatus(err == errNone ? VM_BG_DONE : VM_BG_NO_RADIO, err, kinds); ContactsClose(); ChannelsClose(); MessagesClose(); return kinds; } + +/* "18:05" (24-hour: the label has no room for am/pm). */ +static void AppendTime(Char *out, UInt32 secs) +{ + DateTimeType dt; + + TimSecondsToDateTime(secs, &dt); + TimeToAscii((UInt8)dt.hour, (UInt8)dt.minute, tfColon24h, out + StrLen(out)); +} + +void BgStatusText(Char *out) +{ + BgStatus st; + UInt16 size = sizeof(st), card, n, kind; + LocalID id; + UInt32 ref, next = 0; + + out[0] = 0; + if (PrefGetAppPreferences(VM_CREATOR, VM_BG_STATUS_ID, &st, &size, false) != noPreferenceFound && + size == sizeof(st) && st.version == VM_BG_STATUS_VERSION) { + StrCopy(out, "Last "); + AppendTime(out, st.when); + switch (st.stage) { + case VM_BG_LAUNCHING: StrCat(out, " stopped"); break; + case VM_BG_HOTSYNC: StrCat(out, " HotSync"); break; + case VM_BG_NO_RADIO: StrCat(out, " no radio"); break; + case VM_BG_LAUNCH_ERR: + StrCat(out, " err "); + StrIToA(out + StrLen(out), st.err); + break; + case VM_BG_DONE: + for (n = 0, kind = 0; kind < VM_SND_COUNT; kind++) + if (st.kinds & (1 << kind)) + n++; + StrCat(out, n ? " new" : " ok"); + break; + } + } else { + StrCopy(out, "Not checked yet"); + } + if (FindSelf(&card, &id)) + next = AlmGetAlarm(card, id, &ref); + StrCat(out, next ? ", next " : ", no alarm"); + if (next) + AppendTime(out, next); +} diff --git a/palm-client/src/bgcheck.h b/palm-client/src/bgcheck.h index a7b752d..5629ccf 100644 --- a/palm-client/src/bgcheck.h +++ b/palm-client/src/bgcheck.h @@ -7,8 +7,8 @@ * and plays the notification sound. If anything new arrived, the alarm stays * for display, and BgDisplayAlarm shows an alert with an Open button. * - * While the app is open it checks for itself: the alarm is cleared at launch - * and set again at exit. + * While the app is open it checks for itself: the alarm keeps coming and is + * skipped, and exiting sets it N minutes on. */ #ifndef VM_BGCHECK_H #define VM_BGCHECK_H @@ -24,12 +24,14 @@ void BgSetInterval(UInt16 minutes); /* Sets the next alarm from the interval (clears it when off). */ void BgSchedule(void); -void BgCancel(void); /* Launch codes; no globals needed. */ void BgAlarmTriggered(SysAlarmTriggeredParamType *p); void BgDisplayAlarm(void); +/* "Last 18:05 ok, next 18:10" for Preferences: out holds 40. */ +void BgStatusText(Char *out) VM_SECT4; + /* The VM_LAUNCH_BGCHECK work, with globals: returns the enabled sound kinds (1 << VM_SND_*) found. */ UInt16 BgCheckRun(void) VM_SECT4; diff --git a/palm-client/src/main.c b/palm-client/src/main.c index 7b8bf94..51a9c01 100644 --- a/palm-client/src/main.c +++ b/palm-client/src/main.c @@ -190,7 +190,6 @@ UInt32 PilotMain(UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags) return errNone; } if (cmd == sysAppLaunchCmdNormalLaunch) { - BgCancel(); AppLoadPrefs(); UiFontInit(SoundsLargeText()); HeardLoad(); diff --git a/palm-client/src/resources.h b/palm-client/src/resources.h index 2eaa3a4..fc9acc4 100644 --- a/palm-client/src/resources.h +++ b/palm-client/src/resources.h @@ -133,6 +133,7 @@ #define SoundsCheckTrigger 2214 #define SoundsCheckList 2215 /* items: kCheckMinutes (sounds.c) */ #define BgNewAlert 2216 +#define SoundsStatusLabel 2217 /* last background check, or the volume hint */ #define ScopesForm 2300 #define ScopesDefaultLabel 2301 diff --git a/palm-client/src/sounds.c b/palm-client/src/sounds.c index f9d1dfb..980045f 100644 --- a/palm-client/src/sounds.c +++ b/palm-client/src/sounds.c @@ -7,6 +7,7 @@ #include "ui/draw.h" static void SavePrefs(void) VM_SECT3; +static void ShowCheckStatus(FormType *form) VM_SECT3; #define VM_SOUNDS_PREFS_ID 1 #define VM_SOUNDS_PREFS_VERSION 1 @@ -117,6 +118,18 @@ void SoundsNotify(UInt16 kinds, const VmConv *onScreen) } } +/* The status line shows the volume hint while checking is off. */ +static void ShowCheckStatus(FormType *form) +{ + Char text[40]; + + if (BgInterval()) + BgStatusText(text); + else + StrCopy(text, "Volume: Prefs, General, Alarm"); + FrmCopyLabel(form, SoundsStatusLabel, text); +} + void SoundsFormOpen(UInt16 returnForm) { if (returnForm != SoundsForm) @@ -144,13 +157,17 @@ Boolean SoundsFormHandleEvent(EventType *event) LstSetSelection(list, i); CtlSetLabel(FrmGetObjectPtr(form, FrmGetObjectIndex(form, SoundsCheckTrigger)), LstGetSelectionText(list, i)); + ShowCheckStatus(form); FrmDrawForm(form); return true; case popSelectEvent: - /* the alarm is set when the app exits; the trigger's label is set by the form */ + /* the trigger's label is set by the form */ if (event->data.popSelect.controlID == SoundsCheckTrigger && - event->data.popSelect.selection < VM_CHECK_CHOICES) + event->data.popSelect.selection < VM_CHECK_CHOICES) { BgSetInterval(kCheckMinutes[event->data.popSelect.selection]); + BgSchedule(); + ShowCheckStatus(form); + } break; case ctlSelectEvent: id = event->data.ctlSelect.controlID; diff --git a/palm-client/tools/make_icon.sh b/palm-client/tools/make_icon.sh new file mode 100755 index 0000000..fd6ff85 --- /dev/null +++ b/palm-client/tools/make_icon.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# Renders the app icon BMPs in resources/icon/ from the SVG (needs rsvg-convert +# and ImageMagick: brew install librsvg imagemagick). The BMPs are committed, so +# the build itself doesn't need these tools. +# +# tools/make_icon.sh [icon.svg] +# +# Large icon 32x22 and small (list view) 15x9, each at 1 bit (ordered dither), +# 4 bits (16 grays: the Visor Neo) and 8 bits (colour; pilrc maps it to the +# Palm palette). White is transparent. +set -e +cd "$(dirname "$0")/.." +SVG="${1:-../meshcore-visor-hair.svg}" +OUT=resources/icon +TMP=$(mktemp -d) +trap 'rm -rf "$TMP"' EXIT +mkdir -p "$OUT" + +rsvg-convert -w 512 -h 512 "$SVG" -o "$TMP/full.png" +magick "$TMP/full.png" -trim +repage "$TMP/trim.png" + +for spec in large:32x22 small:15x9; do + name=${spec%%:*} + size=${spec#*:} + magick "$TMP/trim.png" -resize "$size" -background white -gravity center -extent "$size" \ + -alpha remove "$TMP/$name.png" + magick "$TMP/$name.png" -colorspace Gray -ordered-dither o2x2 -threshold 50% -type Bilevel -compress None "BMP3:$OUT/${name}1.bmp" + magick "$TMP/$name.png" -colorspace Gray -dither None -colors 16 -type Palette -compress None "BMP3:$OUT/${name}4.bmp" + magick "$TMP/$name.png" -dither None -colors 64 -type Palette -compress None "BMP3:$OUT/${name}8.bmp" +done +ls -l "$OUT"