Skip to content

Commit

Permalink
Fixed bug in backlight hold feature.
Browse files Browse the repository at this point in the history
Also reduced double press time to 1000 ms.
  • Loading branch information
imgrant committed Feb 24, 2017
1 parent df8c8af commit 5c6070c
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 49 deletions.
2 changes: 1 addition & 1 deletion resources/properties.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<!-- Beta name:
<string id="AppName">Flexirunner Beta</string>
-->
<string id="AppVersion">6.1.0</string>
<string id="AppVersion">6.1.1</string>
<string id="lTimerDisplay">Timer field</string>
<string id="lTimerTimer">Timer</string>
<string id="lTimerMoving">Moving time</string>
Expand Down
30 changes: 18 additions & 12 deletions source/FlexiRunnerApp-rectangle-148x205.mc
Original file line number Diff line number Diff line change
Expand Up @@ -202,24 +202,14 @@ class FlexiRunnerView extends Toybox.WatchUi.DataField {

//! Timer transitions from stopped to running state
function onTimerStart() {
var info = Activity.getActivityInfo();
//! If the start/stop button was last pushed less than 1.5 seconds ago,
//! toggle the force backlight feature (see in compute(), above).
//! That is, press the start/stop button twice in quick succession
//! to make the backlight stay on, or revert to the normal timeout
//! setting as configured on the watch.
if ( ( info.elapsedTime > 0 ) && ( (info.elapsedTime - mStartStopPushed) < 1500 ) ) {
uBacklight = !uBacklight;
}
mStartStopPushed = info.elapsedTime;
startStopPushed();
mTimerRunning = true;
}


//! Timer transitions from running to stopped state
function onTimerStop() {
var info = Activity.getActivityInfo();
mStartStopPushed = info.elapsedTime;
startStopPushed();
mTimerRunning = false;
}

Expand All @@ -236,6 +226,22 @@ class FlexiRunnerView extends Toybox.WatchUi.DataField {
}


//! Start/stop button was pushed - emulated via timer start/stop
//! If the button was double pressed quickly, toggle
//! the force backlight feature (see in compute(), above).
function startStopPushed() {
var info = Activity.getActivityInfo();
var doublePressTimeMs = null;
if ( mStartStopPushed > 0 && info.elapsedTime > 0 ) {
doublePressTimeMs = info.elapsedTime - mStartStopPushed;
}
if ( doublePressTimeMs != null && doublePressTimeMs < 1000 ) {
uBacklight = !uBacklight;
}
mStartStopPushed = info.elapsedTime;
}


//! Current activity is ended
function onTimerReset() {
mStoppedTime = 0;
Expand Down
30 changes: 18 additions & 12 deletions source/FlexiRunnerApp-rectangle-205x148.mc
Original file line number Diff line number Diff line change
Expand Up @@ -202,24 +202,14 @@ class FlexiRunnerView extends Toybox.WatchUi.DataField {

//! Timer transitions from stopped to running state
function onTimerStart() {
var info = Activity.getActivityInfo();
//! If the start/stop button was last pushed less than 1.5 seconds ago,
//! toggle the force backlight feature (see in compute(), above).
//! That is, press the start/stop button twice in quick succession
//! to make the backlight stay on, or revert to the normal timeout
//! setting as configured on the watch.
if ( ( info.elapsedTime > 0 ) && ( (info.elapsedTime - mStartStopPushed) < 1500 ) ) {
uBacklight = !uBacklight;
}
mStartStopPushed = info.elapsedTime;
startStopPushed();
mTimerRunning = true;
}


//! Timer transitions from running to stopped state
function onTimerStop() {
var info = Activity.getActivityInfo();
mStartStopPushed = info.elapsedTime;
startStopPushed();
mTimerRunning = false;
}

Expand All @@ -236,6 +226,22 @@ class FlexiRunnerView extends Toybox.WatchUi.DataField {
}


//! Start/stop button was pushed - emulated via timer start/stop
//! If the button was double pressed quickly, toggle
//! the force backlight feature (see in compute(), above).
function startStopPushed() {
var info = Activity.getActivityInfo();
var doublePressTimeMs = null;
if ( mStartStopPushed > 0 && info.elapsedTime > 0 ) {
doublePressTimeMs = info.elapsedTime - mStartStopPushed;
}
if ( doublePressTimeMs != null && doublePressTimeMs < 1000 ) {
uBacklight = !uBacklight;
}
mStartStopPushed = info.elapsedTime;
}


//! Current activity is ended
function onTimerReset() {
mStoppedTime = 0;
Expand Down
30 changes: 18 additions & 12 deletions source/FlexiRunnerApp-round.mc
Original file line number Diff line number Diff line change
Expand Up @@ -202,24 +202,14 @@ class FlexiRunnerView extends Toybox.WatchUi.DataField {

//! Timer transitions from stopped to running state
function onTimerStart() {
var info = Activity.getActivityInfo();
//! If the start/stop button was last pushed less than 1.5 seconds ago,
//! toggle the force backlight feature (see in compute(), above).
//! That is, press the start/stop button twice in quick succession
//! to make the backlight stay on, or revert to the normal timeout
//! setting as configured on the watch.
if ( ( info.elapsedTime > 0 ) && ( (info.elapsedTime - mStartStopPushed) < 1500 ) ) {
uBacklight = !uBacklight;
}
mStartStopPushed = info.elapsedTime;
startStopPushed();
mTimerRunning = true;
}


//! Timer transitions from running to stopped state
function onTimerStop() {
var info = Activity.getActivityInfo();
mStartStopPushed = info.elapsedTime;
startStopPushed();
mTimerRunning = false;
}

Expand All @@ -236,6 +226,22 @@ class FlexiRunnerView extends Toybox.WatchUi.DataField {
}


//! Start/stop button was pushed - emulated via timer start/stop
//! If the button was double pressed quickly, toggle
//! the force backlight feature (see in compute(), above).
function startStopPushed() {
var info = Activity.getActivityInfo();
var doublePressTimeMs = null;
if ( mStartStopPushed > 0 && info.elapsedTime > 0 ) {
doublePressTimeMs = info.elapsedTime - mStartStopPushed;
}
if ( doublePressTimeMs != null && doublePressTimeMs < 1000 ) {
uBacklight = !uBacklight;
}
mStartStopPushed = info.elapsedTime;
}


//! Current activity is ended
function onTimerReset() {
mStoppedTime = 0;
Expand Down
30 changes: 18 additions & 12 deletions source/FlexiRunnerApp-semiround.mc
Original file line number Diff line number Diff line change
Expand Up @@ -202,24 +202,14 @@ class FlexiRunnerView extends Toybox.WatchUi.DataField {

//! Timer transitions from stopped to running state
function onTimerStart() {
var info = Activity.getActivityInfo();
//! If the start/stop button was last pushed less than 1.5 seconds ago,
//! toggle the force backlight feature (see in compute(), above).
//! That is, press the start/stop button twice in quick succession
//! to make the backlight stay on, or revert to the normal timeout
//! setting as configured on the watch.
if ( ( info.elapsedTime > 0 ) && ( (info.elapsedTime - mStartStopPushed) < 1500 ) ) {
uBacklight = !uBacklight;
}
mStartStopPushed = info.elapsedTime;
startStopPushed();
mTimerRunning = true;
}


//! Timer transitions from running to stopped state
function onTimerStop() {
var info = Activity.getActivityInfo();
mStartStopPushed = info.elapsedTime;
startStopPushed();
mTimerRunning = false;
}

Expand All @@ -236,6 +226,22 @@ class FlexiRunnerView extends Toybox.WatchUi.DataField {
}


//! Start/stop button was pushed - emulated via timer start/stop
//! If the button was double pressed quickly, toggle
//! the force backlight feature (see in compute(), above).
function startStopPushed() {
var info = Activity.getActivityInfo();
var doublePressTimeMs = null;
if ( mStartStopPushed > 0 && info.elapsedTime > 0 ) {
doublePressTimeMs = info.elapsedTime - mStartStopPushed;
}
if ( doublePressTimeMs != null && doublePressTimeMs < 1000 ) {
uBacklight = !uBacklight;
}
mStartStopPushed = info.elapsedTime;
}


//! Current activity is ended
function onTimerReset() {
mStoppedTime = 0;
Expand Down

0 comments on commit 5c6070c

Please sign in to comment.