Merge branch 'bugfix-2.1.x' into Tenlog_DWIN
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
//
|
||||
#if ENABLED(SR_LCD_3W_NL)
|
||||
// Feature checks for SR_LCD_3W_NL
|
||||
#elif EITHER(LCD_I2C_TYPE_MCP23017, LCD_I2C_TYPE_MCP23008)
|
||||
#elif ANY(LCD_I2C_TYPE_MCP23017, LCD_I2C_TYPE_MCP23008)
|
||||
#define USES_LIQUIDTWI2
|
||||
#elif ENABLED(LCD_I2C_TYPE_PCA8574)
|
||||
#define USES_LIQUIDCRYSTAL_I2C
|
||||
@@ -54,21 +54,21 @@
|
||||
#define HAS_MENU_BACKLASH
|
||||
#endif
|
||||
#if ENABLED(LCD_BED_TRAMMING)
|
||||
#define HAS_MENU_BED_CORNERS
|
||||
#define HAS_MENU_BED_TRAMMING
|
||||
#endif
|
||||
#if ENABLED(CANCEL_OBJECTS)
|
||||
#define HAS_MENU_CANCELOBJECT
|
||||
#endif
|
||||
#if EITHER(DELTA_CALIBRATION_MENU, DELTA_AUTO_CALIBRATION)
|
||||
#if ANY(DELTA_CALIBRATION_MENU, DELTA_AUTO_CALIBRATION)
|
||||
#define HAS_MENU_DELTA_CALIBRATE
|
||||
#endif
|
||||
#if EITHER(LED_CONTROL_MENU, CASE_LIGHT_MENU)
|
||||
#if ANY(LED_CONTROL_MENU, CASE_LIGHT_MENU)
|
||||
#define HAS_MENU_LED
|
||||
#endif
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
#define HAS_MENU_FILAMENT
|
||||
#endif
|
||||
#if ENABLED(SDSUPPORT)
|
||||
#if HAS_MEDIA
|
||||
#define HAS_MENU_MEDIA
|
||||
#endif
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
@@ -99,9 +99,230 @@
|
||||
#define HAS_MENU_TOUCH_SCREEN
|
||||
#endif
|
||||
#if ENABLED(ASSISTED_TRAMMING_WIZARD)
|
||||
#define HAS_MENU_TRAMMING
|
||||
#define HAS_MENU_TRAMMING_WIZARD
|
||||
#endif
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
#define HAS_MENU_UBL
|
||||
#endif
|
||||
#if ENABLED(ONE_CLICK_PRINT)
|
||||
#define HAS_MENU_ONE_CLICK_PRINT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAS_GRAPHICAL_TFT
|
||||
#include "../../../../Marlin/src/lcd/tft/fontdata/fontdata.h"
|
||||
#define UI_INCL_(W, H) STRINGIFY_(../../../../Marlin/src/lcd/tft/ui_##W##x##H.h)
|
||||
#define UI_INCL(W, H) UI_INCL_(W, H)
|
||||
#include UI_INCL(TFT_WIDTH, TFT_HEIGHT)
|
||||
|
||||
#define Latin_Extended_A 1
|
||||
#define Cyrillic 2
|
||||
#define Greek 3
|
||||
#define Katakana 4
|
||||
#define Korean 5
|
||||
#define Vietnamese 6
|
||||
#define Simplified_Chinese 7
|
||||
#define Traditional_Chinese 8
|
||||
|
||||
#if TFT_FONT == NOTOSANS
|
||||
#if FONT_SIZE == 14
|
||||
#define TFT_FONT_NOTOSANS_14
|
||||
#if FONT_EXTRA == Latin_Extended_A
|
||||
#define TFT_FONT_NOTOSANS_14_LATIN
|
||||
#elif FONT_EXTRA == Cyrillic
|
||||
#define TFT_FONT_NOTOSANS_14_CYRIL
|
||||
#elif FONT_EXTRA == Greek
|
||||
#define TFT_FONT_NOTOSANS_14_GREEK
|
||||
#elif FONT_EXTRA == Katakana
|
||||
#define TFT_FONT_NOTOSANS_14_KATA
|
||||
#elif FONT_EXTRA == Korean
|
||||
#define TFT_FONT_NOTOSANS_14_KO
|
||||
#elif FONT_EXTRA == Vietnamese
|
||||
#define TFT_FONT_NOTOSANS_14_VI
|
||||
#elif FONT_EXTRA == Simplified_Chinese
|
||||
#define TFT_FONT_NOTOSANS_14_ZH_CN
|
||||
#elif FONT_EXTRA == Traditional_Chinese
|
||||
#define TFT_FONT_NOTOSANS_14_ZH_TW
|
||||
#endif
|
||||
#elif FONT_SIZE == 16
|
||||
#define TFT_FONT_NOTOSANS_16
|
||||
#if FONT_EXTRA == Latin_Extended_A
|
||||
#define TFT_FONT_NOTOSANS_16_LATIN
|
||||
#elif FONT_EXTRA == Cyrillic
|
||||
#define TFT_FONT_NOTOSANS_16_CYRIL
|
||||
#elif FONT_EXTRA == Greek
|
||||
#define TFT_FONT_NOTOSANS_16_GREEK
|
||||
#elif FONT_EXTRA == Katakana
|
||||
#define TFT_FONT_NOTOSANS_16_KATA
|
||||
#elif FONT_EXTRA == Korean
|
||||
#define TFT_FONT_NOTOSANS_16_KO
|
||||
#elif FONT_EXTRA == Vietnamese
|
||||
#define TFT_FONT_NOTOSANS_16_VI
|
||||
#elif FONT_EXTRA == Simplified_Chinese
|
||||
#define TFT_FONT_NOTOSANS_16_ZH_CN
|
||||
#elif FONT_EXTRA == Traditional_Chinese
|
||||
#define TFT_FONT_NOTOSANS_16_ZH_TW
|
||||
#endif
|
||||
#elif FONT_SIZE == 19
|
||||
#define TFT_FONT_NOTOSANS_19
|
||||
#if FONT_EXTRA == Latin_Extended_A
|
||||
#define TFT_FONT_NOTOSANS_19_LATIN
|
||||
#elif FONT_EXTRA == Cyrillic
|
||||
#define TFT_FONT_NOTOSANS_19_CYRIL
|
||||
#elif FONT_EXTRA == Greek
|
||||
#define TFT_FONT_NOTOSANS_19_GREEK
|
||||
#elif FONT_EXTRA == Katakana
|
||||
#define TFT_FONT_NOTOSANS_19_KATA
|
||||
#elif FONT_EXTRA == Korean
|
||||
#define TFT_FONT_NOTOSANS_19_KO
|
||||
#elif FONT_EXTRA == Vietnamese
|
||||
#define TFT_FONT_NOTOSANS_19_VI
|
||||
#elif FONT_EXTRA == Simplified_Chinese
|
||||
#define TFT_FONT_NOTOSANS_19_ZH_CN
|
||||
#elif FONT_EXTRA == Traditional_Chinese
|
||||
#define TFT_FONT_NOTOSANS_19_ZH_TW
|
||||
#endif
|
||||
#elif FONT_SIZE == 26
|
||||
#define TFT_FONT_NOTOSANS_26
|
||||
#if FONT_EXTRA == Latin_Extended_A
|
||||
#define TFT_FONT_NOTOSANS_26_LATIN
|
||||
#elif FONT_EXTRA == Cyrillic
|
||||
#define TFT_FONT_NOTOSANS_26_CYRIL
|
||||
#elif FONT_EXTRA == Greek
|
||||
#define TFT_FONT_NOTOSANS_26_GREEK
|
||||
#elif FONT_EXTRA == Katakana
|
||||
#define TFT_FONT_NOTOSANS_26_KATA
|
||||
#elif FONT_EXTRA == Korean
|
||||
#define TFT_FONT_NOTOSANS_26_KO
|
||||
#elif FONT_EXTRA == Vietnamese
|
||||
#define TFT_FONT_NOTOSANS_26_VI
|
||||
#elif FONT_EXTRA == Simplified_Chinese
|
||||
#define TFT_FONT_NOTOSANS_26_ZH_CN
|
||||
#elif FONT_EXTRA == Traditional_Chinese
|
||||
#define TFT_FONT_NOTOSANS_26_ZH_TW
|
||||
#endif
|
||||
#elif FONT_SIZE == 27
|
||||
#define TFT_FONT_NOTOSANS_27
|
||||
#if FONT_EXTRA == Latin_Extended_A
|
||||
#define TFT_FONT_NOTOSANS_27_LATIN
|
||||
#elif FONT_EXTRA == Cyrillic
|
||||
#define TFT_FONT_NOTOSANS_27_CYRIL
|
||||
#elif FONT_EXTRA == Greek
|
||||
#define TFT_FONT_NOTOSANS_27_GREEK
|
||||
#elif FONT_EXTRA == Katakana
|
||||
#define TFT_FONT_NOTOSANS_27_KATA
|
||||
#elif FONT_EXTRA == Korean
|
||||
#define TFT_FONT_NOTOSANS_27_KO
|
||||
#elif FONT_EXTRA == Vietnamese
|
||||
#define TFT_FONT_NOTOSANS_27_VI
|
||||
#elif FONT_EXTRA == Simplified_Chinese
|
||||
#define TFT_FONT_NOTOSANS_27_ZH_CN
|
||||
#elif FONT_EXTRA == Traditional_Chinese
|
||||
#define TFT_FONT_NOTOSANS_27_ZH_TW
|
||||
#endif
|
||||
#elif FONT_SIZE == 28
|
||||
#define TFT_FONT_NOTOSANS_28
|
||||
#if FONT_EXTRA == Latin_Extended_A
|
||||
#define TFT_FONT_NOTOSANS_28_LATIN
|
||||
#elif FONT_EXTRA == Cyrillic
|
||||
#define TFT_FONT_NOTOSANS_28_CYRIL
|
||||
#elif FONT_EXTRA == Greek
|
||||
#define TFT_FONT_NOTOSANS_28_GREEK
|
||||
#elif FONT_EXTRA == Katakana
|
||||
#define TFT_FONT_NOTOSANS_28_KATA
|
||||
#elif FONT_EXTRA == Korean
|
||||
#define TFT_FONT_NOTOSANS_28_KO
|
||||
#elif FONT_EXTRA == Vietnamese
|
||||
#define TFT_FONT_NOTOSANS_28_VI
|
||||
#elif FONT_EXTRA == Simplified_Chinese
|
||||
#define TFT_FONT_NOTOSANS_28_ZH_CN
|
||||
#elif FONT_EXTRA == Traditional_Chinese
|
||||
#define TFT_FONT_NOTOSANS_28_ZH_TW
|
||||
#endif
|
||||
#elif FONT_SIZE == 29
|
||||
#define TFT_FONT_NOTOSANS_29
|
||||
#if FONT_EXTRA == Latin_Extended_A
|
||||
#define TFT_FONT_NOTOSANS_29_LATIN
|
||||
#elif FONT_EXTRA == Cyrillic
|
||||
#define TFT_FONT_NOTOSANS_29_CYRIL
|
||||
#elif FONT_EXTRA == Greek
|
||||
#define TFT_FONT_NOTOSANS_29_GREEK
|
||||
#elif FONT_EXTRA == Katakana
|
||||
#define TFT_FONT_NOTOSANS_29_KATA
|
||||
#elif FONT_EXTRA == Korean
|
||||
#define TFT_FONT_NOTOSANS_29_KO
|
||||
#elif FONT_EXTRA == Vietnamese
|
||||
#define TFT_FONT_NOTOSANS_29_VI
|
||||
#elif FONT_EXTRA == Simplified_Chinese
|
||||
#define TFT_FONT_NOTOSANS_29_ZH_CN
|
||||
#elif FONT_EXTRA == Traditional_Chinese
|
||||
#define TFT_FONT_NOTOSANS_29_ZH_TW
|
||||
#endif
|
||||
#endif
|
||||
#elif TFT_FONT == UNIFONT
|
||||
#if FONT_SIZE == 10
|
||||
#define TFT_FONT_UNIFONT_10
|
||||
#if FONT_EXTRA == Latin_Extended_A
|
||||
#define TFT_FONT_UNIFONT_10_LATIN
|
||||
#elif FONT_EXTRA == Cyrillic
|
||||
#define TFT_FONT_UNIFONT_10_CYRIL
|
||||
#elif FONT_EXTRA == Greek
|
||||
#define TFT_FONT_UNIFONT_10_GREEK
|
||||
#elif FONT_EXTRA == Katakana
|
||||
#define TFT_FONT_UNIFONT_10_KATA
|
||||
#elif FONT_EXTRA == Korean
|
||||
#define TFT_FONT_UNIFONT_10_KO
|
||||
#elif FONT_EXTRA == Vietnamese
|
||||
#define TFT_FONT_UNIFONT_10_VI
|
||||
#elif FONT_EXTRA == Simplified_Chinese
|
||||
#define TFT_FONT_UNIFONT_10_ZH_CN
|
||||
#elif FONT_EXTRA == Traditional_Chinese
|
||||
#define TFT_FONT_UNIFONT_10_ZH_TW
|
||||
#endif
|
||||
#elif FONT_SIZE == 20
|
||||
#define TFT_FONT_UNIFONT_20
|
||||
#if FONT_EXTRA == Latin_Extended_A
|
||||
#define TFT_FONT_UNIFONT_20_LATIN
|
||||
#elif FONT_EXTRA == Cyrillic
|
||||
#define TFT_FONT_UNIFONT_20_CYRIL
|
||||
#elif FONT_EXTRA == Greek
|
||||
#define TFT_FONT_UNIFONT_20_GREEK
|
||||
#elif FONT_EXTRA == Katakana
|
||||
#define TFT_FONT_UNIFONT_20_KATA
|
||||
#elif FONT_EXTRA == Korean
|
||||
#define TFT_FONT_UNIFONT_20_KO
|
||||
#elif FONT_EXTRA == Vietnamese
|
||||
#define TFT_FONT_UNIFONT_20_VI
|
||||
#elif FONT_EXTRA == Simplified_Chinese
|
||||
#define TFT_FONT_UNIFONT_20_ZH_CN
|
||||
#elif FONT_EXTRA == Traditional_Chinese
|
||||
#define TFT_FONT_UNIFONT_20_ZH_TW
|
||||
#endif
|
||||
#elif FONT_SIZE == 30
|
||||
#define TFT_FONT_UNIFONT_30
|
||||
#if FONT_EXTRA == Latin_Extended_A
|
||||
#define TFT_FONT_UNIFONT_30_LATIN
|
||||
#elif FONT_EXTRA == Cyrillic
|
||||
#define TFT_FONT_UNIFONT_30_CYRIL
|
||||
#elif FONT_EXTRA == Greek
|
||||
#define TFT_FONT_UNIFONT_30_GREEK
|
||||
#elif FONT_EXTRA == Katakana
|
||||
#define TFT_FONT_UNIFONT_30_KATA
|
||||
#elif FONT_EXTRA == Korean
|
||||
#define TFT_FONT_UNIFONT_30_KO
|
||||
#elif FONT_EXTRA == Vietnamese
|
||||
#define TFT_FONT_UNIFONT_30_VI
|
||||
#elif FONT_EXTRA == Simplified_Chinese
|
||||
#define TFT_FONT_UNIFONT_30_ZH_CN
|
||||
#elif FONT_EXTRA == Traditional_Chinese
|
||||
#define TFT_FONT_UNIFONT_30_ZH_TW
|
||||
#endif
|
||||
#endif
|
||||
#elif TFT_FONT == HELVETICA
|
||||
#if FONT_SIZE == 14
|
||||
#define TFT_FONT_HELVETICA_14
|
||||
#elif FONT_SIZE == 19
|
||||
#define TFT_FONT_HELVETICA_19
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
import pioutil
|
||||
if pioutil.is_pio_build():
|
||||
|
||||
import subprocess,os,re
|
||||
import subprocess,os,re,fnmatch,glob
|
||||
srcfilepattern = re.compile(r".*[.](cpp|c)$")
|
||||
marlinbasedir = os.path.join(os.getcwd(), "Marlin/")
|
||||
Import("env")
|
||||
|
||||
from platformio.package.meta import PackageSpec
|
||||
@@ -53,20 +55,22 @@ if pioutil.is_pio_build():
|
||||
# Get a reference to the FEATURE_CONFIG under construction
|
||||
feat = FEATURE_CONFIG[feature]
|
||||
|
||||
# Split up passed lines on commas or newlines and iterate
|
||||
# Add common options to the features config under construction
|
||||
# For lib_deps replace a previous instance of the same library
|
||||
atoms = re.sub(r',\s*', '\n', flines).strip().split('\n')
|
||||
# Split up passed lines on commas or newlines and iterate.
|
||||
# Take care to convert Windows '\' paths to Unix-style '/'.
|
||||
# Add common options to the features config under construction.
|
||||
# For lib_deps replace a previous instance of the same library.
|
||||
atoms = re.sub(r',\s*', '\n', flines.replace('\\', '/')).strip().split('\n')
|
||||
for line in atoms:
|
||||
parts = line.split('=')
|
||||
name = parts.pop(0)
|
||||
if name in ['build_flags', 'extra_scripts', 'src_filter', 'lib_ignore']:
|
||||
if name in ['build_flags', 'extra_scripts', 'build_src_filter', 'lib_ignore']:
|
||||
feat[name] = '='.join(parts)
|
||||
blab("[%s] %s=%s" % (feature, name, feat[name]), 3)
|
||||
else:
|
||||
for dep in re.split(r',\s*', line):
|
||||
lib_name = re.sub(r'@([~^]|[<>]=?)?[\d.]+', '', dep.strip()).split('=').pop(0)
|
||||
lib_re = re.compile('(?!^' + lib_name + '\\b)')
|
||||
if not 'lib_deps' in feat: feat['lib_deps'] = {}
|
||||
feat['lib_deps'] = list(filter(lib_re.match, feat['lib_deps'])) + [dep]
|
||||
blab("[%s] lib_deps = %s" % (feature, dep), 3)
|
||||
|
||||
@@ -90,7 +94,7 @@ if pioutil.is_pio_build():
|
||||
val = None
|
||||
if val:
|
||||
opt = mat[1].upper()
|
||||
blab("%s.custom_marlin.%s = '%s'" % ( env['PIOENV'], opt, val ))
|
||||
blab("%s.custom_marlin.%s = '%s'" % ( env['PIOENV'], opt, val ), 2)
|
||||
add_to_feat_cnf(opt, val)
|
||||
|
||||
def get_all_known_libs():
|
||||
@@ -127,6 +131,7 @@ if pioutil.is_pio_build():
|
||||
def apply_features_config():
|
||||
load_features()
|
||||
blab("========== Apply enabled features...")
|
||||
build_filters = ' '.join(env.GetProjectOption('build_src_filter'))
|
||||
for feature in FEATURE_CONFIG:
|
||||
if not env.MarlinHas(feature):
|
||||
continue
|
||||
@@ -171,25 +176,89 @@ if pioutil.is_pio_build():
|
||||
blab("Running extra_scripts for %s... " % feature, 2)
|
||||
env.SConscript(feat['extra_scripts'], exports="env")
|
||||
|
||||
if 'src_filter' in feat:
|
||||
if 'build_src_filter' in feat:
|
||||
blab("========== Adding build_src_filter for %s... " % feature, 2)
|
||||
src_filter = ' '.join(env.GetProjectOption('src_filter'))
|
||||
# first we need to remove the references to the same folder
|
||||
my_srcs = re.findall(r'[+-](<.*?>)', feat['src_filter'])
|
||||
cur_srcs = re.findall(r'[+-](<.*?>)', src_filter)
|
||||
for d in my_srcs:
|
||||
if d in cur_srcs:
|
||||
src_filter = re.sub(r'[+-]' + d, '', src_filter)
|
||||
|
||||
src_filter = feat['src_filter'] + ' ' + src_filter
|
||||
set_env_field('build_src_filter', [src_filter])
|
||||
env.Replace(SRC_FILTER=src_filter)
|
||||
build_filters = build_filters + ' ' + feat['build_src_filter']
|
||||
# Just append the filter in the order that the build environment specifies.
|
||||
# Important here is the order of entries in the "features.ini" file.
|
||||
|
||||
if 'lib_ignore' in feat:
|
||||
blab("========== Adding lib_ignore for %s... " % feature, 2)
|
||||
lib_ignore = env.GetProjectOption('lib_ignore') + [feat['lib_ignore']]
|
||||
set_env_field('lib_ignore', lib_ignore)
|
||||
|
||||
build_src_filter = ""
|
||||
if True:
|
||||
# Build the actual equivalent build_src_filter list based on the inclusions by the features.
|
||||
# PlatformIO doesn't do it this way, but maybe in the future....
|
||||
cur_srcs = set()
|
||||
# Remove the references to the same folder
|
||||
my_srcs = re.findall(r'([+-]<.*?>)', build_filters)
|
||||
for d in my_srcs:
|
||||
# Assume normalized relative paths
|
||||
plain = d[2:-1]
|
||||
if d[0] == '+':
|
||||
def addentry(fullpath, info=None):
|
||||
relp = os.path.relpath(fullpath, marlinbasedir)
|
||||
if srcfilepattern.match(relp):
|
||||
if info:
|
||||
blab("Added src file %s (%s)" % (relp, str(info)), 3)
|
||||
else:
|
||||
blab("Added src file %s " % relp, 3)
|
||||
cur_srcs.add(relp)
|
||||
# Special rule: If a direct folder is specified add all files within.
|
||||
fullplain = os.path.join(marlinbasedir, plain)
|
||||
if os.path.isdir(fullplain):
|
||||
blab("Directory content addition for %s " % plain, 3)
|
||||
gpattern = os.path.join(fullplain, "**")
|
||||
for fname in glob.glob(gpattern, recursive=True):
|
||||
addentry(fname, "dca")
|
||||
else:
|
||||
# Add all the things from the pattern by GLOB.
|
||||
def srepl(matchi):
|
||||
g0 = matchi.group(0)
|
||||
return r"**" + g0[1:]
|
||||
gpattern = re.sub(r'[*]($|[^*])', srepl, plain)
|
||||
gpattern = os.path.join(marlinbasedir, gpattern)
|
||||
|
||||
for fname in glob.glob(gpattern, recursive=True):
|
||||
addentry(fname)
|
||||
else:
|
||||
# Special rule: If a direct folder is specified then remove all files within.
|
||||
def onremove(relp, info=None):
|
||||
if info:
|
||||
blab("Removed src file %s (%s)" % (relp, str(info)), 3)
|
||||
else:
|
||||
blab("Removed src file %s " % relp, 3)
|
||||
fullplain = os.path.join(marlinbasedir, plain)
|
||||
if os.path.isdir(fullplain):
|
||||
blab("Directory content removal for %s " % plain, 2)
|
||||
def filt(x):
|
||||
common = os.path.commonpath([plain, x])
|
||||
if not common == os.path.normpath(plain): return True
|
||||
onremove(x, "dcr")
|
||||
return False
|
||||
cur_srcs = set(filter(filt, cur_srcs))
|
||||
else:
|
||||
# Remove matching source entries.
|
||||
def filt(x):
|
||||
if not fnmatch.fnmatch(x, plain): return True
|
||||
onremove(x)
|
||||
return False
|
||||
cur_srcs = set(filter(filt, cur_srcs))
|
||||
# Transform the resulting set into a string.
|
||||
for x in cur_srcs:
|
||||
if build_src_filter != "": build_src_filter += ' '
|
||||
build_src_filter += "+<" + x + ">"
|
||||
|
||||
#blab("Final build_src_filter: " + build_src_filter, 3)
|
||||
else:
|
||||
build_src_filter = build_filters
|
||||
|
||||
# Update in PlatformIO
|
||||
set_env_field('build_src_filter', [build_src_filter])
|
||||
env.Replace(SRC_FILTER=build_src_filter)
|
||||
|
||||
#
|
||||
# Use the compiler to get a list of all enabled features
|
||||
#
|
||||
@@ -212,7 +281,7 @@ if pioutil.is_pio_build():
|
||||
#
|
||||
def MarlinHas(env, feature):
|
||||
load_marlin_features()
|
||||
r = re.compile('^' + feature + '$')
|
||||
r = re.compile('^' + feature + '$', re.IGNORECASE)
|
||||
found = list(filter(r.match, env['MARLIN_FEATURES']))
|
||||
|
||||
# Defines could still be 'false' or '0', so check
|
||||
@@ -225,6 +294,8 @@ if pioutil.is_pio_build():
|
||||
elif val in env['MARLIN_FEATURES']:
|
||||
some_on = env.MarlinHas(val)
|
||||
|
||||
#blab("%s is %s" % (feature, str(some_on)), 2)
|
||||
|
||||
return some_on
|
||||
|
||||
validate_pio()
|
||||
|
||||
@@ -18,7 +18,16 @@ def apply_opt(name, val, conf=None):
|
||||
if name == "lcd": name, val = val, "on"
|
||||
|
||||
# Create a regex to match the option and capture parts of the line
|
||||
regex = re.compile(rf'^(\s*)(//\s*)?(#define\s+)({name}\b)(\s*)(.*?)(\s*)(//.*)?$', re.IGNORECASE)
|
||||
# 1: Indentation
|
||||
# 2: Comment
|
||||
# 3: #define and whitespace
|
||||
# 4: Option name
|
||||
# 5: First space after name
|
||||
# 6: Remaining spaces between name and value
|
||||
# 7: Option value
|
||||
# 8: Whitespace after value
|
||||
# 9: End comment
|
||||
regex = re.compile(rf'^(\s*)(//\s*)?(#define\s+)({name}\b)(\s?)(\s*)(.*?)(\s*)(//.*)?$', re.IGNORECASE)
|
||||
|
||||
# Find and enable and/or update all matches
|
||||
for file in ("Configuration.h", "Configuration_adv.h"):
|
||||
@@ -37,10 +46,11 @@ def apply_opt(name, val, conf=None):
|
||||
newline = re.sub(r'^(\s*)(#define)(\s{1,3})?(\s*)', r'\1//\2 \4', line)
|
||||
else:
|
||||
# For options with values, enable and set the value
|
||||
newline = match[1] + match[3] + match[4] + match[5] + val
|
||||
if match[8]:
|
||||
sp = match[7] if match[7] else ' '
|
||||
newline += sp + match[8]
|
||||
addsp = '' if match[5] else ' '
|
||||
newline = match[1] + match[3] + match[4] + match[5] + addsp + val + match[6]
|
||||
if match[9]:
|
||||
sp = match[8] if match[8] else ' '
|
||||
newline += sp + match[9]
|
||||
lines[i] = newline
|
||||
blab(f"Set {name} to {val}")
|
||||
|
||||
@@ -88,9 +98,10 @@ def fetch_example(url):
|
||||
if not url.startswith('http'):
|
||||
brch = "bugfix-2.1.x"
|
||||
if '@' in url: url, brch = map(str.strip, url.split('@'))
|
||||
if url == 'examples/default': url = 'default'
|
||||
url = f"https://raw.githubusercontent.com/MarlinFirmware/Configurations/{brch}/config/{url}"
|
||||
url = url.replace("%", "%25").replace(" ", "%20")
|
||||
|
||||
|
||||
# Find a suitable fetch command
|
||||
if shutil.which("curl") is not None:
|
||||
fetch = "curl -L -s -S -f -o"
|
||||
@@ -103,7 +114,7 @@ def fetch_example(url):
|
||||
import os
|
||||
|
||||
# Reset configurations to default
|
||||
os.system("git reset --hard HEAD")
|
||||
os.system("git checkout HEAD Marlin/*.h")
|
||||
|
||||
# Try to fetch the remote files
|
||||
gotfile = False
|
||||
@@ -191,7 +202,7 @@ def apply_config_ini(cp):
|
||||
|
||||
# For 'examples/<path>' fetch an example set from GitHub.
|
||||
# For https?:// do a direct fetch of the URL.
|
||||
if ckey.startswith('examples/') or ckey.startswith('http:'):
|
||||
if ckey.startswith('examples/') or ckey.startswith('http'):
|
||||
fetch_example(ckey)
|
||||
ckey = 'base'
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ if pioutil.is_pio_build():
|
||||
assets_path = Path(env.Dictionary("PROJECT_BUILD_DIR"), env.Dictionary("PIOENV"), "assets")
|
||||
|
||||
def download_mks_assets():
|
||||
print("Downloading MKS Assets")
|
||||
print("Downloading MKS Assets for TFT_LVGL_UI")
|
||||
r = requests.get(url, stream=True)
|
||||
# the user may have a very clean workspace,
|
||||
# so create the PROJECT_LIBDEPS_DIR directory if not exits
|
||||
@@ -25,7 +25,7 @@ if pioutil.is_pio_build():
|
||||
fd.write(chunk)
|
||||
|
||||
def copy_mks_assets():
|
||||
print("Copying MKS Assets")
|
||||
print("Copying MKS Assets for TFT_LVGL_UI")
|
||||
output_path = Path(tempfile.mkdtemp())
|
||||
zip_obj = zipfile.ZipFile(zip_path, 'r')
|
||||
zip_obj.extractall(output_path)
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
# the appropriate framework variants folder, so that its contents
|
||||
# will be picked up by PlatformIO just like any other variant.
|
||||
#
|
||||
import pioutil
|
||||
import pioutil, re
|
||||
marlin_variant_pattern = re.compile("marlin_.*")
|
||||
if pioutil.is_pio_build():
|
||||
import shutil,marlin
|
||||
from pathlib import Path
|
||||
@@ -32,7 +33,7 @@ if pioutil.is_pio_build():
|
||||
else:
|
||||
platform_name = PackageSpec(platform_packages[0]).name
|
||||
|
||||
if platform_name in [ "usb-host-msc", "usb-host-msc-cdc-msc", "usb-host-msc-cdc-msc-2", "usb-host-msc-cdc-msc-3", "tool-stm32duino", "biqu-bx-workaround", "main" ]:
|
||||
if platform_name in [ "Arduino_Core_STM32", "usb-host-msc", "usb-host-msc-cdc-msc", "usb-host-msc-cdc-msc-2", "usb-host-msc-cdc-msc-3", "tool-stm32duino", "biqu-bx-workaround", "main" ]:
|
||||
platform_name = "framework-arduinoststm32"
|
||||
|
||||
FRAMEWORK_DIR = Path(platform.get_package_dir(platform_name))
|
||||
@@ -44,15 +45,20 @@ if pioutil.is_pio_build():
|
||||
variant = board.get("build.variant")
|
||||
#series = mcu_type[:7].upper() + "xx"
|
||||
|
||||
# Prepare a new empty folder at the destination
|
||||
variant_dir = FRAMEWORK_DIR / "variants" / variant
|
||||
if variant_dir.is_dir():
|
||||
shutil.rmtree(variant_dir)
|
||||
if not variant_dir.is_dir():
|
||||
variant_dir.mkdir()
|
||||
# Only prepare a new variant if the PlatformIO configuration provides it (board_build.variant).
|
||||
# This check is important to avoid deleting official board config variants.
|
||||
if marlin_variant_pattern.match(str(variant).lower()):
|
||||
# Prepare a new empty folder at the destination
|
||||
variant_dir = FRAMEWORK_DIR / "variants" / variant
|
||||
if variant_dir.is_dir():
|
||||
shutil.rmtree(variant_dir)
|
||||
if not variant_dir.is_dir():
|
||||
variant_dir.mkdir()
|
||||
|
||||
# Source dir is a local variant sub-folder
|
||||
source_dir = Path("buildroot/share/PlatformIO/variants", variant)
|
||||
assert source_dir.is_dir()
|
||||
# Source dir is a local variant sub-folder
|
||||
source_dir = Path("buildroot/share/PlatformIO/variants", variant)
|
||||
assert source_dir.is_dir()
|
||||
|
||||
marlin.copytree(source_dir, variant_dir)
|
||||
print("Copying variant " + str(variant) + " to framework directory...")
|
||||
|
||||
marlin.copytree(source_dir, variant_dir)
|
||||
|
||||
@@ -16,7 +16,8 @@ def copytree(src, dst, symlinks=False, ignore=None):
|
||||
shutil.copy2(item, dst / item.name)
|
||||
|
||||
def replace_define(field, value):
|
||||
for define in env['CPPDEFINES']:
|
||||
envdefs = env['CPPDEFINES'].copy()
|
||||
for define in envdefs:
|
||||
if define[0] == field:
|
||||
env['CPPDEFINES'].remove(define)
|
||||
env['CPPDEFINES'].append((field, value))
|
||||
|
||||
@@ -60,6 +60,7 @@ if pioutil.is_pio_build():
|
||||
|
||||
def rename_target(source, target, env):
|
||||
from pathlib import Path
|
||||
Path(target[0].path).replace(Path(target[0].dir.path, new_name))
|
||||
from datetime import datetime
|
||||
Path(target[0].path).replace(Path(target[0].dir.path, datetime.now().strftime(new_name.replace('{date}', '%Y%m%d').replace('{time}', '%H%M%S'))))
|
||||
|
||||
marlin.add_post_action(rename_target)
|
||||
|
||||
@@ -71,10 +71,10 @@ if pioutil.is_pio_build():
|
||||
config = env.GetProjectConfig()
|
||||
result = check_envs("env:"+build_env, board_envs, config)
|
||||
|
||||
# if not result:
|
||||
# err = "Error: Build environment '%s' is incompatible with %s. Use one of these: %s" % \
|
||||
# ( build_env, motherboard, ", ".join([ e[4:] for e in board_envs if e.startswith("env:") ]) )
|
||||
# raise SystemExit(err)
|
||||
# if not result:
|
||||
# err = "Error: Build environment '%s' is incompatible with %s. Use one of these environments: %s" % \
|
||||
# ( build_env, motherboard, ", ".join([ e[4:] for e in board_envs if e.startswith("env:") ]) )
|
||||
# raise SystemExit(err)
|
||||
|
||||
#
|
||||
# Check for Config files in two common incorrect places
|
||||
@@ -129,8 +129,10 @@ if pioutil.is_pio_build():
|
||||
#
|
||||
if 'FILAMENT_RUNOUT_SENSOR' in env['MARLIN_FEATURES'] and 'NUM_RUNOUT_SENSORS' in env['MARLIN_FEATURES']:
|
||||
if env['MARLIN_FEATURES']['NUM_RUNOUT_SENSORS'].isdigit() and int(env['MARLIN_FEATURES']['NUM_RUNOUT_SENSORS']) > 1:
|
||||
if 'FILAMENT_RUNOUT_SCRIPT' in env['MARLIN_FEATURES'] and "%c" not in env['MARLIN_FEATURES']['FILAMENT_RUNOUT_SCRIPT']:
|
||||
err = "ERROR: FILAMENT_RUNOUT_SCRIPT needs a %c parameter when NUM_RUNOUT_SENSORS is > 1"
|
||||
raise SystemExit(err)
|
||||
if 'FILAMENT_RUNOUT_SCRIPT' in env['MARLIN_FEATURES']:
|
||||
frs = env['MARLIN_FEATURES']['FILAMENT_RUNOUT_SCRIPT']
|
||||
if "M600" in frs and "%c" not in frs:
|
||||
err = "ERROR: FILAMENT_RUNOUT_SCRIPT needs a %c parameter (e.g., \"M600 T%c\") when NUM_RUNOUT_SENSORS is > 1"
|
||||
raise SystemExit(err)
|
||||
|
||||
sanity_check_target()
|
||||
|
||||
@@ -190,7 +190,7 @@ def extract():
|
||||
elif state == Parse.BLOCK_COMMENT:
|
||||
|
||||
# Look for temperature sensors
|
||||
if cline == "Temperature sensors available:":
|
||||
if re.match(r'temperature sensors.*:', cline, re.IGNORECASE):
|
||||
state, cline = Parse.GET_SENSORS, "Temperature Sensors"
|
||||
|
||||
options_json, section = use_comment(cline, options_json, section, comment_buff)
|
||||
|
||||
@@ -39,9 +39,9 @@ def get_file_sha256sum(filepath):
|
||||
# Compress a JSON file into a zip file
|
||||
#
|
||||
import zipfile
|
||||
def compress_file(filepath, outpath):
|
||||
def compress_file(filepath, storedname, outpath):
|
||||
with zipfile.ZipFile(outpath, 'w', compression=zipfile.ZIP_BZIP2, compresslevel=9) as zipf:
|
||||
zipf.write(filepath, compress_type=zipfile.ZIP_BZIP2, compresslevel=9)
|
||||
zipf.write(filepath, arcname=storedname, compress_type=zipfile.ZIP_BZIP2, compresslevel=9)
|
||||
|
||||
#
|
||||
# Compute the build signature. The idea is to extract all defines in the configuration headers
|
||||
@@ -71,7 +71,7 @@ def compute_build_signature(env):
|
||||
conf = json.load(infile)
|
||||
if conf['__INITIAL_HASH'] == hashes:
|
||||
# Same configuration, skip recomputing the building signature
|
||||
compress_file(marlin_json, marlin_zip)
|
||||
compress_file(marlin_json, 'marlin_config.json', marlin_zip)
|
||||
return
|
||||
except:
|
||||
pass
|
||||
@@ -255,7 +255,7 @@ def compute_build_signature(env):
|
||||
return
|
||||
|
||||
# Compress the JSON file as much as we can
|
||||
compress_file(marlin_json, marlin_zip)
|
||||
compress_file(marlin_json, 'marlin_config.json', marlin_zip)
|
||||
|
||||
# Generate a C source file for storing this array
|
||||
with open('Marlin/src/mczip.h','wb') as result_file:
|
||||
|
||||
Reference in New Issue
Block a user