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