Skip to content

Commit a15d88c

Browse files
committed
Added support for fenix 7 Pro and epix Pro (Gen 2) watches
1 parent 1470ffa commit a15d88c

15 files changed

+76
-40
lines changed

Source/SmartBikeLights

Submodule SmartBikeLights updated 55 files

Source/manifest.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
<iq:product id="edgeexplore2"/>
2929
<iq:product id="enduro"/>
3030
<iq:product id="epix2"/>
31+
<iq:product id="epix2pro42mm"/>
32+
<iq:product id="epix2pro47mm"/>
33+
<iq:product id="epix2pro51mm"/>
3134
<iq:product id="fenix5"/>
3235
<iq:product id="fenix5plus"/>
3336
<iq:product id="fenix5s"/>
@@ -40,8 +43,11 @@
4043
<iq:product id="fenix6spro"/>
4144
<iq:product id="fenix6xpro"/>
4245
<iq:product id="fenix7"/>
46+
<iq:product id="fenix7pro"/>
4347
<iq:product id="fenix7s"/>
48+
<iq:product id="fenix7spro"/>
4449
<iq:product id="fenix7x"/>
50+
<iq:product id="fenix7xpro"/>
4551
<iq:product id="fenixchronos"/>
4652
<iq:product id="fr245"/>
4753
<iq:product id="fr245m"/>

Source/monkey.jungle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,18 @@ edge540.excludeAnnotations = $(rectangleNonTouchScreen);staticGlance
3939
edge840.excludeAnnotations = $(rectangleTouchScreen);staticGlance
4040
enduro.excludeAnnotations = $(roundNonTouchScreen);staticGlance
4141
epix2.excludeAnnotations = $(roundHighResolution);staticGlance
42+
epix2pro42mm.excludeAnnotations = $(roundHighResolution);staticGlance
43+
epix2pro47mm.excludeAnnotations = $(roundHighResolution);staticGlance
44+
epix2pro51mm.excludeAnnotations = $(roundHighResolution);staticGlance
4245
fenix6pro.excludeAnnotations = $(roundNonTouchScreen);staticGlance
4346
fenix6spro.excludeAnnotations = $(roundNonTouchScreen);staticGlance
4447
fenix6xpro.excludeAnnotations = $(roundNonTouchScreen);staticGlance
4548
fenix7.excludeAnnotations = $(roundNonTouchScreen);staticGlance
49+
fenix7pro.excludeAnnotations = $(roundNonTouchScreen);staticGlance
4650
fenix7s.excludeAnnotations = $(roundNonTouchScreen);staticGlance
51+
fenix7spro.excludeAnnotations = $(roundNonTouchScreen);staticGlance
4752
fenix7x.excludeAnnotations = $(roundNonTouchScreen);staticGlance
53+
fenix7xpro.excludeAnnotations = $(roundNonTouchScreen);staticGlance
4854
fr245m.excludeAnnotations = $(roundNonTouchScreen);staticGlance
4955
fr255.excludeAnnotations = $(roundNonTouchScreen);staticGlance
5056
fr255m.excludeAnnotations = $(roundNonTouchScreen);staticGlance

Source/source-generated/AppSettings.Settings.mc

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Toybox;
2+
using Toybox.Lang;
23
using Toybox.WatchUi;
34
using Toybox.Application.Properties as Properties;
45

@@ -11,11 +12,12 @@ module AppSettings {
1112
const configurationNameValues = ["CN1", "CN2", "CN3"];
1213
const configurationValues = [1, 2, 3];
1314
const settingValues = ["IL", "AC", "CC"];
14-
1515
class BaseMenu extends WatchUi.Menu2 {
16+
protected var viewRef;
1617

17-
public function initialize() {
18+
public function initialize(view) {
1819
Menu2.initialize(null);
20+
viewRef = view != null ? view.weak() : null;
1921
}
2022

2123
public function close() {
@@ -29,8 +31,9 @@ module AppSettings {
2931

3032
class Menu extends BaseMenu {
3133

32-
public function initialize() {
33-
BaseMenu.initialize();
34+
public function initialize(view) {
35+
BaseMenu.initialize(view);
36+
3437
Menu2.setTitle("Settings");
3538
// Invert lights
3639
Menu2.addItem(new WatchUi.ToggleMenuItem(Rez.Strings.IL, null, 0, Properties.getValue("IL"), null));
@@ -43,9 +46,9 @@ module AppSettings {
4346
}
4447

4548
public function onSelect(index, menuItem) {
46-
var key = settingValues[index];
49+
var key = index < settingValues.size() ? settingValues[index] : null;
4750
if (index == 0) {
48-
var newValue = !Properties.getValue("IL"); // Toggle invert lights
51+
var newValue = !Properties.getValue(key); // Toggle invert lights
4952
menuItem.setEnabled(newValue);
5053
Properties.setValue(key, newValue);
5154
Application.getApp().onSettingsChanged();
@@ -66,7 +69,7 @@ module AppSettings {
6669
private var _nameKeys;
6770

6871
public function initialize(title, key, menuItem, values, names, nameKeys) {
69-
BaseMenu.initialize();
72+
BaseMenu.initialize(null);
7073
Menu2.setTitle(title);
7174
_key = key;
7275
_menuItem = menuItem.weak();
@@ -76,7 +79,11 @@ module AppSettings {
7679
for (var i = 0; i < values.size(); i++) {
7780
var value = values[i];
7881
var name = nameKeys != null ? Properties.getValue(nameKeys[i]) : null;
79-
name = name == null ? Rez.Strings[names[i]] : name;
82+
if (name == null) {
83+
name = names[i];
84+
name = name instanceof String ? name : Rez.Strings[name];
85+
}
86+
8087
Menu.addItem(new WatchUi.MenuItem(name, null, value, null));
8188
}
8289
}
@@ -95,7 +102,11 @@ module AppSettings {
95102
var index = _values.indexOf(newValue);
96103
if (_menuItem.stillAlive() && index >= 0) {
97104
var name = _nameKeys != null ? Properties.getValue(_nameKeys[index]) : null;
98-
name = name == null ? Rez.Strings[_names[index]] : name;
105+
if (name == null) {
106+
name = _names[index];
107+
name = name instanceof String ? name : Rez.Strings[name];
108+
}
109+
99110
_menuItem.get().setSubLabel(name);
100111
}
101112

Source/source-generated/BikeLightsControlView.HighResolution.mc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class BikeLightsControlView extends BikeLightsView {
9292
!validateSettingsLightModes(headlightData[0]) ||
9393
!validateSettingsLightModes(taillightData[0])) {
9494
if (WatchUi has :Menu2) {
95-
menu = new AppSettings.Menu();
95+
menu = new AppSettings.Menu(self);
9696
_insideMenu = true;
9797
WatchUi.pushView(menu, new MenuDelegate(menu), WatchUi.SLIDE_IMMEDIATE);
9898
return true;
@@ -252,7 +252,7 @@ class BikeLightsControlView extends BikeLightsView {
252252
_timer = null;
253253
}
254254

255-
release();
255+
release(true);
256256
}
257257

258258
protected function getBackgroundColor() {

Source/source-generated/BikeLightsControlView.MediumResolution.mc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class BikeLightsControlView extends BikeLightsView {
9292
!validateSettingsLightModes(headlightData[0]) ||
9393
!validateSettingsLightModes(taillightData[0])) {
9494
if (WatchUi has :Menu2) {
95-
menu = new AppSettings.Menu();
95+
menu = new AppSettings.Menu(self);
9696
_insideMenu = true;
9797
WatchUi.pushView(menu, new MenuDelegate(menu), WatchUi.SLIDE_IMMEDIATE);
9898
return true;
@@ -252,7 +252,7 @@ class BikeLightsControlView extends BikeLightsView {
252252
_timer = null;
253253
}
254254

255-
release();
255+
release(true);
256256
}
257257

258258
protected function getBackgroundColor() {

Source/source-generated/BikeLightsGlanceView.HighResolution.mc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ class BikeLightsGlanceView extends WatchUi.GlanceView {
6363
}
6464

6565
function onLayout(dc) {
66-
var width = dc.getWidth();
6766
var height = dc.getHeight();
6867
var padding = 3;
6968
_offsetX = -25;

Source/source-generated/BikeLightsGlanceView.MediumResolution.mc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ class BikeLightsGlanceView extends WatchUi.GlanceView {
6363
}
6464

6565
function onLayout(dc) {
66-
var width = dc.getWidth();
6766
var height = dc.getHeight();
6867
var padding = 3;
6968
_offsetX = -25;

Source/source-generated/BikeLightsView.Rectangle.mc

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ using Toybox.Lang;
1111
using Toybox.Time;
1212
using Toybox.Time.Gregorian;
1313
using Toybox.Application.Properties as Properties;
14+
using Toybox.Attention;
1415

1516
(:rectangle :nonTouchScreen :mediumResolution)
1617
const lightModeCharacters = [
@@ -93,6 +94,7 @@ class BikeLightsView extends WatchUi.View {
9394
(:settings) var headlightSettings;
9495
(:settings) var taillightSettings;
9596
private var _individualNetwork;
97+
private var _updateSettings = false;
9698

9799
// Fields used to evaluate filters
98100
protected var _todayMoment;
@@ -187,7 +189,7 @@ class BikeLightsView extends WatchUi.View {
187189
recreateLightNetwork();
188190
}
189191

190-
function release() {
192+
function release(final) {
191193
releaseLights();
192194
if (_lightNetwork != null && _lightNetwork has :release) {
193195
_lightNetwork.release();
@@ -198,6 +200,11 @@ class BikeLightsView extends WatchUi.View {
198200

199201
function onUpdate(dc) {
200202
var timer = System.getTimer();
203+
if (_updateSettings) {
204+
_updateSettings = false;
205+
onSettingsChanged();
206+
}
207+
201208
_lastUpdateTime = timer;
202209
var width = dc.getWidth();
203210
var height = dc.getHeight();
@@ -327,7 +334,6 @@ class BikeLightsView extends WatchUi.View {
327334
: lightSettings;
328335
}
329336

330-
(:lightButtons)
331337
function setLightAndControlMode(lightData, lightType, newMode, newControlMode) {
332338
if (lightData[0] == null || _errorCode != null) {
333339
return; // This can happen when in menu the network is dropped or an invalid configuration is set
@@ -633,7 +639,7 @@ class BikeLightsView extends WatchUi.View {
633639
}
634640

635641
protected function recreateLightNetwork() {
636-
release();
642+
release(false);
637643
_lightNetwork = _individualNetwork != null
638644
? new AntLightNetwork.IndividualLightNetwork(_individualNetwork[0], _individualNetwork[1], _lightNetworkListener)
639645
: new AntPlus.LightNetwork(_lightNetworkListener);
@@ -821,7 +827,7 @@ class BikeLightsView extends WatchUi.View {
821827
: "LC";
822828
var value = getPropertyValue(configKey);
823829
if (value == null || value.length() == 0) {
824-
return new [15];
830+
return new [16];
825831
}
826832

827833
var filterResult = [0 /* next index */, 0 /* operator type */];

Source/source-generated/BikeLightsView.Round.mc

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ using Toybox.Lang;
1111
using Toybox.Time;
1212
using Toybox.Time.Gregorian;
1313
using Toybox.Application.Properties as Properties;
14+
using Toybox.Attention;
1415

1516
(:round :nonTouchScreen :mediumResolution)
1617
const lightModeCharacters = [
@@ -93,6 +94,7 @@ class BikeLightsView extends WatchUi.View {
9394
(:settings) var headlightSettings;
9495
(:settings) var taillightSettings;
9596
private var _individualNetwork;
97+
private var _updateSettings = false;
9698

9799
// Fields used to evaluate filters
98100
protected var _todayMoment;
@@ -187,7 +189,7 @@ class BikeLightsView extends WatchUi.View {
187189
recreateLightNetwork();
188190
}
189191

190-
function release() {
192+
function release(final) {
191193
releaseLights();
192194
if (_lightNetwork != null && _lightNetwork has :release) {
193195
_lightNetwork.release();
@@ -198,6 +200,11 @@ class BikeLightsView extends WatchUi.View {
198200

199201
function onUpdate(dc) {
200202
var timer = System.getTimer();
203+
if (_updateSettings) {
204+
_updateSettings = false;
205+
onSettingsChanged();
206+
}
207+
201208
_lastUpdateTime = timer;
202209
var width = dc.getWidth();
203210
var height = dc.getHeight();
@@ -327,7 +334,6 @@ class BikeLightsView extends WatchUi.View {
327334
: lightSettings;
328335
}
329336

330-
(:lightButtons)
331337
function setLightAndControlMode(lightData, lightType, newMode, newControlMode) {
332338
if (lightData[0] == null || _errorCode != null) {
333339
return; // This can happen when in menu the network is dropped or an invalid configuration is set
@@ -633,7 +639,7 @@ class BikeLightsView extends WatchUi.View {
633639
}
634640

635641
protected function recreateLightNetwork() {
636-
release();
642+
release(false);
637643
_lightNetwork = _individualNetwork != null
638644
? new AntLightNetwork.IndividualLightNetwork(_individualNetwork[0], _individualNetwork[1], _lightNetworkListener)
639645
: new AntPlus.LightNetwork(_lightNetworkListener);
@@ -821,7 +827,7 @@ class BikeLightsView extends WatchUi.View {
821827
: "LC";
822828
var value = getPropertyValue(configKey);
823829
if (value == null || value.length() == 0) {
824-
return new [15];
830+
return new [16];
825831
}
826832

827833
var filterResult = [0 /* next index */, 0 /* operator type */];

0 commit comments

Comments
 (0)