Skip to content

Commit

Permalink
Merge branch 'TFT-GLCD-adapter' into bugfix-2.0.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Serhiy-K authored Jul 25, 2020
2 parents 067af01 + 427931f commit ee3da9e
Show file tree
Hide file tree
Showing 37 changed files with 4,726 additions and 216 deletions.
65 changes: 42 additions & 23 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
*
* :[-1, 0, 1, 2, 3, 4, 5, 6, 7]
*/
#define SERIAL_PORT 0
#define SERIAL_PORT -1

/**
* Select a secondary serial port on the board to use for communication with the host.
Expand All @@ -121,18 +121,25 @@
*
* :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
*/
#define BAUDRATE 250000
#define BAUDRATE 115200

// Enable the Bluetooth serial interface on AT90USB devices
//#define BLUETOOTH

// Choose the name from boards.h that matches your setup
#ifndef MOTHERBOARD
#define MOTHERBOARD BOARD_RAMPS_14_EFB
//#define MOTHERBOARD BOARD_RAMPS_14_EFB //ATMega
//#define MOTHERBOARD BOARD_RAMPS_14_EEB
//#define MOTHERBOARD BOARD_RAMPS4DUE_EFB //SAM3X8E
//#define MOTHERBOARD BOARD_BTT_SKR_V1_3 //LPC1768
//#define MOTHERBOARD BOARD_BTT_SKR_PRO_V1_1 //STM32F407
//#define MOTHERBOARD BOARD_MORPHEUS //STM32F103CBT6
#define MOTHERBOARD BOARD_BLACKPILL_F4x1 //STM32F401CCU6

#endif

// Name displayed in the LCD "Ready" message and Info menu
//#define CUSTOM_MACHINE_NAME "3D Printer"
#define CUSTOM_MACHINE_NAME "3D Printer"

// Printer's unique ID, used by some programs to differentiate between machines.
// Choose your own or use a service like https://www.uuidgenerator.net/version4
Expand Down Expand Up @@ -416,15 +423,19 @@
* 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below.
* 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below.
*/
#define TEMP_SENSOR_0 1
#define TEMP_SENSOR_1 0
#define TEMP_SENSOR_0 998
#if EXTRUDERS == 2
#define TEMP_SENSOR_1 1
#else
#define TEMP_SENSOR_1 0
#endif
#define TEMP_SENSOR_2 0
#define TEMP_SENSOR_3 0
#define TEMP_SENSOR_4 0
#define TEMP_SENSOR_5 0
#define TEMP_SENSOR_6 0
#define TEMP_SENSOR_7 0
#define TEMP_SENSOR_BED 0
#define TEMP_SENSOR_BED 998
#define TEMP_SENSOR_PROBE 0
#define TEMP_SENSOR_CHAMBER 0

Expand Down Expand Up @@ -482,8 +493,8 @@
#define PID_K1 0.95 // Smoothing factor within any PID loop

#if ENABLED(PIDTEMP)
//#define PID_EDIT_MENU // Add PID editing to the "Advanced Settings" menu. (~700 bytes of PROGMEM)
//#define PID_AUTOTUNE_MENU // Add PID auto-tuning to the "Advanced Settings" menu. (~250 bytes of PROGMEM)
// #define PID_EDIT_MENU // Add PID editing to the "Advanced Settings" menu. (~700 bytes of PROGMEM)
// #define PID_AUTOTUNE_MENU // Add PID auto-tuning to the "Advanced Settings" menu. (~250 bytes of PROGMEM)
//#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
// Set/get with gcode: M301 E[extruder number, 0-2]

Expand Down Expand Up @@ -571,14 +582,14 @@
*
* *** IT IS HIGHLY RECOMMENDED TO LEAVE THIS OPTION ENABLED! ***
*/
#define PREVENT_COLD_EXTRUSION
#define EXTRUDE_MINTEMP 170
//#define PREVENT_COLD_EXTRUSION
#define EXTRUDE_MINTEMP 5

/**
* Prevent a single extrusion longer than EXTRUDE_MAXLENGTH.
* Note: For Bowden Extruders make this large enough to allow load/unload.
*/
#define PREVENT_LENGTHY_EXTRUDE
//#define PREVENT_LENGTHY_EXTRUDE
#define EXTRUDE_MAXLENGTH 200

//===========================================================================
Expand All @@ -598,9 +609,9 @@
* details can be tuned in Configuration_adv.h
*/

#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders
#define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed
#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber
//#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders
//#define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed
//#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber

//===========================================================================
//============================= Mechanical Settings =========================
Expand Down Expand Up @@ -847,7 +858,7 @@
* The probe replaces the Z-MIN endstop and is used for Z homing.
* (Automatically enables USE_PROBE_FOR_Z_HOMING.)
*/
#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
//#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN

// Force the use of the probe for Z-axis homing
//#define USE_PROBE_FOR_Z_HOMING
Expand Down Expand Up @@ -1148,7 +1159,7 @@
#endif

// Max software endstops constrain movement within maximum coordinate bounds
#define MAX_SOFTWARE_ENDSTOPS
//#define MAX_SOFTWARE_ENDSTOPS
#if ENABLED(MAX_SOFTWARE_ENDSTOPS)
#define MAX_SOFTWARE_ENDSTOP_X
#define MAX_SOFTWARE_ENDSTOP_Y
Expand Down Expand Up @@ -1238,6 +1249,7 @@
* Normally G28 leaves leveling disabled on completion. Enable
* this option to have G28 restore the prior leveling state.
*/

//#define RESTORE_LEVELING_AFTER_G28

/**
Expand Down Expand Up @@ -1310,7 +1322,7 @@
//#define MESH_EDIT_GFX_OVERLAY // Display a graphics overlay while editing the mesh

#define MESH_INSET 1 // Set Mesh bounds as an inset region of the bed
#define GRID_MAX_POINTS_X 10 // Don't use more than 15 points per axis, implementation limited.
#define GRID_MAX_POINTS_X 5 // Don't use more than 15 points per axis, implementation limited.
#define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X

#define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle
Expand Down Expand Up @@ -1469,10 +1481,10 @@
*/
//#define EEPROM_SETTINGS // Persistent storage with M500 and M501
//#define DISABLE_M503 // Saves ~2700 bytes of PROGMEM. Disable for release!
#define EEPROM_CHITCHAT // Give feedback on EEPROM commands. Disable to save PROGMEM.
//#define EEPROM_CHITCHAT // Give feedback on EEPROM commands. Disable to save PROGMEM.
#define EEPROM_BOOT_SILENT // Keep M503 quiet and only give errors during first load
#if ENABLED(EEPROM_SETTINGS)
//#define EEPROM_AUTO_INIT // Init EEPROM automatically on any errors.
#define EEPROM_AUTO_INIT // Init EEPROM automatically on any errors.
#endif

//
Expand All @@ -1481,7 +1493,7 @@
// When enabled Marlin will send a busy status message to the host
// every couple of seconds when it can't accept commands.
//
#define HOST_KEEPALIVE_FEATURE // Disable this if your host doesn't like keepalive messages
//#define HOST_KEEPALIVE_FEATURE // Disable this if your host doesn't like keepalive messages
#define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113.
#define BUSY_WHILE_HEATING // Some hosts require "busy" messages even during heating

Expand Down Expand Up @@ -1672,7 +1684,7 @@
*
* :['JAPANESE', 'WESTERN', 'CYRILLIC']
*/
#define DISPLAY_CHARSET_HD44780 JAPANESE
#define DISPLAY_CHARSET_HD44780 CYRILLIC

/**
* Info Screen Style (0:Classic, 1:Prusa)
Expand Down Expand Up @@ -1776,7 +1788,7 @@
// If you have a speaker that can produce tones, enable it here.
// By default Marlin assumes you have a buzzer with a fixed frequency.
//
//#define SPEAKER
#define SPEAKER

//
// The duration and frequency for the UI feedback sound.
Expand Down Expand Up @@ -2136,6 +2148,13 @@
//#define EXTUI_LOCAL_BEEPER // Enables use of local Beeper pin with external display
#endif

//
// TFT GLCD Adapter
// Adapter based on STM32F103C8T6 "Blue Pill" board and 320x240 or 400x240 color TFT LCD
// https://github.com/Serhiy-K/TFTGLCDAdapter.git
//
#define TFTGLCD_ADAPTER

//=============================================================================
//=============================== Graphical TFTs ==============================
//=============================================================================
Expand Down
10 changes: 5 additions & 5 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1035,16 +1035,16 @@
#endif

// Play a beep when the feedrate is changed from the Status Screen
//#define BEEP_ON_FEEDRATE_CHANGE
#define BEEP_ON_FEEDRATE_CHANGE
#if ENABLED(BEEP_ON_FEEDRATE_CHANGE)
#define FEEDRATE_CHANGE_BEEP_DURATION 10
#define FEEDRATE_CHANGE_BEEP_FREQUENCY 440
#define FEEDRATE_CHANGE_BEEP_DURATION 50
#define FEEDRATE_CHANGE_BEEP_FREQUENCY 800
#endif

#if HAS_LCD_MENU

// Include a page of printer information in the LCD Main Menu
//#define LCD_INFO_MENU
#define LCD_INFO_MENU
#if ENABLED(LCD_INFO_MENU)
//#define LCD_PRINTER_INFO_IS_BOOTSCREEN // Show bootscreen(s) instead of Printer Info pages
#endif
Expand Down Expand Up @@ -1087,7 +1087,7 @@
//#define LCD_SHOW_E_TOTAL

#if ENABLED(SHOW_BOOTSCREEN)
#define BOOTSCREEN_TIMEOUT 4000 // (ms) Total Duration to display the boot screen(s)
#define BOOTSCREEN_TIMEOUT 1500 // (ms) Total Duration to display the boot screen(s)
#endif

#if HAS_GRAPHICAL_LCD && EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY)
Expand Down
10 changes: 8 additions & 2 deletions Marlin/src/HAL/STM32F1/SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ static const spi_pins board_spi_pins[] __FLASH__ = {
BOARD_SPI3_MOSI_PIN },
#endif
};

/*
#if BOARD_NR_SPI >= 1
static void *_spi1_this;
#endif
Expand All @@ -87,7 +87,7 @@ static const spi_pins board_spi_pins[] __FLASH__ = {
#if BOARD_NR_SPI >= 3
static void *_spi3_this;
#endif

*/
/**
* Constructor
*/
Expand Down Expand Up @@ -169,6 +169,12 @@ void SPIClass::beginSlave() {
_currentSetting->state = SPI_STATE_READY;
}

static inline void waitSpiTxEnd(spi_dev *spi_d) {
while (spi_is_tx_empty(spi_d) == 0) { /* nada */ } // wait until TXE=1
while (spi_is_busy(spi_d) != 0) { /* nada */ } // wait until BSY=0
}


void SPIClass::end() {
if (!spi_is_enabled(_currentSetting->spi_d)) return;

Expand Down
1 change: 1 addition & 0 deletions Marlin/src/core/boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@
#define BOARD_FYSETC_S6 4217 // FYSETC S6 board
#define BOARD_FLYF407ZG 4218 // FLYF407ZG board (STM32F407ZG)
#define BOARD_MKS_ROBIN2 4219 // MKS_ROBIN2 (STM32F407ZE)
#define BOARD_BLACKPILL_F4x1 4220 // STM32F401CCU6 / STM32F411CEU6

//
// ARM Cortex M7
Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,10 @@

if (do_ubl_mesh_map) display_map(g29_map_type); // Display the current point

#if ENABLED(TFTGLCD_ADAPTER)
ui.ubl_plot(lpos.x, lpos.y); // update plot screen
#endif

ui.refresh();

float new_z = z_values[lpos.x][lpos.y];
Expand Down
24 changes: 23 additions & 1 deletion Marlin/src/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,28 @@
#define LCD_WIDTH 16
#define LCD_HEIGHT 2

#elif ENABLED(TFTGLCD_ADAPTER)

#define IS_ULTIPANEL
#define NEWPANEL
#define LCD_CONNECT_BY_SPI //uncomment if panel connected by SPI bus
#define LCD_USE_I2C_BUZZER //hardware buzzer on panel for I2C and SPI buses
#if ENABLED(SDSUPPORT)
#define LCD_PROGRESS_BAR
#endif
#define LCD_WIDTH 20 //20 or 24 chars in line
#define LCD_HEIGHT 10 //lines
#define LCD_I2C_ADDRESS 0x33 //used only when panel connected via I2C
#define LCD_CONTRAST_MIN 127
#define LCD_CONTRAST_MAX 255
#define DEFAULT_LCD_CONTRAST 250
#define ENCODER_PULSES_PER_STEP 2
#define ENCODER_STEPS_PER_MENU_ITEM 1
#define HAS_SLOW_BUTTONS //buttons and encoder on panel
#define CONVERT_TO_EXT_ASCII //use extended 128-255 symbols from ASCII table except 208 and 209 as UTF markers for cyliilic
//this time supported only bg, ru and uk languages (cyrillic)
//first 7 ASCII symbols in panel font must be replaced with Marlin special symbols

#endif

#if ENABLED(IS_RRD_FG_SC)
Expand Down Expand Up @@ -412,7 +434,7 @@
#define USES_LIQUIDCRYSTAL
#endif

#if ENABLED(ULTIPANEL) && DISABLED(NO_LCD_MENUS)
#if (ENABLED(ULTIPANEL) || ENABLED(TFTGLCD_ADAPTER)) && DISABLED(NO_LCD_MENUS)
#define HAS_LCD_MENU 1
#endif
#if ENABLED(ADC_KEYPAD)
Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,10 @@
#define _LCD_CONTRAST_INIT 17
#elif ENABLED(MINIPANEL)
#define _LCD_CONTRAST_INIT 150
#elif ENABLED(TFTGLCD_ADAPTER)
#define _LCD_CONTRAST_MIN 0
#define _LCD_CONTRAST_INIT 250
#define _LCD_CONTRAST_MAX 255
#endif

#ifdef _LCD_CONTRAST_INIT
Expand Down
3 changes: 2 additions & 1 deletion Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -2222,7 +2222,8 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
+ ENABLED(TOUCH_UI_FTDI_EVE) \
+ ENABLED(FSMC_GRAPHICAL_TFT) \
+ ENABLED(TFT_LVGL_UI_FSMC) \
+ ENABLED(TFT_LVGL_UI_SPI)
+ ENABLED(TFT_LVGL_UI_SPI) \
+ ENABLED(TFTGLCD_ADAPTER)
#error "Please select no more than one LCD controller option."
#endif

Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

#include "../../inc/MarlinConfigPre.h"

#if DISABLED(TFTGLCD_ADAPTER)

#if HAS_CHARACTER_LCD

#include "../ultralcd.h"
Expand Down Expand Up @@ -1120,3 +1122,5 @@ int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length) {
#endif // DEBUG_LCDPRINT

#endif // HAS_CHARACTER_LCD

#endif //TFTGLCD_ADAPTER
4 changes: 4 additions & 0 deletions Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

#include "../../inc/MarlinConfigPre.h"

#if DISABLED(TFTGLCD_ADAPTER)

#if HAS_CHARACTER_LCD

/**
Expand Down Expand Up @@ -1515,3 +1517,5 @@ void MarlinUI::draw_status_screen() {
#endif // HAS_LCD_MENU

#endif // HAS_CHARACTER_LCD

#endif //TFTGLCD_ADAPTER
18 changes: 18 additions & 0 deletions Marlin/src/lcd/HD44780/ultralcd_HD44780.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,22 @@

#include "../../inc/MarlinConfig.h"

#if DISABLED(TFTGLCD_ADAPTER)

#if LCD_HEIGHT > 3
#include "../../libs/duration_t.h"
#endif

////////////////////////////////////
// Setup button and encode mappings for each panel (into 'buttons' variable
//
// This is just to map common functions (across different panels) onto the same
// macro name. The mapping is independent of whether the button is directly connected or
// via a shift/i2c register.

////////////////////////////////////
// Create LCD class instance and chipset-specific information

#if ENABLED(LCD_I2C_TYPE_PCF8575)

// NOTE: These are register-mapped pins on the PCF8575 controller, not Arduino pins.
Expand Down Expand Up @@ -100,3 +116,5 @@

#include "../fontutils.h"
#include "../lcdprint.h"

#endif //TFTGLCD_ADAPTER
Loading

0 comments on commit ee3da9e

Please sign in to comment.