mini improvements

pull/2422/head
dapgo 2023-01-05 22:44:31 +01:00
parent 07dea734f2
commit 680587831e
6 changed files with 22 additions and 9 deletions

View File

@ -8,7 +8,7 @@ var rect = Bangle.appRect;
var history = [];
var readFreq=5000; //ms //PEND add to settings
var saveFreq=60000; //ms 1min
var v_saveToFile='Y'; //Y save //N
var v_saveToFile= new Boolean(true); //true save //false
//with upload file º is not displayed properly
//with upload RAM º is displayed
var v_t_symbol="";//ºC
@ -69,7 +69,7 @@ function saveToFile() {
strlastSaveTime=a.toISOString();
//strlastSaveTime=strlastSaveTime.concat(a.getFullYear(),a.getMonth()+1,a.getDate(),a.getHours(),a.getMinutes());;
if (v_mode_debug==1) console.log("saving="+strlastSaveTime+";"+a.getHours()+":"+a.getMinutes()+";"+lastMeasure);
if (v_saveToFile=='Y'){
if (v_saveToFile==true){
//write(strlastSaveTime+";"+
require("Storage").open(filename,"a").write((a.getMonth()+1)+";"+a.getDate()+";"+a.getHours()+":"+a.getMinutes()+";"+lastMeasure+"\n");
//(getTime()+",");
@ -127,7 +127,7 @@ setInterval(function() {
drawTemperature();
}, readFreq); //ms
if (v_saveToFile=="Y") {
if (v_saveToFile==true) {
setInterval(function() {
saveToFile();
}, saveFreq); //ms

View File

@ -1,5 +1,9 @@
# Digital clock widget (bottom widget area)
This very basic widget clock allows to test the unfrequently used widget bottom area.
This very basic widget clock shows time inside apps that respect the bottom widget area, also allows to test this unfrequently used area.
Note that it will not be displayed when a clock app is been shown
Compatible with BangleJS1,BangleJS2,and EMSCRIPTENx emulators
forked from
https://github.com/espruino/BangleApps/tree/master/apps/widclk
@ -10,14 +14,17 @@ Example of usage
![](widTextBottom_ss1.jpg)
Screenshot emulator bangle.js2
![](ss_bjs2.jpg)
## Usage
Upload the widget file
Open an app that supports displaying widgets
Open an app (not a clock/watchface) that supports displaying widgets (included the bottom one)
@ -25,4 +32,4 @@ Open an app that supports displaying widgets
This app is so basic that probably the easiest is to just edit the code ;)
Otherwise you can contact me [here](https://github.com/dapgo)
Otherwise you can contact me [here](https://github.com/dapgo/my_espruino_smartwatch_things)

View File

@ -3,11 +3,12 @@
"name": "Digital clock (Bottom) widget",
"shortName": "Digital clock Bottom Widget",
"version": "0.05",
"description": "Displays time in the bottom of the screen (may not be compatible with some apps)",
"description": "Displays time HH:mm in the bottom of the screen (may not be compatible with some apps)",
"icon": "widclkbttm.png",
"type": "widget",
"tags": "widget",
"supports": ["BANGLEJS","BANGLEJS2"],
"screenshots": [{"url":"ss_bjs1.png"}],
"readme": "README.md",
"storage": [
{"name":"widclkbttm.wid.js","url":"widclkbttm.wid.js"}

BIN
apps/widclkbttm/ss_bjs1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

BIN
apps/widclkbttm/ss_bjs2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -1,6 +1,11 @@
WIDGETS["wdclkbttm"]={area:"br",width:Bangle.CLOCK?0:60,draw:function() {
console.log("clock? "+Bangle.CLOCK);
if (Bangle.CLOCK){
console.log("clock and return");
return;
};
if (!Bangle.CLOCK == !this.width) { // if we're the wrong size for if we have a clock or not...
this.width = Bangle.CLOCK?0:60;
this.width = Bangle.CLOCK?0:60;
return setTimeout(Bangle.drawWidgets,1); // widget changed size - redraw
}
if (!this.width) return; // if size not right, return