summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/alarm_menu.c50
-rw-r--r--apps/lang/english.lang8
2 files changed, 48 insertions, 10 deletions
diff --git a/apps/alarm_menu.c b/apps/alarm_menu.c
index 40b817df57..5709c5ad4a 100644
--- a/apps/alarm_menu.c
+++ b/apps/alarm_menu.c
@@ -33,16 +33,27 @@
33#include "rtc.h" 33#include "rtc.h"
34#include "misc.h" 34#include "misc.h"
35#include "screens.h" 35#include "screens.h"
36 36#include"talk.h"
37#include "lang.h" 37#include "lang.h"
38#include "power.h" 38#include "power.h"
39#include "alarm_menu.h" 39#include "alarm_menu.h"
40#include "backlight.h" 40#include "backlight.h"
41
42#include "splash.h" 41#include "splash.h"
43#include "statusbar.h" 42#include "statusbar.h"
44#include "textarea.h" 43#include "textarea.h"
45 44
45static void speak_time(int hours, int minutes, bool speak_hours)
46{
47 if (talk_menus_enabled()){
48 if(speak_hours) {
49 talk_value(hours, UNIT_HOUR, false);
50 talk_value(minutes, UNIT_MIN, true);
51 } else {
52 talk_value(minutes, UNIT_MIN, false);
53 }
54 }
55}
56
46bool alarm_screen(void) 57bool alarm_screen(void)
47{ 58{
48 int h, m; 59 int h, m;
@@ -53,7 +64,7 @@ bool alarm_screen(void)
53 int button; 64 int button;
54 int i; 65 int i;
55 bool update = true; 66 bool update = true;
56 67 bool hour_wrapped = false;
57 68
58 rtc_get_alarm(&h, &m); 69 rtc_get_alarm(&h, &m);
59 70
@@ -74,6 +85,12 @@ bool alarm_screen(void)
74 gui_textarea_clear(&screens[i]); 85 gui_textarea_clear(&screens[i]);
75 screens[i].puts(0, 3, str(LANG_ALARM_MOD_KEYS)); 86 screens[i].puts(0, 3, str(LANG_ALARM_MOD_KEYS));
76 } 87 }
88 /* Talk when entering the wakeup screen */
89 if (talk_menus_enabled())
90 {
91 talk_value(h, UNIT_HOUR, true);
92 talk_value(m, UNIT_MIN, true);
93 }
77 update = false; 94 update = false;
78 } 95 }
79 96
@@ -91,15 +108,23 @@ bool alarm_screen(void)
91 /* accept alarms only if they are in 2 minutes or more */ 108 /* accept alarms only if they are in 2 minutes or more */
92 tm = get_time(); 109 tm = get_time();
93 togo = (m + h * 60 - tm->tm_min - tm->tm_hour * 60 + 1440) % 1440; 110 togo = (m + h * 60 - tm->tm_min - tm->tm_hour * 60 + 1440) % 1440;
111
94 if (togo > 1) { 112 if (togo > 1) {
95 rtc_init(); 113 rtc_init();
96 rtc_set_alarm(h,m); 114 rtc_set_alarm(h,m);
97 rtc_enable_alarm(true); 115 rtc_enable_alarm(true);
116 if (talk_menus_enabled())
117 {
118 talk_id(LANG_ALARM_MOD_TIME_TO_GO, true);
119 talk_value(togo / 60, UNIT_HOUR, true);
120 talk_value(togo % 60, UNIT_MIN, true);
121 talk_force_enqueue_next();
122 }
98 gui_syncsplash(HZ*2, str(LANG_ALARM_MOD_TIME_TO_GO), 123 gui_syncsplash(HZ*2, str(LANG_ALARM_MOD_TIME_TO_GO),
99 togo / 60, togo % 60); 124 togo / 60, togo % 60);
100 done = true; 125 done = true;
101 } else { 126 } else {
102 gui_syncsplash(HZ, str(LANG_ALARM_MOD_ERROR)); 127 gui_syncsplash(HZ, ID2P(LANG_ALARM_MOD_ERROR));
103 update = true; 128 update = true;
104 } 129 }
105 break; 130 break;
@@ -111,9 +136,12 @@ bool alarm_screen(void)
111 if (m == 60) { 136 if (m == 60) {
112 h += 1; 137 h += 1;
113 m = 0; 138 m = 0;
139 hour_wrapped = true;
114 } 140 }
115 if (h == 24) 141 if (h == 24)
116 h = 0; 142 h = 0;
143
144 speak_time(h, m, hour_wrapped);
117 break; 145 break;
118 146
119 /* dec(m) */ 147 /* dec(m) */
@@ -123,31 +151,41 @@ bool alarm_screen(void)
123 if (m == -5) { 151 if (m == -5) {
124 h -= 1; 152 h -= 1;
125 m = 55; 153 m = 55;
154 hour_wrapped = true;
126 } 155 }
127 if (h == -1) 156 if (h == -1)
128 h = 23; 157 h = 23;
158
159 speak_time(h, m, hour_wrapped);
129 break; 160 break;
130 161
131 /* inc(h) */ 162 /* inc(h) */
132 case ACTION_STD_NEXT: 163 case ACTION_STD_NEXT:
133 case ACTION_STD_NEXTREPEAT: 164 case ACTION_STD_NEXTREPEAT:
134 h = (h+1) % 24; 165 h = (h+1) % 24;
166
167 if (talk_menus_enabled())
168 talk_value(h, UNIT_HOUR, false);
135 break; 169 break;
136 170
137 /* dec(h) */ 171 /* dec(h) */
138 case ACTION_STD_PREV: 172 case ACTION_STD_PREV:
139 case ACTION_STD_PREVREPEAT: 173 case ACTION_STD_PREVREPEAT:
140 h = (h+23) % 24; 174 h = (h+23) % 24;
175
176 if (talk_menus_enabled())
177 talk_value(h, UNIT_HOUR, false);
141 break; 178 break;
142 179
143 case ACTION_STD_CANCEL: 180 case ACTION_STD_CANCEL:
144 rtc_enable_alarm(false); 181 rtc_enable_alarm(false);
145 gui_syncsplash(HZ*2, str(LANG_ALARM_MOD_DISABLE)); 182 gui_syncsplash(HZ*2, ID2P(LANG_ALARM_MOD_DISABLE));
146 done = true; 183 done = true;
147 break; 184 break;
148 185
149 case ACTION_NONE: 186 case ACTION_NONE:
150 gui_syncstatusbar_draw(&statusbars, false); 187 gui_syncstatusbar_draw(&statusbars, false);
188 hour_wrapped = false;
151 break; 189 break;
152 190
153 default: 191 default:
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 5b1aa68eec..14f99d97c5 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -4695,7 +4695,7 @@
4695 </dest> 4695 </dest>
4696 <voice> 4696 <voice>
4697 *: none 4697 *: none
4698 alarm: "" 4698 alarm: "Waking up in"
4699 </voice> 4699 </voice>
4700</phrase> 4700</phrase>
4701<phrase> 4701<phrase>
@@ -4712,7 +4712,7 @@
4712 </dest> 4712 </dest>
4713 <voice> 4713 <voice>
4714 *: none 4714 *: none
4715 alarm: "" 4715 alarm: "Alarm set"
4716 </voice> 4716 </voice>
4717</phrase> 4717</phrase>
4718<phrase> 4718<phrase>
@@ -4729,7 +4729,7 @@
4729 </dest> 4729 </dest>
4730 <voice> 4730 <voice>
4731 *: none 4731 *: none
4732 alarm: "" 4732 alarm: "Alarm Time Is Too Soon!"
4733 </voice> 4733 </voice>
4734</phrase> 4734</phrase>
4735<phrase> 4735<phrase>
@@ -4765,7 +4765,7 @@
4765 </dest> 4765 </dest>
4766 <voice> 4766 <voice>
4767 *: none 4767 *: none
4768 alarm: "" 4768 alarm: "Alarm Disabled"
4769 </voice> 4769 </voice>
4770</phrase> 4770</phrase>
4771<phrase> 4771<phrase>