widhwbttm (hw stats)

A new bottom widget to show free mem and other stats
pull/2399/head
dapgo 2022-12-14 21:59:50 +01:00
parent 7d356c388c
commit 9fd4964495
8 changed files with 93 additions and 0 deletions

2
apps/widhwbttm/Changelog Normal file
View File

@ -0,0 +1,2 @@
0.01: Fork of widclkbttm (Digital clock bttom widget)

30
apps/widhwbttm/README.md Normal file
View File

@ -0,0 +1,30 @@
# hw stats bttom widget (bottom widget area)
A basic HW/performance monitor widget that shows on real time some technical info, such as free mem, free storage, trash mem, files, FW version. Also allows to test the unfrequently used widget bottom area.
Compatible with BangleJS1,BangleJS2,and EMSCRIPTENx emulators
forked from widclkbttm (Digital clock bttom widget)
## Photo
Example of usage
![](widhwbttm.ss1.jpg)
![](widhwbttm.ss2.jpg)
## Usage
Upload the widget file
Open an app (not a clock/watchface) that supports displaying widgets (included the bottom one)
Different info is refreshed following a predefined frequency and sequence.
## Support
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/my_espruino_smartwatch_things)

View File

@ -0,0 +1,15 @@
{
"id": "widhwbttm",
"name": "HW stats (Bottom) widget",
"shortName": "Digital clock Bottom Widget",
"version": "0.01",
"description": "Displays technical info and mem stats in the bottom of the screen (may not be compatible with some apps)",
"icon": "widhwbttm.png",
"type": "widget",
"tags": "widget",
"supports": ["BANGLEJS","BANGLEJS2"],
"readme": "README.md",
"storage": [
{"name":"widhwbttm.wid.js","url":"widhwbttm.wid.js"}
]
}

View File

@ -0,0 +1 @@
{"id":"widhwbttm.wid.js","name":"hw stats bttom widget","type":"widget","version":"0.01","files":"widhwbttm.info,widhwbttm.wid.js"}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

View File

@ -0,0 +1,45 @@
(function() {
var v_switch; // show stats
if (process.env.BOARD=='BANGLEJS'||process.env.BOARD=='EMSCRIPTEN') v_font_size=16
else v_font_size=13;
var v_str_hw=new String();
if (v_switch == null || v_switch == '') v_switch=0;
function draw(){
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;
return setTimeout(Bangle.drawWidgets,1); // widget changed size - redraw
}
if (!this.width) return; // if size not right, return
if (v_switch==0) {
//var v_hw=process.memory();
v_str_hw=process.memory().free+"/"+process.memory().total;
v_switch++;
} else if (v_switch==1) {
// var v_hw=process.env.VERSION;
v_str_hw="V:"+process.env.VERSION;
v_switch++;
} else if (v_switch==2) {
v_str_hw="M:"+process.env.BOARD;
v_switch++;
} else {
stor=require("Storage").getStats();
if (v_switch==3) {
v_str_hw="St:"+stor.freeBytes;
v_switch++;
} else if (v_switch==4) {
v_str_hw="TrB:"+stor.trashBytes;
v_switch++;
} else if (v_switch==5) {
v_str_hw="Fil:"+stor.fileCount;
v_switch=0;
}
}
g.reset().setFontVector(v_font_size).setFontAlign(-1, 0).setColor("#0ff");
//clean a longer previous string
g.drawString(" ", this.x, this.y+11, true);
g.drawString(v_str_hw, this.x, this.y+11, true);
} //end draw
WIDGETS["wdhwbttm"]={area:"bl",width:Bangle.CLOCK?0:60,draw:draw};
})()