Display: add a primitive status display.
This isn't pretty at all, but it shows the principle. Unfortunately it also exploits a bug in the I2C sending mechanism, I2C sending hangs a few seconds after reset.
This commit is contained in:
parent
62190caaa5
commit
a47c4b40df
5
clock.c
5
clock.c
|
|
@ -13,6 +13,7 @@
|
|||
#include "debug.h"
|
||||
#include "heater.h"
|
||||
#include "serial.h"
|
||||
#include "display.h"
|
||||
#ifdef TEMP_INTERCOM
|
||||
#include "intercom.h"
|
||||
#endif
|
||||
|
|
@ -84,6 +85,10 @@ static void clock_250ms(void) {
|
|||
}
|
||||
|
||||
ifclock(clock_flag_1s) {
|
||||
#ifdef DISPLAY
|
||||
display_clock();
|
||||
#endif
|
||||
|
||||
if (DEBUG_POSITION && (debug_flags & DEBUG_POSITION)) {
|
||||
// current position
|
||||
update_current_position();
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
void display_init(void);
|
||||
void display_clear(void);
|
||||
|
||||
void display_clock(void);
|
||||
void display_set_cursor(uint8_t line, uint8_t column);
|
||||
void display_writechar(uint8_t data);
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
#include "displaybus.h"
|
||||
#include "font.h"
|
||||
#include "sendf.h"
|
||||
#include "dda.h"
|
||||
|
||||
|
||||
static const uint8_t PROGMEM init_sequence[] = {
|
||||
|
|
@ -86,6 +88,9 @@ void display_clear(void) {
|
|||
|
||||
\param column The horizontal cursor position to set, in pixels. First
|
||||
column is zero.
|
||||
|
||||
Use this for debugging purposes, only. Regular display updates happen in
|
||||
display_clock().
|
||||
*/
|
||||
void display_set_cursor(uint8_t line, uint8_t column) {
|
||||
|
||||
|
|
@ -98,6 +103,18 @@ void display_set_cursor(uint8_t line, uint8_t column) {
|
|||
displaybus_write(0x10 | ((column >> 4) & 0x0F), 1);
|
||||
}
|
||||
|
||||
/**
|
||||
Regular update of the display. Typically called once a second from clock.c.
|
||||
*/
|
||||
void display_clock(void) {
|
||||
|
||||
display_set_cursor(0, 2);
|
||||
update_current_position();
|
||||
sendf_P(display_writechar, PSTR("X:%lq Y:%lq Z:%lq F:%lu "),
|
||||
current_position.axis[X], current_position.axis[Y],
|
||||
current_position.axis[Z], current_position.F);
|
||||
}
|
||||
|
||||
/**
|
||||
Prints a character at the current cursor position.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue