Browse Source

Fix LCD compile error, etc. (#12472)

pull/1/head
Ludy 6 years ago
committed by Scott Lahteine
parent
commit
1f93d2bcf7
  1. 9
      Marlin/src/inc/Conditionals_LCD.h
  2. 167
      Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp
  3. 2
      Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp
  4. 10
      Marlin/src/lcd/dogm/lcdprint_u8g.cpp
  5. 2
      Marlin/src/lcd/dogm/ultralcd_DOGM.cpp
  6. 2
      Marlin/src/lcd/dogm/ultralcd_DOGM.h
  7. 6
      Marlin/src/lcd/lcdprint.h
  8. 2
      Marlin/src/lcd/menu/menu_configuration.cpp
  9. 125
      Marlin/src/lcd/ultralcd.cpp
  10. 51
      Marlin/src/lcd/ultralcd.h
  11. 6
      Marlin/src/module/temperature.cpp
  12. 4
      Marlin/src/module/temperature.h
  13. 3
      Marlin/src/pins/pins_ANET_10.h

9
Marlin/src/inc/Conditionals_LCD.h

@ -26,8 +26,6 @@
* Conditionals that need to be set before Configuration_adv.h or pins.h
*/
#define LCD_HAS_DIRECTIONAL_BUTTONS (BUTTON_EXISTS(UP) || BUTTON_EXISTS(DWN) || BUTTON_EXISTS(LFT) || BUTTON_EXISTS(RT))
#if ENABLED(CARTESIO_UI)
#define DOGLCD
@ -305,8 +303,11 @@
#define HAS_GRAPHICAL_LCD ENABLED(DOGLCD)
#define HAS_CHARACTER_LCD (HAS_SPI_LCD && !HAS_GRAPHICAL_LCD)
#define HAS_LCD_MENU (ENABLED(ULTIPANEL) && DISABLED(NO_LCD_MENUS))
#define HAS_DIGITAL_BUTTONS ENABLED(NEWPANEL)
#define HAS_ENCODER_WHEEL (ENABLED(NEWPANEL) && DISABLED(ADC_KEYPAD))
#define HAS_ADC_BUTTONS ENABLED(ADC_KEYPAD)
#define HAS_DIGITAL_BUTTONS (!HAS_ADC_BUTTONS && ENABLED(NEWPANEL))
#define HAS_SHIFT_ENCODER (!HAS_ADC_BUTTONS && (ENABLED(REPRAPWORLD_KEYPAD) || (HAS_SPI_LCD && DISABLED(NEWPANEL))))
#define HAS_ENCODER_WHEEL (!HAS_ADC_BUTTONS && ENABLED(NEWPANEL))
#if HAS_GRAPHICAL_LCD
/**

167
Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp

@ -28,7 +28,6 @@
#define LCD_CLASS LiquidCrystal
#endif
extern LCD_CLASS lcd;
LCD_CLASS *plcd = &lcd;
int lcd_glyph_height(void) { return 1; }
@ -868,11 +867,7 @@ static const hd44780_charmap_t g_hd44780_charmap_common[] PROGMEM = {
/* return v1 - v2 */
static int hd44780_charmap_compare(hd44780_charmap_t * v1, hd44780_charmap_t * v2) {
if (v1->uchar < v2->uchar)
return -1;
else if (v1->uchar > v2->uchar)
return 1;
return 0;
return (v1->uchar < v2->uchar) ? -1 : (v1->uchar > v2->uchar) ? 1 : 0;
}
static int pf_bsearch_cb_comp_hd4map_pgm(void *userdata, size_t idx, void * data_pin) {
@ -882,83 +877,9 @@ static int pf_bsearch_cb_comp_hd4map_pgm(void *userdata, size_t idx, void * data
return hd44780_charmap_compare(&localval, (hd44780_charmap_t *)data_pin);
}
#if DEBUG
int test_hd44780_charmap(hd44780_charmap_t *data, size_t size, char *name, char flg_show_contents) {
int ret;
size_t idx = 0;
hd44780_charmap_t preval = {0, 0, 0};
hd44780_charmap_t pinval = {0, 0, 0};
char flg_error = 0;
int i;
TRACE("Test %s\n", name);
for (i = 0; i < size; i ++) {
memcpy_P (&pinval, &(data[i]), sizeof(pinval));
if (flg_show_contents) {
#if 1
TRACE("[% 4d] % 6" PRIu32 "(0x%04" PRIX32 ") --> 0x%02X,0x%02X%s\n", i, pinval.uchar, pinval.uchar, (unsigned int)(pinval.idx), (unsigned int)(pinval.idx2), (preval.uchar < pinval.uchar?"":" <--- ERROR"));
#else
TRACE("[% 4d]", i);
TRACE("% 6" PRIu32 "(0x%04" PRIX32 "),", pinval.uchar, pinval.uchar);
TRACE("0x%02X,", (unsigned int)(pinval.idx));
TRACE("0x%02X,", (unsigned int)(pinval.idx2));
TRACE("%s", (preval.uchar < pinval.uchar?"":" <--- ERROR"));
#endif
}
if (preval.uchar >= pinval.uchar) {
flg_error = 1;
// TRACE("Error: out of order in array %s: idx=%d, val=%d(0x%x)\n", name, i, pinval.uchar, pinval.uchar);
// return -1;
}
memcpy (&preval, &pinval, sizeof(pinval));
ret = pf_bsearch_r((void *)data, size, pf_bsearch_cb_comp_hd4map_pgm, (void *)&pinval, &idx);
if (ret < 0) {
flg_error = 1;
TRACE("Error: not found item in array %s: idx=%d, val=%d(0x%x)\n", name, i, pinval.uchar, pinval.uchar);
//return -1;
}
if (idx != i) {
flg_error = 1;
TRACE("Error: wrong index found item in array %s: idx=%d, val=%d(0x%x)\n", name, i, pinval.uchar, pinval.uchar);
//return -1;
}
}
if (flg_error) {
TRACE("\nError: in array %s\n\n", name);
return -1;
}
TRACE("\nPASS array %s\n\n", name);
return 0;
}
int test_hd44780_charmap_all(void) {
int flg_error = 0;
if (test_hd44780_charmap(g_hd44780_charmap_device, NUM_ARRAY(g_hd44780_charmap_device), "g_hd44780_charmap_device", 0) < 0) {
flg_error = 1;
test_hd44780_charmap(g_hd44780_charmap_device, NUM_ARRAY(g_hd44780_charmap_device), "g_hd44780_charmap_device", 1);
}
if (test_hd44780_charmap(g_hd44780_charmap_common, NUM_ARRAY(g_hd44780_charmap_common), "g_hd44780_charmap_common", 0) < 0) {
flg_error = 1;
test_hd44780_charmap(g_hd44780_charmap_common, NUM_ARRAY(g_hd44780_charmap_common), "g_hd44780_charmap_common", 1);
}
if (flg_error) {
TRACE("\nFAILED in hd44780 tests!\n");
return -1;
}
TRACE("\nPASS in hd44780 tests.\n");
return 0;
}
#endif // DEBUG
void lcd_moveto(const uint8_t col, const uint8_t row) { lcd.setCursor(col, row); }
void lcd_moveto(int col, int row) {
plcd->setCursor(col, row);
}
void lcd_put_int(const int i) { lcd.print(i); }
// return < 0 on error
// return the advanced cols
@ -976,7 +897,7 @@ int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length) {
// TODO: fix the '\\' that doesnt exist in the HD44870
if (c < 128) {
plcd->write((uint8_t)c);
lcd.write((uint8_t)c);
return 1;
}
copy_address = NULL;
@ -993,16 +914,16 @@ int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length) {
hd44780_charmap_t localval;
// found
memcpy_P(&localval, copy_address, sizeof(localval));
plcd->write(localval.idx);
lcd.write(localval.idx);
if (max_length >= 2 && localval.idx2 > 0) {
plcd->write(localval.idx2);
lcd.write(localval.idx2);
return 2;
}
return 1;
}
// Not found, print '?' instead
plcd->write((uint8_t)'?');
lcd.write((uint8_t)'?');
return 1;
}
@ -1037,4 +958,78 @@ int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length) {
return lcd_put_u8str_max_cb(utf8_str_P, read_byte_rom, max_length);
}
#if ENABLED(DEBUG_LCDPRINT)
int test_hd44780_charmap(hd44780_charmap_t *data, size_t size, char *name, char flg_show_contents) {
int ret;
size_t idx = 0;
hd44780_charmap_t preval = {0, 0, 0};
hd44780_charmap_t pinval = {0, 0, 0};
char flg_error = 0;
int i;
TRACE("Test %s\n", name);
for (i = 0; i < size; i ++) {
memcpy_P(&pinval, &(data[i]), sizeof(pinval));
if (flg_show_contents) {
#if 1
TRACE("[% 4d] % 6" PRIu32 "(0x%04" PRIX32 ") --> 0x%02X,0x%02X%s\n", i, pinval.uchar, pinval.uchar, (unsigned int)(pinval.idx), (unsigned int)(pinval.idx2), (preval.uchar < pinval.uchar?"":" <--- ERROR"));
#else
TRACE("[% 4d]", i);
TRACE("% 6" PRIu32 "(0x%04" PRIX32 "),", pinval.uchar, pinval.uchar);
TRACE("0x%02X,", (unsigned int)(pinval.idx));
TRACE("0x%02X,", (unsigned int)(pinval.idx2));
TRACE("%s", (preval.uchar < pinval.uchar?"":" <--- ERROR"));
#endif
}
if (preval.uchar >= pinval.uchar) {
flg_error = 1;
//TRACE("Error: out of order in array %s: idx=%d, val=%d(0x%x)\n", name, i, pinval.uchar, pinval.uchar);
//return -1;
}
memcpy(&preval, &pinval, sizeof(pinval));
ret = pf_bsearch_r((void *)data, size, pf_bsearch_cb_comp_hd4map_pgm, (void *)&pinval, &idx);
if (ret < 0) {
flg_error = 1;
TRACE("Error: not found item in array %s: idx=%d, val=%d(0x%x)\n", name, i, pinval.uchar, pinval.uchar);
//return -1;
}
if (idx != i) {
flg_error = 1;
TRACE("Error: wrong index found item in array %s: idx=%d, val=%d(0x%x)\n", name, i, pinval.uchar, pinval.uchar);
//return -1;
}
}
if (flg_error) {
TRACE("\nError: in array %s\n\n", name);
return -1;
}
TRACE("\nPASS array %s\n\n", name);
return 0;
}
int test_hd44780_charmap_all(void) {
int flg_error = 0;
if (test_hd44780_charmap(g_hd44780_charmap_device, NUM_ARRAY(g_hd44780_charmap_device), "g_hd44780_charmap_device", 0) < 0) {
flg_error = 1;
test_hd44780_charmap(g_hd44780_charmap_device, NUM_ARRAY(g_hd44780_charmap_device), "g_hd44780_charmap_device", 1);
}
if (test_hd44780_charmap(g_hd44780_charmap_common, NUM_ARRAY(g_hd44780_charmap_common), "g_hd44780_charmap_common", 0) < 0) {
flg_error = 1;
test_hd44780_charmap(g_hd44780_charmap_common, NUM_ARRAY(g_hd44780_charmap_common), "g_hd44780_charmap_common", 1);
}
if (flg_error) {
TRACE("\nFAILED in hd44780 tests!\n");
return -1;
}
TRACE("\nPASS in hd44780 tests.\n");
return 0;
}
#endif // DEBUG_LCDPRINT
#endif // HAS_CHARACTER_LCD

2
Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp

@ -25,7 +25,7 @@
#if HAS_CHARACTER_LCD
/**
* ultralcd_impl_HD44780.cpp
* ultralcd_HD44780.cpp
*
* LCD display implementations for Hitachi HD44780.
* These are the most common LCD character displays.

10
Marlin/src/lcd/dogm/lcdprint_u8g.cpp

@ -23,13 +23,11 @@ extern U8GLIB *pu8g;
#include "u8g_fontutf8.h"
#include "../lcdprint.h"
int lcd_glyph_height(void) {
return u8g_GetFontBBXHeight(pu8g->getU8g());
}
int lcd_glyph_height(void) { return u8g_GetFontBBXHeight(pu8g->getU8g()); }
void lcd_moveto(int col, int row) {
_lcd_setcursor(col, row);
}
void lcd_moveto(const uint8_t col, const uint8_t row) { _lcd_setcursor(col, row); }
void lcd_put_int(const int i) { pu8g->print(i); }
// return < 0 on error
// return the advanced pixels

2
Marlin/src/lcd/dogm/ultralcd_DOGM.cpp

@ -21,7 +21,7 @@
*/
/**
* ultralcd_impl_DOGM.cpp
* ultralcd_DOGM.cpp
*
* Implementation of the LCD display routines for a DOGM128 graphic display.
* by STB for ErikZalm/Marlin. Common LCD 128x64 pixel graphic displays.

2
Marlin/src/lcd/dogm/ultralcd_DOGM.h

@ -21,7 +21,7 @@
*/
/**
* ultralcd_impl_DOGM.h
* ultralcd_DOGM.h
*/
#include "../../inc/MarlinConfigPre.h"

6
Marlin/src/lcd/lcdprint.h

@ -48,10 +48,12 @@ int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length);
*/
int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length);
void lcd_moveto(int col, int row);
void lcd_moveto(const uint8_t col, const uint8_t row);
void lcd_put_int(const int i);
inline int lcd_put_u8str_P(PGM_P str) { return lcd_put_u8str_max_P(str, PIXEL_LEN_NOLIMIT); }
inline int lcd_put_u8str(const char* str) { return lcd_put_u8str_max(str, PIXEL_LEN_NOLIMIT); }
inline int lcd_put_wchar(wchar_t c) { return lcd_put_wchar_max(c, PIXEL_LEN_NOLIMIT); }
inline int lcd_put_wchar(const wchar_t c) { return lcd_put_wchar_max(c, PIXEL_LEN_NOLIMIT); }

2
Marlin/src/lcd/menu/menu_configuration.cpp

@ -66,7 +66,7 @@ static void lcd_factory_settings() {
ui.encoderPosition = 0;
draw_menu_item_static(0, PSTR(MSG_PROGRESS_BAR_TEST), true, true);
lcd_moveto((LCD_WIDTH) / 2 - 2, LCD_HEIGHT - 2);
lcd_put_u8str(int(bar_percent)); lcd_put_wchar('%');
lcd_put_int(bar_percent); lcd_put_wchar('%');
lcd_moveto(0, LCD_HEIGHT - 1); ui.draw_progress_bar(bar_percent);
}

125
Marlin/src/lcd/ultralcd.cpp

@ -207,12 +207,6 @@ void MarlinUI::init() {
SET_INPUT_PULLUP(BTN_ENC);
#endif
#if ENABLED(REPRAPWORLD_KEYPAD) && DISABLED(ADC_KEYPAD)
SET_OUTPUT(SHIFT_CLK);
OUT_WRITE(SHIFT_LD, HIGH);
SET_INPUT_PULLUP(SHIFT_OUT);
#endif
#if BUTTON_EXISTS(UP)
SET_INPUT(BTN_UP);
#endif
@ -226,19 +220,27 @@ void MarlinUI::init() {
SET_INPUT(BTN_RT);
#endif
#else // !HAS_DIGITAL_BUTTONS
#endif // !HAS_DIGITAL_BUTTONS
#if HAS_SHIFT_ENCODER
#if ENABLED(SR_LCD_2W_NL) // Non latching 2 wire shift register
SET_OUTPUT(SR_DATA_PIN);
SET_OUTPUT(SR_CLK_PIN);
#elif defined(SHIFT_CLK)
SET_OUTPUT(SHIFT_CLK);
OUT_WRITE(SHIFT_LD, HIGH);
OUT_WRITE(SHIFT_EN, LOW);
#if defined(SHIFT_EN) && SHIFT_EN >= 0
OUT_WRITE(SHIFT_EN, LOW);
#endif
SET_INPUT_PULLUP(SHIFT_OUT);
#endif // SR_LCD_2W_NL
#endif // !HAS_DIGITAL_BUTTONS
#endif
#endif // HAS_SHIFT_ENCODER
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
SET_INPUT_PULLUP(SD_DETECT_PIN);
@ -273,9 +275,9 @@ bool MarlinUI::get_blink() {
#if ENABLED(REPRAPWORLD_KEYPAD) && HAS_ENCODER_ACTION
volatile uint8_t MarlinUI::buttons_reprapworld_keypad;
volatile uint8_t MarlinUI::keypad_buttons;
#if DISABLED(ADC_KEYPAD) && HAS_LCD_MENU
#if HAS_LCD_MENU && !HAS_ADC_BUTTONS
void lcd_move_x();
void lcd_move_y();
@ -296,10 +298,10 @@ bool MarlinUI::get_blink() {
bool MarlinUI::handle_keypad() {
#if ENABLED(ADC_KEYPAD)
#if HAS_ADC_BUTTONS
#define ADC_MIN_KEY_DELAY 100
if (buttons_reprapworld_keypad) {
if (keypad_buttons) {
#if HAS_ENCODER_ACTION
refresh(LCDVIEW_REDRAW_NOW);
if (encoderDirection == -1) { // side effect which signals we are inside a menu
@ -310,15 +312,16 @@ bool MarlinUI::get_blink() {
else if (RRK(EN_REPRAPWORLD_KEYPAD_RIGHT)) { return_to_status(); quick_feedback(); }
#endif
}
else if (RRK(EN_REPRAPWORLD_KEYPAD_DOWN)) encoderPosition += ENCODER_PULSES_PER_STEP;
else if (RRK(EN_REPRAPWORLD_KEYPAD_UP)) encoderPosition -= ENCODER_PULSES_PER_STEP;
else if (RRK(EN_REPRAPWORLD_KEYPAD_DOWN)) encoderPosition -= ENCODER_PULSES_PER_STEP;
else if (RRK(EN_REPRAPWORLD_KEYPAD_UP)) encoderPosition += ENCODER_PULSES_PER_STEP;
else if (RRK(EN_REPRAPWORLD_KEYPAD_LEFT)) { MenuItem_back::action(); quick_feedback(); }
else if (RRK(EN_REPRAPWORLD_KEYPAD_RIGHT)) encoderPosition = 0;
#endif
next_button_update_ms = millis() + ADC_MIN_KEY_DELAY;
return true;
}
#else // !ADC_KEYPAD
#else // !HAS_ADC_BUTTONS
static uint8_t keypad_debounce = 0;
@ -408,7 +411,9 @@ void MarlinUI::status_screen() {
// share the same line on the display.
//
millis_t ms = millis();
#if DISABLED(PROGRESS_MSG_ONCE) || (PROGRESS_MSG_EXPIRE > 0)
millis_t ms = millis();
#endif
// If the message will blink rather than expire...
#if DISABLED(PROGRESS_MSG_ONCE)
@ -818,8 +823,8 @@ void MarlinUI::update() {
break;
} // switch
#if ENABLED(ADC_KEYPAD)
buttons_reprapworld_keypad = 0;
#if HAS_ADC_BUTTONS
keypad_buttons = 0;
#endif
#if HAS_GRAPHICAL_LCD
@ -890,7 +895,7 @@ void MarlinUI::update() {
} // ELAPSED(ms, next_lcd_update_ms)
}
#if ENABLED(ADC_KEYPAD)
#if HAS_ADC_BUTTONS
typedef struct {
uint16_t ADCKeyValueMin, ADCKeyValueMax;
@ -953,30 +958,38 @@ void MarlinUI::update() {
* Warning: This function is called from interrupt context!
*/
void MarlinUI::update_buttons() {
static uint8_t lastEncoderBits;
const millis_t now = millis();
if (ELAPSED(now, next_button_update_ms)) {
#if HAS_DIGITAL_BUTTONS
uint8_t newbutton = 0;
#if BUTTON_EXISTS(EN1)
if (BUTTON_PRESSED(EN1)) newbutton |= EN_A;
#endif
#if BUTTON_EXISTS(EN2)
if (BUTTON_PRESSED(EN2)) newbutton |= EN_B;
#endif
#if BUTTON_EXISTS(ENC)
if (BUTTON_PRESSED(ENC)) newbutton |= EN_C;
#endif
#if BUTTON_EXISTS(BACK)
if (BUTTON_PRESSED(BACK)) newbutton |= EN_D;
#if BUTTON_EXISTS(EN1) || BUTTON_EXISTS(EN2) || BUTTON_EXISTS(ENC) || BUTTON_EXISTS(BACK)
uint8_t newbutton = 0;
#if BUTTON_EXISTS(EN1)
if (BUTTON_PRESSED(EN1)) newbutton |= EN_A;
#endif
#if BUTTON_EXISTS(EN2)
if (BUTTON_PRESSED(EN2)) newbutton |= EN_B;
#endif
#if BUTTON_EXISTS(ENC)
if (BUTTON_PRESSED(ENC)) newbutton |= EN_C;
#endif
#if BUTTON_EXISTS(BACK)
if (BUTTON_PRESSED(BACK)) newbutton |= EN_D;
#endif
#else
constexpr uint8_t newbutton = 0;
#endif
//
// Directional buttons
//
#if LCD_HAS_DIRECTIONAL_BUTTONS
#if BUTTON_EXISTS(UP) || BUTTON_EXISTS(DWN) || BUTTON_EXISTS(LFT) || BUTTON_EXISTS(RT)
const int8_t pulses = (ENCODER_PULSES_PER_STEP) * encoderDirection;
@ -1008,40 +1021,40 @@ void MarlinUI::update() {
}
#endif
#endif // LCD_HAS_DIRECTIONAL_BUTTONS
#endif // UP || DWN || LFT || RT
#if ENABLED(ADC_KEYPAD)
buttons = newbutton
#if ENABLED(LCD_HAS_SLOW_BUTTONS)
| slow_buttons
#endif
;
buttons = 0;
if (buttons_reprapworld_keypad == 0) {
uint8_t newbutton_reprapworld_keypad = get_ADC_keyValue();
if (WITHIN(newbutton_reprapworld_keypad, 1, 8))
buttons_reprapworld_keypad = _BV(newbutton_reprapworld_keypad - 1);
}
#elif HAS_ADC_BUTTONS
#else
buttons = 0;
if (keypad_buttons == 0) {
const uint8_t b = get_ADC_keyValue();
if (WITHIN(b, 1, 8)) keypad_buttons = _BV(b - 1);
}
buttons = newbutton
#if ENABLED(LCD_HAS_SLOW_BUTTONS)
| slow_buttons
#endif
;
#endif
#if HAS_SHIFT_ENCODER
GET_SHIFT_BUTTON_STATES(
#if ENABLED(REPRAPWORLD_KEYPAD)
GET_SHIFT_BUTTON_STATES(buttons_reprapworld_keypad);
keypad_buttons
#else
buttons
#endif
#endif
#else // !HAS_DIGITAL_BUTTONS
GET_SHIFT_BUTTON_STATES(buttons);
);
#endif
} // next_button_update_ms
#if HAS_ENCODER_WHEEL
static uint8_t lastEncoderBits;
#define encrot0 0
#define encrot1 2

51
Marlin/src/lcd/ultralcd.h

@ -46,7 +46,7 @@
LCDVIEW_CALL_NO_REDRAW
};
#if ENABLED(ADC_KEYPAD)
#if HAS_ADC_BUTTONS
uint8_t get_ADC_keyValue();
#endif
@ -88,6 +88,30 @@
#endif
#if ENABLED(REPRAPWORLD_KEYPAD)
#define REPRAPWORLD_BTN_OFFSET 0 // Bit offset into buttons for shift register values
#define BLEN_REPRAPWORLD_KEYPAD_F3 0
#define BLEN_REPRAPWORLD_KEYPAD_F2 1
#define BLEN_REPRAPWORLD_KEYPAD_F1 2
#define BLEN_REPRAPWORLD_KEYPAD_DOWN 3
#define BLEN_REPRAPWORLD_KEYPAD_RIGHT 4
#define BLEN_REPRAPWORLD_KEYPAD_MIDDLE 5
#define BLEN_REPRAPWORLD_KEYPAD_UP 6
#define BLEN_REPRAPWORLD_KEYPAD_LEFT 7
#define EN_REPRAPWORLD_KEYPAD_F1 (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_F1))
#define EN_REPRAPWORLD_KEYPAD_F2 (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_F2))
#define EN_REPRAPWORLD_KEYPAD_F3 (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_F3))
#define EN_REPRAPWORLD_KEYPAD_DOWN (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_DOWN))
#define EN_REPRAPWORLD_KEYPAD_RIGHT (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_RIGHT))
#define EN_REPRAPWORLD_KEYPAD_MIDDLE (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_MIDDLE))
#define EN_REPRAPWORLD_KEYPAD_UP (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_UP))
#define EN_REPRAPWORLD_KEYPAD_LEFT (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_LEFT))
#define RRK(B) (keypad_buttons & (B))
#endif
#if HAS_DIGITAL_BUTTONS
// Wheel spin pins where BA is 00, 10, 11, 01 (1 bit always changes)
@ -112,27 +136,6 @@
#endif
#if ENABLED(REPRAPWORLD_KEYPAD)
#define REPRAPWORLD_BTN_OFFSET 0 // Bit offset into buttons for shift register values
#define BLEN_REPRAPWORLD_KEYPAD_F3 0
#define BLEN_REPRAPWORLD_KEYPAD_F2 1
#define BLEN_REPRAPWORLD_KEYPAD_F1 2
#define BLEN_REPRAPWORLD_KEYPAD_DOWN 3
#define BLEN_REPRAPWORLD_KEYPAD_RIGHT 4
#define BLEN_REPRAPWORLD_KEYPAD_MIDDLE 5
#define BLEN_REPRAPWORLD_KEYPAD_UP 6
#define BLEN_REPRAPWORLD_KEYPAD_LEFT 7
#define EN_REPRAPWORLD_KEYPAD_F1 (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_F1))
#define EN_REPRAPWORLD_KEYPAD_F2 (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_F2))
#define EN_REPRAPWORLD_KEYPAD_F3 (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_F3))
#define EN_REPRAPWORLD_KEYPAD_DOWN (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_DOWN))
#define EN_REPRAPWORLD_KEYPAD_RIGHT (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_RIGHT))
#define EN_REPRAPWORLD_KEYPAD_MIDDLE (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_MIDDLE))
#define EN_REPRAPWORLD_KEYPAD_UP (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_UP))
#define EN_REPRAPWORLD_KEYPAD_LEFT (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_LEFT))
#define RRK(B) (buttons_reprapworld_keypad & (B))
#ifdef EN_C
#define BUTTON_CLICK() ((buttons & EN_C) || RRK(EN_REPRAPWORLD_KEYPAD_MIDDLE))
@ -180,6 +183,8 @@
#else
#define BUTTON_EXISTS(BN) 0
// Shift register bits correspond to buttons:
#define BL_LE 7 // Left
#define BL_UP 6 // Up
@ -463,7 +468,7 @@ public:
static volatile uint8_t buttons;
#if ENABLED(REPRAPWORLD_KEYPAD)
static volatile uint8_t buttons_reprapworld_keypad;
static volatile uint8_t keypad_buttons;
static bool handle_keypad();
#endif
#if ENABLED(LCD_HAS_SLOW_BUTTONS)

6
Marlin/src/module/temperature.cpp

@ -217,7 +217,7 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS];
bool Temperature::heater_idle_timeout_exceeded[HOTENDS] = { false };
#endif
#if ENABLED(ADC_KEYPAD)
#if HAS_ADC_BUTTONS
uint32_t Temperature::current_ADCKey_raw = 0;
uint8_t Temperature::ADCKey_count = 0;
#endif
@ -1869,7 +1869,7 @@ void Temperature::isr() {
// avoid multiple loads of pwm_count
uint8_t pwm_count_tmp = pwm_count;
#if ENABLED(ADC_KEYPAD)
#if HAS_ADC_BUTTONS
static unsigned int raw_ADCKey_value = 0;
#endif
@ -2290,7 +2290,7 @@ void Temperature::isr() {
break;
#endif
#if ENABLED(ADC_KEYPAD)
#if HAS_ADC_BUTTONS
case Prepare_ADC_KEY:
HAL_START_ADC(ADC_KEYPAD_PIN);
break;

4
Marlin/src/module/temperature.h

@ -112,7 +112,7 @@ enum ADCSensorState : char {
Prepare_FILWIDTH,
Measure_FILWIDTH,
#endif
#if ENABLED(ADC_KEYPAD)
#if HAS_ADC_BUTTONS
Prepare_ADC_KEY,
Measure_ADC_KEY,
#endif
@ -291,7 +291,7 @@ class Temperature {
#endif
public:
#if ENABLED(ADC_KEYPAD)
#if HAS_ADC_BUTTONS
static uint32_t current_ADCKey_raw;
static uint8_t ADCKey_count;
#endif

3
Marlin/src/pins/pins_ANET_10.h

@ -161,9 +161,6 @@
#define LCD_PINS_D5 11
#define LCD_PINS_D6 16
#define LCD_PINS_D7 17
#define BTN_EN1 -1
#define BTN_EN2 -1
#define BTN_ENC -1
#define ADC_KEYPAD_PIN 1
#elif ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) || ENABLED(ANET_FULL_GRAPHICS_LCD)
// Pin definitions for the Anet A6 Full Graphics display and the RepRapDiscount Full Graphics

Loading…
Cancel
Save