mirror of
https://github.com/house-of-abbey/GarminHomeAssistant.git
synced 2025-05-01 05:02:34 +00:00
@ -112,7 +112,11 @@ class BackgroundServiceDelegate extends System.ServiceDelegate {
|
||||
data.put("speed", Math.round(position.speed));
|
||||
}
|
||||
if (position.heading != null) {
|
||||
data.put("course", Math.round(position.heading * 180 / Math.PI));
|
||||
var heading = Math.round(position.heading * 180 / Math.PI);
|
||||
while (heading < 0) {
|
||||
heading += 360;
|
||||
}
|
||||
data.put("course", heading);
|
||||
}
|
||||
if (position.altitude != null) {
|
||||
data.put("altitude", Math.round(position.altitude));
|
||||
|
@ -25,9 +25,10 @@ using Toybox.Application.Properties;
|
||||
using Toybox.Timer;
|
||||
|
||||
class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem {
|
||||
private var mConfirm as Lang.Boolean;
|
||||
private var mData as Lang.Dictionary;
|
||||
private var mTemplate as Lang.String;
|
||||
private var mConfirm as Lang.Boolean;
|
||||
private var mData as Lang.Dictionary;
|
||||
private var mTemplate as Lang.String;
|
||||
private var mHasVibrate as Lang.Boolean = false;
|
||||
|
||||
function initialize(
|
||||
label as Lang.String or Lang.Symbol,
|
||||
@ -40,6 +41,9 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem {
|
||||
} or Null
|
||||
) {
|
||||
WatchUi.ToggleMenuItem.initialize(label, null, null, false, options);
|
||||
if (Attention has :vibrate) {
|
||||
mHasVibrate = true;
|
||||
}
|
||||
mConfirm = confirm;
|
||||
mData = data;
|
||||
mTemplate = template;
|
||||
@ -198,6 +202,13 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem {
|
||||
},
|
||||
method(:onReturnSetState)
|
||||
);
|
||||
if (mHasVibrate and Settings.getVibrate()) {
|
||||
Attention.vibrate([
|
||||
new Attention.VibeProfile(50, 100), // On for 100ms
|
||||
new Attention.VibeProfile( 0, 100), // Off for 100ms
|
||||
new Attention.VibeProfile(50, 100) // On for 100ms
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user