Updated lcars and notanalog to use qalarm
parent
3a03b8cf7c
commit
0fb271dfef
|
|
@ -16,4 +16,4 @@
|
|||
0.16: Improved stability. Wind can now be shown.
|
||||
0.17: Settings for mph/kph and other minor improvements.
|
||||
0.18: Fullscreen mode can now be enabled or disabled in the settings.
|
||||
0.19: Use widtmr for alarm functionality instead of own implementation.
|
||||
0.19: Use qalarm for alarm functionality instead of own implementation.
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
const SETTINGS_FILE = "lcars.setting.json";
|
||||
const locale = require('locale');
|
||||
const storage = require('Storage')
|
||||
const storage = require('Storage');
|
||||
const qalarm = require('qalarm');
|
||||
let settings = {
|
||||
alarm: -1,
|
||||
dataRow1: "Steps",
|
||||
|
|
@ -563,52 +564,26 @@ function getWeather(){
|
|||
/*
|
||||
* Handle alarm
|
||||
*/
|
||||
function isWidtmrAvailable(){
|
||||
try {
|
||||
WIDGETS["widtmr"].isStarted();
|
||||
return true;
|
||||
} catch(e) {
|
||||
// In case the widtmr widget is not installed, the timer can
|
||||
// not be used...
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function isAlarmEnabled(){
|
||||
if(!isWidtmrAvailable()){
|
||||
return false;
|
||||
}
|
||||
|
||||
return WIDGETS["widtmr"].isStarted();
|
||||
return qalarm.isTimerStarted("lcars");
|
||||
}
|
||||
|
||||
function getAlarmMinutes(){
|
||||
if(!isWidtmrAvailable()){
|
||||
return "-";
|
||||
}
|
||||
return WIDGETS["widtmr"].getRemainingMinutes();
|
||||
return qalarm.getTimerMin("lcars");
|
||||
}
|
||||
|
||||
function increaseAlarm(){
|
||||
if(!isWidtmrAvailable()){
|
||||
return;
|
||||
}
|
||||
|
||||
// Set to zero if alarm was disabled before
|
||||
if(!isAlarmEnabled()){
|
||||
WIDGETS["widtmr"].setTimer(0);
|
||||
}
|
||||
|
||||
WIDGETS["widtmr"].increaseTimer(5);
|
||||
WIDGETS["widtmr"].setStarted(true);
|
||||
var mins = qalarm.getTimerMin("lcars")+5;
|
||||
qalarm.deleteTimer("lcars");
|
||||
qalarm.editTimer("lcars", 0, mins, 0);
|
||||
}
|
||||
|
||||
function decreaseAlarm(){
|
||||
if(!isWidtmrAvailable()){
|
||||
return;
|
||||
var mins = qalarm.getTimerMin("lcars")-5;
|
||||
qalarm.deleteTimer("lcars");
|
||||
if(mins > 0){
|
||||
qalarm.editTimer("lcars", 0, mins, 0);
|
||||
}
|
||||
|
||||
WIDGETS["widtmr"].decreaseTimer(5);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
"icon": "lcars.png",
|
||||
"version":"0.19",
|
||||
"readme": "README.md",
|
||||
"dependencies": {"widtmr":"app"},
|
||||
"dependencies": {"qalarm":"app"},
|
||||
"supports": ["BANGLEJS2"],
|
||||
"description": "Library Computer Access Retrieval System (LCARS) clock.",
|
||||
"type": "clock",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
0.01: Launch app.
|
||||
0.02: 12k steps are 360 degrees - improves readability of steps.
|
||||
0.03: Battery improvements through sleep (no minute updates) and partial updates of drawing.
|
||||
0.04: Use widtmr widget for timer instead of own alarm implementation.
|
||||
0.04: Use qalarm for timer instead of own alarm implementation.
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
"readme": "README.md",
|
||||
"supports": ["BANGLEJS2"],
|
||||
"description": "An analog watch face for people that can not read analog watch faces.",
|
||||
"dependencies": {"widtmr":"app"},
|
||||
"dependencies": {"qalarm":"app"},
|
||||
"type": "clock",
|
||||
"tags": "clock",
|
||||
"screenshots": [
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
const locale = require('locale');
|
||||
const storage = require('Storage')
|
||||
const SETTINGS_FILE = "notanalog.setting.json";
|
||||
const qalarm = require('qalarm');
|
||||
let settings = {
|
||||
alarm: -1,
|
||||
};
|
||||
|
|
@ -392,52 +393,26 @@ function queueDraw() {
|
|||
/*
|
||||
* Handle alarm
|
||||
*/
|
||||
function isWidtmrAvailable(){
|
||||
try {
|
||||
WIDGETS["widtmr"].isStarted();
|
||||
return true;
|
||||
} catch(e) {
|
||||
// In case the widtmr widget is not installed, the timer can
|
||||
// not be used...
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function isAlarmEnabled(){
|
||||
if(!isWidtmrAvailable()){
|
||||
return false;
|
||||
}
|
||||
|
||||
return WIDGETS["widtmr"].isStarted();
|
||||
return qalarm.isTimerStarted("lcars");
|
||||
}
|
||||
|
||||
function getAlarmMinutes(){
|
||||
if(!isWidtmrAvailable()){
|
||||
return "-";
|
||||
}
|
||||
return WIDGETS["widtmr"].getRemainingMinutes();
|
||||
return qalarm.getTimerMin("lcars");
|
||||
}
|
||||
|
||||
function increaseAlarm(){
|
||||
if(!isWidtmrAvailable()){
|
||||
return;
|
||||
}
|
||||
|
||||
// Set to zero if alarm was disabled before
|
||||
if(!isAlarmEnabled()){
|
||||
WIDGETS["widtmr"].setTimer(0);
|
||||
}
|
||||
|
||||
WIDGETS["widtmr"].increaseTimer(5);
|
||||
WIDGETS["widtmr"].setStarted(true);
|
||||
var mins = qalarm.getTimerMin("lcars")+5;
|
||||
qalarm.deleteTimer("lcars");
|
||||
qalarm.editTimer("lcars", 0, mins, 0);
|
||||
}
|
||||
|
||||
function decreaseAlarm(){
|
||||
if(!isWidtmrAvailable()){
|
||||
return;
|
||||
var mins = qalarm.getTimerMin("lcars")-5;
|
||||
qalarm.deleteTimer("lcars");
|
||||
if(mins > 0){
|
||||
qalarm.editTimer("lcars", 0, mins, 0);
|
||||
}
|
||||
|
||||
WIDGETS["widtmr"].decreaseTimer(5);
|
||||
}
|
||||
|
||||
function feedback(){
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
Bangle.loadWidgets();
|
||||
|
||||
let alarms = require("Storage").readJSON("qalarm.json", 1) || [];
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue