mirror of https://github.com/espruino/BangleApps
Merge branch 'master' into modules-lint
commit
a00f1b6568
|
@ -4,6 +4,7 @@ module.exports = {
|
|||
"env": {
|
||||
// TODO: "espruino": false
|
||||
// TODO: "banglejs": false
|
||||
// For a prototype of the above, see https://github.com/espruino/BangleApps/pull/3237
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"globals": {
|
||||
|
@ -25,10 +26,8 @@ module.exports = {
|
|||
"Flash": "readonly",
|
||||
"Float32Array": "readonly",
|
||||
"Float64Array": "readonly",
|
||||
"fs": "readonly",
|
||||
"Function": "readonly",
|
||||
"Graphics": "readonly",
|
||||
"heatshrink": "readonly",
|
||||
"I2C": "readonly",
|
||||
"Int16Array": "readonly",
|
||||
"Int32Array": "readonly",
|
||||
|
@ -48,11 +47,9 @@ module.exports = {
|
|||
"RegExp": "readonly",
|
||||
"Serial": "readonly",
|
||||
"SPI": "readonly",
|
||||
"Storage": "readonly",
|
||||
"StorageFile": "readonly",
|
||||
"String": "readonly",
|
||||
"SyntaxError": "readonly",
|
||||
"tensorflow": "readonly",
|
||||
"TFMicroInterpreter": "readonly",
|
||||
"TypeError": "readonly",
|
||||
"Uint16Array": "readonly",
|
||||
|
@ -60,8 +57,10 @@ module.exports = {
|
|||
"Uint32Array": "readonly",
|
||||
"Uint8Array": "readonly",
|
||||
"Uint8ClampedArray": "readonly",
|
||||
"Unistroke": "readonly",
|
||||
"Waveform": "readonly",
|
||||
// Methods and Fields at https://banglejs.com/reference
|
||||
"__FILE__": "readonly",
|
||||
"analogRead": "readonly",
|
||||
"analogWrite": "readonly",
|
||||
"arguments": "readonly",
|
||||
|
@ -131,7 +130,41 @@ module.exports = {
|
|||
"VIBRATE": "readonly",
|
||||
// Aliases and not defined at https://banglejs.com/reference
|
||||
"g": "readonly",
|
||||
"WIDGETS": "readonly"
|
||||
"WIDGETS": "readonly",
|
||||
"module": "readonly",
|
||||
"exports": "writable",
|
||||
"D0": "readonly",
|
||||
"D1": "readonly",
|
||||
"D2": "readonly",
|
||||
"D3": "readonly",
|
||||
"D4": "readonly",
|
||||
"D5": "readonly",
|
||||
"D6": "readonly",
|
||||
"D7": "readonly",
|
||||
"D8": "readonly",
|
||||
"D9": "readonly",
|
||||
"D10": "readonly",
|
||||
"D11": "readonly",
|
||||
"D12": "readonly",
|
||||
"D13": "readonly",
|
||||
"D14": "readonly",
|
||||
"D15": "readonly",
|
||||
"D16": "readonly",
|
||||
"D17": "readonly",
|
||||
"D18": "readonly",
|
||||
"D19": "readonly",
|
||||
"D20": "readonly",
|
||||
"D21": "readonly",
|
||||
"D22": "readonly",
|
||||
"D23": "readonly",
|
||||
"D24": "readonly",
|
||||
"D25": "readonly",
|
||||
"D26": "readonly",
|
||||
"D27": "readonly",
|
||||
"D28": "readonly",
|
||||
"D29": "readonly",
|
||||
"D30": "readonly",
|
||||
"D31": "readonly"
|
||||
},
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 11
|
||||
|
@ -154,8 +187,7 @@ module.exports = {
|
|||
"no-unreachable": "warn",
|
||||
"no-cond-assign": "warn",
|
||||
"no-useless-catch": "warn",
|
||||
// TODO: "no-undef": "warn",
|
||||
"no-undef": "off",
|
||||
"no-undef": "warn",
|
||||
"no-unused-vars": ["warn", { "args": "none" } ],
|
||||
"no-useless-escape": "off",
|
||||
"no-control-regex" : "off"
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
0.01: New Widget!
|
||||
0.02: Minor code improvements
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "1button",
|
||||
"name": "One-Button-Tracker",
|
||||
"version": "0.01",
|
||||
"version": "0.02",
|
||||
"description": "A widget that turns BTN1 into a tracker, records time of button press/release.",
|
||||
"icon": "widget.png",
|
||||
"type": "widget",
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
console.log("Button let go");
|
||||
digitalWrite(LED2,0);
|
||||
var unpress_time = new Date();
|
||||
recFile = require("Storage").open("one_button_presses.csv","a");
|
||||
const recFile = require("Storage").open("one_button_presses.csv","a");
|
||||
recFile.write([press_time.getTime(),unpress_time.getTime()].join(",")+"\n");
|
||||
}, BTN1, { repeat: true, edge: 'falling', debounce: 50 });
|
||||
|
||||
|
|
|
@ -2,3 +2,4 @@
|
|||
0.02: Faster maze generation
|
||||
0.03: Avoid clearing bottom widgets
|
||||
0.04: Minor code improvements
|
||||
0.05: Minor code improvements
|
||||
|
|
|
@ -206,7 +206,7 @@ function Maze(n) {
|
|||
return false;
|
||||
};
|
||||
this.tick = function() {
|
||||
accel = Bangle.getAccel();
|
||||
let accel = Bangle.getAccel();
|
||||
if (this.ball_x%this.wall_length) {
|
||||
this.try_move_horizontally(accel.x);
|
||||
} else if (this.ball_y%this.wall_length) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{ "id": "acmaze",
|
||||
"name": "AccelaMaze",
|
||||
"shortName":"AccelaMaze",
|
||||
"version": "0.04",
|
||||
"version": "0.05",
|
||||
"description": "Tilt the watch to roll a ball through a maze.",
|
||||
"icon": "app.png",
|
||||
"tags": "game",
|
||||
|
|
|
@ -8,3 +8,4 @@
|
|||
0.08: Fixed zero steps issue caused by 0.07
|
||||
0.09: Prettied up user interface, decluttered graphs
|
||||
0.10: Minor code improvements
|
||||
0.11: Minor code improvements
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"id": "activepedom",
|
||||
"name": "Active Pedometer",
|
||||
"shortName": "Active Pedometer",
|
||||
"version": "0.10",
|
||||
"version": "0.11",
|
||||
"description": "(NOT RECOMMENDED) Pedometer that filters out arm movement and displays a step goal progress. Steps are saved to a daily file and can be viewed as graph. The `Health` app now provides step logging and graphs.",
|
||||
"icon": "app.png",
|
||||
"tags": "outdoors,widget",
|
||||
|
|
|
@ -32,10 +32,10 @@
|
|||
}
|
||||
|
||||
function storeData() {
|
||||
now = new Date();
|
||||
month = now.getMonth() + 1; //month is 0-based
|
||||
let now = new Date();
|
||||
let month = now.getMonth() + 1; //month is 0-based
|
||||
if (month < 10) month = "0" + month; //leading 0
|
||||
filename = filename = "activepedom" + now.getFullYear() + month + now.getDate() + ".data"; //new file for each day
|
||||
let filename = "activepedom" + now.getFullYear() + month + now.getDate() + ".data"; //new file for each day
|
||||
dataFile = s.open(filename,"a");
|
||||
if (dataFile) { //check if filen already exists
|
||||
if (dataFile.getLength() == 0) {
|
||||
|
@ -222,16 +222,17 @@
|
|||
if (on) WIDGETS["activepedom"].draw();
|
||||
});
|
||||
|
||||
//Read data from file and set variables
|
||||
let pedomData = s.readJSON(PEDOMFILE,1);
|
||||
if (pedomData) {
|
||||
if (pedomData.lastUpdate) lastUpdate = new Date(pedomData.lastUpdate);
|
||||
stepsCounted = pedomData.stepsToday|0;
|
||||
stepsTooShort = pedomData.stepsTooShort;
|
||||
stepsTooLong = pedomData.stepsTooLong;
|
||||
stepsOutsideTime = pedomData.stepsOutsideTime;
|
||||
// Read data from file and set variables
|
||||
{ // new scope ensures pedomData gets freed
|
||||
let pedomData = s.readJSON(PEDOMFILE,1);
|
||||
if (pedomData) {
|
||||
if (pedomData.lastUpdate) lastUpdate = new Date(pedomData.lastUpdate);
|
||||
stepsCounted = pedomData.stepsToday|0;
|
||||
stepsTooShort = pedomData.stepsTooShort;
|
||||
stepsTooLong = pedomData.stepsTooLong;
|
||||
stepsOutsideTime = pedomData.stepsOutsideTime;
|
||||
}
|
||||
}
|
||||
pedomdata = 0; //reset pedomdata to save memory
|
||||
|
||||
setStepSensitivity(setting('stepSensitivity')); //set step sensitivity (80 is standard, 400 is muss less sensitive)
|
||||
/*timerStoreData =*/ setInterval(storeData, storeDataInterval); //store data regularly
|
||||
|
|
|
@ -13,3 +13,4 @@
|
|||
0.09: Use default Bangle formatter for booleans
|
||||
0.10: Use Bangle.setUI({remove:...}) to allow loading the launcher without a full reset on 2v16
|
||||
Modified to avoid leaving functions defined when using setUI({remove:...})
|
||||
0.11: Minor code improvements
|
||||
|
|
|
@ -107,7 +107,7 @@ let isoStr = function(date) {
|
|||
|
||||
let calWeekBuffer = [false,false,false]; //buffer tz, date, week no (once calculated until other tz or date is requested)
|
||||
let ISO8601calWeek = function(date) { //copied from: https://gist.github.com/IamSilviu/5899269#gistcomment-3035480
|
||||
dateNoTime = date; dateNoTime.setHours(0,0,0,0);
|
||||
const dateNoTime = date; dateNoTime.setHours(0,0,0,0);
|
||||
if (calWeekBuffer[0] === date.getTimezoneOffset() && calWeekBuffer[1] === dateNoTime) return calWeekBuffer[2];
|
||||
calWeekBuffer[0] = date.getTimezoneOffset();
|
||||
calWeekBuffer[1] = dateNoTime;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"id": "antonclkplus",
|
||||
"name": "Anton Clock Plus",
|
||||
"shortName": "Anton Clock+",
|
||||
"version": "0.10",
|
||||
"version": "0.11",
|
||||
"description": "A clock using the bold Anton font, optionally showing seconds and date in ISO-8601 format.",
|
||||
"readme":"README.md",
|
||||
"icon": "app.png",
|
||||
|
|
|
@ -7,3 +7,4 @@
|
|||
0.07: Added potato GLaDOS and quote functionality when you tap her
|
||||
0.08: Fixed drawing issues with the quotes and added more
|
||||
0.09: Minor code improvements
|
||||
0.10: Minor code improvements
|
||||
|
|
|
@ -136,6 +136,7 @@ else if (img == "apetureLaboratoriesLight"){
|
|||
function drawStart(){
|
||||
g.clear();
|
||||
g.reset();
|
||||
let apSciLab;
|
||||
if (g.theme.dark){apSciLab = getImg("apetureLaboratories");}
|
||||
else {apSciLab = getImg("apetureLaboratoriesLight");}
|
||||
g.drawImage(apSciLab, xyCenter-apSciLab.width/2, xyCenter-apSciLab.height/2);
|
||||
|
@ -241,7 +242,7 @@ function buttonPressed(){
|
|||
if (curWarning < maxWarning) curWarning += 1;
|
||||
else curWarning = 0;
|
||||
g.reset();
|
||||
buttonImg = getImg("butPress");
|
||||
const buttonImg = getImg("butPress");
|
||||
g.drawImage(buttonImg, 0, 0);
|
||||
|
||||
warningImg = getImg("w"+String(curWarning));
|
||||
|
@ -251,7 +252,7 @@ function buttonPressed(){
|
|||
}
|
||||
function buttonUnpressed(){
|
||||
if (!pause){
|
||||
buttonImg = getImg("butUnpress");
|
||||
const buttonImg = getImg("butUnpress");
|
||||
g.drawImage(buttonImg, 0, 0);
|
||||
}
|
||||
else{
|
||||
|
@ -277,11 +278,12 @@ function draw() {
|
|||
|
||||
g.reset(); // default draw styles
|
||||
//draw watchface
|
||||
let apSciWatch;
|
||||
if (g.theme.dark){apSciWatch = getImg("apetureWatch");}
|
||||
else {apSciWatch = getImg("apetureWatchLight");}
|
||||
g.drawImage(apSciWatch, xyCenter-apSciWatch.width/2, xyCenter-apSciWatch.height/2);
|
||||
|
||||
potato = getImg("potato");
|
||||
const potato = getImg("potato");
|
||||
g.drawImage(potato, 118, 118);
|
||||
|
||||
g.drawImage(warningImg, 1, g.getWidth()-61);//update warning
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"id": "aptsciclk",
|
||||
"name": "Apeture Science Clock",
|
||||
"shortName":"AptSci Clock",
|
||||
"version": "0.09",
|
||||
"version": "0.10",
|
||||
"description": "A clock based on the portal series",
|
||||
"icon": "app.png",
|
||||
"screenshots": [{"url":"screenshot.png"}],
|
||||
|
|
|
@ -5,3 +5,4 @@
|
|||
0.05: Enable widgets
|
||||
0.06: Fix azimuth (bug #2651), only show degrees
|
||||
0.07: Minor code improvements
|
||||
0.08: Minor code improvements
|
||||
|
|
|
@ -23,7 +23,7 @@ function drawMoon(phase, x, y) {
|
|||
"waning-crescent",
|
||||
];
|
||||
|
||||
img = require("Storage").read(`${moonImgFiles[phase]}.img`);
|
||||
const img = require("Storage").read(`${moonImgFiles[phase]}.img`);
|
||||
// image width & height = 92px
|
||||
g.drawImage(img, x - parseInt(92 / 2), y);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "astrocalc",
|
||||
"name": "Astrocalc",
|
||||
"version": "0.07",
|
||||
"version": "0.08",
|
||||
"description": "Calculates interesting information on the sun like sunset and sunrise and moon cycles for the current day based on your location from MyLocation app",
|
||||
"icon": "astrocalc.png",
|
||||
"tags": "app,sun,moon,cycles,tool,outdoors",
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
0.01: Beta version for Bangle 2 paired with Chrome (2021/12/11)
|
||||
0.02: The app is now a clock, the data is greyed after the connection is lost (2021/12/22)
|
||||
0.03: Set the Awair's IP directly on the webpage (2021/12/27)
|
||||
0.04: Minor code improvements
|
||||
|
|
|
@ -80,7 +80,7 @@ function draw() {
|
|||
g.drawString(""+bt_current_humi, 123, 110);
|
||||
g.drawString(""+bt_current_temp, 158, 110);
|
||||
|
||||
for (i = 0; i < 10; i++) {
|
||||
for (let i = 0; i < 10; i++) {
|
||||
if (display_frozen) { g.setColor("#888"); }
|
||||
|
||||
// max height = 32
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"icon": "app.png",
|
||||
"screenshots": [{"url":"screenshot.png"}],
|
||||
"allow_emulator": true,
|
||||
"version":"0.03",
|
||||
"version": "0.04",
|
||||
"description": "Displays the level of CO2, VOC, PM 2.5, Humidity and Temperature, from your Awair device.",
|
||||
"type": "clock",
|
||||
"tags": "clock,tool,health",
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
0.01: Initial version of Balltastic released! Happy!
|
||||
0.02: Set LCD timeout for Espruino 2v10 compatibility
|
||||
0.03: Now also works on Bangle.js 2
|
||||
0.04: Minor code improvements
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
BANGLEJS2 = process.env.HWVERSION==2;
|
||||
const BANGLEJS2 = process.env.HWVERSION==2;
|
||||
Bangle.setLCDBrightness(1);
|
||||
if (!BANGLEJS2) Bangle.setLCDMode("doublebuffered");
|
||||
Bangle.setLCDTimeout(0);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "balltastic",
|
||||
"name": "Balltastic",
|
||||
"version": "0.03",
|
||||
"version": "0.04",
|
||||
"description": "Simple but fun ball eats dots game.",
|
||||
"icon": "app.png",
|
||||
"screenshots": [{"url":"bangle2-balltastic-screenshot.png"}],
|
||||
|
|
|
@ -4,3 +4,4 @@
|
|||
Clean up code
|
||||
0.03: Add software back button on main menu
|
||||
0.04: Minor code improvements
|
||||
0.05: Minor code improvements
|
||||
|
|
|
@ -148,7 +148,7 @@ function accelHandler(accel) {
|
|||
|
||||
// slope for Z
|
||||
if (exerciseType.useZaxis) {
|
||||
l = historyAvgZ.length;
|
||||
let l = historyAvgZ.length;
|
||||
if (l > 1) {
|
||||
const p1 = historyAvgZ[l - 2];
|
||||
const p2 = historyAvgZ[l - 1];
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{ "id": "banglexercise",
|
||||
"name": "BanglExercise",
|
||||
"shortName":"BanglExercise",
|
||||
"version": "0.04",
|
||||
"version": "0.05",
|
||||
"description": "Can automatically track exercises while wearing the Bangle.js watch.",
|
||||
"icon": "app.png",
|
||||
"screenshots": [{"url":"screenshot.png"}],
|
||||
|
|
|
@ -11,3 +11,4 @@
|
|||
0.11: Initial port to the BangleJS2
|
||||
0.12: Remove debug log
|
||||
0.13: Minor code improvements
|
||||
0.14: Minor code improvements
|
||||
|
|
|
@ -101,6 +101,7 @@ function loadLinesFromFile(requestedLineCount, fileName) {
|
|||
|
||||
var readFile = Storage.open(fileName, "r");
|
||||
|
||||
let nextLine;
|
||||
while ((nextLine = readFile.readLine())) {
|
||||
if(nextLine) {
|
||||
allLines.push(nextLine);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"id": "batchart",
|
||||
"name": "Battery Chart",
|
||||
"shortName": "Battery Chart",
|
||||
"version": "0.13",
|
||||
"version": "0.14",
|
||||
"description": "A widget and an app for recording and visualizing battery percentage over time.",
|
||||
"icon": "app.png",
|
||||
"tags": "app,widget,battery,time,record,chart,tool",
|
||||
|
|
|
@ -5,3 +5,4 @@
|
|||
0.05: proper fix for the race condition in queueDraw()
|
||||
0.06: Tell clock widgets to hide.
|
||||
0.07: Better battery graphic - now has green, yellow and red sections; battery status reflected in the bar across the middle of the screen; current battery state checked only once every 15 minutes, leading to longer-lasting battery charge
|
||||
0.08: Minor code improvements
|
||||
|
|
|
@ -31,7 +31,7 @@ function draw() {
|
|||
var dow = require("date_utils").dows(0,1)[date.getDay()];
|
||||
|
||||
if ((date.getTime() >= lastBattCheck + 15*60000) || Bangle.isCharging()) {
|
||||
lastBattcheck = date.getTime();
|
||||
lastBattCheck = date.getTime();
|
||||
width = E.getBattery();
|
||||
width += width/2;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{ "id": "bigdclock",
|
||||
"name": "Big digit clock containing just the essentials",
|
||||
"shortName":"Big digit clk",
|
||||
"version":"0.07",
|
||||
"version": "0.08",
|
||||
"description": "A clock containing just the essentials, made as easy to read as possible for those of us that need glasses. It contains the time, the day-of-week, the day-of-month, and the current battery state-of-charge.",
|
||||
"icon": "bigdclock.png",
|
||||
"type": "clock",
|
||||
|
|
|
@ -4,3 +4,4 @@
|
|||
0.04: Add options for units in locale and recording GPS
|
||||
0.05: Allow toggling of "max" values (screen tap) and recording (button press)
|
||||
0.06: Fix local unit setting
|
||||
0.07: Minor code improvements
|
||||
|
|
|
@ -409,7 +409,8 @@ function updateClock() {
|
|||
|
||||
if ( emulator ) {
|
||||
max.spd++; max.alt++;
|
||||
d=new Date(); sec=d.getSeconds();
|
||||
const d=new Date();
|
||||
sec=d.getSeconds();
|
||||
onGPS(lf);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"id": "bikespeedo",
|
||||
"name": "Bike Speedometer (beta)",
|
||||
"shortName": "Bike Speedometer",
|
||||
"version": "0.06",
|
||||
"version": "0.07",
|
||||
"description": "Shows GPS speed, GPS heading, Compass heading, GPS altitude and Barometer altitude from internal sources",
|
||||
"icon": "app.png",
|
||||
"screenshots": [{"url":"Screenshot.png"}],
|
||||
|
|
|
@ -5,3 +5,4 @@
|
|||
0.05: move setUI() up before draw() as to not have a false positive 'sanity
|
||||
check' when building on github.
|
||||
0.06: Minor code improvements
|
||||
0.07: Minor code improvements
|
||||
|
|
|
@ -136,7 +136,7 @@ var cgimg;
|
|||
*/
|
||||
function drawSquare(gfx, x, y, data, numOfBits) {
|
||||
|
||||
for(i = numOfBits; i > 0 ; i--) {
|
||||
for(let i = numOfBits; i > 0 ; i--) {
|
||||
if( (data & 1) != 0) {
|
||||
gfx.fillRect(x + (i - 1) * x_step, y,
|
||||
x + i * x_step , y + y_step);
|
||||
|
@ -245,7 +245,7 @@ function drawBattery(gfx, level) {
|
|||
var pos_y = bat_pos_y - 1;
|
||||
var stepLevel = Math.round((level + 10) / 20);
|
||||
|
||||
for(i = 0; i < stepLevel; i++) {
|
||||
for(let i = 0; i < stepLevel; i++) {
|
||||
pos_y -= bat_size_y + 2;
|
||||
gfx.fillRect(bat_pos_x, pos_y,
|
||||
bat_pos_x + bat_size_x, pos_y + bat_size_y);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"shortName":"BinWatch",
|
||||
"icon": "app.png",
|
||||
"screenshots": [{"url":"screenshot.png"}],
|
||||
"version": "0.06",
|
||||
"version": "0.07",
|
||||
"supports": ["BANGLEJS2"],
|
||||
"readme": "README.md",
|
||||
"allow_emulator":true,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
...
|
||||
0.02: First update with ChangeLog Added
|
||||
0.03: updated watch face to use the ClockFace library
|
||||
0.04: Minor code improvements
|
||||
|
|
|
@ -34,10 +34,10 @@ const background = {
|
|||
),
|
||||
};
|
||||
|
||||
numbersDims = {
|
||||
/*const numbersDims = {
|
||||
width: 20,
|
||||
height: 44,
|
||||
};
|
||||
};*/
|
||||
const numbers = [
|
||||
require("heatshrink").decompress(
|
||||
atob(
|
||||
|
@ -88,7 +88,7 @@ const numbers = [
|
|||
)
|
||||
),
|
||||
];
|
||||
digitPositions = [
|
||||
const digitPositions = [
|
||||
// relative to the box
|
||||
{ x: 13, y: 6 },
|
||||
{ x: 32, y: 6 },
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"id": "bowserWF",
|
||||
"name": "Bowser Watchface",
|
||||
"shortName": "Bowser Watchface",
|
||||
"version": "0.03",
|
||||
"version": "0.04",
|
||||
"description": "Let bowser show you the time",
|
||||
"icon": "app.png",
|
||||
"type": "clock",
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
0.01: New app!
|
||||
0.02: Minor code improvements
|
||||
0.03: Minor code improvements
|
||||
|
|
|
@ -51,9 +51,9 @@ g.setFont("6x8", 2);
|
|||
function circle() {
|
||||
|
||||
g.clear();
|
||||
adjusted_radius = max_radius * Math.abs(origin);
|
||||
const adjusted_radius = max_radius * Math.abs(origin);
|
||||
g.drawCircle(120, 120, adjusted_radius);
|
||||
radius = Math.abs(Math.sin(origin));
|
||||
//const radius = Math.abs(Math.sin(origin));
|
||||
angle += 2;
|
||||
origin = angle * (Math.PI / 180);
|
||||
if (angle >= 0 && angle < 90) {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"id": "breath",
|
||||
"name": "Breathing App",
|
||||
"shortName": "Breathing App",
|
||||
"version": "0.02",
|
||||
"version": "0.03",
|
||||
"description": "app to aid relaxation and train breath syncronicity using haptics and visualisation, also displays HR",
|
||||
"icon": "app-icon.png",
|
||||
"tags": "tools,health",
|
||||
|
|
|
@ -41,3 +41,4 @@
|
|||
Additional logging on errors
|
||||
Add debug option for disabling active scanning
|
||||
0.17: New GUI based on layout library
|
||||
0.18: Minor code improvements
|
||||
|
|
|
@ -6,7 +6,7 @@ exports.enable = () => {
|
|||
|
||||
var log = function(text, param){
|
||||
if (global.showStatusInfo)
|
||||
showStatusInfo(text);
|
||||
global.showStatusInfo(text);
|
||||
if (settings.debuglog){
|
||||
var logline = new Date().toISOString() + " - " + text;
|
||||
if (param) logline += ": " + JSON.stringify(param);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"id": "bthrm",
|
||||
"name": "Bluetooth Heart Rate Monitor",
|
||||
"shortName": "BT HRM",
|
||||
"version": "0.17",
|
||||
"version": "0.18",
|
||||
"description": "Overrides Bangle.js's build in heart rate monitor with an external Bluetooth one.",
|
||||
"icon": "app.png",
|
||||
"screenshots": [{"url":"screen.png"}],
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
name : "BT HR",
|
||||
fields : ["BT Heartrate", "BT Battery", "Energy expended", "Contact", "RR"],
|
||||
getValues : () => {
|
||||
result = [bpm,bat,energy,contact,rr];
|
||||
const result = [bpm,bat,energy,contact,rr];
|
||||
bpm = "";
|
||||
rr = "";
|
||||
bat = "";
|
||||
|
|
|
@ -2,3 +2,4 @@
|
|||
0.02: Write available data on reset or kill
|
||||
0.03: Buzz short on every finished measurement and longer if all are done
|
||||
0.04: Minor code improvements
|
||||
0.05: Minor code improvements
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"id": "bthrv",
|
||||
"name": "Bluetooth Heart Rate variance calculator",
|
||||
"shortName": "BT HRV",
|
||||
"version": "0.04",
|
||||
"version": "0.05",
|
||||
"description": "Calculates HRV from a a BT HRM with interval data",
|
||||
"icon": "app.png",
|
||||
"type": "app",
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
result = [hrv];
|
||||
const result = [hrv];
|
||||
hrv = "";
|
||||
rrHistory = [];
|
||||
return result;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
0.01: New App!
|
||||
0.02: Use fractional numbers and scale the points to keep working consistently on whole screen
|
||||
0.03: Use default Bangle formatter for booleans
|
||||
0.04: Minor code improvements
|
||||
|
|
|
@ -129,7 +129,7 @@ class BanglejsApp {
|
|||
|
||||
E.srand(Date.now());
|
||||
|
||||
calibration = new BanglejsApp();
|
||||
const calibration = new BanglejsApp();
|
||||
calibration.load_settings();
|
||||
Bangle.disableCalibration = true;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "Touchscreen Calibration",
|
||||
"shortName":"Calibration",
|
||||
"icon": "calibration.png",
|
||||
"version":"0.03",
|
||||
"version": "0.04",
|
||||
"description": "(NOT RECOMMENDED) A simple calibration app for the touchscreen. Please use the Touchscreen Calibration in the Settings app instead.",
|
||||
"supports": ["BANGLEJS","BANGLEJS2"],
|
||||
"readme": "README.md",
|
||||
|
|
|
@ -2,3 +2,4 @@
|
|||
0.02: Bugfixes
|
||||
0.03: Use Bangle.setBacklight()
|
||||
0.04: Add option to buzz after computer move
|
||||
0.05: Minor code improvements
|
||||
|
|
|
@ -14,7 +14,7 @@ if (this.imports !== undefined &&
|
|||
this.printerr !== undefined){//seed or gjs
|
||||
p4_log = function(){
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
printerr(args.join(', '));
|
||||
this.printerr(args.join(', '));
|
||||
};
|
||||
}
|
||||
else if (this.console === undefined){//MSIE
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"id": "chess",
|
||||
"name": "Chess",
|
||||
"shortName": "Chess",
|
||||
"version": "0.04",
|
||||
"version": "0.05",
|
||||
"description": "Chess game based on the [p4wn engine](https://p4wn.sourceforge.net/). Drag on the touchscreen to move the green cursor onto a piece, select it with a single touch and drag the now red cursor around. Release the piece with another touch to finish the move. The button opens a menu.",
|
||||
"icon": "app.png",
|
||||
"tags": "game",
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
0.01: New App!
|
||||
0.02: Minor code improvements
|
||||
|
|
|
@ -19,7 +19,7 @@ function drawPlayers() {
|
|||
g.clear(1);
|
||||
g.setFont("6x8",2);
|
||||
var l = [{name:ME,cnt:mycounter}];
|
||||
for (p of players) l.push(p);
|
||||
for (const p of players) l.push(p);
|
||||
l.sort((a,b)=>a.cnt-b.cnt);
|
||||
var y=0;
|
||||
l.forEach(player=>{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "clickms",
|
||||
"name": "Click Master",
|
||||
"version": "0.01",
|
||||
"version": "0.02",
|
||||
"description": "Get several friends to start the game, then compete to see who can press BTN1 the most!",
|
||||
"icon": "click-master.png",
|
||||
"tags": "game",
|
||||
|
|
|
@ -3,3 +3,4 @@
|
|||
Add a 'time' clockinfo that also displays a percentage of day left
|
||||
0.03: Change 3rd mode to show the time to next sunrise/sunset time (not actual time)
|
||||
0.04: Minor code improvements
|
||||
0.05: Minor code improvements
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
let day = true;
|
||||
let d = date.getTime();
|
||||
let dayLength = sunset.getTime()-sunrise.getTime();
|
||||
let timePast;
|
||||
let timeTotal;
|
||||
if (d < sunrise.getTime()) {
|
||||
day = false; // early morning
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{ "id": "clkinfosunrise",
|
||||
"name": "Sunrise Clockinfo",
|
||||
"version": "0.04",
|
||||
"version": "0.05",
|
||||
"description": "For clocks that display 'clockinfo' (messages that can be cycled through using the clock_info module) this displays sunrise and sunset based on the location from the 'My Location' app",
|
||||
"icon": "app.png",
|
||||
"type": "clkinfo",
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
0.01: New App!
|
||||
0.02: Minor code improvements
|
||||
0.03: Minor code improvements
|
||||
|
|
|
@ -66,7 +66,7 @@ function showNumpad(text, key_, callback) {
|
|||
s = key + text.substr(key.length, 999);
|
||||
g.setFont("Vector:24").setFontAlign(1,0).drawString(s,g.getWidth(),12);
|
||||
}
|
||||
ds="12%";
|
||||
const ds="12%";
|
||||
var numPad = new Layout ({
|
||||
type:"v", c: [{
|
||||
type:"v", c: [
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{ "id": "contacts",
|
||||
"name": "Contacts",
|
||||
"version": "0.02",
|
||||
"version": "0.03",
|
||||
"description": "Provides means of storing user contacts, viewing/editing them on device and from the App loader",
|
||||
"icon": "app.png",
|
||||
"tags": "tool",
|
||||
|
|
|
@ -7,3 +7,4 @@
|
|||
fixed bangle2 colors for chrono and last lap highlight
|
||||
added screen for bangle2 and a small README
|
||||
0.05: Minor code improvements
|
||||
0.06: Minor code improvements
|
||||
|
|
|
@ -65,7 +65,7 @@ function chronometer() {
|
|||
}
|
||||
|
||||
currentLap = calculateLap(state.whenStarted);
|
||||
total = calculateLap(state.whenStartedTotal);
|
||||
const total = calculateLap(state.whenStartedTotal);
|
||||
|
||||
state.laps[0] = total;
|
||||
state.laps[1] = currentLap;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"id": "devstopwatch",
|
||||
"name": "Dev Stopwatch",
|
||||
"shortName": "Dev Stopwatch",
|
||||
"version": "0.05",
|
||||
"version": "0.06",
|
||||
"description": "Stopwatch with 5 laps supported (cyclically replaced)",
|
||||
"icon": "app.png",
|
||||
"tags": "stopwatch,chrono,timer,chronometer",
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
0.01: New App!
|
||||
0.02: Tweaked proximity identification settings
|
||||
0.03: Minor code improvements
|
||||
|
|
|
@ -74,6 +74,7 @@ let digestTime = new Uint8Array([ 0, 0, 0 ]);
|
|||
let numberOfDigestPages = 0;
|
||||
let sensorData = [ 0x82, 0x08, 0x3f ];
|
||||
let cyclicCount = 0;
|
||||
let encodedBattery = 0;
|
||||
let lastDigestTime = Math.round(getTime());
|
||||
let lastResetTime = Math.round(getTime());
|
||||
let isExciterPresent = false;
|
||||
|
@ -517,7 +518,7 @@ function updateSensorData() {
|
|||
encodedBattery = encodeBatteryPercentage();
|
||||
}
|
||||
|
||||
encodedAcceleration = encodeAcceleration();
|
||||
let encodedAcceleration = encodeAcceleration();
|
||||
|
||||
sensorData[0] = ((encodedAcceleration.x << 2) & 0xfc) |
|
||||
((encodedAcceleration.y >> 4) & 0x3f);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"id": "diract",
|
||||
"name": "DirAct",
|
||||
"shortName": "DirAct",
|
||||
"version": "0.02",
|
||||
"version": "0.03",
|
||||
"description": "Proximity interaction detection.",
|
||||
"icon": "diract.png",
|
||||
"type": "app",
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
0.01: Initial version
|
||||
0.02: Added BangleJS Two
|
||||
0.03: Minor code improvements
|
||||
0.04: Minor code improvements
|
||||
|
|
|
@ -118,8 +118,8 @@ function checkHR() {
|
|||
|
||||
if(HR_samples.length == 5){
|
||||
g.clear();
|
||||
average_HR = average(HR_samples).toFixed(0);
|
||||
stdev_HR = getStandardDeviation (HR_samples).toFixed(1);
|
||||
let average_HR = average(HR_samples).toFixed(0);
|
||||
let stdev_HR = getStandardDeviation (HR_samples).toFixed(1);
|
||||
|
||||
if (ISBANGLEJS1) {
|
||||
g.drawString("HR: " + average_HR, 120,100);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"id": "edisonsball",
|
||||
"name": "Edison's Ball",
|
||||
"shortName": "Edison's Ball",
|
||||
"version": "0.03",
|
||||
"version": "0.04",
|
||||
"description": "Hypnagogia/Micro-Sleep alarm for experimental use in exploring sleep transition and combating drowsiness",
|
||||
"icon": "app-icon.png",
|
||||
"tags": "sleep,hyponagogia,quick,nap",
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
0.01: New App!
|
||||
0.02: Minor code improvements
|
||||
|
|
|
@ -7,7 +7,7 @@ var R = Bangle.appRect;
|
|||
var termg = Graphics.createArrayBuffer(R.w, R.h, 1, {msb:true});
|
||||
var termVisible = false;
|
||||
termg.setFont("6x8");
|
||||
term = require("VT100").connect(termg, {
|
||||
let term = require("VT100").connect(termg, {
|
||||
charWidth : 6,
|
||||
charHeight : 8
|
||||
});
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"id": "espruinoterm",
|
||||
"name": "Espruino Terminal",
|
||||
"shortName": "Espruino Term",
|
||||
"version": "0.01",
|
||||
"version": "0.02",
|
||||
"description": "Send commands to other Espruino devices via the Bluetooth UART interface, and see the result on a VT100 terminal. Customisable commands!",
|
||||
"icon": "app.png",
|
||||
"screenshots": [{"url":"screenshot.png"}],
|
||||
|
|
|
@ -2,3 +2,4 @@
|
|||
0.02: Move to Bangle.setUI to launcher support
|
||||
0.03: Tell clock widgets to hide.
|
||||
0.04: Minor code improvements
|
||||
0.05: Minor code improvements
|
||||
|
|
|
@ -86,7 +86,7 @@ const drawSec = function (sections, color) {
|
|||
|
||||
const drawClock = function () {
|
||||
|
||||
currentTime = new Date();
|
||||
const currentTime = new Date();
|
||||
|
||||
//Get date as a string
|
||||
date = dateStr(currentTime);
|
||||
|
@ -163,12 +163,10 @@ const drawHR = function () {
|
|||
}
|
||||
|
||||
if (grow) {
|
||||
color = settings.hr.color;
|
||||
g.setColor(color);
|
||||
g.setColor(settings.hr.color);
|
||||
g.fillCircle(settings.hr.x, settings.hr.y, size);
|
||||
} else {
|
||||
color = "#000000";
|
||||
g.setColor(color);
|
||||
g.setColor("#000000");
|
||||
g.drawCircle(settings.hr.x, settings.hr.y, size);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"id": "fclock",
|
||||
"name": "fclock",
|
||||
"shortName": "F Clock",
|
||||
"version": "0.04",
|
||||
"version": "0.05",
|
||||
"description": "Simple design of a digital clock",
|
||||
"icon": "app.png",
|
||||
"type": "clock",
|
||||
|
|
|
@ -2,4 +2,5 @@
|
|||
1.10: Download cards data from Trello public board
|
||||
1.20: Configuration instructions added and card layout optimized
|
||||
1.30: Font size can be changed in Settings
|
||||
1.31: Fix for fast-loading support
|
||||
1.31: Fix for fast-loading support
|
||||
1.32: Minor code improvements
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
while (str.length > maxLength) {
|
||||
let found = false;
|
||||
// Inserts new line at first whitespace of the line
|
||||
for (i = maxLength - 1; i > 0; i--) {
|
||||
for (let i = maxLength - 1; i > 0; i--) {
|
||||
if (str.charAt(i)==' ') {
|
||||
res = res + [str.slice(0, i), "\n"].join('');
|
||||
str = str.slice(i + 1);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"id": "flashcards",
|
||||
"name": "Flash Cards",
|
||||
"shortName": "Flash Cards",
|
||||
"version": "1.31",
|
||||
"version": "1.32",
|
||||
"description": "Flash cards based on public Trello board",
|
||||
"readme":"README.md",
|
||||
"screenshots" : [ { "url":"screenshot.png" }],
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
0.01: New app!
|
||||
0.02: Minor code improvements
|
|
@ -193,7 +193,7 @@ let intervalId;
|
|||
|
||||
if (BTN.read()) {
|
||||
for (let i = 0; i < 10; i++) {
|
||||
color = getColor(i);
|
||||
const color = getColor(i);
|
||||
g.setColor(color[0], color[1], color[2]);
|
||||
g.fillRect((i / 10) * h, 0, ((i + 1) / 10) * h, h);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"id": "flow",
|
||||
"name": "FLOW",
|
||||
"shortName": "FLOW",
|
||||
"version": "0.01",
|
||||
"version": "0.02",
|
||||
"description": "A game where you have to help a flow avoid white obstacles thing by tapping! This is a demake of an app which I forgot the name of. Press BTN(1) to restart. See if you can get to 2500 score!",
|
||||
"icon": "app.png",
|
||||
"tags": "game",
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
0.01: attempt to import
|
||||
0.02: Make it possible for Fastload Utils to fastload into this app.
|
||||
0.03: Minor code improvements
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
"Bangle.loadWidgets()"; // Facilitates fastloading to this app via Fastload Utils, while still not loading widgets on standard `load` calls.
|
||||
|
||||
st = require('Storage');
|
||||
const st = require('Storage');
|
||||
|
||||
l = /^a\..*\.js$/;
|
||||
let l = /^a\..*\.js$/;
|
||||
//l = /.*\.js/;
|
||||
l = st.list(l, {sf:false});
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{ "id": "forge",
|
||||
"name": "App Forge",
|
||||
"version":"0.02",
|
||||
"version": "0.03",
|
||||
"description": "Easy way to run development versions of your apps",
|
||||
"icon": "app.png",
|
||||
"readme": "README.md",
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* This file is designed to be run on the desktop, not Bangle.js */
|
||||
/* eslint-env node */
|
||||
let fs = require('fs');
|
||||
let csv = require('csv');
|
||||
|
||||
|
@ -30,7 +32,7 @@ fs.createReadStream(__dirname+'/country.csv')
|
|||
} else {
|
||||
country = countries[r[1]]; // e.g. United States
|
||||
}
|
||||
zone = zones[r[0]] || { "name": `${city}, ${country}` };
|
||||
let zone = zones[r[0]] || { "name": `${city}, ${country}` };
|
||||
let starttime = parseInt(r[3] || "0"), // Bugger. They're feeding us blanks for UTC now
|
||||
offs = parseInt(r[4]);
|
||||
if (offs<0) {
|
||||
|
@ -43,15 +45,15 @@ fs.createReadStream(__dirname+'/country.csv')
|
|||
zones[r[0]] = zone;
|
||||
})
|
||||
.on('end', () => {
|
||||
for (z in zones) {
|
||||
zone = zones[z];
|
||||
for (let z in zones) {
|
||||
let zone = zones[z];
|
||||
if (zone.offs%60) continue; // One a dem funky timezones. Ignore.
|
||||
zonelist = offsdict[zone.offs] || [];
|
||||
let zonelist = offsdict[zone.offs] || [];
|
||||
zonelist.push(zone.name);
|
||||
offsdict[zone.offs] = zonelist;
|
||||
}
|
||||
offsets = [];
|
||||
for (o in offsdict) {
|
||||
let offsets = [];
|
||||
for (let o in offsdict) {
|
||||
offsets.unshift(parseInt(o));
|
||||
}
|
||||
fs.open("fourTwentyTz.js","w", (err, fd) => {
|
||||
|
@ -67,7 +69,7 @@ fs.createReadStream(__dirname+'/country.csv')
|
|||
fs.write(fd, ";\n", handleWrite);
|
||||
fs.write(fd, "exports.timezones = function(offs) {\n", handleWrite);
|
||||
fs.write(fd, " switch (offs) {\n", handleWrite);
|
||||
for (i=0; i<offsets.length; i++) {
|
||||
for (let i=0; i<offsets.length; i++) {
|
||||
let o = offsets[i].toString();
|
||||
fs.write(fd, ` case ${o}: return ${JSON.stringify(offsdict[o])};\n`, handleWrite);
|
||||
}
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
0.01: New App! Very limited course support.
|
||||
0.02: Course search added to BangleApps page
|
||||
0.02: Course search added to BangleApps page
|
||||
0.03: Minor code improvements
|
||||
|
|
|
@ -41,8 +41,8 @@ function rotateVec(a, theta) {
|
|||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
c = Math.cos(theta);
|
||||
s = Math.sin(theta);
|
||||
const c = Math.cos(theta);
|
||||
const s = Math.sin(theta);
|
||||
pt.x = c * a.x - s * a.y;
|
||||
pt.y = s * a.x + c * a.y;
|
||||
return pt;
|
||||
|
@ -124,7 +124,7 @@ function drawHole(l) {
|
|||
nodelist.push(node.x);
|
||||
nodelist.push(node.y);
|
||||
});
|
||||
newnodelist = g.transformVertices(nodelist, transform);
|
||||
const newnodelist = g.transformVertices(nodelist, transform);
|
||||
|
||||
g.fillPoly(newnodelist, true);
|
||||
//console.log(feature.type);
|
||||
|
@ -139,7 +139,7 @@ function drawHole(l) {
|
|||
waynodelist.push(node.y);
|
||||
});
|
||||
|
||||
newnodelist = g.transformVertices(waynodelist, transform);
|
||||
const newnodelist = g.transformVertices(waynodelist, transform);
|
||||
g.setColor(0, 1, 1); // cyan
|
||||
g.drawPoly(newnodelist);
|
||||
}
|
||||
|
|
|
@ -40,8 +40,8 @@ function rotateVec(a, theta) {
|
|||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
c = Math.cos(theta);
|
||||
s = Math.sin(theta);
|
||||
const c = Math.cos(theta);
|
||||
const s = Math.sin(theta);
|
||||
pt.x = c * a.x - s * a.y;
|
||||
pt.y = s * a.x + c * a.y;
|
||||
return pt;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{ "id": "golfview",
|
||||
"name": "Golf View",
|
||||
"version":"0.02",
|
||||
"version": "0.03",
|
||||
"description": "This app will provide you with on course data to support your golf game!",
|
||||
"icon": "golfview.png",
|
||||
"tags": "outdoors, gps",
|
||||
|
|
|
@ -6,3 +6,4 @@
|
|||
0.06: Move waypoints.json (and editor) to 'waypoints' app
|
||||
0.07: Add support for b2
|
||||
0.08: Fix not displaying of wpindex = 0, correct compass drawing and nm calculation on b2
|
||||
0.09: Minor code improvements
|
||||
|
|
|
@ -157,7 +157,7 @@ function stopdraw() {
|
|||
|
||||
function startTimers() {
|
||||
candraw=true;
|
||||
intervalRefSec = setInterval(function() {
|
||||
/*intervalRefSec =*/ setInterval(function() {
|
||||
heading = newHeading(course,heading);
|
||||
if (course!=heading) drawCompass(heading);
|
||||
},200);
|
||||
|
|
|
@ -5,7 +5,7 @@ function bearing(a,c){var b=radians(c.lon-a.lon),d=radians(a.lat),e=radians(c.la
|
|||
function drawN(){var a=loc.speed(speed);buf.setColor(1);buf.setFont("6x8",2);buf.drawString("o",100,0);buf.setFont("6x8",1);buf.drawString(a.substring(a.length-3),220,40);buf.setFont("Vector",48);var c=course.toString();c=10>course?"00"+c:100>course?"0"+c:c;buf.drawString(c,10,0);buf.drawString(a.substring(0,a.length-3),140,4);flip(buf,Yoff+70);buf.setColor(1);buf.setFont("Vector",24);a=brg.toString();a=10>brg?"00"+a:100>brg?"0"+a:a;buf.setColor(3);buf.drawString("Brg: ",0,0);buf.drawString("Dist: ",
|
||||
0,30);buf.setColor(selected?1:2);buf.drawString(wp.name,140,0);buf.setColor(1);buf.drawString(a,60,0);buf.drawString(loc.distance(dist),60,30);flip(buf,Yoff+130);g.setFont("6x8",1);g.setColor(0,0,0);g.fillRect(10,230,60,239);g.setColor(1,1,1);g.drawString("Sats "+satellites.toString(),10,230)}var savedfix;
|
||||
function onGPS(a){savedfix=a;void 0!==a&&(course=isNaN(a.course)?course:Math.round(a.course),speed=isNaN(a.speed)?speed:a.speed,satellites=a.satellites);candraw&&(void 0!==a&&1==a.fix&&(dist=distance(a,wp),isNaN(dist)&&(dist=0),brg=bearing(a,wp),isNaN(brg)&&(brg=0)),drawN())}var intervalRef;function stopdraw(){candraw=!1;intervalRef&&clearInterval(intervalRef)}
|
||||
function startTimers(){candraw=!0;intervalRefSec=setInterval(function(){heading=newHeading(course,heading);course!=heading&&drawCompass(heading)},200)}function drawAll(){g.setColor(1,.5,.5);g.fillPoly([120,Yoff+50,110,Yoff+70,130,Yoff+70]);g.setColor(1,1,1);drawN();drawCompass(heading)}function startdraw(){g.clear();Bangle.drawWidgets();startTimers();drawAll()}
|
||||
function startTimers(){candraw=!0;setInterval(function(){heading=newHeading(course,heading);course!=heading&&drawCompass(heading)},200)}function drawAll(){g.setColor(1,.5,.5);g.fillPoly([120,Yoff+50,110,Yoff+70,130,Yoff+70]);g.setColor(1,1,1);drawN();drawCompass(heading)}function startdraw(){g.clear();Bangle.drawWidgets();startTimers();drawAll()}
|
||||
function setButtons(){setWatch(nextwp.bind(null,-1),BTN1,{repeat:!0,edge:"falling"});setWatch(doselect,BTN2,{repeat:!0,edge:"falling"});setWatch(nextwp.bind(null,1),BTN3,{repeat:!0,edge:"falling"})}var SCREENACCESS={withApp:!0,request:function(){this.withApp=!1;stopdraw();clearWatch()},release:function(){this.withApp=!0;startdraw();setButtons()}};Bangle.on("lcdPower",function(a){SCREENACCESS.withApp&&(a?startdraw():stopdraw())});var waypoints=require("waypoints").load();
|
||||
wp=waypoints[0];function nextwp(a){selected&&(wpindex+=a,wpindex>=waypoints.length&&(wpindex=0),0>wpindex&&(wpindex=waypoints.length-1),wp=waypoints[wpindex],drawN())}function doselect(){selected&&0!=wpindex&&void 0===waypoints[wpindex].lat&&savedfix.fix&&(waypoints[wpindex]={name:"@"+wp.name,lat:savedfix.lat,lon:savedfix.lon},wp=waypoints[wpindex],require("waypoints").save(waypoints));selected=!selected;drawN()}g.clear();Bangle.setLCDBrightness(1);Bangle.loadWidgets();Bangle.drawWidgets();
|
||||
Bangle.setGPSPower(1);drawAll();startTimers();Bangle.on("GPS",onGPS);setButtons();
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue