LCARS V0.22 - Fixed alarm and use build in steps function as fallback.
parent
944cbb1136
commit
d8bfad06ae
|
|
@ -19,3 +19,4 @@
|
||||||
0.19: Alarms can not go bigger than 100.
|
0.19: Alarms can not go bigger than 100.
|
||||||
0.20: Use alarm for alarm functionality instead of own implementation.
|
0.20: Use alarm for alarm functionality instead of own implementation.
|
||||||
0.21: Add custom theming.
|
0.21: Add custom theming.
|
||||||
|
0.22: Fix alarm and add build in function for step counting.
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
# LCARS clock
|
# LCARS clock
|
||||||
|
|
||||||
A simple LCARS inspired clock.
|
A simple LCARS inspired clock.
|
||||||
Note: To display the steps, the wpedom app is required. To show weather data
|
To show weather data such as temperature, humidity or window you BangleJS must be connected
|
||||||
such as temperature, humidity or window you BangleJS must be connected
|
|
||||||
with Gadgetbride and the weather app must be installed. To use the timer
|
with Gadgetbride and the weather app must be installed. To use the timer
|
||||||
the "sched" app must be installed on your device.
|
the "sched" app must be installed on your device.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
const TIMER_IDX = "lcars";
|
||||||
const SETTINGS_FILE = "lcars.setting.json";
|
const SETTINGS_FILE = "lcars.setting.json";
|
||||||
const locale = require('locale');
|
const locale = require('locale');
|
||||||
const storage = require('Storage')
|
const storage = require('Storage')
|
||||||
|
|
@ -35,7 +36,7 @@ let lcarsViewPos = 0;
|
||||||
var plotMonth = false;
|
var plotMonth = false;
|
||||||
|
|
||||||
|
|
||||||
function convert24to16(input)
|
function convert24to16(input)
|
||||||
{
|
{
|
||||||
let RGB888 = parseInt(input.replace(/^#/, ''), 16);
|
let RGB888 = parseInt(input.replace(/^#/, ''), 16);
|
||||||
let r = (RGB888 & 0xFF0000) >> 16;
|
let r = (RGB888 & 0xFF0000) >> 16;
|
||||||
|
|
@ -171,7 +172,7 @@ Graphics.prototype.setFontAntonioLarge = function(scale) {
|
||||||
*/
|
*/
|
||||||
var drawTimeout;
|
var drawTimeout;
|
||||||
function queueDraw() {
|
function queueDraw() {
|
||||||
|
|
||||||
// Faster updates during alarm to ensure that it is
|
// Faster updates during alarm to ensure that it is
|
||||||
// shown correctly...
|
// shown correctly...
|
||||||
var timeout = isAlarmEnabled() ? 10000 : 60000;
|
var timeout = isAlarmEnabled() ? 10000 : 60000;
|
||||||
|
|
@ -556,17 +557,20 @@ function draw(){
|
||||||
* Step counter via widget
|
* Step counter via widget
|
||||||
*/
|
*/
|
||||||
function getSteps() {
|
function getSteps() {
|
||||||
|
var steps = 0;
|
||||||
try{
|
try{
|
||||||
if (WIDGETS.wpedom !== undefined) {
|
if (WIDGETS.wpedom !== undefined) {
|
||||||
return WIDGETS.wpedom.getSteps();
|
steps = WIDGETS.wpedom.getSteps();
|
||||||
} else if (WIDGETS.activepedom !== undefined) {
|
} else if (WIDGETS.activepedom !== undefined) {
|
||||||
return WIDGETS.activepedom.getSteps();
|
steps = WIDGETS.activepedom.getSteps();
|
||||||
|
} else {
|
||||||
|
steps = Bangle.getHealthStatus("day").steps;
|
||||||
}
|
}
|
||||||
} catch(ex) {
|
} catch(ex) {
|
||||||
// In case we failed, we can only show 0 steps.
|
// In case we failed, we can only show 0 steps.
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return steps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -639,7 +643,7 @@ function increaseAlarm(){
|
||||||
var minutes = isAlarmEnabled() ? getAlarmMinutes() : 0;
|
var minutes = isAlarmEnabled() ? getAlarmMinutes() : 0;
|
||||||
var alarm = require('sched')
|
var alarm = require('sched')
|
||||||
alarm.setAlarm(TIMER_IDX, {
|
alarm.setAlarm(TIMER_IDX, {
|
||||||
timer : (minutes+5)*60*1000,
|
timer : (minutes+5)*60*1000,
|
||||||
});
|
});
|
||||||
alarm.reload();
|
alarm.reload();
|
||||||
} catch(ex){ }
|
} catch(ex){ }
|
||||||
|
|
@ -654,9 +658,9 @@ function decreaseAlarm(){
|
||||||
alarm.setAlarm(TIMER_IDX, undefined);
|
alarm.setAlarm(TIMER_IDX, undefined);
|
||||||
|
|
||||||
if(minutes > 0){
|
if(minutes > 0){
|
||||||
alarm.setAlarm(TIMER_IDX, {
|
alarm.setAlarm(TIMER_IDX, {
|
||||||
timer : minutes*60*1000,
|
timer : minutes*60*1000,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
alarm.reload();
|
alarm.reload();
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
"name": "LCARS Clock",
|
"name": "LCARS Clock",
|
||||||
"shortName":"LCARS",
|
"shortName":"LCARS",
|
||||||
"icon": "lcars.png",
|
"icon": "lcars.png",
|
||||||
"version":"0.21",
|
"version":"0.22",
|
||||||
"readme": "README.md",
|
"readme": "README.md",
|
||||||
"supports": ["BANGLEJS2"],
|
"supports": ["BANGLEJS2"],
|
||||||
"description": "Library Computer Access Retrieval System (LCARS) clock.",
|
"description": "Library Computer Access Retrieval System (LCARS) clock.",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue