diff --git a/app.js b/app.js index 9b67bbb..f429ed8 100644 --- a/app.js +++ b/app.js @@ -9,7 +9,7 @@ const menu = require('./modules/mainMenu') async function main() { lcd.clearScreen() await lcd.intro() - menu.water() + menu.home() const heatingSwitch = new Gpio('17', 'in', 'both'); const appSwitch = new Gpio('23', 'in', 'both'); diff --git a/libs/lcd.js b/libs/lcd.js index d47c755..8eb5574 100644 --- a/libs/lcd.js +++ b/libs/lcd.js @@ -40,7 +40,7 @@ module.exports = { lcd.setCursorSync(6, 2); lcd.printSync(input) }, - waterStatus: async (input) => { + heatingStatus: async (input) => { lcd.printLineSync(2, 'Heating=') lcd.setCursorSync(8, 2); lcd.printSync(' ') @@ -62,7 +62,14 @@ module.exports = { lcd.printSync(input) } }, - degrees: async () => { + currentRoomTemp: async (temp) => { let icon = '°' + temp = temp + icon + console.log(temp) + }, + lastSetTemp: async (temp) => { + let icon = '°' + temp = temp + icon + console.log(temp) } } \ No newline at end of file diff --git a/modules/heating.js b/modules/heating.js index 63c27f5..0615785 100644 --- a/modules/heating.js +++ b/modules/heating.js @@ -26,8 +26,6 @@ module.exports = { response.on('end', async function () { var data = JSON.parse(content); let heatingOn = data.heatingOn - let currentRoomTemp = data.measuredRoomTemp - let currentSetPoint = data.currentSetpoint var time = await common.nextEvent(data.nextScheduleEventUtcTime) @@ -39,39 +37,45 @@ module.exports = { if (heatingOn === 'true') { globalVars.heatingOn = heatingOn lcd.heatingStatus('On') + lcd.lastSetTemp(data.lastTimerSetPoint) + lcd.currentRoomTemp(data.measuredRoomTemp) lcd.NextEvent(globalVars.heatingNextEvent) led.set('red') } else { - globalVars.waterOn = waterOn + globalVars.heatingOn = heatingOn lcd.heatingStatus('Off') - led.set('blue') + lcd.lastSetTemp(data.lastTimerSetPoint) + lcd.currentRoomTemp(data.measuredRoomTemp) lcd.NextEvent(globalVars.heatingNextEvent) + led.set('blue') } } else { // if (waterOn != globalVars.waterOn) { if (heatingOn === 'true') { globalVars.heatingOn = heatingOn lcd.heatingStatus('On') - led.set('red') + lcd.lastSetTemp(data.lastTimerSetPoint) + lcd.currentRoomTemp(data.measuredRoomTemp) lcd.NextEvent(globalVars.heatingNextEvent) + led.set('red') } else { globalVars.heatingOn = heatingOn lcd.heatingStatus('Off') - led.set('blue') + lcd.lastSetTemp(data.lastTimerSetPoint) + lcd.currentRoomTemp(data.measuredRoomTemp) lcd.NextEvent(globalVars.waterNextEvent) + led.set('blue') } // } } }); }); - // Report errors request.on('error', function (error) { led.set('green') lcd.heatingStatus('Error No Data') globalVars.heatingOn = 'error' }); - request.end(); } } \ No newline at end of file