fix: Announce timer value as hours and minutes when played from SF (#3293)

This commit is contained in:
philmoz
2023-04-19 21:59:08 +10:00
committed by GitHub
parent 8b40fb771a
commit 62a40f1c47
15 changed files with 338 additions and 353 deletions
+31 -39
View File
@@ -161,55 +161,47 @@ I18N_PLAY_FUNCTION(de, playDuration, int seconds PLAY_DURATION_ATT)
seconds = -seconds;
}
uint8_t tmp;
if (IS_PLAY_LONG_TIMER())
{
tmp = seconds / 60;
if (seconds % 60 >= 30) tmp += 1;
if (tmp > 0) PLAY_NUMBER(tmp, UNIT_MINUTES, 0);
int hours, minutes;
hours = seconds / 3600;
seconds = seconds % 3600;
minutes = seconds / 60;
seconds = seconds % 60;
if (IS_PLAY_LONG_TIMER() && seconds >= 30) {
minutes += 1;
}
else
{
tmp = seconds / 3600;
seconds %= 3600;
if (tmp > 0 || IS_PLAY_TIME()) {
if (tmp > 1) {
PLAY_NUMBER(tmp, 0, 0);
PUSH_NUMBER_PROMPT(DE_PROMPT_STUNDEN);
} else {
PUSH_NUMBER_PROMPT(DE_PROMPT_EINE);
PUSH_NUMBER_PROMPT(DE_PROMPT_STUNDE);
}
if (seconds > 0) {
PUSH_NUMBER_PROMPT(DE_PROMPT_UND);
}
if (hours > 0 || IS_PLAY_TIME()) {
if (hours > 1) {
PLAY_NUMBER(hours, 0, 0);
PUSH_NUMBER_PROMPT(DE_PROMPT_STUNDEN);
} else {
PUSH_NUMBER_PROMPT(DE_PROMPT_EINE);
PUSH_NUMBER_PROMPT(DE_PROMPT_STUNDE);
}
}
tmp = seconds / 60;
seconds %= 60;
if (tmp > 0) {
if (tmp > 1) {
PLAY_NUMBER(tmp, 0, 0);
PUSH_NUMBER_PROMPT(DE_PROMPT_MINUTEN);
} else {
PUSH_NUMBER_PROMPT(DE_PROMPT_EINE);
PUSH_NUMBER_PROMPT(DE_PROMPT_MINUTE);
}
if (seconds > 0) {
PUSH_NUMBER_PROMPT(DE_PROMPT_UND);
}
if (minutes > 0) {
if (hours)
PUSH_NUMBER_PROMPT(DE_PROMPT_UND);
if (minutes > 1) {
PLAY_NUMBER(minutes, 0, 0);
PUSH_NUMBER_PROMPT(DE_PROMPT_MINUTEN);
} else {
PUSH_NUMBER_PROMPT(DE_PROMPT_EINE);
PUSH_NUMBER_PROMPT(DE_PROMPT_MINUTE);
}
}
if (!IS_PLAY_LONG_TIMER() && seconds > 0) {
if (minutes)
PUSH_NUMBER_PROMPT(DE_PROMPT_UND);
if (seconds > 1) {
PLAY_NUMBER(seconds, 0, 0);
PUSH_NUMBER_PROMPT(DE_PROMPT_SEKUNDEN);
} else {
if (seconds == 1) {
PUSH_NUMBER_PROMPT(DE_PROMPT_EINE);
PUSH_NUMBER_PROMPT(DE_PROMPT_SEKUNDE);
}
PUSH_NUMBER_PROMPT(DE_PROMPT_EINE);
PUSH_NUMBER_PROMPT(DE_PROMPT_SEKUNDE);
}
}
}