Sfoglia il codice sorgente

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

Scott Lahteine 4 anni fa
parent
commit
6027055695
Nessun account collegato all'indirizzo email del committer

+ 1
- 2
Marlin/src/gcode/host/M360.cpp Vedi File

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

+ 8
- 0
Marlin/src/inc/Conditionals_LCD.h Vedi File

@@ -399,6 +399,14 @@
399 399
   #endif
400 400
 #endif
401 401
 
402
+#if ENABLED(SR_LCD_3W_NL)
403
+  // Feature checks for SR_LCD_3W_NL
404
+#elif EITHER(LCD_I2C_TYPE_MCP23017, LCD_I2C_TYPE_MCP23008)
405
+  #define USES_LIQUIDTWI2
406
+#elif ANY(HAS_CHARACTER_LCD, LCD_I2C_TYPE_PCF8575, LCD_I2C_TYPE_PCA8574, SR_LCD_2W_NL, LCM1602)
407
+  #define USES_LIQUIDCRYSTAL
408
+#endif
409
+
402 410
 #if ENABLED(ULTIPANEL) && DISABLED(NO_LCD_MENUS)
403 411
   #define HAS_LCD_MENU 1
404 412
 #endif

+ 12
- 19
Marlin/src/lcd/HD44780/ultralcd_HD44780.h Vedi File

@@ -22,26 +22,13 @@
22 22
 #pragma once
23 23
 
24 24
 /**
25
- * Implementation of the LCD display routines for a Hitachi HD44780 display.
26
- * These are the most common LCD character displays.
25
+ * Hitachi HD44780 display defines and headers
27 26
  */
28 27
 
29 28
 #include "../../inc/MarlinConfig.h"
30 29
 
31
-#if LCD_HEIGHT > 3
32
-  #include "../../libs/duration_t.h"
33
-#endif
34
-
35
-////////////////////////////////////
36
-// Setup button and encode mappings for each panel (into 'buttons' variable
37
-//
38
-// This is just to map common functions (across different panels) onto the same
39
-// macro name. The mapping is independent of whether the button is directly connected or
40
-// via a shift/i2c register.
41
-
42
-////////////////////////////////////
43
-// Create LCD class instance and chipset-specific information
44 30
 #if ENABLED(LCD_I2C_TYPE_PCF8575)
31
+
45 32
   // NOTE: These are register-mapped pins on the PCF8575 controller, not Arduino pins.
46 33
   #define LCD_I2C_PIN_BL  3
47 34
   #define LCD_I2C_PIN_EN  2
@@ -58,6 +45,7 @@
58 45
   #define LCD_CLASS LiquidCrystal_I2C
59 46
 
60 47
 #elif ENABLED(LCD_I2C_TYPE_MCP23017)
48
+
61 49
   // For the LED indicators (which may be mapped to different events in update_indicators())
62 50
   #define LCD_HAS_STATUS_INDICATORS
63 51
   #define LED_A 0x04 //100
@@ -69,40 +57,45 @@
69 57
   #define LCD_CLASS LiquidTWI2
70 58
 
71 59
 #elif ENABLED(LCD_I2C_TYPE_MCP23008)
60
+
72 61
   #include <Wire.h>
73 62
   #include <LiquidTWI2.h>
74 63
   #define LCD_CLASS LiquidTWI2
75 64
 
76 65
 #elif ENABLED(LCD_I2C_TYPE_PCA8574)
66
+
77 67
   #include <LiquidCrystal_I2C.h>
78 68
   #define LCD_CLASS LiquidCrystal_I2C
79 69
 
80 70
 #elif ENABLED(SR_LCD_2W_NL)
71
+
81 72
   // 2 wire Non-latching LCD SR from:
82 73
   // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
83
-//  extern "C" void __cxa_pure_virtual() { while (1); }
84 74
   #include <LCD.h>
85 75
   #include <LiquidCrystal_SR.h>
86 76
   #define LCD_CLASS LiquidCrystal_SR
77
+
87 78
 #elif ENABLED(SR_LCD_3W_NL)
88 79
 
89
-//NewLiquidCrystal was not working for me, but this worked first try
90
-//https://github.com/mikeshub/SailfishLCD
91
-//uses the code directly from Sailfish
80
+  // NewLiquidCrystal didn't work, so this uses
81
+  // https://github.com/mikeshub/SailfishLCD
92 82
 
93 83
   #include <SailfishLCD.h>
94 84
   #define LCD_CLASS LiquidCrystalSerial
95 85
 
96 86
 #elif ENABLED(LCM1602)
87
+
97 88
   #include <Wire.h>
98 89
   #include <LCD.h>
99 90
   #include <LiquidCrystal_I2C.h>
100 91
   #define LCD_CLASS LiquidCrystal_I2C
101 92
 
102 93
 #else
94
+
103 95
   // Standard directly connected LCD implementations
104 96
   #include <LiquidCrystal.h>
105 97
   #define LCD_CLASS LiquidCrystal
98
+
106 99
 #endif
107 100
 
108 101
 #include "../fontutils.h"

+ 0
- 1
Marlin/src/pins/pins.h Vedi File

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

+ 13
- 8
buildroot/share/PlatformIO/scripts/common-features-dependencies.py Vedi File

@@ -20,21 +20,24 @@ def load_config():
20 20
 	config.read("platformio.ini")
21 21
 	items = config.items('features')
22 22
 	for key in items:
23
-		deps = re.sub(',\\s*', '\n', key[1]).strip().split('\n')
24
-		if not key[0].upper() in FEATURE_DEPENDENCIES:
25
-			FEATURE_DEPENDENCIES[key[0].upper()] = {
23
+		ukey = key[0].upper()
24
+		if not ukey in FEATURE_DEPENDENCIES:
25
+			FEATURE_DEPENDENCIES[ukey] = {
26 26
 				'lib_deps': []
27 27
 			}
28
+		deps = re.sub(',\\s*', '\n', key[1]).strip().split('\n')
28 29
 		for dep in deps:
29 30
 			parts = dep.split('=')
30 31
 			name = parts.pop(0)
31 32
 			rest = '='.join(parts)
32 33
 			if name == 'extra_scripts':
33
-				FEATURE_DEPENDENCIES[key[0].upper()]['extra_scripts'] = rest
34
+				FEATURE_DEPENDENCIES[ukey]['extra_scripts'] = rest
34 35
 			elif name == 'src_filter':
35
-				FEATURE_DEPENDENCIES[key[0].upper()]['src_filter'] = rest
36
+				FEATURE_DEPENDENCIES[ukey]['src_filter'] = rest
37
+			elif name == 'lib_ignore':
38
+				FEATURE_DEPENDENCIES[ukey]['lib_ignore'] = rest
36 39
 			else:
37
-				FEATURE_DEPENDENCIES[key[0].upper()]['lib_deps'] += [dep]
40
+				FEATURE_DEPENDENCIES[ukey]['lib_deps'] += [dep]
38 41
 
39 42
 def get_all_known_libs():
40 43
 	known_libs = []
@@ -126,7 +129,7 @@ def search_compiler():
126 129
 		# the first path have the compiler
127 130
 		for path in env['ENV']['PATH'].split(';'):
128 131
 			if not re.search(r'platformio\\packages.*\\bin', path):
129
-				continue			
132
+				continue
130 133
 			#print(path)
131 134
 			for file in os.listdir(path):
132 135
 				if file.endswith("g++.exe"):
@@ -172,7 +175,9 @@ def load_marlin_features():
172 175
 
173 176
 def MarlinFeatureIsEnabled(env, feature):
174 177
 	load_marlin_features()
175
-	return feature in env["MARLIN_FEATURES"]
178
+	r = re.compile(feature)
179
+	matches = list(filter(r.match, env["MARLIN_FEATURES"]))
180
+	return len(matches) > 0
176 181
 
177 182
 # add a method for others scripts to check if a feature is enabled
178 183
 env.AddMethod(MarlinFeatureIsEnabled)

+ 1
- 2
buildroot/tests/esp32-tests Vedi File

@@ -11,11 +11,10 @@ set -e
11 11
 #
12 12
 restore_configs
13 13
 opt_set MOTHERBOARD BOARD_ESPRESSIF_ESP32
14
-opt_enable WIFISUPPORT GCODE_MACROS BAUD_RATE_GCODE M115_GEOMETRY_REPORT REPETIER_GCODE_M360
14
+opt_enable WIFISUPPORT WEBSUPPORT GCODE_MACROS BAUD_RATE_GCODE M115_GEOMETRY_REPORT REPETIER_GCODE_M360
15 15
 opt_add WIFI_SSID "\"ssid\""
16 16
 opt_add WIFI_PWD "\"password\""
17 17
 opt_set TX_BUFFER_SIZE 64
18
-opt_add WEBSUPPORT
19 18
 exec_test $1 $2 "ESP32 with WIFISUPPORT and WEBSUPPORT"
20 19
 
21 20
 #

+ 12
- 36
platformio.ini Vedi File

@@ -40,21 +40,25 @@ lib_deps           =
40 40
 TFT_LVGL_UI         = MKS-LittlevGL=https://github.com/makerbase-mks/MKS-LittlevGL/archive/master.zip
41 41
                       src_filter=+<src/lcd/extui/lib/mks_ui>
42 42
 HAS_TRINAMIC_CONFIG = TMCStepper@~0.7.1
43
-SR_LCD_2W_NL        = SailfishLCD=https://github.com/mikeshub/SailfishLCD/archive/master.zip
44 43
 SR_LCD_3W_NL        = SailfishLCD=https://github.com/mikeshub/SailfishLCD/archive/master.zip
45
-DIGIPOT_MCP4018     = SlowSoftI2CMaster
46
-DIGIPOT_MCP4451     = SlowSoftI2CMaster
44
+DIGIPOT_MCP4...     = SlowSoftI2CMaster
47 45
 HAS_TMC26X          = TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip
48 46
 HAS_L64XX           = Arduino-L6470@0.8.0
49 47
 NEOPIXEL_LED        = Adafruit NeoPixel@1.5.0
50 48
 MAX6675_IS_MAX31865 = Adafruit MAX31865 library@~1.1.0
51 49
 HAS_GRAPHICAL_LCD   = U8glib-HAL@0.4.1
52 50
                       src_filter=+<src/lcd/dogm>
53
-HAS_CHARACTER_LCD   = LiquidCrystal@1.5.0, LiquidTWI2@1.2.7
51
+USES_LIQUIDCRYSTAL  = LiquidCrystal@1.5.0
52
+USES_LIQUIDTWI2     = LiquidTWI2@1.2.7
54 53
 TOUCH_UI_FTDI_EVE   = src_filter=+<src/lcd/extui/lib/ftdi_eve_touch_ui>
55 54
 HAS_DGUS_LCD        = src_filter=+<src/lcd/extui/lib/dgus>
56 55
 DWIN_CREALITY_LCD   = src_filter=+<src/lcd/dwin>
57 56
 HAS_LCD_MENU        = src_filter=+<src/lcd/menu>
57
+(ESP32_)?WIFISUPPORT = AsyncTCP, ESP Async WebServer
58
+  ESP3DLib=https://github.com/luc-github/ESP3DLib.git
59
+  arduinoWebSockets=https://github.com/Links2004/arduinoWebSockets.git
60
+  ESP32SSDP=https://github.com/luc-github/ESP32SSDP.git
61
+  lib_ignore=ESPAsyncTCP
58 62
 
59 63
 #
60 64
 # Default values apply to all 'env:' prefixed environments
@@ -306,14 +310,11 @@ lib_compat_mode   = strict
306 310
 extra_scripts     = ${common.extra_scripts}
307 311
   Marlin/src/HAL/LPC1768/upload_extra_script.py
308 312
 src_filter        = ${common.default_src_filter} +<src/HAL/LPC1768>
309
-lib_deps          = Servo
313
+lib_deps          = ${common.lib_deps}
314
+  Servo
310 315
   LiquidCrystal@1.0.0
311
-  U8glib-HAL@0.4.1
312
-  TMCStepper@~0.7.1
313 316
   Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/1.5.0.zip
314
-  SailfishLCD=https://github.com/mikeshub/SailfishLCD/archive/master.zip
315 317
 build_flags       = ${common.build_flags} -DU8G_HAL_LINKS -IMarlin/src/HAL/LPC1768/include -IMarlin/src/HAL/LPC1768/u8g
316
-lib_ignore        = LiquidTWI2
317 318
   # debug options for backtrace
318 319
   #-funwind-tables
319 320
   #-mpoke-function-name
@@ -361,8 +362,7 @@ build_flags   = !python Marlin/src/HAL/STM32F1/build_flags.py
361 362
   ${common.build_flags} -std=gnu++14 -DHAVE_SW_SERIAL
362 363
 build_unflags = -std=gnu++11
363 364
 src_filter    = ${common.default_src_filter} +<src/HAL/STM32F1>
364
-lib_ignore    =
365
-  SPI
365
+lib_ignore    = SPI
366 366
 lib_deps      = ${common.lib_deps}
367 367
   SoftwareSerialM
368 368
 
@@ -395,18 +395,10 @@ build_flags       = ${common_stm32f1.build_flags}
395 395
 extra_scripts     = ${common.extra_scripts}
396 396
   pre:buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py
397 397
   buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py
398
-lib_deps          =
399
-  TMCStepper@~0.7.1
400
-  Adafruit MAX31865 library@~1.1.0
401
-  U8glib-HAL@0.4.1
402
-  Arduino-L6470@0.8.0
403
-  SlowSoftI2CMaster
404
-  LiquidTWI2@1.2.7
398
+lib_deps          = ${common.lib_deps}
405 399
   Adafruit NeoPixel=https://github.com/ccccmagicboy/Adafruit_NeoPixel#meeb_3dp_use
406
-  SailfishLCD=https://github.com/mikeshub/SailfishLCD/archive/master.zip
407 400
   SoftwareSerialM
408 401
   USBComposite for STM32F1@0.91
409
-lib_ignore        = SPI
410 402
 debug_tool        = stlink
411 403
 upload_protocol   = dfu
412 404
 
@@ -498,7 +490,6 @@ lib_deps          = ${common_stm32f1.lib_deps}
498 490
 platform      = ${common_stm32.platform}
499 491
 board         = disco_f407vg
500 492
 build_flags   = ${common.build_flags} -DUSE_STM32GENERIC -DSTM32GENERIC -DSTM32F4 -DMENU_USB_SERIAL -DMENU_SERIAL=SerialUSB -DHAL_IWDG_MODULE_ENABLED
501
-lib_ignore    = Adafruit NeoPixel, TMCStepper
502 493
 src_filter    = ${common.default_src_filter} +<src/HAL/STM32_F4_F7> -<src/HAL/STM32_F4_F7/STM32F7>
503 494
 
504 495
 #
@@ -508,7 +499,6 @@ src_filter    = ${common.default_src_filter} +<src/HAL/STM32_F4_F7> -<src/HAL/ST
508 499
 platform      = ${common_stm32.platform}
509 500
 board         = remram_v1
510 501
 build_flags   = ${common.build_flags} -DUSE_STM32GENERIC -DSTM32GENERIC -DSTM32F7 -DMENU_USB_SERIAL -DMENU_SERIAL=SerialUSB -DHAL_IWDG_MODULE_ENABLED
511
-lib_ignore    = Adafruit NeoPixel, TMCStepper
512 502
 src_filter    = ${common.default_src_filter} +<src/HAL/STM32_F4_F7> -<src/HAL/STM32_F4_F7/STM32F4>
513 503
 
514 504
 #
@@ -550,7 +540,6 @@ build_flags   = ${common_stm32f1.build_flags}
550 540
 build_unflags = ${common_stm32f1.build_unflags}
551 541
   -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DERROR_LED_PORT=GPIOE -DERROR_LED_PIN=6
552 542
 lib_ignore    = ${common_stm32f1.lib_ignore}
553
-  LiquidTWI2
554 543
 
555 544
 #
556 545
 # MKS Robin Mini (STM32F103VET6)
@@ -911,13 +900,6 @@ monitor_speed = 500000
911 900
 platform      = espressif32@1.11.2
912 901
 board         = esp32dev
913 902
 build_flags   = ${common.build_flags} -DCORE_DEBUG_LEVEL=0
914
-lib_deps      = ${common.lib_deps}
915
-  AsyncTCP=https://github.com/me-no-dev/AsyncTCP/archive/master.zip
916
-  ESPAsyncWebServer=https://github.com/me-no-dev/ESPAsyncWebServer/archive/master.zip
917
-  ESP3DLib=https://github.com/luc-github/ESP3DLib.git
918
-  arduinoWebSockets=https://github.com/Links2004/arduinoWebSockets.git
919
-  ESP32SSDP=https://github.com/luc-github/ESP32SSDP.git
920
-lib_ignore    = LiquidCrystal, LiquidTWI2, SailfishLCD, ESPAsyncTCP
921 903
 src_filter    = ${common.default_src_filter} +<src/HAL/ESP32>
922 904
 upload_speed  = 115200
923 905
 #upload_port   = marlinesp.local
@@ -929,8 +911,6 @@ upload_speed  = 115200
929 911
 [env:teensy31]
930 912
 platform      = teensy
931 913
 board         = teensy31
932
-lib_deps      = ${common.lib_deps}
933
-  TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip
934 914
 src_filter    = ${common.default_src_filter} +<src/HAL/TEENSY31_32>
935 915
 
936 916
 #
@@ -939,8 +919,6 @@ src_filter    = ${common.default_src_filter} +<src/HAL/TEENSY31_32>
939 919
 [env:teensy35]
940 920
 platform      = teensy
941 921
 board         = teensy35
942
-lib_deps      = ${common.lib_deps}
943
-  TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip
944 922
 src_filter    = ${common.default_src_filter} +<src/HAL/TEENSY35_36>
945 923
 
946 924
 #
@@ -964,6 +942,4 @@ src_filter      = ${common.default_src_filter} +<src/HAL/LINUX>
964 942
 platform    = atmelavr
965 943
 board       = megaatmega2560
966 944
 build_flags = -c -H -std=gnu++11 -Wall -Os -D__MARLIN_FIRMWARE__
967
-lib_deps    = ${common.lib_deps}
968
-  TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip
969 945
 src_filter  = +<src/Marlin.cpp>

Loading…
Annulla
Salva