This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* This rewrites boot0.js based on current settings. If settings changed then it | |
recalculates, but this avoids us doing a whole bunch of reconfiguration most | |
of the time. */ | |
E.showMessage(/*LANG*/"Updating boot0..."); | |
var DEBUG_TIME = true; // print time taken by each section of boot.js | |
var s = require('Storage').readJSON('setting.json',1)||{}; | |
var BANGLEJS2 = process.env.HWVERSION==2; // Is Bangle.js 2 | |
var boot = "", bootPost = ""; | |
if (DEBUG_TIME) boot += "var t=getTime();"; | |
if (require('Storage').hash) { // new in 2v11 - helps ensure files haven't changed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var exports = {}; | |
/* Module that allows for loading of clock 'info' displays | |
that can be scrolled through on the clock face. | |
`load()` returns an array of menu items: | |
* 'item.name' : friendly name | |
* 'item.get' : function that resolves with: | |
{ | |
'text' : the text to display for this item |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// HSB test | |
for (var y=0;y<176;y+=4) | |
for (var x=0;x<176;x+=4) | |
g.setColor.apply(g,E.HSBtoRGB(x/176.0,y/176.0,1,1).map(x=>x/256)).fillRect(x,y,x+3,y+3); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Where on the screen are we? | |
var W = 240; | |
var H = 180; | |
var X = 0; | |
var Y = 30; | |
// Misc setup | |
require("Font7x11Numeric7Seg").add(Graphics); | |
Bangle.setLCDPower(1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// fill for 2v09 firmwares | |
if (!g.theme) { | |
g.theme = { | |
fg:-1,bg:0,fgH:-1,bgH:"#008" | |
}; | |
} | |
// test with widgets | |
//WIDGETS = {a:1}; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function draw() { | |
c = c=>g.setColor(c?"#ff0000":-1); | |
c(BTN4.read());g.fillRect(0,0,100,239); | |
c(BTN5.read());g.fillRect(100,0,200,239); | |
c(BTN1.read());g.fillRect(200,0,239,79); | |
c(BTN2.read());g.fillRect(200,80,239,159); | |
c(BTN3.read());g.fillRect(200,160,239,239); | |
} | |
[BTN1,BTN2,BTN3,BTN4,BTN5].forEach(b=>setWatch(draw,b,{repeat:1,edge:0})); | |
draw(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Copyright (c) 2015 Gordon Williams, Tobias Schwalm. See the file LICENSE for copying permission. */ | |
/* | |
Library for interfacing to the SIM900A. | |
Uses the 'NetworkJS' library to provide a JS endpoint for HTTP. | |
``` | |
Serial1.setup(115200, { rx: B7, tx : B6 }); | |
console.log("Connecting to SIM900 module"); | |
var gprs = require('SIM900').connect(Serial1, B4, function(err) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var WIFI_NAME = "BTHub4-XFTX"; | |
var WIFI_PASS = "735dfd986d"; | |
// var re = /:[^/]+/g; needs changing to | |
// var re = /:[^\/]+/g; | |
var wifi = require("Wifi"); | |
wifi.connect(WIFI_NAME, { password : WIFI_PASS }, function(err) { | |
if (err) { |
NewerOlder