Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] bugfix-2.1.x from MarlinFirmware:bugfix-2.1.x #524

Merged
merged 6 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1110,8 +1110,8 @@
* Screw Thread. Use one of the following defines:
*
* M3_CW = M3 Clockwise, M3_CCW = M3 Counter-Clockwise
* M4_CW = M3 Clockwise, M4_CCW = M4 Counter-Clockwise
* M5_CW = M3 Clockwise, M5_CCW = M5 Counter-Clockwise
* M4_CW = M4 Clockwise, M4_CCW = M4 Counter-Clockwise
* M5_CW = M5 Clockwise, M5_CCW = M5 Counter-Clockwise
*
* :{'M3_CW':'M3 Clockwise','M3_CCW':'M3 Counter-Clockwise','M4_CW':'M4 Clockwise','M4_CCW':'M4 Counter-Clockwise','M5_CW':'M5 Clockwise','M5_CCW':'M5 Counter-Clockwise'}
*/
Expand Down
2 changes: 1 addition & 1 deletion Marlin/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* here we define this default string as the date where the latest release
* version was tagged.
*/
//#define STRING_DISTRIBUTION_DATE "2024-09-22"
//#define STRING_DISTRIBUTION_DATE "2024-09-24"

/**
* Defines a generic printer name to be output to the LCD after booting Marlin.
Expand Down
17 changes: 9 additions & 8 deletions Marlin/src/HAL/ESP32/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,16 +209,17 @@ int MarlinHAL::freeMemory() { return ESP.getFreeHeap(); }
// ADC
// ------------------------

#define ADC1_CHANNEL(pin) ADC1_GPIO ## pin ## _CHANNEL

// https://docs.espressif.com/projects/esp-idf/en/release-v4.4/esp32/api-reference/peripherals/adc.html
adc1_channel_t get_channel(int pin) {
switch (pin) {
case 39: return ADC1_CHANNEL(39);
case 36: return ADC1_CHANNEL(36);
case 35: return ADC1_CHANNEL(35);
case 34: return ADC1_CHANNEL(34);
case 33: return ADC1_CHANNEL(33);
case 32: return ADC1_CHANNEL(32);
case 39: return ADC1_CHANNEL_3;
case 36: return ADC1_CHANNEL_0;
case 35: return ADC1_CHANNEL_7;
case 34: return ADC1_CHANNEL_6;
case 33: return ADC1_CHANNEL_5;
case 32: return ADC1_CHANNEL_4;
case 37: return ADC1_CHANNEL_1;
case 38: return ADC1_CHANNEL_2;
}
return ADC1_CHANNEL_MAX;
}
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/ESP32/timers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
config.counter_en = TIMER_PAUSE;
config.alarm_en = TIMER_ALARM_EN;
config.intr_type = TIMER_INTR_LEVEL;
config.auto_reload = true;
config.auto_reload = TIMER_AUTORELOAD_EN;

// Select and initialize the timer
timer_init(timer.group, timer.idx, &config);
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/inc/MarlinConfigPre-1-axes.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#define __MARLIN_FIRMWARE__
#endif

#if __has_include("../../Config.h")
#if __has_include("../../../Marlin/Config.h")
#include "../../Config.h"
#else
#define USE_STD_CONFIGS 1
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/inc/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* version was tagged.
*/
#ifndef STRING_DISTRIBUTION_DATE
#define STRING_DISTRIBUTION_DATE "2024-09-22"
#define STRING_DISTRIBUTION_DATE "2024-09-24"
#endif

/**
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/menu/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ void _lcd_draw_homing() {
}
}

#if ENABLED(LCD_BED_LEVELING) || (HAS_LEVELING && DISABLED(SLIM_LCD_MENUS))
#if HAS_LEVELING
void _lcd_toggle_bed_leveling() { set_bed_leveling_enabled(!planner.leveling_active); }
#endif

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/menu/menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ void _lcd_draw_homing();
void menu_advanced_settings();
#endif

#if ENABLED(LCD_BED_LEVELING) || (HAS_LEVELING && DISABLED(SLIM_LCD_MENUS))
#if HAS_LEVELING
void _lcd_toggle_bed_leveling();
#endif

Expand Down
1 change: 0 additions & 1 deletion buildroot/bin/mftest
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ env shortcuts: tree due esp lin lp8|lpc8 lp9|lpc9 m128 m256|mega stm|f1 f4 f7 s6
TESTPATH=buildroot/tests

STATE_FILE="./.pio/.mftestrc"
SED=$(which gsed sed | head -n1)

shopt -s extglob nocasematch

Expand Down
8 changes: 3 additions & 5 deletions buildroot/bin/mfutil
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
#

# Check dependencies
which curl 1>/dev/null 2>&1 || { echo "curl not found! Please install it."; exit ; }
which git 1>/dev/null 2>&1 || { echo "git not found! Please install it."; exit ; }

SED=$(which gsed sed | head -n1)
[[ -z "$SED" ]] && { echo "No sed found, please install sed" ; exit 1 ; }
which curl &>/dev/null || { echo "curl not found! Please install it."; exit 1 ; }
which git &>/dev/null || { echo "git not found! Please install it."; exit 1 ; }
which sed &>/dev/null || { echo "sed not found! Please install it."; exit 1 ; }

OPEN=$( which gnome-open xdg-open open | head -n1 )

Expand Down
29 changes: 25 additions & 4 deletions buildroot/bin/opt_disable
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,34 @@
# exit on first failure
set -e

SED=$(which gsed sed | head -n1)
# Get SED_CMD, SED_I, and the BSDSED flag
. $(dirname $0)/opt_sed

for opt in "$@" ; do
DID=0 ; FOUND=0
for FN in Configuration Configuration_adv; do
"${SED}" -i "/^\(\s*\)\(#define\s\+${opt}\b\s\?\)\(\s\s\)\?/{s//\1\/\/\2/;h};\${x;/./{x;q0};x;q9}" Marlin/$FN.h && DID=1
((DID||FOUND)) || { grep -E "^\s*//\s*#define\s+${opt}\b" Marlin/$FN.h >/dev/null && FOUND=1 ; }
for FN in Marlin/Configuration.h Marlin/Configuration_adv.h; do
if [[ $BSDSED ]]; then
# BSD sed version (macOS)
"${SED_CMD}" "${SED_I[@]}" \
"/^[[:space:]]*#define[[:space:]]+${opt}\b/{
s/^[[:space:]]*\(#define[[:space:]]+${opt}\b.*\)/\/\/\1/
h
\$b end
}
\$!b
:end
x
/./{ x; q0; }
x
q1" \
$FN && DID=1
else
# GNU sed version
"${SED_CMD}" "${SED_I[@]}" \
"/^\(\s*\)\(#define\s\+${opt}\b\s\?\)\(\s\s\)\?/{s//\1\/\/\2/;h};\${x;/./{x;q0};x;q1}" \
$FN && DID=1
fi
((DID||FOUND)) || { grep -E "^\s*\/\/#define\s+${opt}\b" $FN >/dev/null && FOUND=1 ; }
done
((DID||FOUND)) || (echo "ERROR: $(basename $0) Can't find ${opt}" >&2 && exit 9)
done
29 changes: 25 additions & 4 deletions buildroot/bin/opt_enable
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,34 @@
# exit on first failure
set -e

SED=$(which gsed sed | head -n1)
# Get SED_CMD, SED_I, and the BSDSED flag
. $(dirname $0)/opt_sed

for opt in "$@" ; do
DID=0 ; FOUND=0
for FN in Configuration Configuration_adv; do
"${SED}" -i "/^\(\s*\)\/\/\(\s*\)\(#define\s\+${opt}\b\)\( \?\)/{s//\1\2\3\4\4\4/;h};\${x;/./{x;q0};x;q9}" Marlin/$FN.h && DID=1
((DID||FOUND)) || { grep -E "^\s*#define\s+${opt}\b" Marlin/$FN.h >/dev/null && FOUND=1 ; }
for FN in Marlin/Configuration.h Marlin/Configuration_adv.h; do
if [[ $BSDSED ]]; then
# BSD sed version (macOS)
"${SED_CMD}" "${SED_I[@]}" \
"/^[[:space:]]*\/\/[[:space:]]*#define[[:space:]]+${opt}\b/{
s/^[[:space:]]*\/\/[[:space:]]*\(#define[[:space:]]+${opt}\b\)[[:space:]]*/\1 /
h
\$b end
}
\$!b
:end
x
/./{ x; q0; }
x
q1" \
$FN && DID=1
else
# GNU sed version
"${SED_CMD}" "${SED_I[@]}" \
"/^\(\s*\)\/\/\(\s*\)\(#define\s\+${opt}\b\)\( \?\)/{s//\1\2\3\4\4\4/;h};\${x;/./{x;q0};x;q1}" \
$FN && DID=1
fi
((DID||FOUND)) || { grep -E "^\s*#define\s+${opt}\b" $FN >/dev/null && FOUND=1 ; }
done
((DID||FOUND)) || (echo "ERROR: $(basename $0) Can't find ${opt}" >&2 && exit 9)
done
4 changes: 2 additions & 2 deletions buildroot/bin/opt_find
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ esac

while [[ $# > 0 ]]; do
DID=0
for FN in Configuration Configuration_adv; do
FOUND=$( grep -HEn "^\s*${COMM}#define\s+[A-Z0-9_]*${1}" "Marlin/$FN.h" 2>/dev/null )
for FN in Marlin/Configuration.h Marlin/Configuration_adv.h; do
FOUND=$( grep -HEn "^\s*${COMM}#define\s+[A-Z0-9_]*${1}" $FN 2>/dev/null )
[[ -n "$FOUND" ]] && { echo "$FOUND" ; DID=1 ; }
done
((DID)) || { echo "ERROR: ${MYNAME} - No ${TYPE}match for ${1}" ; exit 9; }
Expand Down
9 changes: 9 additions & 0 deletions buildroot/bin/opt_sed
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Detect sed version
SED_CMD="sed"
SED_I=(-i)
if command -v gsed >/dev/null 2>&1; then
SED_CMD="gsed"
elif [[ "$(uname)" == "Darwin" ]]; then
SED_I=(-i '')
BSDSED=1
fi
27 changes: 24 additions & 3 deletions buildroot/bin/opt_set
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,33 @@
# exit on first failure
set -e

SED=$(which gsed sed | head -n1)
# Get SED_CMD, SED_I, and the BSDSED flag
. $(dirname $0)/opt_sed

while [[ $# > 1 ]]; do
DID=0
for FN in Configuration Configuration_adv; do
"${SED}" -i "/^\(\s*\)\/*\s*\(#define\s\+${1}\b\) *\(.*\)$/{s//\1\2 ${2} \/\/ \3/;h};\${x;/./{x;q0};x;q9}" Marlin/$FN.h && DID=1
for FN in Marlin/Configuration.h Marlin/Configuration_adv.h; do
if [[ $BSDSED ]]; then
# BSD sed version (macOS)
$SED_CMD "${SED_I[@]}" \
"/^[[:space:]]*\/\{0,2\}[[:space:]]*#define[[:space:]]+${1}\b/{
s/^[[:space:]]*\/\{0,2\}[[:space:]]*\(#define[[:space:]]+${1}\b\)[[:space:]]*.*/\1 ${2} \/\/ &/
h
\$b end
}
\$!b
:end
x
/./{ x; q0; }
x
q1" \
$FN && DID=1
else
# GNU sed version
$SED_CMD "${SED_I[@]}" \
"/^\(\s*\)\/\{0,2\}\s*\(#define\s\+${1}\b\)\s*\(.*\)$/{s//\1\2 ${2} \/\/ \3/;h};\${x;/./{x;q0};x;q1}" \
$FN && DID=1
fi
done
((DID)) ||
eval "echo '#define ${1} ${2}' >>Marlin/Configuration.h" ||
Expand Down
16 changes: 0 additions & 16 deletions buildroot/bin/pins_set

This file was deleted.

38 changes: 38 additions & 0 deletions buildroot/share/PlatformIO/boards/marlin_MKS_TinyBee.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"build": {
"arduino":{
"ldscript": "esp32_out.ld"
},
"core": "esp32",
"extra_flags": "-DARDUINO_ESP32_DEV",
"f_cpu": "240000000L",
"f_flash": "40000000L",
"flash_mode": "dio",
"mcu": "esp32",
"variant": "esp32"
},
"connectivity": [
"wifi",
"bluetooth",
"ethernet",
"can"
],
"debug": {
"openocd_board": "esp-wroom-32.cfg"
},
"frameworks": [
"arduino",
"espidf"
],
"name": "MKS TinyBee V1.0",
"upload": {
"flash_size": "8MB",
"maximum_ram_size": 524288,
"maximum_size": 8388608,
"require_upload_port": true,
"speed": 460800,
"offset_address": 65536
},
"url": "https://github.com/makerbase-mks/MKS-TinyBee",
"vendor": "MKS Makerbase"
}
46 changes: 33 additions & 13 deletions buildroot/share/PlatformIO/scripts/preprocessor.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# preprocessor.py
#
import subprocess
import subprocess, os

nocache = 1
verbose = 0
Expand Down Expand Up @@ -53,12 +53,14 @@ def run_preprocessor(env, fn=None):
# Find a compiler, considering the OS
#
def search_compiler(env):
global nocache

from pathlib import Path, PurePath

ENV_BUILD_PATH = Path(env['PROJECT_BUILD_DIR'], env['PIOENV'])
GCC_PATH_CACHE = ENV_BUILD_PATH / ".gcc_path"

gccpath = None
try:
gccpath = env.GetProjectOption('custom_gcc')
blab("Getting compiler from env")
Expand All @@ -71,24 +73,42 @@ def search_compiler(env):
blab("Getting g++ path from cache")
return GCC_PATH_CACHE.read_text()

# Use any item in $PATH corresponding to a platformio toolchain bin folder
path_separator = ':'
gcc_exe = '*g++'
if env['PLATFORM'] == 'win32':

sysname = os.uname().sysname
if sysname == 'Windows':
path_separator = ';'
gcc_exe += ".exe"

envpath = map(Path, env['ENV']['PATH'].split(path_separator))

# Search for the compiler in PATH
for ppath in map(Path, env['ENV']['PATH'].split(path_separator)):
for ppath in envpath:
# Use any item in $PATH corresponding to a platformio toolchain bin folder
if ppath.match(env['PROJECT_PACKAGES_DIR'] + "/**/bin"):
for gpath in ppath.glob(gcc_exe):
gccpath = str(gpath.resolve())
# Cache the g++ path to no search always
if not nocache and ENV_BUILD_PATH.exists():
blab("Caching g++ for current env")
GCC_PATH_CACHE.write_text(gccpath)
return gccpath

gccpath = env.get('CXX')
blab("Couldn't find a compiler! Fallback to %s" % gccpath)
# Skip '*-elf-g++' (crosstool-NG)
if not gpath.stem.endswith('-elf-g++'):
gccpath = str(gpath.resolve())
break

if not gccpath:
for ppath in envpath:
for gpath in ppath.glob(gcc_exe):
# Skip macOS Clang
if gpath != 'usr/bin/g++' or sysname != 'Darwin':
gccpath = str(gpath.resolve())
break

if not gccpath:
gccpath = env.get('CXX')
blab("Couldn't find a compiler! Fallback to '%s'" % gccpath)
nocache = 1

# Cache the g++ path to speed up the next build
if not nocache and gccpath and ENV_BUILD_PATH.exists():
blab("Caching g++ for current env")
GCC_PATH_CACHE.write_text(gccpath)

return gccpath
1 change: 0 additions & 1 deletion buildroot/share/git/mfhelp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ Modify Configuration.h / Configuration_adv.h:

Modify pins files:

pins_set ............. Set the value of a pin in a pins file
pinsformat.py ........ Python script to format pins files

THIS
Loading
Loading