mirror of https://github.com/espruino/BangleApps
Sliding Clock: get rid of the setup variables after the init to reduce the memory footprint
parent
ebc8d1ba8a
commit
c09dd1af5a
|
@ -265,7 +265,7 @@ function bangleVersion(){
|
|||
return (g.getHeight()>200)? 1 : 2;
|
||||
}
|
||||
|
||||
const row_types = {
|
||||
var row_types = {
|
||||
large: {
|
||||
color: 'major',
|
||||
speed: 'medium',
|
||||
|
@ -314,11 +314,11 @@ function initDisplay(settings) {
|
|||
row_displays.push(create_row(row_type,j));
|
||||
}
|
||||
});
|
||||
initComplete();
|
||||
}
|
||||
|
||||
function mergeMaps(map1,map2){
|
||||
if(map2 == null){
|
||||
console.log("no merge:" + map2);
|
||||
return;
|
||||
}
|
||||
Object.keys(map2).forEach(key => {
|
||||
|
@ -336,10 +336,7 @@ function mergeObjects(obj1, obj2){
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
const heights = {
|
||||
tiny: [14,11],
|
||||
var heights = {
|
||||
vvsmall: [15,13],
|
||||
vsmall: [20,15],
|
||||
ssmall: [22,17],
|
||||
|
@ -351,14 +348,14 @@ const heights = {
|
|||
vlarge: [60,50]
|
||||
};
|
||||
|
||||
const rotations = {
|
||||
var rotations = {
|
||||
0: 0,
|
||||
90: 3,
|
||||
180: 2,
|
||||
270: 1,
|
||||
};
|
||||
|
||||
const speeds = {
|
||||
var speeds = {
|
||||
fast: 20,
|
||||
medium: 10,
|
||||
slow: 5,
|
||||
|
@ -447,6 +444,13 @@ function create_row_type(row_type, row_def){
|
|||
};
|
||||
}
|
||||
|
||||
function initComplete(){
|
||||
row_types = null;
|
||||
speeds = null;
|
||||
rotations = null;
|
||||
heights = null;
|
||||
}
|
||||
|
||||
function create_row(row_type, row_no){
|
||||
return new ShiftText(row_type.x(row_no),
|
||||
row_type.y(row_no),
|
||||
|
@ -605,7 +609,6 @@ function setColorScheme(colorscheme_name){
|
|||
for (var i=0; i < color_schemes.length; i++) {
|
||||
if(color_schemes[i].name === colorscheme_name){
|
||||
color_scheme_index = i;
|
||||
console.log("match");
|
||||
updateColorScheme();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -8,10 +8,17 @@ const monthToText = require("slidingtext.utils.en.js").monthToText;
|
|||
class EnglishDateFormatter extends DateFormatter {
|
||||
constructor() {
|
||||
super();
|
||||
this.row_types = {
|
||||
small: {size: 'ssmall'}
|
||||
};
|
||||
this.row_defs = [
|
||||
}
|
||||
formatDate(date){
|
||||
const hours_txt = hoursToText(date.getHours());
|
||||
const mins_txt = numberToText(date.getMinutes());
|
||||
const day_of_week = dayOfWeek(date);
|
||||
const date_txt = numberToDayNumberText(date.getDate()).join(' ');
|
||||
const month = monthToText(date);
|
||||
return [hours_txt,mins_txt[0],mins_txt[1],day_of_week,date_txt,month];
|
||||
}
|
||||
defaultRowTypes(){
|
||||
return [
|
||||
{
|
||||
type: 'large',
|
||||
init_coords: [0.05,0.07],
|
||||
|
@ -32,17 +39,12 @@ class EnglishDateFormatter extends DateFormatter {
|
|||
}
|
||||
];
|
||||
}
|
||||
formatDate(date){
|
||||
const hours_txt = hoursToText(date.getHours());
|
||||
const mins_txt = numberToText(date.getMinutes());
|
||||
const day_of_week = dayOfWeek(date);
|
||||
const date_txt = numberToDayNumberText(date.getDate()).join(' ');
|
||||
const month = monthToText(date);
|
||||
return [hours_txt,mins_txt[0],mins_txt[1],day_of_week,date_txt,month];
|
||||
}
|
||||
defaultRowTypes(){ return this.row_types;}
|
||||
|
||||
defaultRowDefs(){ return this.row_defs; }
|
||||
defaultRowDefs(){
|
||||
return {
|
||||
small: {size: 'ssmall'}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = EnglishDateFormatter;
|
Loading…
Reference in New Issue