Migrate to SDK4.44+MV2
This commit is contained in:
1 parent
bf7a8a30b4
commit
d286450c92
4 files changed
+19
-21
No files matched your search
+9
-1
@@ -97,7 +97,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"characterRegex": "[sincostaeθ=¯¹0123456789]",
|
"characterRegex": "[sincostae\u03b8=\u00af\u00b90123456789]",
|
||||||
"file": "mansalva_regular.ttf",
|
"file": "mansalva_regular.ttf",
|
||||||
"name": "FONT_MANSALVA_REGULAR_22",
|
"name": "FONT_MANSALVA_REGULAR_22",
|
||||||
"type": "font"
|
"type": "font"
|
||||||
@@ -109,6 +109,14 @@
|
|||||||
"type": "font"
|
"type": "font"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"usesPermissions": [
|
||||||
|
{
|
||||||
|
"name": "Internet",
|
||||||
|
"parameters": {
|
||||||
|
"domains": ["api.pavlok.com"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+4
-4
@@ -75,7 +75,7 @@ static uint8_t s_zap_cooldown;
|
|||||||
static uint8_t s_countdown_int = 0;
|
static uint8_t s_countdown_int = 0;
|
||||||
static bool s_continuous_zap_on_first_triangle;
|
static bool s_continuous_zap_on_first_triangle;
|
||||||
static char s_countdown_buf[4];
|
static char s_countdown_buf[4];
|
||||||
static char s_progress_buf[6];
|
static char s_progress_buf[8];
|
||||||
|
|
||||||
// constants
|
// constants
|
||||||
//// shared (setter+alarm)
|
//// shared (setter+alarm)
|
||||||
@@ -183,7 +183,7 @@ static void status_window_load(StatusWindowPurpose purpose) {
|
|||||||
scroll_layer_set_content_size(s_status_scroll_layer, GSize(bounds.size.w, max_size.h));
|
scroll_layer_set_content_size(s_status_scroll_layer, GSize(bounds.size.w, max_size.h));
|
||||||
return;
|
return;
|
||||||
case STATUS_CONFIRMATION: {
|
case STATUS_CONFIRMATION: {
|
||||||
static char s_status_confirmed_buffer[86];
|
static char s_status_confirmed_buffer[88];
|
||||||
snprintf(s_status_confirmed_buffer, sizeof(s_status_confirmed_buffer), "Alarm disarmed and re-set (%02u:%02u) successfully.\n\nSELECT: Exit\nBACK: Change alarm time", the_time.HourSet, the_time.MinuteSet);
|
snprintf(s_status_confirmed_buffer, sizeof(s_status_confirmed_buffer), "Alarm disarmed and re-set (%02u:%02u) successfully.\n\nSELECT: Exit\nBACK: Change alarm time", the_time.HourSet, the_time.MinuteSet);
|
||||||
text_layer_set_text(s_status_txt_layer, s_status_confirmed_buffer);
|
text_layer_set_text(s_status_txt_layer, s_status_confirmed_buffer);
|
||||||
window_set_click_config_provider(s_status_window, status_confirmation_click_config_provider);
|
window_set_click_config_provider(s_status_window, status_confirmation_click_config_provider);
|
||||||
@@ -246,13 +246,13 @@ static bool schedule_alarm(WakeupReason schedule_reason) {
|
|||||||
case WAKE_ALARM: {
|
case WAKE_ALARM: {
|
||||||
target = compute_alarm_time(the_time.HourWIP, the_time.MinuteWIP);
|
target = compute_alarm_time(the_time.HourWIP, the_time.MinuteWIP);
|
||||||
wakeup_cancel_all();
|
wakeup_cancel_all();
|
||||||
status = wakeup_schedule_simple_robust(target, SECONDS_PER_MINUTE, schedule_reason);
|
status = wakeup_schedule_simple_robust(target, schedule_reason);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WAKE_RECOVERY_ALARM:
|
case WAKE_RECOVERY_ALARM:
|
||||||
target = time(NULL) + 15;
|
target = time(NULL) + 15;
|
||||||
// no need to cancel alarms, as recovery alarms are short-lived and are expired by the time another is being scheduled
|
// no need to cancel alarms, as recovery alarms are short-lived and are expired by the time another is being scheduled
|
||||||
status = wakeup_schedule_simple_robust(target, 15, schedule_reason);
|
status = wakeup_schedule_simple_robust(target, schedule_reason);
|
||||||
}
|
}
|
||||||
if (status < 0) {
|
if (status < 0) {
|
||||||
push_status_window(STATUS_FAILURE);
|
push_status_window(STATUS_FAILURE);
|
||||||
|
|||||||
+5
-15
@@ -16,29 +16,19 @@ static void glance_reload_callback(AppGlanceReloadSession *session, size_t limit
|
|||||||
app_glance_add_slice(session, slice);
|
app_glance_add_slice(session, slice);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mostly stolen from https://github.com/SeaPea/GentleWake;
|
// Originally stolen from https://github.com/SeaPea/GentleWake (simplified by me for SDK 4.44+);
|
||||||
// A slightly more robust wakeup scheduler that retries on certain errors and
|
// A slightly more robust wakeup scheduler that retries on errors
|
||||||
// can retry for a different wakeup time offset by retry_diff up to retry_max times
|
WakeupId wakeup_schedule_simple_robust(time_t wakeup_time, WakeupReason wakeup_reason) {
|
||||||
WakeupId wakeup_schedule_simple_robust(time_t wakeup_time, int8_t retry_diff, WakeupReason wakeup_reason) {
|
|
||||||
WakeupId result = 0;
|
WakeupId result = 0;
|
||||||
uint8_t try_count = 0;
|
|
||||||
|
|
||||||
result = wakeup_schedule(wakeup_time, wakeup_reason, true);
|
result = wakeup_schedule(wakeup_time, wakeup_reason, true);
|
||||||
|
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
// If result is negative, something went wrong, so make sure all wakeups for this app are cancelled and try again
|
// If result is negative, something went wrong, so make sure all wakeups for this app are cancelled and try again
|
||||||
wakeup_cancel_all();
|
wakeup_cancel_all();
|
||||||
|
|
||||||
result = wakeup_schedule(wakeup_time, wakeup_reason, true);
|
result = wakeup_schedule(wakeup_time, wakeup_reason, true);
|
||||||
|
|
||||||
if (result == E_RANGE) {
|
// As of SDK 4.44, E_RANGE result no longer needs handled, as it now only reports wakeups scheduled by THIS app;
|
||||||
// E_RANGE means some other app has the same wakeup time +/- 1 minute, so try to set
|
// we call wakeup_cancel_all() above, so E_RANGE will never be encountered
|
||||||
// the wakeup for a time up to (retry_diff * 8) minutes before/after.
|
|
||||||
while (result == E_RANGE && try_count++ < 8) {
|
|
||||||
wakeup_time += retry_diff;
|
|
||||||
result = wakeup_schedule(wakeup_time, wakeup_reason, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result >= 0) {
|
if (result >= 0) {
|
||||||
|
|||||||
+1
-1
@@ -16,4 +16,4 @@ typedef struct TheTime {
|
|||||||
|
|
||||||
extern struct TheTime the_time;
|
extern struct TheTime the_time;
|
||||||
|
|
||||||
WakeupId wakeup_schedule_simple_robust(time_t wakeup_time, int8_t retry_diff, WakeupReason wakeup_reason);
|
WakeupId wakeup_schedule_simple_robust(time_t wakeup_time, WakeupReason wakeup_reason);
|
||||||
Reference in new issue
Block a user