From 692fab68b9a3d4173be7d2dd8c89ac51106a4065 Mon Sep 17 00:00:00 2001 From: Markus Hitter Date: Sat, 28 May 2016 17:04:32 +0200 Subject: [PATCH] display_hd44780.c: replace silly demo with temperatures. Now we have something useful. And it works nicely :-) --- display_hd44780.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/display_hd44780.c b/display_hd44780.c index ef245a4..685786a 100644 --- a/display_hd44780.c +++ b/display_hd44780.c @@ -12,6 +12,7 @@ #include "delay.h" #include "sendf.h" #include "dda.h" +#include "temp.h" /** @@ -54,7 +55,7 @@ void display_greeting(void) { Regular update of the display. Typically called once a second from clock.c. */ void display_clock(void) { - static uint8_t pos = 0; + uint16_t temperature; display_clear(); @@ -62,16 +63,18 @@ void display_clock(void) { sendf_P(display_writechar, PSTR("X:%lq Y:%lq"), current_position.axis[X], current_position.axis[Y]); - /** - This is a tiny demo showing how cursor positioning works. The - four-character text should move along the second display line. - */ - display_set_cursor(1, pos); - display_writestr_P(PSTR("ick!")); - pos++; - if (pos >= DISPLAY_SYMBOLS_PER_LINE) { - pos = 0; - } + #ifdef HEATER_EXTRUDER + display_set_cursor(1, 0); + temperature = temp_get(TEMP_SENSOR_extruder); + sendf_P(display_writechar, PSTR("%u.%su"), + temperature >> 2, (uint8_t)(temperature & 3) * 25); + #endif + #ifdef HEATER_BED + display_set_cursor(1, DISPLAY_SYMBOLS_PER_LINE / 2); + temperature = temp_get(TEMP_SENSOR_bed); + sendf_P(display_writechar, PSTR("%u.%su"), + temperature >> 2, (uint8_t)(temperature & 3) * 25); + #endif } /**