Skip to content

Commit fe9a0a6

Browse files
Revert PR #268 - add daylight savings time toggle
The DST code has not yet been fully tested, the upcoming movement refactor is upon us and it will integrate with the micro timezone library anyway. Revert it so that next can be merged into main. This reverts commit 5a8a49a, reversing changes made to bfadb81.
1 parent 30267df commit fe9a0a6

File tree

3 files changed

+4
-125
lines changed

3 files changed

+4
-125
lines changed

movement/movement.c

Lines changed: 0 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -150,107 +150,6 @@ const int16_t movement_timezone_offsets[] = {
150150
-60, // 40 : -1:00:00 (Azores Standard Time)
151151
};
152152

153-
/* These are approximate equivalent DST timezones for each
154-
* timezone in the offset table. Unlike the full tzinfo file,
155-
* the time-offsets used above are incomplete, so there are
156-
* cases below where an approximate DST timezone is proposed
157-
* for a timezone where no one observes DST, and cases
158-
* where we can't propose an equivaent DST timezone since
159-
* there isn't an appropriate one in the offset table.
160-
*
161-
* However, this should be good enough for anyone living in
162-
* a DST-observing region to manually toggle DST without
163-
* having to separately change the hour and timezone info
164-
* in the time set face.
165-
*/
166-
const uint8_t movement_dst_jump_table[] = {
167-
1, // 0 UTC + 1 = CET
168-
2, // 1 CET + 1 = SAST
169-
3, // 2 SAST + 1 = AST
170-
5, // 3 AST + 1 = GST
171-
6, // 4 IST + 1 = AT
172-
7, // 5 GST + 1 = PST
173-
8, // 6 AT + 1 = IST
174-
10, // 7 PST + 1 = KT
175-
11, // 8 IST + 1 = MT
176-
9, // 9 Nepal has no equivalent DST timezone, but they don't observe DST anyway
177-
12, // 10 KT + 1 = TST
178-
11, // 11 Myanmar has no equivalent DST timezone, but they don't observe DST anyway
179-
13, // 12 TST + 1 = CST
180-
15, // 13 CST + 1 = JST
181-
14, // 14 ACWST has no equivalent DST timezone, but they don't observe DST anyway
182-
17, // 15 JST + 1 = AEST
183-
18, // 16 ACST + 1 = LHST
184-
19, // 17 AEST + 1 = SIT
185-
18, // 18 LHST has no equivalent DST timezone, but they don't observe DST anyway
186-
20, // 19 SIT + 1 = NZST
187-
22, // 20 NZST + 1 = TT
188-
23, // 21 CST + 1 = CDT
189-
24, // 22 TT + 1 = LIT
190-
23, // 23 CDT is already a daylight timezone
191-
24, // 24 LIT has no equivalent DST timezone, but they don't observe DST anyway
192-
26, // 25 BIT + 1 = NT
193-
27, // 26 NT + 1 = HAST
194-
29, // 27 HAST + 1 = AST
195-
28, // 28 MIT has no equivalent DST timezone, but they don't observe DST anyway
196-
30, // 29 AST + 1 = PST
197-
31, // 30 PST + 1 = MST
198-
32, // 31 MST + 1 = CST
199-
33, // 32 CST + 1 = EST
200-
35, // 33 EST + 1 = AST
201-
36, // 34 VST + 1 = NST
202-
37, // 35 AST + 1 = BT
203-
38, // 36 NST + 1 = NDT
204-
39, // 37 BT + 1 = 39
205-
38, // 38 NDT is already a daylight timezone
206-
40, // 39 FNT + 1 = AST
207-
0 // 40 AST + 1 = UTC
208-
};
209-
210-
const uint8_t movement_dst_inverse_jump_table[] = {
211-
40, // 0
212-
0, // 1
213-
1, // 2
214-
2, // 3
215-
4, // 4
216-
3, // 5
217-
4, // 6
218-
5, // 7
219-
6, // 8
220-
9, // 9
221-
7, // 10
222-
8, // 11
223-
10, // 12
224-
12, // 13
225-
14, // 14
226-
13, // 15
227-
16, // 16
228-
15, // 17
229-
16, // 18
230-
17, // 19
231-
19, // 20
232-
21, // 21
233-
20, // 22
234-
21, // 23
235-
24, // 24
236-
25, // 25
237-
25, // 26
238-
26, // 27
239-
28, // 28
240-
27, // 29
241-
29, // 30
242-
30, // 31
243-
31, // 32
244-
32, // 33
245-
34, // 34
246-
33, // 35
247-
34, // 36
248-
35, // 37
249-
36, // 38
250-
37, // 39
251-
39 // 40
252-
};
253-
254153
const char movement_valid_position_0_chars[] = " AaBbCcDdEeFGgHhIiJKLMNnOoPQrSTtUuWXYZ-='+\\/0123456789";
255154
const char movement_valid_position_1_chars[] = " ABCDEFHlJLNORTtUX-='01378";
256155

movement/movement.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ typedef union {
6363
bool clock_24h_leading_zero : 1; // indicates whether clock should leading zero to indicate 24 hour mode.
6464
bool use_imperial_units : 1; // indicates whether to use metric units (the default) or imperial.
6565
bool alarm_enabled : 1; // indicates whether there is at least one alarm enabled.
66-
bool dst_active : 1; // indicates whether daylight savings time is active
67-
uint8_t reserved : 4; // room for more preferences if needed.
66+
uint8_t reserved : 5; // room for more preferences if needed.
6867
} bit;
6968
uint32_t reg;
7069
} movement_settings_t;
@@ -130,8 +129,6 @@ typedef struct {
130129
} movement_event_t;
131130

132131
extern const int16_t movement_timezone_offsets[];
133-
extern const uint8_t movement_dst_jump_table[];
134-
extern const uint8_t movement_dst_inverse_jump_table[];
135132
extern const char movement_valid_position_0_chars[];
136133
extern const char movement_valid_position_1_chars[];
137134

movement/watch_faces/settings/set_time_face.c

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
#include "watch.h"
2828
#include "watch_utility.h"
2929

30-
#define SET_TIME_FACE_NUM_SETTINGS (8)
31-
const char set_time_face_titles[SET_TIME_FACE_NUM_SETTINGS][3] = {"HR", "M1", "SE", "YR", "MO", "DA", "ZO", "DS"};
30+
#define SET_TIME_FACE_NUM_SETTINGS (7)
31+
const char set_time_face_titles[SET_TIME_FACE_NUM_SETTINGS][3] = {"HR", "M1", "SE", "YR", "MO", "DA", "ZO"};
3232

3333
static bool _quick_ticks_running;
3434

@@ -59,16 +59,6 @@ static void _handle_alarm_button(movement_settings_t *settings, watch_date_time
5959
settings->bit.time_zone++;
6060
if (settings->bit.time_zone > 40) settings->bit.time_zone = 0;
6161
break;
62-
case 7: // daylight savings time
63-
if (settings->bit.dst_active) { // deactivate DST
64-
date_time.unit.hour = (date_time.unit.hour + 24 - 1) % 24;
65-
settings->bit.time_zone = movement_dst_inverse_jump_table[settings->bit.time_zone];
66-
} else { // activate DST
67-
date_time.unit.hour = (date_time.unit.hour + 1) % 24;
68-
settings->bit.time_zone = movement_dst_jump_table[settings->bit.time_zone];
69-
}
70-
settings->bit.dst_active = !settings->bit.dst_active;
71-
break;
7262
}
7363
if (date_time.unit.day > days_in_month(date_time.unit.month, date_time.unit.year + WATCH_RTC_REFERENCE_YEAR))
7464
date_time.unit.day = 1;
@@ -155,18 +145,14 @@ bool set_time_face_loop(movement_event_t event, movement_settings_t *settings, v
155145
watch_clear_indicator(WATCH_INDICATOR_24H);
156146
watch_clear_indicator(WATCH_INDICATOR_PM);
157147
sprintf(buf, "%s %2d%02d%02d", set_time_face_titles[current_page], date_time.unit.year + 20, date_time.unit.month, date_time.unit.day);
158-
} else if (current_page < 7) { // zone
148+
} else {
159149
if (event.subsecond % 2) {
160150
watch_clear_colon();
161151
sprintf(buf, "%s ", set_time_face_titles[current_page]);
162152
} else {
163153
watch_set_colon();
164154
sprintf(buf, "%s %3d%02d ", set_time_face_titles[current_page], (int8_t) (movement_timezone_offsets[settings->bit.time_zone] / 60), (int8_t) (movement_timezone_offsets[settings->bit.time_zone] % 60) * (movement_timezone_offsets[settings->bit.time_zone] < 0 ? -1 : 1));
165155
}
166-
} else { // daylight savings
167-
watch_clear_colon();
168-
if (settings->bit.dst_active) sprintf(buf, "%s dsT y", set_time_face_titles[current_page]);
169-
else sprintf(buf, "%s dsT n", set_time_face_titles[current_page]);
170156
}
171157

172158
// blink up the parameter we're setting
@@ -184,9 +170,6 @@ bool set_time_face_loop(movement_event_t event, movement_settings_t *settings, v
184170
case 5:
185171
buf[8] = buf[9] = ' ';
186172
break;
187-
case 7:
188-
buf[9] = ' ';
189-
break;
190173
}
191174
}
192175

0 commit comments

Comments
 (0)