Skip to content

Commit

Permalink
fix #12
Browse files Browse the repository at this point in the history
  • Loading branch information
ursoft committed Nov 21, 2019
1 parent 9e56316 commit e4ecd36
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,7 @@
//===========================================================================

// @section homing
#define LCD_SHOW_ENDSTOPS_STATUS

// Specify here all the endstop connectors that are connected to any endstop or probe.
// Almost all printers will be using one per axis. Probes will use one or more of the
Expand Down
8 changes: 8 additions & 0 deletions Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,16 @@ void MarlinUI::draw_kill_screen() {
// Homed but unknown... '123' <-> ' '.
// Homed and known, display constantly.
//
#if ENABLED(LCD_SHOW_ENDSTOPS_STATUS)
#include "../../module/endstops.h"
#endif

FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink) {
#if ENABLED(LCD_SHOW_ENDSTOPS_STATUS)
lcd_put_wchar((endstops.axis_min(axis) ? 'x' : 'X') + uint8_t(axis));
#else
lcd_put_wchar('X' + uint8_t(axis));
#endif
if (blink)
lcd_put_u8str(value);
else {
Expand Down
21 changes: 21 additions & 0 deletions Marlin/src/module/endstops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,27 @@ static void print_es_state(const bool is_hit, PGM_P const label=nullptr) {
SERIAL_EOL();
}

#if ENABLED(LCD_SHOW_ENDSTOPS_STATUS)
bool Endstops::axis_min(AxisEnum ax) {
bool ret;
switch(ax) {
case X_AXIS:
ret = READ(X_MIN_PIN) != X_MIN_ENDSTOP_INVERTING;
break;
case Y_AXIS:
ret = READ(Y_MIN_PIN) != Y_MIN_ENDSTOP_INVERTING;
break;
case Z_AXIS:
ret = READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING;
break;
default:
ret = false;
break;
}
return ret;
}
#endif

void _O2 Endstops::report_states() {
#if ENABLED(BLTOUCH)
bltouch._set_SW_mode();
Expand Down
3 changes: 3 additions & 0 deletions Marlin/src/module/endstops.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ class Endstops {
#endif

static void resync();
#if ENABLED(LCD_SHOW_ENDSTOPS_STATUS)
static bool axis_min(AxisEnum ax);
#endif

// Debugging of endstops
#if ENABLED(PINS_DEBUGGING)
Expand Down

0 comments on commit e4ecd36

Please sign in to comment.