mirror of
https://git.wetfence.xyz/RandyTheSilly/Trigalarm.git
synced 2026-10-27 03:09:58 -04:00
Begin v2 conversion
This commit is contained in:
1 parent
98f13a941d
commit
ce67fc3081
9 files changed
+95
-275
No files matched your search
+47
-157
@@ -61,12 +61,8 @@ static bool s_skip_current_day = false;
|
||||
static WakeupReason s_alarm_reason;
|
||||
static uint8_t s_solution_indices[3];
|
||||
static uint8_t s_selected_indices[3] = {9, 9, 9};
|
||||
static uint8_t s_main_countdown_till_zap;
|
||||
static uint8_t s_awareness_countdown_int = 0;
|
||||
static char s_awareness_countdown_buf[4];
|
||||
static uint8_t s_alarm_zap_repeat_countdown = 0;
|
||||
static uint8_t s_awareness_zap_intensity = 0;
|
||||
static bool s_hide_countdown = true;
|
||||
static uint32_t s_vibe_segments[5];
|
||||
static VibePattern s_vibe_pattern;
|
||||
|
||||
@@ -94,16 +90,9 @@ static char *s_options_under[2];
|
||||
|
||||
////////////////////// STATUS //////////////////////
|
||||
|
||||
static void click_handler_disable_tutorial(void *recognizer, void *ctx) {
|
||||
settings.TutorialEnabled = false;
|
||||
persist_write_data(STORAGE_KEY_SETTINGS, &settings, sizeof(settings));
|
||||
window_stack_pop_all(true);
|
||||
}
|
||||
|
||||
static void click_handler_push_setter(void *recognizer, void *ctx) {
|
||||
s_highlight_pos = 0;
|
||||
s_skip_current_day = true; // setting the next alarm should assume the user meant tomorrow
|
||||
s_alarm_reason = WAKE_MAIN_ALARM; // going back to setter means alarm was disarmed or failed to set; do not punish user
|
||||
s_skip_current_day = true; // setting the next alarm should assume the user meant tomorrow
|
||||
window_stack_pop_all(true);
|
||||
push_setter_window();
|
||||
}
|
||||
@@ -116,11 +105,6 @@ static void click_handler_retry(void *recognizer, void *ctx) {
|
||||
window_stack_pop(true);
|
||||
}
|
||||
|
||||
static void status_main_tutorial_click_config_provider(void *ctx) {
|
||||
window_single_click_subscribe(BUTTON_ID_SELECT, click_handler_exit);
|
||||
window_single_click_subscribe(BUTTON_ID_BACK, click_handler_disable_tutorial);
|
||||
}
|
||||
|
||||
static void status_confirmation_click_config_provider(void *ctx) {
|
||||
window_single_click_subscribe(BUTTON_ID_BACK, click_handler_push_setter);
|
||||
window_single_click_subscribe(BUTTON_ID_SELECT, click_handler_exit);
|
||||
@@ -143,11 +127,6 @@ static void status_window_load(StatusWindowPurpose purpose) {
|
||||
text_layer_set_font(s_status_txt_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24));
|
||||
|
||||
switch (purpose) {
|
||||
case STATUS_MAIN_TUTORIAL:
|
||||
// don't disable ticks to ensure vibrations remain till the tutorial is closed
|
||||
text_layer_set_text(s_status_txt_layer, "Correct! An awareness alarm is now being set. Solve it within the time limit to disarm Trigalarm.\n\nPress SELECT to exit or BACK to disable this tutorial in the future (and exit).");
|
||||
window_set_click_config_provider(s_status_window, status_main_tutorial_click_config_provider);
|
||||
break;
|
||||
case STATUS_CONFIRMATION: {
|
||||
static char s_status_confirmed_buffer[106];
|
||||
snprintf(s_status_confirmed_buffer, sizeof(s_status_confirmed_buffer), "Alarm disarmed and re-set (%02u:%02u) successfully.\n\nPress SELECT to exit or BACK to change the alarm time.", the_time.HourSet, the_time.MinuteSet);
|
||||
@@ -209,40 +188,26 @@ static bool schedule_alarm(WakeupReason schedule_reason) {
|
||||
WakeupId status;
|
||||
|
||||
switch (schedule_reason) {
|
||||
case WAKE_MAIN_ALARM: {
|
||||
case WAKE_ALARM: {
|
||||
target = compute_alarm_time(the_time.HourWIP, the_time.MinuteWIP);
|
||||
wakeup_cancel_all();
|
||||
status = wakeup_schedule_simple_robust(target, SECONDS_PER_MINUTE, schedule_reason);
|
||||
if (settings.PavlokEnabled) {
|
||||
persist_write_int(STORAGE_KEY_PAVLOK_INTENSITY, settings.PavlokMin);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WAKE_AWARENESS_ALARM:
|
||||
target = time(NULL) + settings.AwarenessTimeGapMinutes * SECONDS_PER_MINUTE;
|
||||
wakeup_cancel_all();
|
||||
status = wakeup_schedule_simple_robust(target, SECONDS_PER_MINUTE, schedule_reason);
|
||||
if (settings.PavlokEnabled && (s_alarm_reason == WAKE_AWARENESS_ALARM || s_alarm_reason == WAKE_RECOVERY_AWARENESS_ALARM)) {
|
||||
uint8_t next_intensity = s_awareness_zap_intensity + settings.PavlokStep;
|
||||
if (next_intensity <= settings.PavlokMax && next_intensity <= 100) {
|
||||
// only boost next intensity if it is within the allowed bounds
|
||||
persist_write_int(STORAGE_KEY_PAVLOK_INTENSITY, s_awareness_zap_intensity + settings.PavlokStep);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WAKE_RECOVERY_MAIN_ALARM:
|
||||
case WAKE_RECOVERY_AWARENESS_ALARM:
|
||||
case WAKE_RECOVERY_ALARM:
|
||||
target = time(NULL) + 15;
|
||||
// no need to cancel alarms, as recovery alarms short-lived and is 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);
|
||||
}
|
||||
if (status < 0) {
|
||||
push_status_window(STATUS_SET_FAILURE);
|
||||
persist_write_int(STORAGE_KEY_ALARM_REASON, WAKE_MAIN_ALARM);
|
||||
persist_write_int(STORAGE_KEY_ALARM_REASON, WAKE_ALARM);
|
||||
s_alarm_reason = WAKE_ALARM;
|
||||
return false;
|
||||
}
|
||||
if (persist_read_int(STORAGE_KEY_ALARM_REASON) != schedule_reason) {
|
||||
persist_write_int(STORAGE_KEY_ALARM_REASON, schedule_reason);
|
||||
s_alarm_reason = schedule_reason;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -289,25 +254,15 @@ static void inbox_received_handler(DictionaryIterator *iter, void *context) {
|
||||
if (dict_find(iter, MESSAGE_KEY_PKJS_ALARM_RESET)) {
|
||||
the_time.HourWIP = 0;
|
||||
the_time.MinuteWIP = 0;
|
||||
s_alarm_reason = WAKE_MAIN_ALARM;
|
||||
schedule_alarm(WAKE_MAIN_ALARM);
|
||||
s_alarm_reason = WAKE_ALARM;
|
||||
schedule_alarm(WAKE_ALARM);
|
||||
return;
|
||||
}
|
||||
|
||||
apply_uint8_from_tuple(iter, MESSAGE_KEY_PKJS_PAVLOK_ENABLE, &settings.PavlokEnabled);
|
||||
apply_uint8_from_tuple(iter, MESSAGE_KEY_PKJS_PAVLOK_ZAP_INTERVAL, &settings.PavlokIntervalSeconds);
|
||||
apply_uint8_from_tuple(iter, MESSAGE_KEY_PKJS_PAVLOK_ZAP_MIN, &settings.PavlokMin);
|
||||
apply_uint8_from_tuple(iter, MESSAGE_KEY_PKJS_PAVLOK_ZAP_MAX, &settings.PavlokMax);
|
||||
apply_uint8_from_tuple(iter, MESSAGE_KEY_PKJS_PAVLOK_ZAP_STEP, &settings.PavlokStep);
|
||||
apply_uint8_from_tuple(iter, MESSAGE_KEY_PKJS_PAVLOK_ZAP_MAIN_DELAY, &settings.PavlokMainDelay);
|
||||
apply_uint8_from_tuple(iter, MESSAGE_KEY_PKJS_AWARENESS_TIME_GAP, &settings.AwarenessTimeGapMinutes);
|
||||
apply_uint8_from_tuple(iter, MESSAGE_KEY_PKJS_AWARENESS_TIME_LIMIT, &settings.AwarenessTimeLimitSeconds);
|
||||
if (settings.PavlokMax <= settings.PavlokMin) {
|
||||
// disable step mode if max is not higher than min
|
||||
settings.PavlokStep = 0;
|
||||
// ensure force quit/overwrite punishments aren't weaker than base
|
||||
settings.PavlokMax = settings.PavlokMin;
|
||||
}
|
||||
apply_uint8_from_tuple(iter, MESSAGE_KEY_PKJS_PAVLOK_ZAP_INTENSITY, &settings.PavlokIntensity);
|
||||
apply_uint8_from_tuple(iter, MESSAGE_KEY_PKJS_TRIANGLE_COUNT, &settings.TriangleCount);
|
||||
apply_uint8_from_tuple(iter, MESSAGE_KEY_PKJS_TRIANGLE_MIN_SECS, &settings.TriangeMinSecs);
|
||||
persist_write_data(STORAGE_KEY_SETTINGS, &settings, sizeof(settings));
|
||||
}
|
||||
|
||||
@@ -330,43 +285,13 @@ static void send_zap(uint8_t intensity) {
|
||||
|
||||
////////////////////// ALARM //////////////////////
|
||||
|
||||
static void main_alarm_seconds_handler(struct tm *tick_time, TimeUnits units_changed) {
|
||||
if (s_main_countdown_till_zap > 0) {
|
||||
s_main_countdown_till_zap--;
|
||||
if (s_main_countdown_till_zap == 0) {
|
||||
send_zap(settings.PavlokMin);
|
||||
s_alarm_zap_repeat_countdown = settings.PavlokIntervalSeconds;
|
||||
}
|
||||
} else if (s_alarm_zap_repeat_countdown > 0) {
|
||||
s_alarm_zap_repeat_countdown--;
|
||||
if (s_alarm_zap_repeat_countdown == 0) {
|
||||
send_zap(settings.PavlokMin);
|
||||
s_alarm_zap_repeat_countdown = settings.PavlokIntervalSeconds;
|
||||
}
|
||||
}
|
||||
vibes_enqueue_custom_pattern(s_vibe_pattern);
|
||||
}
|
||||
|
||||
static void awareness_alarm_seconds_handler(struct tm *tick_time, TimeUnits units_changed) {
|
||||
if (s_awareness_countdown_int > 0) {
|
||||
s_awareness_countdown_int--;
|
||||
snprintf(s_awareness_countdown_buf, sizeof(s_awareness_countdown_buf), "%03u", s_awareness_countdown_int);
|
||||
text_layer_set_text(s_countdown_txt_layer, s_awareness_countdown_buf);
|
||||
if (s_awareness_countdown_int == 0) {
|
||||
send_zap(s_awareness_zap_intensity);
|
||||
s_alarm_zap_repeat_countdown = settings.PavlokIntervalSeconds;
|
||||
}
|
||||
} else {
|
||||
if (s_alarm_zap_repeat_countdown > 0) {
|
||||
s_alarm_zap_repeat_countdown--;
|
||||
if (s_alarm_zap_repeat_countdown == 0) {
|
||||
send_zap(s_awareness_zap_intensity);
|
||||
s_alarm_zap_repeat_countdown = settings.PavlokIntervalSeconds;
|
||||
}
|
||||
}
|
||||
layer_set_hidden(text_layer_get_layer(s_countdown_txt_layer), s_hide_countdown);
|
||||
s_hide_countdown = !s_hide_countdown;
|
||||
vibes_enqueue_custom_pattern(s_vibe_pattern);
|
||||
s_awareness_countdown_int--;
|
||||
snprintf(s_awareness_countdown_buf, sizeof(s_awareness_countdown_buf), "%03u", s_awareness_countdown_int);
|
||||
text_layer_set_text(s_countdown_txt_layer, s_awareness_countdown_buf);
|
||||
if (s_awareness_countdown_int == 0) {
|
||||
send_zap(settings.PavlokIntensity);
|
||||
// TODO demote and reset countdown int
|
||||
}
|
||||
}
|
||||
|
||||
@@ -447,20 +372,15 @@ static void alarm_select_hold_handler(void *recognizer, void *ctx) {
|
||||
wakeup_service_subscribe(NULL);
|
||||
|
||||
if (s_awareness_countdown_int > 0) {
|
||||
// set main alarm if the awareness alarm was solved within time limit
|
||||
// TODO promote OR disarm
|
||||
// if (s_current_triangle == settings.TriangleCount) {
|
||||
tick_timer_service_unsubscribe(); // alarm is fully disarmed - prevent stimulus in confirmation window
|
||||
if (schedule_alarm(WAKE_MAIN_ALARM)) {
|
||||
if (schedule_alarm(WAKE_ALARM)) {
|
||||
push_status_window(STATUS_CONFIRMATION);
|
||||
}
|
||||
} else {
|
||||
// otherwise, set awareness alarm and exit
|
||||
if (schedule_alarm(WAKE_AWARENESS_ALARM)) {
|
||||
if (settings.TutorialEnabled && (s_alarm_reason == WAKE_MAIN_ALARM || s_alarm_reason == WAKE_RECOVERY_MAIN_ALARM)) {
|
||||
push_status_window(STATUS_MAIN_TUTORIAL);
|
||||
} else {
|
||||
window_stack_pop_all(true);
|
||||
}
|
||||
}
|
||||
// } else {
|
||||
// GENERATE NEW TRIANLGE AND SET TIME LIMIT
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -529,7 +449,7 @@ static void drop_menu_window_unload(Window *window) {
|
||||
}
|
||||
|
||||
static void live_wakeup_handler_for_alarm(WakeupId id, int32_t wakeup_reason) {
|
||||
if (wakeup_reason == WAKE_RECOVERY_MAIN_ALARM || wakeup_reason == WAKE_RECOVERY_AWARENESS_ALARM) {
|
||||
if (wakeup_reason == WAKE_RECOVERY_ALARM) {
|
||||
// if recovery alarm, re-schedule it
|
||||
schedule_alarm(wakeup_reason);
|
||||
}
|
||||
@@ -771,26 +691,13 @@ static void alarm_window_load() {
|
||||
text_layer_set_background_color(s_countdown_txt_layer, GColorClear);
|
||||
text_layer_set_text_color(s_countdown_txt_layer, GColorWhite);
|
||||
text_layer_set_text_alignment(s_countdown_txt_layer, GTextAlignmentCenter);
|
||||
s_alarm_zap_repeat_countdown = 0;
|
||||
if (s_alarm_reason == WAKE_AWARENESS_ALARM || s_alarm_reason == WAKE_RECOVERY_AWARENESS_ALARM) {
|
||||
s_awareness_countdown_int = settings.AwarenessTimeLimitSeconds;
|
||||
text_layer_set_font(s_countdown_txt_layer, s_font_lecoish_small);
|
||||
snprintf(s_awareness_countdown_buf, sizeof(s_awareness_countdown_buf), "%03u", s_awareness_countdown_int);
|
||||
text_layer_set_text(s_countdown_txt_layer, s_awareness_countdown_buf);
|
||||
layer_add_child(window_layer, text_layer_get_layer(s_countdown_txt_layer));
|
||||
|
||||
schedule_alarm(WAKE_RECOVERY_AWARENESS_ALARM);
|
||||
tick_timer_service_subscribe(SECOND_UNIT, awareness_alarm_seconds_handler);
|
||||
} else {
|
||||
s_awareness_countdown_int = 0;
|
||||
s_main_countdown_till_zap = settings.PavlokMainDelay;
|
||||
text_layer_set_font(s_countdown_txt_layer, s_font_mansalva_small);
|
||||
text_layer_set_text(s_countdown_txt_layer, "🏁 hold select 🏁");
|
||||
layer_add_child(window_layer, text_layer_get_layer(s_countdown_txt_layer));
|
||||
|
||||
schedule_alarm(WAKE_RECOVERY_MAIN_ALARM);
|
||||
tick_timer_service_subscribe(SECOND_UNIT, main_alarm_seconds_handler);
|
||||
}
|
||||
s_awareness_countdown_int = settings.TriangeMinSecs; // TODO calculate max based on min and triangle count
|
||||
text_layer_set_font(s_countdown_txt_layer, s_font_lecoish_small);
|
||||
snprintf(s_awareness_countdown_buf, sizeof(s_awareness_countdown_buf), "%03u", s_awareness_countdown_int);
|
||||
text_layer_set_text(s_countdown_txt_layer, s_awareness_countdown_buf);
|
||||
layer_add_child(window_layer, text_layer_get_layer(s_countdown_txt_layer));
|
||||
schedule_alarm(WAKE_RECOVERY_ALARM);
|
||||
tick_timer_service_subscribe(SECOND_UNIT, awareness_alarm_seconds_handler);
|
||||
}
|
||||
|
||||
static void alarm_window_unload() {
|
||||
@@ -820,21 +727,8 @@ static void alarm_window_unload() {
|
||||
}
|
||||
|
||||
static void push_alarm_window() {
|
||||
s_alarm_reason = persist_read_int(STORAGE_KEY_ALARM_REASON);
|
||||
|
||||
switch (s_alarm_reason) {
|
||||
case WAKE_RECOVERY_MAIN_ALARM:
|
||||
send_zap(settings.PavlokMax);
|
||||
break;
|
||||
case WAKE_RECOVERY_AWARENESS_ALARM:
|
||||
send_zap(settings.PavlokMax);
|
||||
[[fallthrough]];
|
||||
case WAKE_AWARENESS_ALARM:
|
||||
s_awareness_zap_intensity = persist_read_int(STORAGE_KEY_PAVLOK_INTENSITY);
|
||||
vibes_long_pulse();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
if (s_alarm_reason == WAKE_RECOVERY_ALARM) {
|
||||
send_zap(settings.PavlokIntensity);
|
||||
}
|
||||
|
||||
window_set_window_handlers(
|
||||
@@ -935,12 +829,7 @@ static void setter_down_click_handler(void *recognizer, void *ctx) {
|
||||
|
||||
static void setter_select_click_handler(void *recognizer, void *ctx) {
|
||||
if (s_highlight_pos == 2) {
|
||||
if (s_alarm_reason != WAKE_MAIN_ALARM) {
|
||||
send_zap(settings.PavlokMax);
|
||||
vibes_double_pulse();
|
||||
return; // early return to avoid overwriting recovery/awareness alarm
|
||||
}
|
||||
bool success = schedule_alarm(WAKE_MAIN_ALARM);
|
||||
bool success = schedule_alarm(WAKE_ALARM);
|
||||
if (!success) {
|
||||
return; // early return to avoid indicating alarm was set when it was not
|
||||
}
|
||||
@@ -1057,8 +946,6 @@ static void setter_window_unload() {
|
||||
}
|
||||
|
||||
static void push_setter_window() {
|
||||
s_alarm_reason = persist_read_int(STORAGE_KEY_ALARM_REASON);
|
||||
|
||||
window_set_window_handlers(
|
||||
s_window,
|
||||
(WindowHandlers){.load = setter_window_load, .unload = setter_window_unload});
|
||||
@@ -1076,7 +963,7 @@ static void init() {
|
||||
|
||||
// initialize pkjs
|
||||
app_message_register_inbox_received(inbox_received_handler);
|
||||
app_message_open(128, 128); // TODO tighten sizes
|
||||
app_message_open(128, 64);
|
||||
|
||||
// load settings from persist (or set defaults if not present)
|
||||
if (persist_exists(STORAGE_KEY_SETTINGS)) {
|
||||
@@ -1084,21 +971,24 @@ static void init() {
|
||||
} else {
|
||||
settings.TutorialEnabled = true;
|
||||
settings.PavlokEnabled = false;
|
||||
settings.PavlokIntervalSeconds = 10;
|
||||
settings.PavlokMin = 30;
|
||||
settings.PavlokMax = 60;
|
||||
settings.PavlokStep = 10;
|
||||
settings.PavlokMainDelay = 60;
|
||||
settings.AwarenessTimeGapMinutes = 9;
|
||||
settings.AwarenessTimeLimitSeconds = 30;
|
||||
settings.PavlokIntensity = 50;
|
||||
settings.TriangleCount = 5;
|
||||
settings.TriangeMinSecs = 25;
|
||||
}
|
||||
|
||||
// read even when opening setter to ensure a recovery alarm is not able to be overwritten
|
||||
s_alarm_reason = persist_read_int(STORAGE_KEY_ALARM_REASON);
|
||||
|
||||
switch (launch_reason()) {
|
||||
case APP_LAUNCH_WAKEUP:
|
||||
push_alarm_window();
|
||||
break;
|
||||
default:
|
||||
push_setter_window();
|
||||
if (s_alarm_reason == WAKE_RECOVERY_ALARM) {
|
||||
push_alarm_window();
|
||||
} else {
|
||||
push_setter_window();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
typedef enum
|
||||
{
|
||||
STATUS_MAIN_TUTORIAL = 0,
|
||||
STATUS_CONFIRMATION = 1,
|
||||
STATUS_SET_FAILURE = 2,
|
||||
STATUS_MATH_FAILURE = 3
|
||||
|
||||
+2
-4
@@ -3,10 +3,8 @@
|
||||
|
||||
typedef enum
|
||||
{
|
||||
WAKE_MAIN_ALARM = 0,
|
||||
WAKE_AWARENESS_ALARM = 1,
|
||||
WAKE_RECOVERY_MAIN_ALARM = 2,
|
||||
WAKE_RECOVERY_AWARENESS_ALARM = 3
|
||||
WAKE_ALARM = 0,
|
||||
WAKE_RECOVERY_ALARM = 1,
|
||||
} WakeupReason;
|
||||
|
||||
typedef struct TheTime {
|
||||
|
||||
+5
-12
@@ -2,24 +2,17 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// BUMP ON UPDATES
|
||||
#define STORAGE_KEY_SETTINGS 50
|
||||
#define STORAGE_KEY_ALARM_REASON 100
|
||||
|
||||
#define STORAGE_KEY_SETTINGS 51 // BUMP ON MAJOR UPDATES
|
||||
#define STORAGE_KEY_ALARM_HOUR 0
|
||||
#define STORAGE_KEY_ALARM_MINUTE 1
|
||||
#define STORAGE_KEY_PAVLOK_INTENSITY 2
|
||||
#define STORAGE_KEY_ALARM_REASON 2
|
||||
|
||||
typedef struct AppSettings {
|
||||
bool TutorialEnabled;
|
||||
bool PavlokEnabled;
|
||||
uint8_t PavlokMin;
|
||||
uint8_t PavlokMax;
|
||||
uint8_t PavlokStep;
|
||||
uint8_t PavlokMainDelay;
|
||||
uint8_t PavlokIntervalSeconds;
|
||||
uint8_t AwarenessTimeGapMinutes;
|
||||
uint8_t AwarenessTimeLimitSeconds;
|
||||
uint8_t PavlokIntensity;
|
||||
uint8_t TriangleCount;
|
||||
uint8_t TriangeMinSecs;
|
||||
} __attribute__((__packed__)) AppSettings;
|
||||
|
||||
_Static_assert(sizeof(AppSettings) <= 256, "AppSettings exceeds Pebble 256-byte persist limit!");
|
||||
+18
-63
@@ -32,59 +32,14 @@ module.exports = [
|
||||
"defaultValue": "Test API Key w/Beep"
|
||||
},
|
||||
{
|
||||
"id": "pavlok_zap_min",
|
||||
"id": "pavlok_zap_intensity",
|
||||
"type": "slider",
|
||||
"messageKey": "PKJS_PAVLOK_ZAP_MIN",
|
||||
"defaultValue": 30,
|
||||
"messageKey": "PKJS_PAVLOK_ZAP_INTENSITY",
|
||||
"defaultValue": 50,
|
||||
"min": 5,
|
||||
"max": 100,
|
||||
"step": 5,
|
||||
"label": "Zap Intensity (Base)",
|
||||
"description": "% intensity of base zap during alarms."
|
||||
},
|
||||
{
|
||||
"id": "pavlok_zap_max",
|
||||
"type": "slider",
|
||||
"messageKey": "PKJS_PAVLOK_ZAP_MAX",
|
||||
"defaultValue": 60,
|
||||
"min": 10,
|
||||
"max": 100,
|
||||
"step": 5,
|
||||
"label": "Zap Intensity (Max)",
|
||||
"description": "% intensity of max zap; only takes effect if greater than base. Used for force exit/alarm overwrite penalties, as well as max value to step to in awareness alarms if zap step is enabled."
|
||||
},
|
||||
{
|
||||
"id": "pavlok_zap_step",
|
||||
"type": "slider",
|
||||
"messageKey": "PKJS_PAVLOK_ZAP_STEP",
|
||||
"defaultValue": 10,
|
||||
"min": 0,
|
||||
"max": 100,
|
||||
"step": 5,
|
||||
"label": "Zap Step",
|
||||
"description": "% to increment base zap intensity after each failed awareness alarm; set to 0 to disable."
|
||||
},
|
||||
{
|
||||
"id": "pavlok_zap_main_delay",
|
||||
"type": "slider",
|
||||
"messageKey": "PKJS_PAVLOK_ZAP_MAIN_DELAY",
|
||||
"defaultValue": 60,
|
||||
"min": 15,
|
||||
"max": 120,
|
||||
"step": 1,
|
||||
"label": "Zap Main Alarm Delay",
|
||||
"description": "Seconds into main alarm to start zaps."
|
||||
},
|
||||
{
|
||||
"id": "pavlok_zap_interval",
|
||||
"type": "slider",
|
||||
"messageKey": "PKJS_PAVLOK_ZAP_INTERVAL",
|
||||
"defaultValue": 10,
|
||||
"min": 1,
|
||||
"max": 60,
|
||||
"step": 1,
|
||||
"label": "Zap Repeat Interval",
|
||||
"description": "Seconds between zaps during alarms."
|
||||
"label": "Zap Intensity %"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -94,27 +49,27 @@ module.exports = [
|
||||
{
|
||||
"type": "heading",
|
||||
"size": 3,
|
||||
"defaultValue": "Awareness Alarm"
|
||||
"defaultValue": "Alarm Options"
|
||||
},
|
||||
{
|
||||
"id": "awareness_time_gap",
|
||||
"id": "triangle_count",
|
||||
"type": "slider",
|
||||
"messageKey": "PKJS_AWARENESS_TIME_GAP",
|
||||
"defaultValue": 9,
|
||||
"messageKey": "PKJS_TRIANGLE_COUNT",
|
||||
"defaultValue": 5,
|
||||
"min": 1,
|
||||
"max": 30,
|
||||
"label": "Gap (Minutes)",
|
||||
"description": "Time gap between main alarm and subsequent awareness alarms."
|
||||
"max": 20,
|
||||
"label": "Triangle Count",
|
||||
"description": "Number of triangles to solve before disarming the alarm."
|
||||
},
|
||||
{
|
||||
"id": "awareness_time_limit",
|
||||
"id": "triangle_min_secs",
|
||||
"type": "slider",
|
||||
"messageKey": "PKJS_AWARENESS_TIME_LIMIT",
|
||||
"defaultValue": 30,
|
||||
"min": 3,
|
||||
"max": 120,
|
||||
"label": "Time Limit (Seconds)",
|
||||
"description": "Time limit the awareness alarm must be solved within to disarm Trigalarm."
|
||||
"messageKey": "PKJS_TRIANGLE_MIN_SECS",
|
||||
"defaultValue": 25,
|
||||
"min": 5,
|
||||
"max": 60,
|
||||
"label": "Minimum Time Limit (Seconds)",
|
||||
"description": "Time limit the last/fastest triangle must be solved within. All other time limits are calculated based on this one."
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
+2
-10
@@ -8,19 +8,11 @@ module.exports = function (minified) {
|
||||
if (this.get()) {
|
||||
clayConfig.getItemById('pavlok_api_key').show();
|
||||
clayConfig.getItemById('pavlok_test_beep').show();
|
||||
clayConfig.getItemById('pavlok_zap_min').show();
|
||||
clayConfig.getItemById('pavlok_zap_max').show();
|
||||
clayConfig.getItemById('pavlok_zap_step').show();
|
||||
clayConfig.getItemById('pavlok_zap_main_delay').show();
|
||||
clayConfig.getItemById('pavlok_zap_interval').show();
|
||||
clayConfig.getItemById('pavlok_zap_intensity').show();
|
||||
} else {
|
||||
clayConfig.getItemById('pavlok_api_key').hide();
|
||||
clayConfig.getItemById('pavlok_test_beep').hide();
|
||||
clayConfig.getItemById('pavlok_zap_min').hide();
|
||||
clayConfig.getItemById('pavlok_zap_max').hide();
|
||||
clayConfig.getItemById('pavlok_zap_step').hide();
|
||||
clayConfig.getItemById('pavlok_zap_main_delay').hide();
|
||||
clayConfig.getItemById('pavlok_zap_interval').hide();
|
||||
clayConfig.getItemById('pavlok_zap_intensity').hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-3
@@ -10,9 +10,7 @@ Pebble.addEventListener('showConfiguration', function () {
|
||||
|
||||
// custom listener so messages can be sent from customClay.js
|
||||
Pebble.addEventListener('webviewclosed', function(e) {
|
||||
if (e && !e.response) {
|
||||
return;
|
||||
}
|
||||
if (!e || !e.response) { return; }
|
||||
|
||||
var data;
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user