Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change ST9720 delay settings priorities #22713

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Marlin/src/HAL/AVR/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@
// Default graphical display delays
//
#if F_CPU >= 20000000
#define CPU_ST7920_DELAY_1 DELAY_NS(150)
#define CPU_ST7920_DELAY_2 DELAY_NS( 0)
#define CPU_ST7920_DELAY_3 DELAY_NS(150)
#define CPU_ST7920_DELAY_1 150
#define CPU_ST7920_DELAY_2 0
#define CPU_ST7920_DELAY_3 150
#elif F_CPU == 16000000
#define CPU_ST7920_DELAY_1 DELAY_NS(125)
#define CPU_ST7920_DELAY_2 DELAY_NS( 0)
#define CPU_ST7920_DELAY_3 DELAY_NS(188)
#define CPU_ST7920_DELAY_1 125
#define CPU_ST7920_DELAY_2 0
#define CPU_ST7920_DELAY_3 188
#endif

#ifndef pgm_read_ptr
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/HAL/LINUX/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ uint8_t _getc();
extern MSerialT usb_serial;
#define MYSERIAL1 usb_serial

#define CPU_ST7920_DELAY_1 DELAY_NS(600)
#define CPU_ST7920_DELAY_2 DELAY_NS(750)
#define CPU_ST7920_DELAY_3 DELAY_NS(750)
#define CPU_ST7920_DELAY_1 600
#define CPU_ST7920_DELAY_2 750
#define CPU_ST7920_DELAY_3 750

//
// Interrupts
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/HAL/LPC1768/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ extern "C" volatile uint32_t _millis;
//
// Default graphical display delays
//
#define CPU_ST7920_DELAY_1 DELAY_NS(600)
#define CPU_ST7920_DELAY_2 DELAY_NS(750)
#define CPU_ST7920_DELAY_3 DELAY_NS(750)
#define CPU_ST7920_DELAY_1 600
#define CPU_ST7920_DELAY_2 750
#define CPU_ST7920_DELAY_3 750

typedef ForwardSerial1Class< decltype(UsbSerial) > DefaultSerial1;
extern DefaultSerial1 USBSerial;
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/HAL/NATIVE_SIM/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ extern MSerialT serial_stream_3;
#endif


#define CPU_ST7920_DELAY_1 DELAY_NS(600)
#define CPU_ST7920_DELAY_2 DELAY_NS(750)
#define CPU_ST7920_DELAY_3 DELAY_NS(750)
#define CPU_ST7920_DELAY_1 600
#define CPU_ST7920_DELAY_2 750
#define CPU_ST7920_DELAY_3 750

//
// Interrupts
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/HAL/STM32/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
//
// Default graphical display delays
//
#define CPU_ST7920_DELAY_1 DELAY_NS(300)
#define CPU_ST7920_DELAY_2 DELAY_NS( 40)
#define CPU_ST7920_DELAY_3 DELAY_NS(340)
#define CPU_ST7920_DELAY_1 300
#define CPU_ST7920_DELAY_2 40
#define CPU_ST7920_DELAY_3 340

//
// Serial Ports
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/HAL/STM32F1/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
//
// Default graphical display delays
//
#define CPU_ST7920_DELAY_1 DELAY_NS(300)
#define CPU_ST7920_DELAY_2 DELAY_NS( 40)
#define CPU_ST7920_DELAY_3 DELAY_NS(340)
#define CPU_ST7920_DELAY_1 300
#define CPU_ST7920_DELAY_2 40
#define CPU_ST7920_DELAY_3 340

#ifndef STM32_FLASH_SIZE
#if ANY(MCU_STM32F103RE, MCU_STM32F103VE, MCU_STM32F103ZE)
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/HAL/TEENSY31_32/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@

#include <stdint.h>

#define CPU_ST7920_DELAY_1 DELAY_NS(600)
#define CPU_ST7920_DELAY_2 DELAY_NS(750)
#define CPU_ST7920_DELAY_3 DELAY_NS(750)
#define CPU_ST7920_DELAY_1 600
#define CPU_ST7920_DELAY_2 750
#define CPU_ST7920_DELAY_3 750

//#undef MOTHERBOARD
//#define MOTHERBOARD BOARD_TEENSY31_32
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/HAL/TEENSY35_36/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
#include <stdint.h>
#include <util/atomic.h>

#define CPU_ST7920_DELAY_1 DELAY_NS(600)
#define CPU_ST7920_DELAY_2 DELAY_NS(750)
#define CPU_ST7920_DELAY_3 DELAY_NS(750)
#define CPU_ST7920_DELAY_1 600
#define CPU_ST7920_DELAY_2 750
#define CPU_ST7920_DELAY_3 750

// ------------------------
// Defines
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/HAL/TEENSY40_41/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
#include "../../feature/ethernet.h"
#endif

#define CPU_ST7920_DELAY_1 DELAY_NS(600)
#define CPU_ST7920_DELAY_2 DELAY_NS(750)
#define CPU_ST7920_DELAY_3 DELAY_NS(750)
#define CPU_ST7920_DELAY_1 600
#define CPU_ST7920_DELAY_2 750
#define CPU_ST7920_DELAY_3 750

// ------------------------
// Defines
Expand Down
12 changes: 6 additions & 6 deletions Marlin/src/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,16 +237,16 @@
#elif ENABLED(CR10_STOCKDISPLAY)

#define IS_RRD_FG_SC 1
#define LCD_ST7920_DELAY_1 DELAY_NS(125)
#define LCD_ST7920_DELAY_2 DELAY_NS(125)
#define LCD_ST7920_DELAY_3 DELAY_NS(125)
#define LCD_ST7920_DELAY_1 125
#define LCD_ST7920_DELAY_2 125
#define LCD_ST7920_DELAY_3 125

#elif ENABLED(ANET_FULL_GRAPHICS_LCD, ANET_FULL_GRAPHICS_LCD_ALT_WIRING)

#define IS_RRD_FG_SC 1
#define LCD_ST7920_DELAY_1 DELAY_NS(150)
#define LCD_ST7920_DELAY_2 DELAY_NS(150)
#define LCD_ST7920_DELAY_3 DELAY_NS(150)
#define LCD_ST7920_DELAY_1 150
#define LCD_ST7920_DELAY_2 150
#define LCD_ST7920_DELAY_3 150

#elif ANY(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER, BQ_LCD_SMART_CONTROLLER, K3D_FULL_GRAPHIC_SMART_CONTROLLER)

Expand Down
50 changes: 50 additions & 0 deletions Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,61 @@
// Optimize this code with -O3
#pragma GCC optimize (3)

#ifndef ST7920_DELAY_1
#ifndef LCD_ST7920_DELAY_1
#define LCD_ST7920_DELAY_1 0
#endif
#ifndef BOARD_ST7920_DELAY_1
#define BOARD_ST7920_DELAY_1 0
#endif
#ifndef CPU_ST7920_DELAY_1
#define CPU_ST7920_DELAY_1 0
#endif
#if LCD_ST7920_DELAY_1 || BOARD_ST7920_DELAY_1 || CPU_ST7920_DELAY_1
#define ST7920_DELAY_1 DELAY_NS(_MAX(LCD_ST7920_DELAY_1, BOARD_ST7920_DELAY_1, CPU_ST7920_DELAY_1))
#else
#define ST7920_DELAY_1
#endif
#endif
#ifndef ST7920_DELAY_2
#ifndef LCD_ST7920_DELAY_2
#define LCD_ST7920_DELAY_2 0
#endif
#ifndef BOARD_ST7920_DELAY_2
#define BOARD_ST7920_DELAY_2 0
#endif
#ifndef CPU_ST7920_DELAY_2
#define CPU_ST7920_DELAY_2 0
#endif
#if LCD_ST7920_DELAY_2 || BOARD_ST7920_DELAY_2 || CPU_ST7920_DELAY_2
#define ST7920_DELAY_2 DELAY_NS(_MAX(LCD_ST7920_DELAY_2, BOARD_ST7920_DELAY_2, CPU_ST7920_DELAY_2))
#else
#define ST7920_DELAY_2
#endif
#endif
#ifndef ST7920_DELAY_3
#ifndef LCD_ST7920_DELAY_3
#define LCD_ST7920_DELAY_3 0
#endif
#ifndef BOARD_ST7920_DELAY_3
#define BOARD_ST7920_DELAY_3 0
#endif
#ifndef CPU_ST7920_DELAY_3
#define CPU_ST7920_DELAY_3 0
#endif
#if LCD_ST7920_DELAY_3 || BOARD_ST7920_DELAY_3 || CPU_ST7920_DELAY_3
#define ST7920_DELAY_3 DELAY_NS(_MAX(LCD_ST7920_DELAY_3, BOARD_ST7920_DELAY_3, CPU_ST7920_DELAY_3))
#else
#define ST7920_DELAY_3
#endif
#endif

#ifdef ARDUINO_ARCH_STM32F1
#define ST7920_DAT(V) !!((V) & 0x80)
#else
#define ST7920_DAT(V) ((V) & 0x80)
#endif

#define ST7920_SND_BIT do{ \
WRITE(ST7920_CLK_PIN, LOW); ST7920_DELAY_1; \
WRITE(ST7920_DAT_PIN, ST7920_DAT(val)); ST7920_DELAY_2; \
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/pins/mega/pins_SILVER_GATE.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@
#define KILL_PIN 21
#define HOME_PIN 28
#endif
#define BOARD_ST7920_DELAY_1 DELAY_NS( 0)
#define BOARD_ST7920_DELAY_2 DELAY_NS(250)
#define BOARD_ST7920_DELAY_3 DELAY_NS( 0)
#define BOARD_ST7920_DELAY_1 0
#define BOARD_ST7920_DELAY_2 250
#define BOARD_ST7920_DELAY_3 0
#endif
#endif

Expand Down
30 changes: 1 addition & 29 deletions Marlin/src/pins/pins_postprocess.h
Original file line number Diff line number Diff line change
Expand Up @@ -1221,35 +1221,7 @@
//
// Default DOGLCD SPI delays
//
#if ENABLED(U8GLIB_ST7920)
#ifndef ST7920_DELAY_1
#ifdef LCD_ST7920_DELAY_1
#define ST7920_DELAY_1 LCD_ST7920_DELAY_1
#elif defined(BOARD_ST7920_DELAY_1)
#define ST7920_DELAY_1 BOARD_ST7920_DELAY_1
#elif defined(CPU_ST7920_DELAY_1)
#define ST7920_DELAY_1 CPU_ST7920_DELAY_1
#endif
#endif
#ifndef ST7920_DELAY_2
#ifdef LCD_ST7920_DELAY_2
#define ST7920_DELAY_2 LCD_ST7920_DELAY_2
#elif defined(BOARD_ST7920_DELAY_2)
#define ST7920_DELAY_2 BOARD_ST7920_DELAY_2
#elif defined(CPU_ST7920_DELAY_2)
#define ST7920_DELAY_2 CPU_ST7920_DELAY_2
#endif
#endif
#ifndef ST7920_DELAY_3
#ifdef LCD_ST7920_DELAY_3
#define ST7920_DELAY_3 LCD_ST7920_DELAY_3
#elif defined(BOARD_ST7920_DELAY_3)
#define ST7920_DELAY_3 BOARD_ST7920_DELAY_3
#elif defined(CPU_ST7920_DELAY_3)
#define ST7920_DELAY_3 CPU_ST7920_DELAY_3
#endif
#endif
#else
#if DISABLED(U8GLIB_ST7920)
#undef ST7920_DELAY_1
#undef ST7920_DELAY_2
#undef ST7920_DELAY_3
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/pins/rambo/pins_EINSY_RAMBO.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@
#endif // HAS_WIRED_LCD

#if ENABLED(U8GLIB_ST7920)
#define BOARD_ST7920_DELAY_1 DELAY_NS( 0)
#define BOARD_ST7920_DELAY_2 DELAY_NS(250)
#define BOARD_ST7920_DELAY_3 DELAY_NS( 0)
#define BOARD_ST7920_DELAY_1 0
#define BOARD_ST7920_DELAY_2 250
#define BOARD_ST7920_DELAY_3 0
#endif

#undef MK3_FAN_PINS
6 changes: 3 additions & 3 deletions Marlin/src/pins/rambo/pins_EINSY_RETRO.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@

// Alter timing for graphical display
#if ENABLED(U8GLIB_ST7920)
#define BOARD_ST7920_DELAY_1 DELAY_NS( 0)
#define BOARD_ST7920_DELAY_2 DELAY_NS(250)
#define BOARD_ST7920_DELAY_3 DELAY_NS( 0)
#define BOARD_ST7920_DELAY_1 0
#define BOARD_ST7920_DELAY_2 250
#define BOARD_ST7920_DELAY_3 0
#endif
6 changes: 3 additions & 3 deletions Marlin/src/pins/rambo/pins_MINIRAMBO.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
#endif // HAS_WIRED_LCD || TOUCH_UI_ULTIPANEL

#if ENABLED(U8GLIB_ST7920)
#define BOARD_ST7920_DELAY_1 DELAY_NS( 0)
#define BOARD_ST7920_DELAY_2 DELAY_NS(250)
#define BOARD_ST7920_DELAY_3 DELAY_NS( 0)
#define BOARD_ST7920_DELAY_1 0
#define BOARD_ST7920_DELAY_2 250
#define BOARD_ST7920_DELAY_3 0
#endif
6 changes: 3 additions & 3 deletions Marlin/src/pins/rambo/pins_RAMBO.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@

// Alter timing for graphical display
#if ENABLED(U8GLIB_ST7920)
#define BOARD_ST7920_DELAY_1 DELAY_NS(0)
#define BOARD_ST7920_DELAY_2 DELAY_NS(0)
#define BOARD_ST7920_DELAY_3 DELAY_NS(0)
#define BOARD_ST7920_DELAY_1 0
#define BOARD_ST7920_DELAY_2 0
#define BOARD_ST7920_DELAY_3 0
#endif
6 changes: 3 additions & 3 deletions Marlin/src/pins/ramps/pins_3DRAG.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@
#endif // IS_ULTRA_LCD && IS_NEWPANEL

#if ENABLED(U8GLIB_ST7920)
#define BOARD_ST7920_DELAY_1 DELAY_NS( 0)
#define BOARD_ST7920_DELAY_2 DELAY_NS(188)
#define BOARD_ST7920_DELAY_3 DELAY_NS( 0)
#define BOARD_ST7920_DELAY_1 0
#define BOARD_ST7920_DELAY_2 188
#define BOARD_ST7920_DELAY_3 0
#endif

/**
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/pins/ramps/pins_BQ_ZUM_MEGA_3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@

// Alter timing for graphical display
#if ENABLED(U8GLIB_ST7920)
#define BOARD_ST7920_DELAY_1 DELAY_NS( 0)
#define BOARD_ST7920_DELAY_2 DELAY_NS( 0)
#define BOARD_ST7920_DELAY_3 DELAY_NS(189)
#define BOARD_ST7920_DELAY_1 0
#define BOARD_ST7920_DELAY_2 0
#define BOARD_ST7920_DELAY_3 189
#endif
6 changes: 3 additions & 3 deletions Marlin/src/pins/ramps/pins_DAGOMA_F5.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@

// Alter timing for graphical display
#if ENABLED(U8GLIB_ST7920)
#define BOARD_ST7920_DELAY_1 DELAY_NS(0)
#define BOARD_ST7920_DELAY_2 DELAY_NS(250)
#define BOARD_ST7920_DELAY_3 DELAY_NS(250)
#define BOARD_ST7920_DELAY_1 0
#define BOARD_ST7920_DELAY_2 250
#define BOARD_ST7920_DELAY_3 250
#endif

//
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/pins/ramps/pins_FORMBOT_TREX2PLUS.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@

// Alter timing for graphical display
#if ENABLED(U8GLIB_ST7920)
#define BOARD_ST7920_DELAY_1 DELAY_NS(200)
#define BOARD_ST7920_DELAY_2 DELAY_NS(200)
#define BOARD_ST7920_DELAY_3 DELAY_NS(200)
#define BOARD_ST7920_DELAY_1 200
#define BOARD_ST7920_DELAY_2 200
#define BOARD_ST7920_DELAY_3 200
#endif
12 changes: 6 additions & 6 deletions Marlin/src/pins/sanguino/pins_ANET_10.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,9 @@
#define BTN_EN1 28
#define BTN_EN2 10
#define BTN_ENC 17
#define BOARD_ST7920_DELAY_1 DELAY_NS(250)
#define BOARD_ST7920_DELAY_2 DELAY_NS(250)
#define BOARD_ST7920_DELAY_3 DELAY_NS(250)
#define BOARD_ST7920_DELAY_1 250
#define BOARD_ST7920_DELAY_2 250
#define BOARD_ST7920_DELAY_3 250
#else
#define SERVO0_PIN 29 // free for BLTouch/3D-Touch
#define BEEPER_PIN 17
Expand All @@ -207,9 +207,9 @@
#define BTN_EN1 11
#define BTN_EN2 10
#define BTN_ENC 16
#define BOARD_ST7920_DELAY_1 DELAY_NS(125)
#define BOARD_ST7920_DELAY_2 DELAY_NS(63)
#define BOARD_ST7920_DELAY_3 DELAY_NS(125)
#define BOARD_ST7920_DELAY_1 125
#define BOARD_ST7920_DELAY_2 63
#define BOARD_ST7920_DELAY_3 125
#endif

#endif
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/pins/sanguino/pins_MELZI.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@
// Alter timing for graphical display
#if ENABLED(U8GLIB_ST7920)
#ifndef BOARD_ST7920_DELAY_1
#define BOARD_ST7920_DELAY_1 DELAY_NS( 0)
#define BOARD_ST7920_DELAY_1 0
#endif
#ifndef BOARD_ST7920_DELAY_2
#define BOARD_ST7920_DELAY_2 DELAY_NS(188)
#define BOARD_ST7920_DELAY_2 188
#endif
#ifndef BOARD_ST7920_DELAY_3
#define BOARD_ST7920_DELAY_3 DELAY_NS( 0)
#define BOARD_ST7920_DELAY_3 0
#endif
#endif

Expand Down
Loading