Skip to content

Commit

Permalink
Version 2.6
Browse files Browse the repository at this point in the history
Longer alarm
Alarm image change
Protection against double sending of overnight
Rearrangement of export section
Coloured export section bullet points
  • Loading branch information
JamesFowler42 committed Dec 7, 2014
1 parent 4e11dde commit 3d70287
Show file tree
Hide file tree
Showing 19 changed files with 139 additions and 45 deletions.
Binary file modified app_store_assets/144x144.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app_store_assets/144x144.psd
Binary file not shown.
Binary file modified app_store_assets/48x48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app_store_assets/48x48.psd
Binary file not shown.
Binary file modified app_store_assets/morpheuz-banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app_store_assets/morpheuz-banner.psd
Binary file not shown.
43 changes: 26 additions & 17 deletions build.xml
Original file line number Diff line number Diff line change
@@ -1,41 +1,43 @@
<?xml version="1.0"?>
<project name="morpheuz" basedir="." default="all">

<property name="ver" value="26"/>
<property name="inc" value="7"/>
<property name="inc" value="11"/>
<property name="builddir" value="website/morpheuz/build"/>
<property name="srcdir" value="website/morpheuz"/>
<property name="test.dir" value="../Desktop/morpheuz"/>
<property name="img" value="/img"/>

<target name="all" description="all">
<antcall target="shrink" inheritrefs="true" inheritall="true">
<param name="in.file" value="view.css" />
<param name="min.file" value="view-${ver}.min.css" />
</antcall>
</antcall>
<antcall target="shrink" inheritrefs="true" inheritall="true">
<param name="in.file" value="view.js" />
<param name="min.file" value="view-${ver}.min.js" />
</antcall>
</antcall>
<antcall target="shrink" inheritrefs="true" inheritall="true">
<param name="in.file" value="utils.js" />
<param name="min.file" value="utils.min.js" />
</antcall>
</antcall>
<antcall target="copyedit" inheritrefs="true" inheritall="true">
<param name="in.file" value="view.html" />
<param name="out.file" value="view-${ver}.html" />
</antcall>
</antcall>
<antcall target="copy" inheritrefs="true" inheritall="true">
<param name="min.file" value="view-${ver}.min.css" />
</antcall>
</antcall>
<antcall target="copy" inheritrefs="true" inheritall="true">
<param name="min.file" value="view-${ver}.min.js" />
</antcall>
</antcall>
<antcall target="copy" inheritrefs="true" inheritall="true">
<param name="min.file" value="utils.min.js" />
</antcall>
<antcall target="copy" inheritrefs="true" inheritall="true">
<param name="min.file" value="view-${ver}.html" />
</antcall>
</antcall>
<antcall target="copyimages" inheritrefs="true" inheritall="true" />
</target>

<target name="shrink" description="shrink">
Expand All @@ -50,18 +52,25 @@
</classpath>
</java>
</target>
<target name="copy" description="copy">

<target name="copy" description="copy">
<echo message="Copying ${builddir}/${min.file} to ${test.dir}/${min.file}"/>
<copy file="${builddir}/${min.file}" tofile="${test.dir}/${min.file}" overwrite="true" force="true" />
</target>
<target name="copyedit" description="copyedit">
</target>

<target name="copyedit" description="copyedit">
<echo message="Copying ${srcdir}/${in.file} to ${builddir}/${out.file}"/>
<copy file="${srcdir}/${in.file}" tofile="${builddir}/${out.file}" overwrite="true" force="true" />
<echo message="Editing ${builddir}/${out.file}"/>
<replace file="${builddir}/${out.file}" token="view.js?v=1" value="view-${ver}.min.js?v=${inc}"/>
<replace file="${builddir}/${out.file}" token="view.css?v=1" value="view-${ver}.min.css?v=${inc}"/>
</target>
<replace file="${builddir}/${out.file}" token="view.js?v=1" value="view-${ver}.min.js?v=${inc}"/>
<replace file="${builddir}/${out.file}" token="view.css?v=1" value="view-${ver}.min.css?v=${inc}"/>
</target>

<target name="copyimages" description="copyimages">
<echo message="Copying images from ${srcdir}${img} to ${test.dir}${img}"/>
<copy todir="${test.dir}${img}" overwrite="true" force="true">
<fileset dir="${srcdir}${img}"/>
</copy>
</target>

</project>
Binary file modified resources/images/alarm-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 9 additions & 7 deletions src/alarm.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,20 @@
#include "language.h"

// Times (in seconds) between each buzz (gives a progressive alarm and gaps between phases)
static uint8_t alarm_pattern[] = { 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 60, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 60, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
static uint8_t alarm_pattern[] = { 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 60 };

static uint8_t alarm_count;
static AppTimer *alarm_timer;

#define ALARM_LIMIT (ARRAY_LENGTH(alarm_pattern) * ALARM_PATTERN_MAX_REPEAT)

/*
* Alarm timer loop
*/
static void do_alarm(void *data) {

// Already hit the limit
if (alarm_count >= ARRAY_LENGTH(alarm_pattern)) {
if (alarm_count >= ALARM_LIMIT) {
return;
}

Expand All @@ -49,7 +51,7 @@ static void do_alarm(void *data) {
vibes_long_pulse();

// Prepare the time for the next buzz (this gives progressing and phasing)
alarm_timer = app_timer_register(((uint16_t) alarm_pattern[alarm_count]) * 1000, do_alarm, NULL);
alarm_timer = app_timer_register(((uint16_t) alarm_pattern[alarm_count % (ARRAY_LENGTH(alarm_pattern))]) * 1000, do_alarm, NULL);

alarm_count++;

Expand All @@ -59,7 +61,7 @@ static void do_alarm(void *data) {
}

// Reset powernap and finish alarm
if (alarm_count >= ARRAY_LENGTH(alarm_pattern)) {
if (alarm_count >= ALARM_LIMIT) {
power_nap_reset();
set_alarm_icon(false);
}
Expand Down Expand Up @@ -95,7 +97,7 @@ void snooze_alarm() {
* Check alarm
*/
bool check_alarm() {
return alarm_count < ARRAY_LENGTH(alarm_pattern);
return alarm_count < ALARM_LIMIT;
}

/*
Expand All @@ -112,7 +114,7 @@ void cancel_alarm() {
app_timer_cancel(alarm_timer);

// Max out the count
alarm_count = ARRAY_LENGTH(alarm_pattern);
alarm_count = ALARM_LIMIT;

// Reset power nap if not already done so
power_nap_reset();
Expand All @@ -126,6 +128,6 @@ void cancel_alarm() {
*/
void init_alarm() {
// Max out the count
alarm_count = ARRAY_LENGTH(alarm_pattern);
alarm_count = ALARM_LIMIT;
}

1 change: 1 addition & 0 deletions src/js/e_smartwatchpro.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ function smartwatchProTransmit() {
makeGetAjaxCall(swpUrl, function(resp) {
console.log("smartwatchProTransmit: " + JSON.stringify(resp));
if (resp.status !== 1) {
window.localStorage.setItem("swpdo", "N"); // Turn off send on error
window.localStorage.setItem("swpstat", JSON.stringify(resp.errors));
} else {
window.localStorage.setItem("swpstat", "OK");
Expand Down
22 changes: 20 additions & 2 deletions src/js/f_control.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,29 @@ Pebble.addEventListener("appmessage", function(e) {
}
if (typeof e.payload.keyTransmit !== "undefined") {
console.log("appmessage transmit");
pushoverTransmit();
smartwatchProTransmit();
transmitMethods();
}
});

/*
* Transmit method list
*/
function transmitMethods() {
// Protect against double send without resetting
var transmitDone = window.localStorage.getItem("transmitDone");
if (transmitDone !== null) {
console.log("transmit already done");
return;
}

// Send
pushoverTransmit();
smartwatchProTransmit();

// Protect
window.localStorage.setItem("transmitDone", "done");
}

/*
* Monitor the closing of the config/display screen so as we can do a reset if
* needed
Expand Down
2 changes: 2 additions & 0 deletions src/morpheuz.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
#define TO_HR_DEF 7
#define TO_MIN_DEF 15

#define ALARM_PATTERN_MAX_REPEAT 5

#define POWER_NAP_MINUTES 27
#define POWER_NAP_SETTLE 2
#define POWER_NAP_SETTLE_THRESHOLD 1000
Expand Down
Binary file added website/morpheuz/img/bluebullet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/morpheuz/img/greenbullet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/morpheuz/img/greybullet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/morpheuz/img/redbullet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 41 additions & 10 deletions website/morpheuz/view.css
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,6 @@ a {
background-color: #fff;
}

.swpdiv {
margin-top: 5px;
}

#swp {
background: url('img/exportswp.png') no-repeat 5% 30%;
background-color: #fff;
Expand All @@ -127,11 +123,6 @@ a {
margin-left: 2px;
}

.afterswpdiv {
clear: both;
height: 5px;
}

#emailto {
margin-right: 20px;
}
Expand Down Expand Up @@ -241,4 +232,44 @@ div.jqplot-pie-series.jqplot-data-label {
.error {
color: red;
font-size: 10px;
}
}

li.grey {
list-style-image: url('img/greybullet.png');
margin-bottom: 15px;
}

li.green {
list-style-image: url('img/greenbullet.png');
margin-bottom: 15px;
}

li.blue {
list-style-image: url('img/bluebullet.png');
margin-bottom: 15px;
}

li.red {
list-style-image: url('img/redbullet.png');
margin-bottom: 15px;
}

span.green {
color: green;
}

span.blue {
color: blue;
}

span.red {
color: red;
}

.padded {
padding-top: 5px;
}

.paddedbottom {
padding-bottom: 5px;
}
19 changes: 10 additions & 9 deletions website/morpheuz/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,30 +96,31 @@ <h4>Sleep Analysis Data Point</h4>
<td id='tends'>-</td>
</tr>
</table>
<div class="swpdiv ios noset">
<a id="swp" href="swpro2hk://"></a>
</div>
<div class="afterswpdiv ios"></div>
<h3 class="exporthead">Export</h3>
<div class="exportwrap">
<ol>
<li>
<li class="grey">
<p>CSV Data</p> <textarea id="copy" rows="3" cols="30"></textarea>
<p class="small">Select all &amp; copy the CSV data in this text area</p>
</li>
<li>
<li class="grey">
<p>E-Mail</p> <label for="emailto">To:</label><input id="emailto" type="email" maxlength="254" /><a id="mail" href="mailto:">Export</a> <input id="mailtemp" type="hidden" />
<p class="small android">Whether this link works or not depends upon your phone, the version of the OS it is running and mail apps installed.</p>
<p class="small noset">'To' only saved by pressing Save.</p>
</li>
<li class="noset">
<li id="lipushover" class="noset">
<p>Pushover</p> <label for="ptoken">Token:</label><input id="ptoken" type="text" maxlength="50" /><br/><label for="puser">User:</label><input id="puser" type="text" maxlength="50" />
<p class="small">'token' & 'user' only saved by pressing Save.</p>
<p class="small">Setting these values will enable automatic push messages to Pushover</p>
<p class="small">Last result: <span id="presult"></span></p>
</li>
<li class="noset ios">
<p>Healthkit export via Smartwatch Pro</p> <label for="swpdo">Automatic:</label><input id="swpdo" type="checkbox" />
<li class="grey noset ios">
<p class="paddedbottom">Manual Healthkit export via Smartwatch Pro</p>
<a id="swp" href="swpro2hk://"></a>
<p class="small padded">Needs iOS8 (or above) with <a id="swplink" href="itms://itunes.com/app/smartwatchproforpebble" >Smartwatch Pro</a> installed</p>
</li>
<li id="liswp" class="noset ios">
<p>Automatic Healthkit export via Smartwatch Pro</p> <label for="swpdo">Automatic:</label><input id="swpdo" type="checkbox" />
<p class="small">One manual export is required before activating automatic mode</p>
<p class="small">Last result: <span id="swpstat"></span></p>
</li>
Expand Down
30 changes: 30 additions & 0 deletions website/morpheuz/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,30 @@ $('document').ready(function() {
getEl("presult").textContent = postat;
getEl("swpstat").textContent = swpstat;

// Set the status bullets for pushover
if (postat === "OK") {
$("#lipushover").addClass("green");
$("#presult").addClass("green");
} else if (postat === "" || postat === null || postat === "Disabled") {
$("#lipushover").addClass("blue");
$("#presult").addClass("blue");
} else {
$("#lipushover").addClass("red");
$("#presult").addClass("red");
}

// Set the status bullets for smartwach pro
if (swpstat === "OK") {
$("#liswp").addClass("green");
$("#swpstat").addClass("green");
} else if (swpstat === "" || swpstat === null || swpstat === "Disabled") {
$("#liswp").addClass("blue");
$("#swpstat").addClass("blue");
} else {
$("#liswp").addClass("red");
$("#swpstat").addClass("red");
}

getEl("version").textContent = parseInt(vers, 10) / 10;

if ((new Date().valueOf()) % 10 === 0) {
Expand Down Expand Up @@ -410,6 +434,12 @@ $('document').ready(function() {
} else {
$("#swp").hide();
}

getEl('swplink').onclick = function() {
setTimeout(function() {
window.location.href = 'pebblejs://close';
}, 250);
}

// Build the pie chart data
var data2 = [ [ 'Awake?', out.awake ], [ 'Light', out.light ], [ 'Deep', out.deep ], [ 'Ignore', out.ignore ] ];
Expand Down

0 comments on commit 3d70287

Please sign in to comment.