52 lines
1.4 KiB
JavaScript
52 lines
1.4 KiB
JavaScript
const LCD = require('raspberrypi-liquid-crystal');
|
|
const common = require('./common')
|
|
const globalVars = require('./globalVars')
|
|
const clock = require('./clock');
|
|
const { time } = require('./clock');
|
|
|
|
const lcd = new LCD(1, 0x27, 20, 4);
|
|
|
|
lcd.beginSync();
|
|
|
|
module.exports = {
|
|
clearScreen: async () => {
|
|
lcd.clearSync();
|
|
},
|
|
clearLine: async (line) => {
|
|
line = line - 1
|
|
lcd.setCursorSync(0, line);
|
|
lcd.printSync(' ')
|
|
},
|
|
intro: async () => {
|
|
lcd.clearSync();
|
|
lcd.printLineSync(1, 'MiGenie Status')
|
|
lcd.printLineSync(2, ' By Karl')
|
|
await common.pause(3000)
|
|
module.exports.heading('Hot Water')
|
|
},
|
|
heading: async (title) => {
|
|
lcd.clearSync();
|
|
lcd.printLineSync(2, title)
|
|
},
|
|
time: async () => {
|
|
// set interval
|
|
var tid = setInterval(mycode, 60000);
|
|
async function mycode() {
|
|
|
|
lcd.setCursorSync(15, 0);
|
|
let f
|
|
f = await clock.time()
|
|
lcd.printSync(f)
|
|
|
|
}
|
|
function abortTimer() { // to be called when you want to stop the timer
|
|
clearInterval(tid);
|
|
}
|
|
},
|
|
heatingStatus: async (input) => {
|
|
lcd.setCursorSync(0, 3);
|
|
lcd.printSync(' ')
|
|
lcd.setCursorSync(0, 3);
|
|
lcd.printSync(' ' + input)
|
|
},
|
|
} |