Skip to content
This repository has been archived by the owner on Feb 5, 2022. It is now read-only.

Add config option to vibrate on every full hour #74

Closed
wants to merge 5 commits into from

Conversation

rezart
Copy link
Contributor

@rezart rezart commented May 1, 2016

I really got used to the "vibrate every hour" feature that some other watch faces support and now that I fell in love with minimalin I thought I would add it as a config option

Apologies for not creating an issue beforehand but I found myself with some free time last night and implemented it anyways. Hopefully it's useful to other folks as well.

@groyoh
Copy link
Collaborator

groyoh commented May 1, 2016

@rezart thanks for this. The code looks pretty good but there's a few changes I would like to make before merging it. Would you have some time to update your PR if I give some comments?

@@ -282,6 +290,10 @@ static void config_weather_enabled_updated(DictionaryIterator * iter, Tuple * tu
update_info_layer();
}

static void config_hourly_vibrate_updated(DictionaryIterator * iter, Tuple * tuple){
config_set_int(s_config, ConfigKeyVibrateOnTheHour, tuple->value->int8);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should use config_set_bool.

@rezart
Copy link
Contributor Author

rezart commented May 1, 2016

@groyoh updated :) let me know if you have any other pieces of feedback.

if(hour > 12){
hour -= 12;
}else if(hour == 0){
hour = 12;
}

if(should_vibrate_on_the_hour && minutes == 0){
vibes_short_pulse();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to move this in the tick_handler function. Something like:

 static void tick_handler(struct tm *tick_time, TimeUnits units_changed){
+  if(units_changed & HOUR_UNIT){
+    bool vibrate_on_the_hour = config_get_bool(s_config, ConfigKeyVibrateOnTheHour);
+    if(vibrate_on_the_hour){
+      vibes_short_pulse();
+    }
+  }
   schedule_weather_request(10000);

That way we also avoid calling the config if the hour didn't change.

@groyoh
Copy link
Collaborator

groyoh commented May 1, 2016

@rezart do you (plan to) use this feature on a daily basis? How does it go when you sleep with your watch? Doesn't it bother you?

@AlessioLaiso and I were thinking about disabling the feature when the user sleeps (e.g. using the HealthService). What's your opinion on this?

@rezart
Copy link
Contributor Author

rezart commented May 1, 2016

@groyoh yes I have been using this since last night. That is a good point about the vibrations during quiet times. I actually thought of that right before heading to bed last night and thought it would be annoying, but surprisingly I did not feel any vibrations while sleeping. At first I thought maybe this is something the underlying OS controls directly, where once quiet time is enabled all vibrations are disabled automatically... Could of also very well been that I was just in deep sleep and never noticed.

@rezart
Copy link
Contributor Author

rezart commented May 1, 2016

@groyoh I realized now that you probably mean taking it a step further outside of the user enabled quiet times and have it kick in automatically once the user is detected to be in sleep mode...that sounds really neat! Though I think it might be better to include it in a separate PR? Seems like you were thinking of integrating with PebbleHealth for the step count in #69 which might help pave the way for this feature as well.

@@ -77,6 +77,7 @@
<ToggleWithItemColor toggleLabel="Use rainbow minute hand" toggleValue="{{ rainbow_mode }}" colorItemValue="{{ minute_hand_color }}" colorItemLabel="Minute hand color" footer="Overrides color selection for the minute hand" toggleFirst/>
<ItemColor color="{{ time_color }}" label="Numbers and ticks color"/>
<ItemColor color="{{ background_color }}" label="Background color"/>
<Toggle label="Light vibration on every full hour" value="{{ vibrate_on_the_hour }}" />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you change the label to "Vibrate every full hour"?

@groyoh
Copy link
Collaborator

groyoh commented May 1, 2016

@rezart looks good to me! 👍 I'll merge it once you fix the latest comments. Once in master, I'll test the vibrations and see if it requires to check the health service or not.

@groyoh
Copy link
Collaborator

groyoh commented May 1, 2016

@rezart yeah that's what I meant. Disabling it automatically as soon as the user is in sleep/deep sleep mode. Would most likely be something like:

HealthActivity a = health_service_peek_current_activities();
if(a & HealthActivityNone){
  vibrate();
}

@rezart
Copy link
Contributor Author

rezart commented May 1, 2016

@groyoh should be ready to merge. Let's think about addressing the sleep functionality in a separate PR after testing it some more.

@groyoh
Copy link
Collaborator

groyoh commented May 3, 2016

@rezart I rebased your branch and merged it into master. I'm closing this PR ;) Thanks for the work!

@groyoh groyoh closed this May 3, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants