more cleanups
This commit is contained in:
parent
c4b2abcd70
commit
13ad35fde5
@ -21,7 +21,7 @@ module.exports = {
|
||||
},
|
||||
nextEvent: async (time) => {
|
||||
if (time === 'Thursday, January 1st, 1970 12:13:00 AM') {
|
||||
return 'No Timer Set'
|
||||
return 'Not Set'
|
||||
} else {
|
||||
time = time.match(/.{11}$/gm)
|
||||
time = time[0].toLowerCase()
|
||||
|
28
libs/lcd.js
28
libs/lcd.js
@ -43,19 +43,21 @@ module.exports = {
|
||||
heatingStatus: async (input) => {
|
||||
lcd.printLineSync(2, 'Heating=')
|
||||
lcd.setCursorSync(8, 2);
|
||||
lcd.printSync(' ')
|
||||
lcd.printSync(' ')
|
||||
lcd.setCursorSync(8, 2);
|
||||
lcd.printSync(input)
|
||||
},
|
||||
NextEvent: async (input) => {
|
||||
if (globalVars.waterOn === "true") {
|
||||
lcd.printLineSync(3, 'Switch Off=')
|
||||
lcd.setCursorSync(0, 3)
|
||||
lcd.printSync("Switch Off=")
|
||||
lcd.setCursorSync(11, 3);
|
||||
lcd.printSync(' ')
|
||||
lcd.setCursorSync(11, 3);
|
||||
lcd.printSync(input)
|
||||
} else {
|
||||
lcd.printLineSync(3, 'Switch On=')
|
||||
lcd.setCursorSync(0, 3)
|
||||
lcd.printSync("Switch On=")
|
||||
lcd.setCursorSync(10, 3);
|
||||
lcd.printSync(' ')
|
||||
lcd.setCursorSync(10, 3);
|
||||
@ -63,13 +65,25 @@ module.exports = {
|
||||
}
|
||||
},
|
||||
currentRoomTemp: async (temp) => {
|
||||
let icon = '°'
|
||||
lcd.setCursorSync(0, 1);
|
||||
let icon = '\xDF'
|
||||
temp = temp + icon
|
||||
console.log(temp)
|
||||
lcd.printSync('CT:' + temp);
|
||||
},
|
||||
lastSetTemp: async (temp) => {
|
||||
let icon = '°'
|
||||
lcd.setCursorSync(14, 1);
|
||||
let icon = '\xDF'
|
||||
temp = temp + icon
|
||||
console.log(temp)
|
||||
lcd.printSync('LT:' + temp);
|
||||
},
|
||||
heatingPageOne: async (heatingStatus, measuredRoomTemp, lastTimerSetPoint, heatingNextEvent) => {
|
||||
module.exports.currentRoomTemp(measuredRoomTemp)
|
||||
module.exports.lastSetTemp(lastTimerSetPoint)
|
||||
module.exports.NextEvent(heatingNextEvent)
|
||||
module.exports.heatingStatus(heatingStatus)
|
||||
},
|
||||
waterPageOne: async (waterStatus, waterNextEvent) => {
|
||||
module.exports.NextEvent(waterNextEvent)
|
||||
module.exports.waterStatus(waterStatus)
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ const redLED = new Gpio('4', 'out');
|
||||
const blueLED = new Gpio('27', 'out')
|
||||
const greenLED = new Gpio('22', 'out')
|
||||
|
||||
|
||||
9367
|
||||
module.exports = {
|
||||
set: async (colour) => {
|
||||
switch (colour) {
|
||||
|
@ -36,34 +36,22 @@ module.exports = {
|
||||
if (globalVars.heatingOn === "" || globalVars.heatingOn === "error") {
|
||||
if (heatingOn === 'true') {
|
||||
globalVars.heatingOn = heatingOn
|
||||
lcd.heatingStatus('On')
|
||||
lcd.lastSetTemp(data.lastTimerSetPoint)
|
||||
lcd.currentRoomTemp(data.measuredRoomTemp)
|
||||
lcd.NextEvent(globalVars.heatingNextEvent)
|
||||
lcd.heatingPageOne('On', data.measuredRoomTemp, data.lastTimerSetPoint, globalVars.waterNextEvent)
|
||||
led.set('red')
|
||||
} else {
|
||||
globalVars.heatingOn = heatingOn
|
||||
lcd.heatingStatus('Off')
|
||||
lcd.lastSetTemp(data.lastTimerSetPoint)
|
||||
lcd.currentRoomTemp(data.measuredRoomTemp)
|
||||
lcd.NextEvent(globalVars.heatingNextEvent)
|
||||
lcd.heatingPageOne('Off', data.measuredRoomTemp, data.lastTimerSetPoint, globalVars.waterNextEvent)
|
||||
led.set('blue')
|
||||
}
|
||||
} else {
|
||||
// if (waterOn != globalVars.waterOn) {
|
||||
if (heatingOn === 'true') {
|
||||
globalVars.heatingOn = heatingOn
|
||||
lcd.heatingStatus('On')
|
||||
lcd.lastSetTemp(data.lastTimerSetPoint)
|
||||
lcd.currentRoomTemp(data.measuredRoomTemp)
|
||||
lcd.NextEvent(globalVars.heatingNextEvent)
|
||||
lcd.heatingPageOne('On', data.measuredRoomTemp, data.lastTimerSetPoint, globalVars.waterNextEvent)
|
||||
led.set('red')
|
||||
} else {
|
||||
globalVars.heatingOn = heatingOn
|
||||
lcd.heatingStatus('Off')
|
||||
lcd.lastSetTemp(data.lastTimerSetPoint)
|
||||
lcd.currentRoomTemp(data.measuredRoomTemp)
|
||||
lcd.NextEvent(globalVars.waterNextEvent)
|
||||
lcd.heatingPageOne('Off', data.measuredRoomTemp, data.lastTimerSetPoint, globalVars.waterNextEvent)
|
||||
led.set('blue')
|
||||
}
|
||||
// }
|
||||
|
@ -36,29 +36,23 @@ module.exports = {
|
||||
if (globalVars.waterOn === "" || globalVars.waterOn === "error") {
|
||||
if (waterOn === 'true') {
|
||||
globalVars.waterOn = waterOn
|
||||
lcd.waterStatus('Heating')
|
||||
lcd.NextEvent(globalVars.waterNextEvent)
|
||||
lcd.waterPageOne('Heating', globalVars.waterNextEvent)
|
||||
led.set('red')
|
||||
} else {
|
||||
globalVars.waterOn = waterOn
|
||||
lcd.waterStatus('Not Heating')
|
||||
lcd.waterPageOne('Not Heating', globalVars.waterNextEvent)
|
||||
led.set('blue')
|
||||
lcd.NextEvent(globalVars.waterNextEvent)
|
||||
}
|
||||
} else {
|
||||
// if (waterOn != globalVars.waterOn) {
|
||||
if (waterOn === 'true') {
|
||||
globalVars.waterOn = waterOn
|
||||
lcd.waterStatus('Heating')
|
||||
lcd.waterPageOne('Heating', globalVars.waterNextEvent)
|
||||
led.set('red')
|
||||
lcd.NextEvent(globalVars.waterNextEvent)
|
||||
} else {
|
||||
globalVars.waterOn = waterOn
|
||||
lcd.waterStatus('Not Heating')
|
||||
lcd.waterPageOne('Not Heating', globalVars.waterNextEvent)
|
||||
led.set('blue')
|
||||
lcd.NextEvent(globalVars.waterNextEvent)
|
||||
}
|
||||
// }
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user