forked from FOSS/BangleApps
commit
1e420d2ddc
|
@ -4517,7 +4517,7 @@
|
|||
"name": "LCARS Clock",
|
||||
"shortName":"LCARS",
|
||||
"icon": "lcars.png",
|
||||
"version":"0.11",
|
||||
"version":"0.12",
|
||||
"readme": "README.md",
|
||||
"supports": ["BANGLEJS2"],
|
||||
"description": "Library Computer Access Retrieval System (LCARS) clock.",
|
||||
|
|
|
@ -7,5 +7,6 @@
|
|||
0.07: Added settings to adjust data that is shown for each row.
|
||||
0.08: Support for multiple screens. 24h graph for steps + HRM. Fullscreen Mode.
|
||||
0.09: Tab anywhere to open the launcher.
|
||||
0.10: Fix - Clock is unresponsive, if gadgetbridge connects.
|
||||
0.11: Added getting the gadgetbridge weather
|
||||
0.10: Removed swipes to be compatible with the Pattern Launcher. Stability improvements.
|
||||
0.11: Show the gadgetbridge weather temperature (settings).
|
||||
0.12: Added humidity to data.
|
|
@ -4,20 +4,28 @@ A simple LCARS inspired clock.
|
|||
Note: To display the steps, the health app is required. If this app is not installed, the data will not be shown.
|
||||
To contribute you can open a PR at this [GitHub Repo]( https://github.com/peerdavid/BangleApps)
|
||||
|
||||
## Control
|
||||
* Tap left / right to change between screens.
|
||||
* Tap top / bottom to control the current screen.
|
||||
|
||||
## Features
|
||||
* LCARS Style watch face.
|
||||
* Full screen mode - widgets are still loaded.
|
||||
* Supports multiple screens with different data.
|
||||
* Tab anywhere to open the launcher.
|
||||
* [Screen 1] Date + Time + Lock status.
|
||||
* [Screen 1] Shows randomly images of real planets.
|
||||
* [Screen 1] Shows different states such as (charging, out of battery, GPS on etc.)
|
||||
* [Screen 1] Swipe up/down to activate an alarm.
|
||||
* [Screen 1] Shows 3 customizable datapoints on the first screen.
|
||||
* [Screen 1] The lower orange line indicates the battery level.
|
||||
* [Screen 2] Display graphs for steps + hrm on the second screen.
|
||||
* [Screen 2] Switch between day/month via swipe up/down.
|
||||
* Full screen mode - widgets are still loaded but not shown.
|
||||
* Tab on left/right to switch between different screens.
|
||||
* Cusomizable data that is shown on screen 1 (steps, weather etc.)
|
||||
* Shows random images of real planets.
|
||||
* Tap on top/bottom of screen 1 to activate an alarm.
|
||||
* The lower orange line indicates the battery level.
|
||||
* Display graphs for steps + hrm on the second screen.
|
||||
|
||||
## Data that can be configured
|
||||
* Steps - Steps loaded via the health module
|
||||
* Battery - Current battery level in %
|
||||
* VREF - Voltage of battery
|
||||
* HRM - Last measured HRM
|
||||
* Temp - Weather temperature loaded via the weather module + gadgetbridge
|
||||
* Humidity - Humidity loaded via the weather module + gadgetbridge
|
||||
* CoreT - Temperature of device
|
||||
|
||||
## Multiple screens support
|
||||
Access different screens via swipe left/ right
|
||||
|
@ -26,10 +34,7 @@ Access different screens via swipe left/ right
|
|||

|
||||
|
||||
|
||||
## Icons
|
||||
<div>Icons made by <a href="https://www.flaticon.com/authors/smashicons" title="Smashicons">Smashicons</a>, <a href="https://www.freepik.com" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a></div>
|
||||
|
||||
|
||||
## Contributors
|
||||
- Creator: [David Peer](https://github.com/peerdavid).
|
||||
- Initial creation and improvements: [David Peer](https://github.com/peerdavid).
|
||||
- Improvements: [Adam Schmalhofer](https://github.com/adamschmalhofer).
|
||||
- Improvements: [Jon Warrington](https://github.com/BartokW).
|
||||
|
|
|
@ -1,16 +1,11 @@
|
|||
const SETTINGS_FILE = "lcars.setting.json";
|
||||
const Storage = require("Storage");
|
||||
const weather = require('weather');
|
||||
|
||||
|
||||
// ...and overwrite them with any saved values
|
||||
// This way saved values are preserved if a new version adds more settings
|
||||
const locale = require('locale');
|
||||
const storage = require('Storage')
|
||||
let settings = {
|
||||
alarm: -1,
|
||||
dataRow1: "Battery",
|
||||
dataRow2: "Steps",
|
||||
dataRow3: "Temp."
|
||||
dataRow1: "Steps",
|
||||
dataRow2: "Temp",
|
||||
dataRow3: "Battery"
|
||||
};
|
||||
let saved_settings = storage.readJSON(SETTINGS_FILE, 1) || settings;
|
||||
for (const key in saved_settings) {
|
||||
|
@ -33,13 +28,13 @@ let cGrey = "#9E9E9E";
|
|||
let lcarsViewPos = 0;
|
||||
let drag;
|
||||
let hrmValue = 0;
|
||||
var plotWeek = false;
|
||||
var plotMonth = false;
|
||||
var disableInfoUpdate = true; // When gadgetbridge connects, step infos cannot be loaded
|
||||
|
||||
/*
|
||||
* Requirements and globals
|
||||
*/
|
||||
const locale = require('locale');
|
||||
|
||||
|
||||
var bgLeft = {
|
||||
width : 27, height : 176, bpp : 3,
|
||||
|
@ -123,37 +118,35 @@ function queueDraw() {
|
|||
|
||||
function printData(key, y, c){
|
||||
g.setFontAlign(-1,-1,0);
|
||||
var text = "ERR";
|
||||
var value = "NOT FOUND";
|
||||
key = key.toUpperCase()
|
||||
var text = key;
|
||||
var value = "ERR";
|
||||
|
||||
if(key == "Battery"){
|
||||
text = "BAT";
|
||||
value = E.getBattery() + "%";
|
||||
|
||||
} else if(key == "Steps"){
|
||||
if(key == "STEPS"){
|
||||
text = "STEP";
|
||||
value = getSteps();
|
||||
|
||||
} else if(key == "Temp."){
|
||||
text = "TEMP";
|
||||
value = Math.floor(E.getTemperature()) + "C";
|
||||
|
||||
} else if(key == "HRM"){
|
||||
text = "HRM";
|
||||
value = hrmValue;
|
||||
} else if(key == "BATTERY"){
|
||||
text = "BAT";
|
||||
value = E.getBattery() + "%";
|
||||
|
||||
} else if (key == "VREF"){
|
||||
text = "VREF";
|
||||
value = E.getAnalogVRef().toFixed(2) + "V";
|
||||
|
||||
} else if (key == "Weather"){
|
||||
text = "TEMP";
|
||||
const w = weather.get();
|
||||
if (!w) {
|
||||
value = "ERR";
|
||||
} else {
|
||||
value = require('locale').temp(w.temp-273.15); // applies conversion
|
||||
}
|
||||
} else if(key == "HRM"){
|
||||
value = hrmValue;
|
||||
|
||||
} else if (key == "TEMP"){
|
||||
var weather = getWeather();
|
||||
value = weather.temp;
|
||||
|
||||
} else if (key == "HUMIDITY"){
|
||||
text = "HUM";
|
||||
var weather = getWeather();
|
||||
value = parseInt(weather.hum) + "%";
|
||||
|
||||
} else if(key == "CORET"){
|
||||
value = locale.temp(parseInt(E.getTemperature()));
|
||||
}
|
||||
|
||||
g.setColor(c);
|
||||
|
@ -309,7 +302,7 @@ function drawPosition1(){
|
|||
}
|
||||
|
||||
// Plot HRM graph
|
||||
if(plotWeek){
|
||||
if(plotMonth){
|
||||
var data = new Uint16Array(32);
|
||||
var cnt = new Uint8Array(32);
|
||||
health.readDailySummaries(new Date(), h=>{
|
||||
|
@ -346,8 +339,8 @@ function drawPosition1(){
|
|||
g.setFontAlign(1, 1, 0);
|
||||
g.setFontAntonioMedium();
|
||||
g.setColor(cWhite);
|
||||
g.drawString("WEEK HRM", 154, 27);
|
||||
g.drawString("WEEK STEPS [K]", 154, 115);
|
||||
g.drawString("M-HRM", 154, 27);
|
||||
g.drawString("M-STEPS [K]", 154, 115);
|
||||
|
||||
// Plot day
|
||||
} else {
|
||||
|
@ -387,8 +380,8 @@ function drawPosition1(){
|
|||
g.setFontAlign(1, 1, 0);
|
||||
g.setFontAntonioMedium();
|
||||
g.setColor(cWhite);
|
||||
g.drawString("DAY HRM", 154, 27);
|
||||
g.drawString("DAY STEPS", 154, 115);
|
||||
g.drawString("D-HRM", 154, 27);
|
||||
g.drawString("D-STEPS", 154, 115);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -429,6 +422,32 @@ function getSteps() {
|
|||
}
|
||||
|
||||
|
||||
function getWeather(){
|
||||
var weather;
|
||||
|
||||
try {
|
||||
weather = require('weather').get();
|
||||
} catch(ex) {
|
||||
// Return default
|
||||
}
|
||||
|
||||
if (weather === undefined){
|
||||
weather = {
|
||||
temp: "-",
|
||||
hum: "-",
|
||||
txt: "-",
|
||||
wind: "-",
|
||||
wdir: "-",
|
||||
wrose: "-"
|
||||
};
|
||||
} else {
|
||||
weather.temp = locale.temp(parseInt(weather.temp-273.15))
|
||||
}
|
||||
|
||||
return weather;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle alarm
|
||||
*/
|
||||
|
@ -467,7 +486,7 @@ function handleAlarm(){
|
|||
.then(() => {
|
||||
// Update alarm state to disabled
|
||||
settings.alarm = -1;
|
||||
Storage.writeJSON(SETTINGS_FILE, settings);
|
||||
storage.writeJSON(SETTINGS_FILE, settings);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -507,7 +526,7 @@ function increaseAlarm(){
|
|||
settings.alarm = getCurrentTimeInMinutes() + 5;
|
||||
}
|
||||
|
||||
Storage.writeJSON(SETTINGS_FILE, settings);
|
||||
storage.writeJSON(SETTINGS_FILE, settings);
|
||||
}
|
||||
|
||||
|
||||
|
@ -518,7 +537,7 @@ function decreaseAlarm(){
|
|||
settings.alarm = -1;
|
||||
}
|
||||
|
||||
Storage.writeJSON(SETTINGS_FILE, settings);
|
||||
storage.writeJSON(SETTINGS_FILE, settings);
|
||||
}
|
||||
|
||||
function feedback(){
|
||||
|
@ -562,9 +581,9 @@ Bangle.on('touch', function(btn, e){
|
|||
drawState();
|
||||
return;
|
||||
}
|
||||
} else if (lcarsViewPos == 1 && (is_upper || is_lower) && plotWeek != is_lower){
|
||||
} else if (lcarsViewPos == 1 && (is_upper || is_lower) && plotMonth != is_lower){
|
||||
feedback();
|
||||
plotWeek = is_lower;
|
||||
plotMonth = is_lower;
|
||||
draw();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
alarm: -1,
|
||||
dataRow1: "Battery",
|
||||
dataRow2: "Steps",
|
||||
dataRow3: "Temp."
|
||||
dataRow3: "Temp"
|
||||
};
|
||||
let saved_settings = storage.readJSON(SETTINGS_FILE, 1) || settings;
|
||||
for (const key in saved_settings) {
|
||||
|
@ -18,14 +18,14 @@
|
|||
storage.write(SETTINGS_FILE, settings)
|
||||
}
|
||||
|
||||
var data_options = ["Battery", "Steps", "Temp.", "HRM", "VREF", "Weather"];
|
||||
var data_options = ["Steps", "Battery", "VREF", "HRM", "Temp", "Humidity", "CoreT"];
|
||||
|
||||
E.showMenu({
|
||||
'': { 'title': 'LCARS Clock' },
|
||||
'< Back': back,
|
||||
'Row 1': {
|
||||
value: 0 | data_options.indexOf(settings.dataRow1),
|
||||
min: 0, max: 5,
|
||||
min: 0, max: 6,
|
||||
format: v => data_options[v],
|
||||
onchange: v => {
|
||||
settings.dataRow1 = data_options[v];
|
||||
|
@ -34,7 +34,7 @@
|
|||
},
|
||||
'Row 2': {
|
||||
value: 0 | data_options.indexOf(settings.dataRow2),
|
||||
min: 0, max: 5,
|
||||
min: 0, max: 6,
|
||||
format: v => data_options[v],
|
||||
onchange: v => {
|
||||
settings.dataRow2 = data_options[v];
|
||||
|
@ -43,7 +43,7 @@
|
|||
},
|
||||
'Row 3': {
|
||||
value: 0 | data_options.indexOf(settings.dataRow3),
|
||||
min: 0, max: 5,
|
||||
min: 0, max: 6,
|
||||
format: v => data_options[v],
|
||||
onchange: v => {
|
||||
settings.dataRow3 = data_options[v];
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.6 KiB |
Loading…
Reference in New Issue