display_hd44780.c: replace silly demo with temperatures.

Now we have something useful. And it works nicely :-)
This commit is contained in:
Markus Hitter 2016-05-28 17:04:32 +02:00
parent c2c9753f80
commit 692fab68b9
1 changed files with 14 additions and 11 deletions

View File

@ -12,6 +12,7 @@
#include "delay.h" #include "delay.h"
#include "sendf.h" #include "sendf.h"
#include "dda.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. Regular update of the display. Typically called once a second from clock.c.
*/ */
void display_clock(void) { void display_clock(void) {
static uint8_t pos = 0; uint16_t temperature;
display_clear(); display_clear();
@ -62,16 +63,18 @@ void display_clock(void) {
sendf_P(display_writechar, PSTR("X:%lq Y:%lq"), sendf_P(display_writechar, PSTR("X:%lq Y:%lq"),
current_position.axis[X], current_position.axis[Y]); current_position.axis[X], current_position.axis[Y]);
/** #ifdef HEATER_EXTRUDER
This is a tiny demo showing how cursor positioning works. The display_set_cursor(1, 0);
four-character text should move along the second display line. temperature = temp_get(TEMP_SENSOR_extruder);
*/ sendf_P(display_writechar, PSTR("%u.%su"),
display_set_cursor(1, pos); temperature >> 2, (uint8_t)(temperature & 3) * 25);
display_writestr_P(PSTR("ick!")); #endif
pos++; #ifdef HEATER_BED
if (pos >= DISPLAY_SYMBOLS_PER_LINE) { display_set_cursor(1, DISPLAY_SYMBOLS_PER_LINE / 2);
pos = 0; temperature = temp_get(TEMP_SENSOR_bed);
} sendf_P(display_writechar, PSTR("%u.%su"),
temperature >> 2, (uint8_t)(temperature & 3) * 25);
#endif
} }
/** /**