Merge PR #470 - implement automatic DST toggling
Implements logic to automatically offset daylight saving time settings when calculating timezone offsets. This should make the DST functions work automatically with no need for user input in most cases. Reviewed-by: Matheus Afonso Martins Moreira <matheus@matheusmoreira.com> GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/470
This commit is contained in:
@@ -30,6 +30,19 @@ ext_irq_cb_t btn_alarm_callback;
|
||||
ext_irq_cb_t a2_callback;
|
||||
ext_irq_cb_t a4_callback;
|
||||
|
||||
static bool dst_skip_rolling_back;
|
||||
bool get_dst_skip_rolling_back(void) {
|
||||
return dst_skip_rolling_back;
|
||||
}
|
||||
|
||||
void set_dst_skip_rolling_back(void) {
|
||||
dst_skip_rolling_back = true;
|
||||
}
|
||||
|
||||
void clear_dst_skip_rolling_back(void) {
|
||||
dst_skip_rolling_back = false;
|
||||
}
|
||||
|
||||
bool _watch_rtc_is_enabled(void) {
|
||||
return RTC->MODE2.CTRLA.bit.ENABLE;
|
||||
}
|
||||
@@ -60,6 +73,7 @@ void watch_rtc_set_date_time(watch_date_time date_time) {
|
||||
_sync_rtc(); // Double sync as without it at high Hz faces setting time is unrealiable (specifically, set_time_hackwatch)
|
||||
RTC->MODE2.CLOCK.reg = date_time.reg;
|
||||
_sync_rtc();
|
||||
clear_dst_skip_rolling_back();
|
||||
}
|
||||
|
||||
watch_date_time watch_rtc_get_date_time(void) {
|
||||
|
||||
Reference in New Issue
Block a user