update code base to Marlin 2.0.9.2

This commit is contained in:
Stefan Kalscheuer
2021-10-03 18:57:12 +02:00
parent b9d7ba838e
commit 7077da3591
2617 changed files with 332093 additions and 103438 deletions

0
buildroot/share/scripts/MarlinMesh.scad Executable file → Normal file
View File

View File

@@ -0,0 +1,200 @@
#!/usr/bin/env python3
#
# for python3.5 or higher
#-----------------------------------
# Within Marlin project MarlinFirmware/Configurations, this program visits all folders
# under .../config/examples/*, processing each Configuration.h, Configuration_adv.h,
# _Bootscreen.h, and _Statusscreen.h, to insert:
# #define CONFIG_EXAMPLES_DIR "examples/<style>/<vendor>/<model>"
# ... or similar path leading to this file.
#
# Warning: The program modifies files in place, so be sure to back them up first if needed.
# Can be run multiple times if needed. Only modifies files which don't have
# correct #define CONFIG_EXAMPLES_DIR line.
#
# Invocation:
#-------------
# 1. Change directory to your MarlinFirmware/Configurations working copy
# 2. python3 config-labels.py
#
#-----------------------------------
# 2020-05-10 GMW original
# 2020-06-05 SRL style tweaks
#-----------------------------------
#
import sys,os
from pathlib import Path
from distutils.dir_util import copy_tree # for copy_tree, because shutil.copytree can't handle existing files, dirs
# Modify input_examples_dir and output_examples_dir for your installation
# No trailing slash
# Setting output_examples_dir = input_examples_dir causes the program to insert into the existing files.
input_examples_dir = r'config/examples'
# output_examples_dir = input_examples_dir
output_examples_dir = r'config/examples'
#-------------------------------------
files_to_mod = ['Configuration.h', 'Configuration_adv.h', '_Bootscreen.h', '_Statusscreen.h']
macro_name = 'CONFIG_EXAMPLES_DIR'
def_macro_name = '#define ' + macro_name
filenum = 0
different_out_dir = not (output_examples_dir == input_examples_dir)
#----------------------------------------------
def process_file(subdir: str, filename: str):
#----------------------------------------------
global filenum
filenum += 1
print(str(filenum) + ' ' + filename + ': ' + subdir)
def_line = (def_macro_name + ' "' + subdir.replace('\\', '/') + '"')
#------------------------
# Read file
#------------------------
lines = []
infilepath = os.path.join(input_examples_dir, subdir, filename)
try:
# UTF-8 because some files contain unicode chars
with open(infilepath, 'rt', encoding="utf-8") as infile:
lines = infile.readlines()
except Exception as e:
print('Failed to read file: ' + str(e) )
raise Exception
lines = [line.rstrip('\r\n') for line in lines]
#------------------------
# Process lines
#------------------------
file_modified = False
# region state machine
# -1 = before pragma once;
# 0 = region to place define;
# 1 = past region to place define
region = -1
outlines = []
for line in lines:
outline = line
if (region == -1) and (def_macro_name in line):
outline = None
file_modified = True
elif (region == -1) and ('pragma once' in line):
region = 0
elif (region == 0):
if (line.strip() == ''):
pass
elif (def_macro_name in line):
region = 1
if line == def_line: # leave it as is
pass
else:
outline = def_line
file_modified = True
else: # some other string
outlines.append(def_line)
outlines.append('')
region = 1
file_modified = True
elif (region == 1):
if (def_macro_name in line):
outline = None
file_modified = True
else:
pass
# end if
if outline is not None:
outlines.append(outline)
# end for
#-------------------------
# Output file
#-------------------------
outdir = os.path.join(output_examples_dir, subdir)
outfilepath = os.path.join(outdir, filename)
if file_modified:
# Note: no need to create output dirs, as the initial copy_tree
# will do that.
print(' writing ' + str(outfilepath))
try:
# Preserve unicode chars; Avoid CR-LF on Windows.
with open(outfilepath, "w", encoding="utf-8", newline='\n') as outfile:
outfile.write("\n".join(outlines))
outfile.write("\n")
except Exception as e:
print('Failed to write file: ' + str(e) )
raise Exception
else:
print(' no change for ' + str(outfilepath))
#----------
def main():
#----------
global filenum
global input_examples_dir
global output_examples_dir
filenum = 0
#--------------------------------
# Check for requirements
#--------------------------------
input_examples_dir = input_examples_dir.strip()
input_examples_dir = input_examples_dir.rstrip('\\/')
output_examples_dir = output_examples_dir.strip()
output_examples_dir = output_examples_dir.rstrip('\\/')
for dir in [input_examples_dir, output_examples_dir]:
if not (os.path.exists(dir)):
print('Directory not found: ' + dir)
sys.exit(1)
#--------------------------------
# Copy tree if necessary.
#--------------------------------
# This includes files that are not otherwise included in the
# insertion of the define statement.
#
if different_out_dir:
print('Copying files to new directory: ' + output_examples_dir)
try:
copy_tree(input_examples_dir, output_examples_dir)
except Exception as e:
print('Failed to copy directory: ' + str(e) )
raise Exception
#-----------------------------
# Find and process files
#-----------------------------
len_input_examples_dir = len(input_examples_dir);
len_input_examples_dir += 1
for filename in files_to_mod:
input_path = Path(input_examples_dir)
filepathlist = input_path.rglob(filename)
for filepath in filepathlist:
fulldirpath = str(filepath.parent)
subdir = fulldirpath[len_input_examples_dir:]
process_file(subdir, filename)
#==============
print('--- Starting config-labels ---')
main()
print('--- Done ---')

View File

@@ -2,10 +2,10 @@
"""Thermistor Value Lookup Table Generator
Generates lookup to temperature values for use in a microcontroller in C format based on:
http://en.wikipedia.org/wiki/Steinhart-Hart_equation
https://en.wikipedia.org/wiki/Steinhart-Hart_equation
The main use is for Arduino programs that read data from the circuit board described here:
http://reprap.org/wiki/Temperature_Sensor_v2.0
https://reprap.org/wiki/Temperature_Sensor_v2.0
Usage: python createTemperatureLookupMarlin.py [options]
@@ -22,8 +22,7 @@ from __future__ import print_function
from __future__ import division
from math import *
import sys
import getopt
import sys,getopt
"Constants"
ZERO = 273.15 # zero point of Kelvin scale
@@ -74,7 +73,7 @@ class Thermistor:
return r
def temp(self, adc):
"Convert ADC reading into a temperature in Celcius"
"Convert ADC reading into a temperature in Celsius"
l = log(self.resist(adc))
Tinv = self.c1 + self.c2*l + self.c3* l**3 # inverse temperature
return (1/Tinv) - ZERO # temperature

View File

@@ -13,37 +13,35 @@ LANGHOME="Marlin/src/lcd/language"
[ -d $LANGHOME ] && cd $LANGHOME
FILES=$(ls language_*.h | grep -v -E "(_en|_test)\.h" | sed -E 's/language_([^\.]+)\.h/\1/')
declare -A STRING_MAP
FILES=$(ls language_*.h | grep -v -E "(_en|_test)\.h" | sed -E 's/language_([^\.]+)\.h/\1/' | tr '\n' ' ')
# Get files matching the given arguments
TEST_LANGS=$FILES
TEST_LANGS=""
if [[ -n $@ ]]; then
TEST_LANGS=""
for K in "$@"; do
for F in $FILES; do
[[ "$F" != "${F%$K*}" ]] && TEST_LANGS="$TEST_LANGS $F"
[[ "$F" != "${F%$K*}" ]] && TEST_LANGS+="$F "
done
done
[[ -z $TEST_LANGS ]] && { echo "No languages matching $@." ; exit 0 ; }
else
TEST_LANGS=$FILES
fi
echo -n "Building list of missing strings..."
echo "Missing strings for $TEST_LANGS..."
for i in $(awk '/Language_Str/{print $3}' language_en.h); do
[[ $i == "MSG_CUBED" ]] && continue
for WORD in $(awk '/LSTR/{print $2}' language_en.h); do
[[ $WORD == "MSG_MARLIN" ]] && break
LANG_LIST=""
for j in $TEST_LANGS; do
[[ $(grep -c " ${i} " language_${j}.h) -eq 0 ]] && LANG_LIST="$LANG_LIST $j"
for LANG in $TEST_LANGS; do
if [[ $(grep -c -E "^ *LSTR +$WORD\b" language_${LANG}.h) -eq 0 ]]; then
INHERIT=$(awk '/using namespace/{print $3}' language_${LANG}.h | sed -E 's/Language_([a-zA-Z_]+)\s*;/\1/')
if [[ -z $INHERIT || $INHERIT == "en" ]]; then
LANG_LIST+=" $LANG"
elif [[ $(grep -c -E "^ *LSTR +$WORD\b" language_${INHERIT}.h) -eq 0 ]]; then
LANG_LIST+=" $LANG"
fi
fi
done
[[ -z $LANG_LIST ]] && continue
STRING_MAP[$i]=$LANG_LIST
done
echo
for K in $( printf "%s\n" "${!STRING_MAP[@]}" | sort ); do
case "$#" in
1 ) echo $K ;;
* ) printf "%-35s :%s\n" "$K" "${STRING_MAP[$K]}" ;;
esac
[[ -n $LANG_LIST ]] && printf "%-38s :%s\n" "$WORD" "$LANG_LIST"
done

View File

@@ -119,7 +119,7 @@ def z_parse(gcode, start_at_line=0, end_at_line=0):
# last_z = z
last_i = i
if 0 < end_at_line <= i or temp_line >= min_g1:
# print('break at line {} at heigth {}'.format(i, z))
# print('break at line {} at height {}'.format(i, z))
break
line_between_z = line_between_z[1:]

View File

@@ -0,0 +1,64 @@
#!/usr/bin/env python3
#
# Marlin 3D Printer Firmware
# Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
#
# Based on Sprinter and grbl.
# Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# Generate Marlin TFT Images from bitmaps/PNG/JPG
import sys,re,struct
from PIL import Image,ImageDraw
def image2bin(image, output_file):
if output_file.endswith(('.c', '.cpp')):
f = open(output_file, 'wt')
is_cpp = True
f.write("const uint16_t image[%d] = {\n" % (image.size[1] * image.size[0]))
else:
f = open(output_file, 'wb')
is_cpp = False
pixs = image.load()
for y in range(image.size[1]):
for x in range(image.size[0]):
R = pixs[x, y][0] >> 3
G = pixs[x, y][1] >> 2
B = pixs[x, y][2] >> 3
rgb = (R << 11) | (G << 5) | B
if is_cpp:
strHex = '0x{0:04X}, '.format(rgb)
f.write(strHex)
else:
f.write(struct.pack("B", (rgb & 0xFF)))
f.write(struct.pack("B", (rgb >> 8) & 0xFF))
if is_cpp:
f.write("\n")
if is_cpp:
f.write("};\n")
f.close()
if len(sys.argv) <= 2:
print("Utility to export a image in Marlin TFT friendly format.")
print("It will dump a raw bin RGB565 image or create a CPP file with an array of 16 bit image pixels.")
print("Usage: gen-tft-image.py INPUT_IMAGE.(png|bmp|jpg) OUTPUT_FILE.(cpp|bin)")
print("Author: rhapsodyv")
exit(1)
output_img = sys.argv[2]
img = Image.open(sys.argv[1])
image2bin(img, output_img)

View File

@@ -38,10 +38,12 @@ for (let m of mpatt) mexpr.push(new RegExp('^' + m + '$'));
const argv = process.argv.slice(2), argc = argv.length;
var src_file = 0, src_name = 'STDIN', dst_file;
var src_file = 0, src_name = 'STDIN', dst_file, do_log = false;
if (argc > 0) {
src_file = src_name = argv[0];
dst_file = argv[argc > 1 ? 1 : 0];
let ind = 0;
if (argv[0] == '-v') { do_log = true; ind++; }
dst_file = src_file = src_name = argv[ind++];
if (ind < argc) dst_file = argv[ind];
}
// Read from file or STDIN until it terminates
@@ -81,7 +83,7 @@ function process_text(txt) {
aliasPatt = new RegExp('^(\\s*(//)?#define)\\s+([A-Z_][A-Z0-9_]+)\\s+([A-Z_][A-Z0-9_()]+)\\s*(//.*)?$'),
switchPatt = new RegExp('^(\\s*(//)?#define)\\s+([A-Z_][A-Z0-9_]+)\\s*(//.*)?$'),
undefPatt = new RegExp('^(\\s*(//)?#undef)\\s+([A-Z_][A-Z0-9_]+)\\s*(//.*)?$'),
defPatt = new RegExp('^(\\s*(//)?#define)\\s+([A-Z_][A-Z0-9_]+)\\s+(\\w+)\\s*(//.*)?$'),
defPatt = new RegExp('^(\\s*(//)?#define)\\s+([A-Z_][A-Z0-9_]+)\\s+([-_\\w]+)\\s*(//.*)?$'),
condPatt = new RegExp('^(\\s*(//)?#(if|ifn?def|else|elif)(\\s+\\S+)*)\\s+(//.*)$'),
commPatt = new RegExp('^\\s{20,}(//.*)?$');
const col_value_lj = col_comment - patt.pad - 2;
@@ -98,6 +100,7 @@ function process_text(txt) {
//
// #define MY_PIN [pin]
//
if (do_log) console.log("pin:", line);
const pinnum = r[4].charAt(0) == 'P' ? r[4] : r[4].lpad(patt.pad);
line = r[1] + ' ' + r[3];
line = line.rpad(col_value_lj) + pinnum;
@@ -107,31 +110,57 @@ function process_text(txt) {
//
// #define MY_PIN -1
//
if (do_log) console.log("pin -1:", line);
line = r[1] + ' ' + r[3];
line = line.rpad(col_value_lj) + '-1';
if (r[5]) line = line.rpad(col_comment) + r[5];
}
else if ((r = skipPatt.exec(line)) !== null) {
//
// #define SKIP_ME
//
if (do_log) console.log("skip:", line);
}
else if ((r = aliasPatt.exec(line)) !== null) {
//
// #define ALIAS OTHER
//
if (do_log) console.log("alias:", line);
line = r[1] + ' ' + r[3];
line += r[4].lpad(col_value_rj + 1 - line.length);
if (r[5]) line = line.rpad(col_comment) + r[5];
}
else if ((r = switchPatt.exec(line)) !== null) {
//
// #define SWITCH
//
if (do_log) console.log("switch:", line);
line = r[1] + ' ' + r[3];
if (r[4]) line = line.rpad(col_comment) + r[4];
check_comment_next = true;
}
else if ((r = defPatt.exec(line)) !== null) {
line = r[1] + ' ' + r[3] + ' ' + r[4];
if (r[5]) line = line.rpad(col_comment) + r[5];
//
// #define ...
//
if (do_log) console.log("def:", line);
line = r[1] + ' ' + r[3] + ' ';
line += r[4].lpad(col_value_rj + 1 - line.length);
if (r[5]) line = line.rpad(col_comment - 1) + ' ' + r[5];
}
else if ((r = undefPatt.exec(line)) !== null) {
//
// #undef ...
//
if (do_log) console.log("undef:", line);
line = r[1] + ' ' + r[3];
if (r[4]) line = line.rpad(col_comment) + r[4];
}
else if ((r = condPatt.exec(line)) !== null) {
//
// #if ...
//
if (do_log) console.log("cond:", line);
line = r[1].rpad(col_comment) + r[5];
check_comment_next = true;
}