Optimize LCD, Wifi, etc. libraries (#18730)

This commit is contained in:
Scott Lahteine 2020-07-21 04:00:39 -05:00 committed by GitHub
parent 469f63f74d
commit 6027055695
Signed by: GitHub
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 47 additions and 68 deletions

View file

@ -115,8 +115,7 @@ void GcodeSuite::M360() {
xyz_pos_t cmin = dmin, cmax = dmax; xyz_pos_t cmin = dmin, cmax = dmax;
apply_motion_limits(cmin); apply_motion_limits(cmin);
apply_motion_limits(cmax); apply_motion_limits(cmax);
const xyz_pos_t lmin = dmin.asLogical(), lmax = dmax.asLogical(), const xyz_pos_t wmin = cmin.asLogical(), wmax = cmax.asLogical();
wmin = cmin.asLogical(), wmax = cmax.asLogical();
PGMSTR(MIN_STR, "Min"); PGMSTR(MIN_STR, "Min");
PGMSTR(MAX_STR, "Max"); PGMSTR(MAX_STR, "Max");

View file

@ -399,6 +399,14 @@
#endif #endif
#endif #endif
#if ENABLED(SR_LCD_3W_NL)
// Feature checks for SR_LCD_3W_NL
#elif EITHER(LCD_I2C_TYPE_MCP23017, LCD_I2C_TYPE_MCP23008)
#define USES_LIQUIDTWI2
#elif ANY(HAS_CHARACTER_LCD, LCD_I2C_TYPE_PCF8575, LCD_I2C_TYPE_PCA8574, SR_LCD_2W_NL, LCM1602)
#define USES_LIQUIDCRYSTAL
#endif
#if ENABLED(ULTIPANEL) && DISABLED(NO_LCD_MENUS) #if ENABLED(ULTIPANEL) && DISABLED(NO_LCD_MENUS)
#define HAS_LCD_MENU 1 #define HAS_LCD_MENU 1
#endif #endif

View file

@ -22,26 +22,13 @@
#pragma once #pragma once
/** /**
* Implementation of the LCD display routines for a Hitachi HD44780 display. * Hitachi HD44780 display defines and headers
* These are the most common LCD character displays.
*/ */
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#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) #if ENABLED(LCD_I2C_TYPE_PCF8575)
// NOTE: These are register-mapped pins on the PCF8575 controller, not Arduino pins. // NOTE: These are register-mapped pins on the PCF8575 controller, not Arduino pins.
#define LCD_I2C_PIN_BL 3 #define LCD_I2C_PIN_BL 3
#define LCD_I2C_PIN_EN 2 #define LCD_I2C_PIN_EN 2
@ -58,6 +45,7 @@
#define LCD_CLASS LiquidCrystal_I2C #define LCD_CLASS LiquidCrystal_I2C
#elif ENABLED(LCD_I2C_TYPE_MCP23017) #elif ENABLED(LCD_I2C_TYPE_MCP23017)
// For the LED indicators (which may be mapped to different events in update_indicators()) // For the LED indicators (which may be mapped to different events in update_indicators())
#define LCD_HAS_STATUS_INDICATORS #define LCD_HAS_STATUS_INDICATORS
#define LED_A 0x04 //100 #define LED_A 0x04 //100
@ -69,40 +57,45 @@
#define LCD_CLASS LiquidTWI2 #define LCD_CLASS LiquidTWI2
#elif ENABLED(LCD_I2C_TYPE_MCP23008) #elif ENABLED(LCD_I2C_TYPE_MCP23008)
#include <Wire.h> #include <Wire.h>
#include <LiquidTWI2.h> #include <LiquidTWI2.h>
#define LCD_CLASS LiquidTWI2 #define LCD_CLASS LiquidTWI2
#elif ENABLED(LCD_I2C_TYPE_PCA8574) #elif ENABLED(LCD_I2C_TYPE_PCA8574)
#include <LiquidCrystal_I2C.h> #include <LiquidCrystal_I2C.h>
#define LCD_CLASS LiquidCrystal_I2C #define LCD_CLASS LiquidCrystal_I2C
#elif ENABLED(SR_LCD_2W_NL) #elif ENABLED(SR_LCD_2W_NL)
// 2 wire Non-latching LCD SR from: // 2 wire Non-latching LCD SR from:
// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
// extern "C" void __cxa_pure_virtual() { while (1); }
#include <LCD.h> #include <LCD.h>
#include <LiquidCrystal_SR.h> #include <LiquidCrystal_SR.h>
#define LCD_CLASS LiquidCrystal_SR #define LCD_CLASS LiquidCrystal_SR
#elif ENABLED(SR_LCD_3W_NL) #elif ENABLED(SR_LCD_3W_NL)
//NewLiquidCrystal was not working for me, but this worked first try // NewLiquidCrystal didn't work, so this uses
//https://github.com/mikeshub/SailfishLCD // https://github.com/mikeshub/SailfishLCD
//uses the code directly from Sailfish
#include <SailfishLCD.h> #include <SailfishLCD.h>
#define LCD_CLASS LiquidCrystalSerial #define LCD_CLASS LiquidCrystalSerial
#elif ENABLED(LCM1602) #elif ENABLED(LCM1602)
#include <Wire.h> #include <Wire.h>
#include <LCD.h> #include <LCD.h>
#include <LiquidCrystal_I2C.h> #include <LiquidCrystal_I2C.h>
#define LCD_CLASS LiquidCrystal_I2C #define LCD_CLASS LiquidCrystal_I2C
#else #else
// Standard directly connected LCD implementations // Standard directly connected LCD implementations
#include <LiquidCrystal.h> #include <LiquidCrystal.h>
#define LCD_CLASS LiquidCrystal #define LCD_CLASS LiquidCrystal
#endif #endif
#include "../fontutils.h" #include "../fontutils.h"

View file

@ -615,7 +615,6 @@
// //
#elif MB(ESPRESSIF_ESP32) #elif MB(ESPRESSIF_ESP32)
#include "esp32/pins_ESP32.h" // ESP32 env:esp32 #include "esp32/pins_ESP32.h" // ESP32 env:esp32
#elif MB(MRR_ESPA) #elif MB(MRR_ESPA)
#include "esp32/pins_MRR_ESPA.h" // ESP32 env:esp32 #include "esp32/pins_MRR_ESPA.h" // ESP32 env:esp32

View file

@ -20,21 +20,24 @@ def load_config():
config.read("platformio.ini") config.read("platformio.ini")
items = config.items('features') items = config.items('features')
for key in items: for key in items:
deps = re.sub(',\\s*', '\n', key[1]).strip().split('\n') ukey = key[0].upper()
if not key[0].upper() in FEATURE_DEPENDENCIES: if not ukey in FEATURE_DEPENDENCIES:
FEATURE_DEPENDENCIES[key[0].upper()] = { FEATURE_DEPENDENCIES[ukey] = {
'lib_deps': [] 'lib_deps': []
} }
deps = re.sub(',\\s*', '\n', key[1]).strip().split('\n')
for dep in deps: for dep in deps:
parts = dep.split('=') parts = dep.split('=')
name = parts.pop(0) name = parts.pop(0)
rest = '='.join(parts) rest = '='.join(parts)
if name == 'extra_scripts': if name == 'extra_scripts':
FEATURE_DEPENDENCIES[key[0].upper()]['extra_scripts'] = rest FEATURE_DEPENDENCIES[ukey]['extra_scripts'] = rest
elif name == 'src_filter': elif name == 'src_filter':
FEATURE_DEPENDENCIES[key[0].upper()]['src_filter'] = rest FEATURE_DEPENDENCIES[ukey]['src_filter'] = rest
elif name == 'lib_ignore':
FEATURE_DEPENDENCIES[ukey]['lib_ignore'] = rest
else: else:
FEATURE_DEPENDENCIES[key[0].upper()]['lib_deps'] += [dep] FEATURE_DEPENDENCIES[ukey]['lib_deps'] += [dep]
def get_all_known_libs(): def get_all_known_libs():
known_libs = [] known_libs = []
@ -172,7 +175,9 @@ def load_marlin_features():
def MarlinFeatureIsEnabled(env, feature): def MarlinFeatureIsEnabled(env, feature):
load_marlin_features() load_marlin_features()
return feature in env["MARLIN_FEATURES"] r = re.compile(feature)
matches = list(filter(r.match, env["MARLIN_FEATURES"]))
return len(matches) > 0
# add a method for others scripts to check if a feature is enabled # add a method for others scripts to check if a feature is enabled
env.AddMethod(MarlinFeatureIsEnabled) env.AddMethod(MarlinFeatureIsEnabled)

View file

@ -11,11 +11,10 @@ set -e
# #
restore_configs restore_configs
opt_set MOTHERBOARD BOARD_ESPRESSIF_ESP32 opt_set MOTHERBOARD BOARD_ESPRESSIF_ESP32
opt_enable WIFISUPPORT GCODE_MACROS BAUD_RATE_GCODE M115_GEOMETRY_REPORT REPETIER_GCODE_M360 opt_enable WIFISUPPORT WEBSUPPORT GCODE_MACROS BAUD_RATE_GCODE M115_GEOMETRY_REPORT REPETIER_GCODE_M360
opt_add WIFI_SSID "\"ssid\"" opt_add WIFI_SSID "\"ssid\""
opt_add WIFI_PWD "\"password\"" opt_add WIFI_PWD "\"password\""
opt_set TX_BUFFER_SIZE 64 opt_set TX_BUFFER_SIZE 64
opt_add WEBSUPPORT
exec_test $1 $2 "ESP32 with WIFISUPPORT and WEBSUPPORT" exec_test $1 $2 "ESP32 with WIFISUPPORT and WEBSUPPORT"
# #

View file

@ -40,21 +40,25 @@ lib_deps =
TFT_LVGL_UI = MKS-LittlevGL=https://github.com/makerbase-mks/MKS-LittlevGL/archive/master.zip TFT_LVGL_UI = MKS-LittlevGL=https://github.com/makerbase-mks/MKS-LittlevGL/archive/master.zip
src_filter=+<src/lcd/extui/lib/mks_ui> src_filter=+<src/lcd/extui/lib/mks_ui>
HAS_TRINAMIC_CONFIG = TMCStepper@~0.7.1 HAS_TRINAMIC_CONFIG = TMCStepper@~0.7.1
SR_LCD_2W_NL = SailfishLCD=https://github.com/mikeshub/SailfishLCD/archive/master.zip
SR_LCD_3W_NL = SailfishLCD=https://github.com/mikeshub/SailfishLCD/archive/master.zip SR_LCD_3W_NL = SailfishLCD=https://github.com/mikeshub/SailfishLCD/archive/master.zip
DIGIPOT_MCP4018 = SlowSoftI2CMaster DIGIPOT_MCP4... = SlowSoftI2CMaster
DIGIPOT_MCP4451 = SlowSoftI2CMaster
HAS_TMC26X = TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip HAS_TMC26X = TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip
HAS_L64XX = Arduino-L6470@0.8.0 HAS_L64XX = Arduino-L6470@0.8.0
NEOPIXEL_LED = Adafruit NeoPixel@1.5.0 NEOPIXEL_LED = Adafruit NeoPixel@1.5.0
MAX6675_IS_MAX31865 = Adafruit MAX31865 library@~1.1.0 MAX6675_IS_MAX31865 = Adafruit MAX31865 library@~1.1.0
HAS_GRAPHICAL_LCD = U8glib-HAL@0.4.1 HAS_GRAPHICAL_LCD = U8glib-HAL@0.4.1
src_filter=+<src/lcd/dogm> src_filter=+<src/lcd/dogm>
HAS_CHARACTER_LCD = LiquidCrystal@1.5.0, LiquidTWI2@1.2.7 USES_LIQUIDCRYSTAL = LiquidCrystal@1.5.0
USES_LIQUIDTWI2 = LiquidTWI2@1.2.7
TOUCH_UI_FTDI_EVE = src_filter=+<src/lcd/extui/lib/ftdi_eve_touch_ui> TOUCH_UI_FTDI_EVE = src_filter=+<src/lcd/extui/lib/ftdi_eve_touch_ui>
HAS_DGUS_LCD = src_filter=+<src/lcd/extui/lib/dgus> HAS_DGUS_LCD = src_filter=+<src/lcd/extui/lib/dgus>
DWIN_CREALITY_LCD = src_filter=+<src/lcd/dwin> DWIN_CREALITY_LCD = src_filter=+<src/lcd/dwin>
HAS_LCD_MENU = src_filter=+<src/lcd/menu> HAS_LCD_MENU = src_filter=+<src/lcd/menu>
(ESP32_)?WIFISUPPORT = AsyncTCP, ESP Async WebServer
ESP3DLib=https://github.com/luc-github/ESP3DLib.git
arduinoWebSockets=https://github.com/Links2004/arduinoWebSockets.git
ESP32SSDP=https://github.com/luc-github/ESP32SSDP.git
lib_ignore=ESPAsyncTCP
# #
# Default values apply to all 'env:' prefixed environments # Default values apply to all 'env:' prefixed environments
@ -306,14 +310,11 @@ lib_compat_mode = strict
extra_scripts = ${common.extra_scripts} extra_scripts = ${common.extra_scripts}
Marlin/src/HAL/LPC1768/upload_extra_script.py Marlin/src/HAL/LPC1768/upload_extra_script.py
src_filter = ${common.default_src_filter} +<src/HAL/LPC1768> src_filter = ${common.default_src_filter} +<src/HAL/LPC1768>
lib_deps = Servo lib_deps = ${common.lib_deps}
Servo
LiquidCrystal@1.0.0 LiquidCrystal@1.0.0
U8glib-HAL@0.4.1
TMCStepper@~0.7.1
Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/1.5.0.zip Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/1.5.0.zip
SailfishLCD=https://github.com/mikeshub/SailfishLCD/archive/master.zip
build_flags = ${common.build_flags} -DU8G_HAL_LINKS -IMarlin/src/HAL/LPC1768/include -IMarlin/src/HAL/LPC1768/u8g build_flags = ${common.build_flags} -DU8G_HAL_LINKS -IMarlin/src/HAL/LPC1768/include -IMarlin/src/HAL/LPC1768/u8g
lib_ignore = LiquidTWI2
# debug options for backtrace # debug options for backtrace
#-funwind-tables #-funwind-tables
#-mpoke-function-name #-mpoke-function-name
@ -361,8 +362,7 @@ build_flags = !python Marlin/src/HAL/STM32F1/build_flags.py
${common.build_flags} -std=gnu++14 -DHAVE_SW_SERIAL ${common.build_flags} -std=gnu++14 -DHAVE_SW_SERIAL
build_unflags = -std=gnu++11 build_unflags = -std=gnu++11
src_filter = ${common.default_src_filter} +<src/HAL/STM32F1> src_filter = ${common.default_src_filter} +<src/HAL/STM32F1>
lib_ignore = lib_ignore = SPI
SPI
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
SoftwareSerialM SoftwareSerialM
@ -395,18 +395,10 @@ build_flags = ${common_stm32f1.build_flags}
extra_scripts = ${common.extra_scripts} extra_scripts = ${common.extra_scripts}
pre:buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py pre:buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py
buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py
lib_deps = lib_deps = ${common.lib_deps}
TMCStepper@~0.7.1
Adafruit MAX31865 library@~1.1.0
U8glib-HAL@0.4.1
Arduino-L6470@0.8.0
SlowSoftI2CMaster
LiquidTWI2@1.2.7
Adafruit NeoPixel=https://github.com/ccccmagicboy/Adafruit_NeoPixel#meeb_3dp_use Adafruit NeoPixel=https://github.com/ccccmagicboy/Adafruit_NeoPixel#meeb_3dp_use
SailfishLCD=https://github.com/mikeshub/SailfishLCD/archive/master.zip
SoftwareSerialM SoftwareSerialM
USBComposite for STM32F1@0.91 USBComposite for STM32F1@0.91
lib_ignore = SPI
debug_tool = stlink debug_tool = stlink
upload_protocol = dfu upload_protocol = dfu
@ -498,7 +490,6 @@ lib_deps = ${common_stm32f1.lib_deps}
platform = ${common_stm32.platform} platform = ${common_stm32.platform}
board = disco_f407vg board = disco_f407vg
build_flags = ${common.build_flags} -DUSE_STM32GENERIC -DSTM32GENERIC -DSTM32F4 -DMENU_USB_SERIAL -DMENU_SERIAL=SerialUSB -DHAL_IWDG_MODULE_ENABLED build_flags = ${common.build_flags} -DUSE_STM32GENERIC -DSTM32GENERIC -DSTM32F4 -DMENU_USB_SERIAL -DMENU_SERIAL=SerialUSB -DHAL_IWDG_MODULE_ENABLED
lib_ignore = Adafruit NeoPixel, TMCStepper
src_filter = ${common.default_src_filter} +<src/HAL/STM32_F4_F7> -<src/HAL/STM32_F4_F7/STM32F7> src_filter = ${common.default_src_filter} +<src/HAL/STM32_F4_F7> -<src/HAL/STM32_F4_F7/STM32F7>
# #
@ -508,7 +499,6 @@ src_filter = ${common.default_src_filter} +<src/HAL/STM32_F4_F7> -<src/HAL/ST
platform = ${common_stm32.platform} platform = ${common_stm32.platform}
board = remram_v1 board = remram_v1
build_flags = ${common.build_flags} -DUSE_STM32GENERIC -DSTM32GENERIC -DSTM32F7 -DMENU_USB_SERIAL -DMENU_SERIAL=SerialUSB -DHAL_IWDG_MODULE_ENABLED build_flags = ${common.build_flags} -DUSE_STM32GENERIC -DSTM32GENERIC -DSTM32F7 -DMENU_USB_SERIAL -DMENU_SERIAL=SerialUSB -DHAL_IWDG_MODULE_ENABLED
lib_ignore = Adafruit NeoPixel, TMCStepper
src_filter = ${common.default_src_filter} +<src/HAL/STM32_F4_F7> -<src/HAL/STM32_F4_F7/STM32F4> src_filter = ${common.default_src_filter} +<src/HAL/STM32_F4_F7> -<src/HAL/STM32_F4_F7/STM32F4>
# #
@ -550,7 +540,6 @@ build_flags = ${common_stm32f1.build_flags}
build_unflags = ${common_stm32f1.build_unflags} build_unflags = ${common_stm32f1.build_unflags}
-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DERROR_LED_PORT=GPIOE -DERROR_LED_PIN=6 -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DERROR_LED_PORT=GPIOE -DERROR_LED_PIN=6
lib_ignore = ${common_stm32f1.lib_ignore} lib_ignore = ${common_stm32f1.lib_ignore}
LiquidTWI2
# #
# MKS Robin Mini (STM32F103VET6) # MKS Robin Mini (STM32F103VET6)
@ -911,13 +900,6 @@ monitor_speed = 500000
platform = espressif32@1.11.2 platform = espressif32@1.11.2
board = esp32dev board = esp32dev
build_flags = ${common.build_flags} -DCORE_DEBUG_LEVEL=0 build_flags = ${common.build_flags} -DCORE_DEBUG_LEVEL=0
lib_deps = ${common.lib_deps}
AsyncTCP=https://github.com/me-no-dev/AsyncTCP/archive/master.zip
ESPAsyncWebServer=https://github.com/me-no-dev/ESPAsyncWebServer/archive/master.zip
ESP3DLib=https://github.com/luc-github/ESP3DLib.git
arduinoWebSockets=https://github.com/Links2004/arduinoWebSockets.git
ESP32SSDP=https://github.com/luc-github/ESP32SSDP.git
lib_ignore = LiquidCrystal, LiquidTWI2, SailfishLCD, ESPAsyncTCP
src_filter = ${common.default_src_filter} +<src/HAL/ESP32> src_filter = ${common.default_src_filter} +<src/HAL/ESP32>
upload_speed = 115200 upload_speed = 115200
#upload_port = marlinesp.local #upload_port = marlinesp.local
@ -929,8 +911,6 @@ upload_speed = 115200
[env:teensy31] [env:teensy31]
platform = teensy platform = teensy
board = teensy31 board = teensy31
lib_deps = ${common.lib_deps}
TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip
src_filter = ${common.default_src_filter} +<src/HAL/TEENSY31_32> src_filter = ${common.default_src_filter} +<src/HAL/TEENSY31_32>
# #
@ -939,8 +919,6 @@ src_filter = ${common.default_src_filter} +<src/HAL/TEENSY31_32>
[env:teensy35] [env:teensy35]
platform = teensy platform = teensy
board = teensy35 board = teensy35
lib_deps = ${common.lib_deps}
TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip
src_filter = ${common.default_src_filter} +<src/HAL/TEENSY35_36> src_filter = ${common.default_src_filter} +<src/HAL/TEENSY35_36>
# #
@ -964,6 +942,4 @@ src_filter = ${common.default_src_filter} +<src/HAL/LINUX>
platform = atmelavr platform = atmelavr
board = megaatmega2560 board = megaatmega2560
build_flags = -c -H -std=gnu++11 -Wall -Os -D__MARLIN_FIRMWARE__ build_flags = -c -H -std=gnu++11 -Wall -Os -D__MARLIN_FIRMWARE__
lib_deps = ${common.lib_deps}
TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip
src_filter = +<src/Marlin.cpp> src_filter = +<src/Marlin.cpp>