Skip to content

Commit 0d6eed0

Browse files
Robclaude
andcommitted
fix: speak 'Missed readings' when TTS reading is stale
When a glucose reading is older than glucosetimeout (5.5 min), the periodic TTS now says 'Missed readings' instead of the last known value. Also replaces the hardcoded '8.7' fallback in testCurrentValue and the voice settings test button with the same string. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 5e44beb commit 0d6eed0

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

Common/src/main/java/tk/glucodata/SuperGattCallback.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,11 @@ static void dowithglucose(String SerialNumber, int mgdl, float gl, float rate, i
534534

535535
if (!DontTalk) {
536536
if (dotalk && !alarmSpeechStarted) {
537-
talker.selspeak(sglucose.value);
537+
long readingAgeMs = System.currentTimeMillis() - timmsec;
538+
String toSpeak = readingAgeMs > Notify.glucosetimeout
539+
? Applic.app.getString(R.string.tts_missed_readings)
540+
: sglucose.value;
541+
talker.selspeak(toSpeak);
538542
}
539543
}
540544
if (isWearable) {

Common/src/main/java/tk/glucodata/Talker.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ public static void testCurrentValue(Context context) {
310310
if(DontTalk)
311311
return;
312312
var current = CurrentDisplaySource.resolveCurrent(Notify.glucosetimeout);
313-
var say=(current!=null&&current.getPrimaryStr()!=null)?current.getPrimaryStr():"8.7";
313+
var say=(current!=null&&current.getPrimaryStr()!=null)?current.getPrimaryStr():context.getString(R.string.tts_missed_readings);
314314
var talk=SuperGattCallback.talker;
315315
if(talk!=null && talk.engineReady) {
316316
talk.setvalues();
@@ -888,7 +888,7 @@ public void onNothingSelected (AdapterView<?> parent) {
888888
});
889889
test.setOnClickListener(v-> {
890890
var current = CurrentDisplaySource.resolveCurrent(Notify.glucosetimeout);
891-
var say=(current!=null&&current.getPrimaryStr()!=null)?current.getPrimaryStr():"8.7";
891+
var say=(current!=null&&current.getPrimaryStr()!=null)?current.getPrimaryStr():context.getString(R.string.tts_missed_readings);
892892
getvalues.run();
893893
if(istalking()) {
894894
var talk=SuperGattCallback.talker;

Common/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@
288288
<string name="streamhistory">Bluetooth History</string>
289289
<string name="libreisviewed">Spy views</string>
290290
<string name="novalue">No value</string>
291+
<string name="tts_missed_readings">Missed readings</string>
291292
<string name="talk">Talk</string>
292293
<string name="watches">Watch</string>
293294
<string name="menus">Menus</string>

0 commit comments

Comments
 (0)