Try pre-formating for length

master
Martin Zwigl 2025-03-16 00:49:27 +01:00
parent a7eeef13eb
commit a673a70609
2 changed files with 12 additions and 3 deletions

View File

@ -1,7 +1,9 @@
const settings = require("Storage").readJSON("coin_info.settings.json", 1) || {};
const db = require("Storage").readJSON("coin_info.cmc_key.json", 1) || {};
const csTokens = db.csTokens.split(',');
//
var ticker = 0;
var csTknNameLen = (csTokens[ticker]).length;
var Layout = require("Layout");
var layout = new Layout({
@ -55,11 +57,18 @@ function swipeHandler(lr, ud) {
}
//
var currentLabel = "loading...";
var currentLabel = "...";
function setDummy(x) {
currentLabel = x;
}
function getFmtTknName(currTKn) {
if (currTKn.length > csTknNameLen)
csTknNameLen = currTKn.length;
return currTKn.toUpperCase().padEnd(csTknNameLen);
}
// timeout used to update every minute
var drawTimeout;
// update the screen
@ -69,8 +78,8 @@ function draw() {
// layout.clear(layout.tknGraph);
//
layout.tknName.label = getFmtTknName(csTokens[ticker]);
layout.tknGraph.label = currentLabel;
layout.tknName.label = (csTokens[ticker]).toUpperCase();
layout.render();
// schedule a draw for the next minute

View File

@ -1,7 +1,7 @@
{ "id": "coin_info",
"name": "Crypto-Coins Info",
"shortName":"Coins Info",
"version": "0.06.19",
"version": "0.06.20",
"description": "Crypto-Coins Infos with the help of the Binance API",
"icon": "app.png",
"tags": "clkinfo",