Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8e027304c8 | |||
| 79dcfe5455 | |||
| 834025e486 | |||
| 05d51f9c7f | |||
| 44589a964d | |||
| b3e3a58e8b | |||
| 16106e3961 | |||
| 6dad386de9 | |||
| 8df0cca036 | |||
| 62c280a60f | |||
| 2087a1330d |
@@ -27,7 +27,7 @@ tests-single-ci:
|
|||||||
|
|
||||||
tests-single-local:
|
tests-single-local:
|
||||||
@if ! test -n "$(TEST_TARGET)" ; then echo "***ERROR*** Set TEST_TARGET=<your-module> or use make tests-all-local" ; return 1; fi
|
@if ! test -n "$(TEST_TARGET)" ; then echo "***ERROR*** Set TEST_TARGET=<your-module> or use make tests-all-local" ; return 1; fi
|
||||||
export PATH="./buildroot/bin/:./buildroot/tests/:${PATH}" \
|
export PATH=./buildroot/bin/:./buildroot/tests/:${PATH} \
|
||||||
&& export VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) \
|
&& export VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) \
|
||||||
&& run_tests . $(TEST_TARGET) "$(ONLY_TEST)"
|
&& run_tests . $(TEST_TARGET) "$(ONLY_TEST)"
|
||||||
.PHONY: tests-single-local
|
.PHONY: tests-single-local
|
||||||
@@ -38,7 +38,7 @@ tests-single-local-docker:
|
|||||||
.PHONY: tests-single-local-docker
|
.PHONY: tests-single-local-docker
|
||||||
|
|
||||||
tests-all-local:
|
tests-all-local:
|
||||||
export PATH="./buildroot/bin/:./buildroot/tests/:${PATH}" \
|
export PATH=./buildroot/bin/:./buildroot/tests/:${PATH} \
|
||||||
&& export VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) \
|
&& export VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) \
|
||||||
&& for TEST_TARGET in $$(./get_test_targets.py) ; do echo "Running tests for $$TEST_TARGET" ; run_tests . $$TEST_TARGET ; done
|
&& for TEST_TARGET in $$(./get_test_targets.py) ; do echo "Running tests for $$TEST_TARGET" ; run_tests . $$TEST_TARGET ; done
|
||||||
.PHONY: tests-all-local
|
.PHONY: tests-all-local
|
||||||
|
|||||||
@@ -552,10 +552,14 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// When first starting the main fan, run it at full speed for the
|
/**
|
||||||
// given number of milliseconds. This gets the fan spinning reliably
|
* Fan Kickstart
|
||||||
// before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu)
|
* When part cooling or controller fans first start, run at a speed that
|
||||||
//#define FAN_KICKSTART_TIME 100
|
* gets it spinning reliably for a short time before setting the requested speed.
|
||||||
|
* (Does not work on Sanguinololu with FAN_SOFT_PWM.)
|
||||||
|
*/
|
||||||
|
//#define FAN_KICKSTART_TIME 100 // (ms)
|
||||||
|
//#define FAN_KICKSTART_POWER 180 // 64-255
|
||||||
|
|
||||||
// Some coolers may require a non-zero "off" state.
|
// Some coolers may require a non-zero "off" state.
|
||||||
//#define FAN_OFF_PWM 1
|
//#define FAN_OFF_PWM 1
|
||||||
|
|||||||
+1
-1
@@ -41,7 +41,7 @@
|
|||||||
* here we define this default string as the date where the latest release
|
* here we define this default string as the date where the latest release
|
||||||
* version was tagged.
|
* version was tagged.
|
||||||
*/
|
*/
|
||||||
//#define STRING_DISTRIBUTION_DATE "2022-10-16"
|
//#define STRING_DISTRIBUTION_DATE "2022-10-12"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines a generic printer name to be output to the LCD after booting Marlin.
|
* Defines a generic printer name to be output to the LCD after booting Marlin.
|
||||||
|
|||||||
@@ -6,14 +6,14 @@
|
|||||||
#
|
#
|
||||||
import pioutil
|
import pioutil
|
||||||
if pioutil.is_pio_build():
|
if pioutil.is_pio_build():
|
||||||
import platform
|
import platform
|
||||||
current_OS = platform.system()
|
current_OS = platform.system()
|
||||||
|
|
||||||
if current_OS == 'Windows':
|
if current_OS == 'Windows':
|
||||||
|
|
||||||
Import("env")
|
Import("env")
|
||||||
|
|
||||||
# Use bossac.exe on Windows
|
# Use bossac.exe on Windows
|
||||||
env.Replace(
|
env.Replace(
|
||||||
UPLOADCMD="bossac --info --unlock --write --verify --reset --erase -U false --boot $SOURCE"
|
UPLOADCMD="bossac --info --unlock --write --verify --reset --erase -U false --boot $SOURCE"
|
||||||
)
|
)
|
||||||
|
|||||||
+105
-105
@@ -226,8 +226,8 @@ typedef const_float_t const_celsius_float_t;
|
|||||||
// Helpers
|
// Helpers
|
||||||
#define _RECIP(N) ((N) ? 1.0f / static_cast<float>(N) : 0.0f)
|
#define _RECIP(N) ((N) ? 1.0f / static_cast<float>(N) : 0.0f)
|
||||||
#define _ABS(N) ((N) < 0 ? -(N) : (N))
|
#define _ABS(N) ((N) < 0 ? -(N) : (N))
|
||||||
#define _LS(N) (N = (T)(uint32_t(N) << p))
|
#define _LS(N) (N = (T)(uint32_t(N) << v))
|
||||||
#define _RS(N) (N = (T)(uint32_t(N) >> p))
|
#define _RS(N) (N = (T)(uint32_t(N) >> v))
|
||||||
#define FI FORCE_INLINE
|
#define FI FORCE_INLINE
|
||||||
|
|
||||||
// Forward declarations
|
// Forward declarations
|
||||||
@@ -348,9 +348,9 @@ struct XYval {
|
|||||||
// If any element is true then it's true
|
// If any element is true then it's true
|
||||||
FI operator bool() { return x || y; }
|
FI operator bool() { return x || y; }
|
||||||
// Smallest element
|
// Smallest element
|
||||||
FI T small() const { return _MIN(x, y); }
|
FI T _min() const { return _MIN(x, y); }
|
||||||
// Largest element
|
// Largest element
|
||||||
FI T large() const { return _MAX(x, y); }
|
FI T _max() const { return _MAX(x, y); }
|
||||||
|
|
||||||
// Explicit copy and copies with conversion
|
// Explicit copy and copies with conversion
|
||||||
FI XYval<T> copy() const { return *this; }
|
FI XYval<T> copy() const { return *this; }
|
||||||
@@ -409,18 +409,18 @@ struct XYval {
|
|||||||
FI XYval<T> operator* (const XYZEval<T> &rs) { XYval<T> ls = *this; ls.x *= rs.x; ls.y *= rs.y; return ls; }
|
FI XYval<T> operator* (const XYZEval<T> &rs) { XYval<T> ls = *this; ls.x *= rs.x; ls.y *= rs.y; return ls; }
|
||||||
FI XYval<T> operator/ (const XYZEval<T> &rs) const { XYval<T> ls = *this; ls.x /= rs.x; ls.y /= rs.y; return ls; }
|
FI XYval<T> operator/ (const XYZEval<T> &rs) const { XYval<T> ls = *this; ls.x /= rs.x; ls.y /= rs.y; return ls; }
|
||||||
FI XYval<T> operator/ (const XYZEval<T> &rs) { XYval<T> ls = *this; ls.x /= rs.x; ls.y /= rs.y; return ls; }
|
FI XYval<T> operator/ (const XYZEval<T> &rs) { XYval<T> ls = *this; ls.x /= rs.x; ls.y /= rs.y; return ls; }
|
||||||
FI XYval<T> operator* (const float &p) const { XYval<T> ls = *this; ls.x *= p; ls.y *= p; return ls; }
|
FI XYval<T> operator* (const float &v) const { XYval<T> ls = *this; ls.x *= v; ls.y *= v; return ls; }
|
||||||
FI XYval<T> operator* (const float &p) { XYval<T> ls = *this; ls.x *= p; ls.y *= p; return ls; }
|
FI XYval<T> operator* (const float &v) { XYval<T> ls = *this; ls.x *= v; ls.y *= v; return ls; }
|
||||||
FI XYval<T> operator* (const int &p) const { XYval<T> ls = *this; ls.x *= p; ls.y *= p; return ls; }
|
FI XYval<T> operator* (const int &v) const { XYval<T> ls = *this; ls.x *= v; ls.y *= v; return ls; }
|
||||||
FI XYval<T> operator* (const int &p) { XYval<T> ls = *this; ls.x *= p; ls.y *= p; return ls; }
|
FI XYval<T> operator* (const int &v) { XYval<T> ls = *this; ls.x *= v; ls.y *= v; return ls; }
|
||||||
FI XYval<T> operator/ (const float &p) const { XYval<T> ls = *this; ls.x /= p; ls.y /= p; return ls; }
|
FI XYval<T> operator/ (const float &v) const { XYval<T> ls = *this; ls.x /= v; ls.y /= v; return ls; }
|
||||||
FI XYval<T> operator/ (const float &p) { XYval<T> ls = *this; ls.x /= p; ls.y /= p; return ls; }
|
FI XYval<T> operator/ (const float &v) { XYval<T> ls = *this; ls.x /= v; ls.y /= v; return ls; }
|
||||||
FI XYval<T> operator/ (const int &p) const { XYval<T> ls = *this; ls.x /= p; ls.y /= p; return ls; }
|
FI XYval<T> operator/ (const int &v) const { XYval<T> ls = *this; ls.x /= v; ls.y /= v; return ls; }
|
||||||
FI XYval<T> operator/ (const int &p) { XYval<T> ls = *this; ls.x /= p; ls.y /= p; return ls; }
|
FI XYval<T> operator/ (const int &v) { XYval<T> ls = *this; ls.x /= v; ls.y /= v; return ls; }
|
||||||
FI XYval<T> operator>>(const int &p) const { XYval<T> ls = *this; _RS(ls.x); _RS(ls.y); return ls; }
|
FI XYval<T> operator>>(const int &v) const { XYval<T> ls = *this; _RS(ls.x); _RS(ls.y); return ls; }
|
||||||
FI XYval<T> operator>>(const int &p) { XYval<T> ls = *this; _RS(ls.x); _RS(ls.y); return ls; }
|
FI XYval<T> operator>>(const int &v) { XYval<T> ls = *this; _RS(ls.x); _RS(ls.y); return ls; }
|
||||||
FI XYval<T> operator<<(const int &p) const { XYval<T> ls = *this; _LS(ls.x); _LS(ls.y); return ls; }
|
FI XYval<T> operator<<(const int &v) const { XYval<T> ls = *this; _LS(ls.x); _LS(ls.y); return ls; }
|
||||||
FI XYval<T> operator<<(const int &p) { XYval<T> ls = *this; _LS(ls.x); _LS(ls.y); return ls; }
|
FI XYval<T> operator<<(const int &v) { XYval<T> ls = *this; _LS(ls.x); _LS(ls.y); return ls; }
|
||||||
FI const XYval<T> operator-() const { XYval<T> o = *this; o.x = -x; o.y = -y; return o; }
|
FI const XYval<T> operator-() const { XYval<T> o = *this; o.x = -x; o.y = -y; return o; }
|
||||||
FI XYval<T> operator-() { XYval<T> o = *this; o.x = -x; o.y = -y; return o; }
|
FI XYval<T> operator-() { XYval<T> o = *this; o.x = -x; o.y = -y; return o; }
|
||||||
|
|
||||||
@@ -434,10 +434,10 @@ struct XYval {
|
|||||||
FI XYval<T>& operator+=(const XYZEval<T> &rs) { x += rs.x; y += rs.y; return *this; }
|
FI XYval<T>& operator+=(const XYZEval<T> &rs) { x += rs.x; y += rs.y; return *this; }
|
||||||
FI XYval<T>& operator-=(const XYZEval<T> &rs) { x -= rs.x; y -= rs.y; return *this; }
|
FI XYval<T>& operator-=(const XYZEval<T> &rs) { x -= rs.x; y -= rs.y; return *this; }
|
||||||
FI XYval<T>& operator*=(const XYZEval<T> &rs) { x *= rs.x; y *= rs.y; return *this; }
|
FI XYval<T>& operator*=(const XYZEval<T> &rs) { x *= rs.x; y *= rs.y; return *this; }
|
||||||
FI XYval<T>& operator*=(const float &p) { x *= p; y *= p; return *this; }
|
FI XYval<T>& operator*=(const float &v) { x *= v; y *= v; return *this; }
|
||||||
FI XYval<T>& operator*=(const int &p) { x *= p; y *= p; return *this; }
|
FI XYval<T>& operator*=(const int &v) { x *= v; y *= v; return *this; }
|
||||||
FI XYval<T>& operator>>=(const int &p) { _RS(x); _RS(y); return *this; }
|
FI XYval<T>& operator>>=(const int &v) { _RS(x); _RS(y); return *this; }
|
||||||
FI XYval<T>& operator<<=(const int &p) { _LS(x); _LS(y); return *this; }
|
FI XYval<T>& operator<<=(const int &v) { _LS(x); _LS(y); return *this; }
|
||||||
|
|
||||||
// Exact comparisons. For floats a "NEAR" operation may be better.
|
// Exact comparisons. For floats a "NEAR" operation may be better.
|
||||||
FI bool operator==(const XYval<T> &rs) const { return x == rs.x && y == rs.y; }
|
FI bool operator==(const XYval<T> &rs) const { return x == rs.x && y == rs.y; }
|
||||||
@@ -505,9 +505,9 @@ struct XYZval {
|
|||||||
// If any element is true then it's true
|
// If any element is true then it's true
|
||||||
FI operator bool() { return NUM_AXIS_GANG(x, || y, || z, || i, || j, || k, || u, || v, || w); }
|
FI operator bool() { return NUM_AXIS_GANG(x, || y, || z, || i, || j, || k, || u, || v, || w); }
|
||||||
// Smallest element
|
// Smallest element
|
||||||
FI T small() const { return _MIN(NUM_AXIS_LIST(x, y, z, i, j, k, u, v, w)); }
|
FI T _min() const { return _MIN(NUM_AXIS_LIST(x, y, z, i, j, k, u, v, w)); }
|
||||||
// Largest element
|
// Largest element
|
||||||
FI T large() const { return _MAX(NUM_AXIS_LIST(x, y, z, i, j, k, u, v, w)); }
|
FI T _max() const { return _MAX(NUM_AXIS_LIST(x, y, z, i, j, k, u, v, w)); }
|
||||||
|
|
||||||
// Explicit copy and copies with conversion
|
// Explicit copy and copies with conversion
|
||||||
FI XYZval<T> copy() const { XYZval<T> o = *this; return o; }
|
FI XYZval<T> copy() const { XYZval<T> o = *this; return o; }
|
||||||
@@ -567,18 +567,18 @@ struct XYZval {
|
|||||||
FI XYZval<T> operator* (const XYZEval<T> &rs) { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x *= rs.x, ls.y *= rs.y, ls.z *= rs.z, ls.i *= rs.i, ls.j *= rs.j, ls.k *= rs.k, ls.u *= rs.u, ls.v *= rs.v, ls.w *= rs.w); return ls; }
|
FI XYZval<T> operator* (const XYZEval<T> &rs) { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x *= rs.x, ls.y *= rs.y, ls.z *= rs.z, ls.i *= rs.i, ls.j *= rs.j, ls.k *= rs.k, ls.u *= rs.u, ls.v *= rs.v, ls.w *= rs.w); return ls; }
|
||||||
FI XYZval<T> operator/ (const XYZEval<T> &rs) const { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x /= rs.x, ls.y /= rs.y, ls.z /= rs.z, ls.i /= rs.i, ls.j /= rs.j, ls.k /= rs.k, ls.u /= rs.u, ls.v /= rs.v, ls.w /= rs.w); return ls; }
|
FI XYZval<T> operator/ (const XYZEval<T> &rs) const { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x /= rs.x, ls.y /= rs.y, ls.z /= rs.z, ls.i /= rs.i, ls.j /= rs.j, ls.k /= rs.k, ls.u /= rs.u, ls.v /= rs.v, ls.w /= rs.w); return ls; }
|
||||||
FI XYZval<T> operator/ (const XYZEval<T> &rs) { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x /= rs.x, ls.y /= rs.y, ls.z /= rs.z, ls.i /= rs.i, ls.j /= rs.j, ls.k /= rs.k, ls.u /= rs.u, ls.v /= rs.v, ls.w /= rs.w); return ls; }
|
FI XYZval<T> operator/ (const XYZEval<T> &rs) { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x /= rs.x, ls.y /= rs.y, ls.z /= rs.z, ls.i /= rs.i, ls.j /= rs.j, ls.k /= rs.k, ls.u /= rs.u, ls.v /= rs.v, ls.w /= rs.w); return ls; }
|
||||||
FI XYZval<T> operator* (const float &p) const { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x *= p, ls.y *= p, ls.z *= p, ls.i *= p, ls.j *= p, ls.k *= p, ls.u *= p, ls.v *= p, ls.w *= p ); return ls; }
|
FI XYZval<T> operator* (const float &v) const { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x *= v, ls.y *= v, ls.z *= v, ls.i *= v, ls.j *= v, ls.k *= v, ls.u *= v, ls.v *= v, ls.w *= v ); return ls; }
|
||||||
FI XYZval<T> operator* (const float &p) { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x *= p, ls.y *= p, ls.z *= p, ls.i *= p, ls.j *= p, ls.k *= p, ls.u *= p, ls.v *= p, ls.w *= p ); return ls; }
|
FI XYZval<T> operator* (const float &v) { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x *= v, ls.y *= v, ls.z *= v, ls.i *= v, ls.j *= v, ls.k *= v, ls.u *= v, ls.v *= v, ls.w *= v ); return ls; }
|
||||||
FI XYZval<T> operator* (const int &p) const { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x *= p, ls.y *= p, ls.z *= p, ls.i *= p, ls.j *= p, ls.k *= p, ls.u *= p, ls.v *= p, ls.w *= p ); return ls; }
|
FI XYZval<T> operator* (const int &v) const { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x *= v, ls.y *= v, ls.z *= v, ls.i *= v, ls.j *= v, ls.k *= v, ls.u *= v, ls.v *= v, ls.w *= v ); return ls; }
|
||||||
FI XYZval<T> operator* (const int &p) { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x *= p, ls.y *= p, ls.z *= p, ls.i *= p, ls.j *= p, ls.k *= p, ls.u *= p, ls.v *= p, ls.w *= p ); return ls; }
|
FI XYZval<T> operator* (const int &v) { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x *= v, ls.y *= v, ls.z *= v, ls.i *= v, ls.j *= v, ls.k *= v, ls.u *= v, ls.v *= v, ls.w *= v ); return ls; }
|
||||||
FI XYZval<T> operator/ (const float &p) const { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x /= p, ls.y /= p, ls.z /= p, ls.i /= p, ls.j /= p, ls.k /= p, ls.u /= p, ls.v /= p, ls.w /= p ); return ls; }
|
FI XYZval<T> operator/ (const float &v) const { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x /= v, ls.y /= v, ls.z /= v, ls.i /= v, ls.j /= v, ls.k /= v, ls.u /= v, ls.v /= v, ls.w /= v ); return ls; }
|
||||||
FI XYZval<T> operator/ (const float &p) { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x /= p, ls.y /= p, ls.z /= p, ls.i /= p, ls.j /= p, ls.k /= p, ls.u /= p, ls.v /= p, ls.w /= p ); return ls; }
|
FI XYZval<T> operator/ (const float &v) { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x /= v, ls.y /= v, ls.z /= v, ls.i /= v, ls.j /= v, ls.k /= v, ls.u /= v, ls.v /= v, ls.w /= v ); return ls; }
|
||||||
FI XYZval<T> operator/ (const int &p) const { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x /= p, ls.y /= p, ls.z /= p, ls.i /= p, ls.j /= p, ls.k /= p, ls.u /= p, ls.v /= p, ls.w /= p ); return ls; }
|
FI XYZval<T> operator/ (const int &v) const { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x /= v, ls.y /= v, ls.z /= v, ls.i /= v, ls.j /= v, ls.k /= v, ls.u /= v, ls.v /= v, ls.w /= v ); return ls; }
|
||||||
FI XYZval<T> operator/ (const int &p) { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x /= p, ls.y /= p, ls.z /= p, ls.i /= p, ls.j /= p, ls.k /= p, ls.u /= p, ls.v /= p, ls.w /= p ); return ls; }
|
FI XYZval<T> operator/ (const int &v) { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x /= v, ls.y /= v, ls.z /= v, ls.i /= v, ls.j /= v, ls.k /= v, ls.u /= v, ls.v /= v, ls.w /= v ); return ls; }
|
||||||
FI XYZval<T> operator>>(const int &p) const { XYZval<T> ls = *this; NUM_AXIS_CODE(_RS(ls.x), _RS(ls.y), _RS(ls.z), _RS(ls.i), _RS(ls.j), _RS(ls.k), _RS(ls.u), _RS(ls.v), _RS(ls.w) ); return ls; }
|
FI XYZval<T> operator>>(const int &v) const { XYZval<T> ls = *this; NUM_AXIS_CODE(_RS(ls.x), _RS(ls.y), _RS(ls.z), _RS(ls.i), _RS(ls.j), _RS(ls.k), _RS(ls.u), _RS(ls.v), _RS(ls.w) ); return ls; }
|
||||||
FI XYZval<T> operator>>(const int &p) { XYZval<T> ls = *this; NUM_AXIS_CODE(_RS(ls.x), _RS(ls.y), _RS(ls.z), _RS(ls.i), _RS(ls.j), _RS(ls.k), _RS(ls.u), _RS(ls.v), _RS(ls.w) ); return ls; }
|
FI XYZval<T> operator>>(const int &v) { XYZval<T> ls = *this; NUM_AXIS_CODE(_RS(ls.x), _RS(ls.y), _RS(ls.z), _RS(ls.i), _RS(ls.j), _RS(ls.k), _RS(ls.u), _RS(ls.v), _RS(ls.w) ); return ls; }
|
||||||
FI XYZval<T> operator<<(const int &p) const { XYZval<T> ls = *this; NUM_AXIS_CODE(_LS(ls.x), _LS(ls.y), _LS(ls.z), _LS(ls.i), _LS(ls.j), _LS(ls.k), _LS(ls.u), _LS(ls.v), _LS(ls.w) ); return ls; }
|
FI XYZval<T> operator<<(const int &v) const { XYZval<T> ls = *this; NUM_AXIS_CODE(_LS(ls.x), _LS(ls.y), _LS(ls.z), _LS(ls.i), _LS(ls.j), _LS(ls.k), _LS(ls.u), _LS(ls.v), _LS(ls.w) ); return ls; }
|
||||||
FI XYZval<T> operator<<(const int &p) { XYZval<T> ls = *this; NUM_AXIS_CODE(_LS(ls.x), _LS(ls.y), _LS(ls.z), _LS(ls.i), _LS(ls.j), _LS(ls.k), _LS(ls.u), _LS(ls.v), _LS(ls.w) ); return ls; }
|
FI XYZval<T> operator<<(const int &v) { XYZval<T> ls = *this; NUM_AXIS_CODE(_LS(ls.x), _LS(ls.y), _LS(ls.z), _LS(ls.i), _LS(ls.j), _LS(ls.k), _LS(ls.u), _LS(ls.v), _LS(ls.w) ); return ls; }
|
||||||
FI const XYZval<T> operator-() const { XYZval<T> o = *this; NUM_AXIS_CODE(o.x = -x, o.y = -y, o.z = -z, o.i = -i, o.j = -j, o.k = -k, o.u = -u, o.v = -v, o.w = -w); return o; }
|
FI const XYZval<T> operator-() const { XYZval<T> o = *this; NUM_AXIS_CODE(o.x = -x, o.y = -y, o.z = -z, o.i = -i, o.j = -j, o.k = -k, o.u = -u, o.v = -v, o.w = -w); return o; }
|
||||||
FI XYZval<T> operator-() { XYZval<T> o = *this; NUM_AXIS_CODE(o.x = -x, o.y = -y, o.z = -z, o.i = -i, o.j = -j, o.k = -k, o.u = -u, o.v = -v, o.w = -w); return o; }
|
FI XYZval<T> operator-() { XYZval<T> o = *this; NUM_AXIS_CODE(o.x = -x, o.y = -y, o.z = -z, o.i = -i, o.j = -j, o.k = -k, o.u = -u, o.v = -v, o.w = -w); return o; }
|
||||||
|
|
||||||
@@ -595,10 +595,10 @@ struct XYZval {
|
|||||||
FI XYZval<T>& operator-=(const XYZEval<T> &rs) { NUM_AXIS_CODE(x -= rs.x, y -= rs.y, z -= rs.z, i -= rs.i, j -= rs.j, k -= rs.k, u -= rs.u, v -= rs.v, w -= rs.w); return *this; }
|
FI XYZval<T>& operator-=(const XYZEval<T> &rs) { NUM_AXIS_CODE(x -= rs.x, y -= rs.y, z -= rs.z, i -= rs.i, j -= rs.j, k -= rs.k, u -= rs.u, v -= rs.v, w -= rs.w); return *this; }
|
||||||
FI XYZval<T>& operator*=(const XYZEval<T> &rs) { NUM_AXIS_CODE(x *= rs.x, y *= rs.y, z *= rs.z, i *= rs.i, j *= rs.j, k *= rs.k, u *= rs.u, v *= rs.v, w *= rs.w); return *this; }
|
FI XYZval<T>& operator*=(const XYZEval<T> &rs) { NUM_AXIS_CODE(x *= rs.x, y *= rs.y, z *= rs.z, i *= rs.i, j *= rs.j, k *= rs.k, u *= rs.u, v *= rs.v, w *= rs.w); return *this; }
|
||||||
FI XYZval<T>& operator/=(const XYZEval<T> &rs) { NUM_AXIS_CODE(x /= rs.x, y /= rs.y, z /= rs.z, i /= rs.i, j /= rs.j, k /= rs.k, u /= rs.u, v /= rs.v, w /= rs.w); return *this; }
|
FI XYZval<T>& operator/=(const XYZEval<T> &rs) { NUM_AXIS_CODE(x /= rs.x, y /= rs.y, z /= rs.z, i /= rs.i, j /= rs.j, k /= rs.k, u /= rs.u, v /= rs.v, w /= rs.w); return *this; }
|
||||||
FI XYZval<T>& operator*=(const float &p) { NUM_AXIS_CODE(x *= p, y *= p, z *= p, i *= p, j *= p, k *= p, u *= p, v *= p, w *= p); return *this; }
|
FI XYZval<T>& operator*=(const float &v) { NUM_AXIS_CODE(x *= v, y *= v, z *= v, i *= v, j *= v, k *= v, u *= v, v *= v, w *= v); return *this; }
|
||||||
FI XYZval<T>& operator*=(const int &p) { NUM_AXIS_CODE(x *= p, y *= p, z *= p, i *= p, j *= p, k *= p, u *= p, v *= p, w *= p); return *this; }
|
FI XYZval<T>& operator*=(const int &v) { NUM_AXIS_CODE(x *= v, y *= v, z *= v, i *= v, j *= v, k *= v, u *= v, v *= v, w *= v); return *this; }
|
||||||
FI XYZval<T>& operator>>=(const int &p) { NUM_AXIS_CODE(_RS(x), _RS(y), _RS(z), _RS(i), _RS(j), _RS(k), _RS(u), _RS(v), _RS(w)); return *this; }
|
FI XYZval<T>& operator>>=(const int &v) { NUM_AXIS_CODE(_RS(x), _RS(y), _RS(z), _RS(i), _RS(j), _RS(k), _RS(u), _RS(v), _RS(w)); return *this; }
|
||||||
FI XYZval<T>& operator<<=(const int &p) { NUM_AXIS_CODE(_LS(x), _LS(y), _LS(z), _LS(i), _LS(j), _LS(k), _LS(u), _LS(v), _LS(w)); return *this; }
|
FI XYZval<T>& operator<<=(const int &v) { NUM_AXIS_CODE(_LS(x), _LS(y), _LS(z), _LS(i), _LS(j), _LS(k), _LS(u), _LS(v), _LS(w)); return *this; }
|
||||||
|
|
||||||
// Exact comparisons. For floats a "NEAR" operation may be better.
|
// Exact comparisons. For floats a "NEAR" operation may be better.
|
||||||
FI bool operator==(const XYZEval<T> &rs) const { return true NUM_AXIS_GANG(&& x == rs.x, && y == rs.y, && z == rs.z, && i == rs.i, && j == rs.j, && k == rs.k, && u == rs.u, && v == rs.v, && w == rs.w); }
|
FI bool operator==(const XYZEval<T> &rs) const { return true NUM_AXIS_GANG(&& x == rs.x, && y == rs.y, && z == rs.z, && i == rs.i, && j == rs.j, && k == rs.k, && u == rs.u, && v == rs.v, && w == rs.w); }
|
||||||
@@ -654,15 +654,15 @@ struct XYZEval {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Length reduced to one dimension
|
// Length reduced to one dimension
|
||||||
FI T magnitude() const { return (T)sqrtf(LOGICAL_AXIS_GANG(+ e*e, + x*x, + y*y, + z*z, + i*i, + j*j, + k*k, + u*u, + v*v, + w*w)); }
|
FI T magnitude() const { return (T)sqrtf(LOGICAL_AXIS_GANG(+ e*e, + x*x, + y*y, + z*z, + i*i, + j*j, + k*k, + u*u, + v*v, + w*w)); }
|
||||||
// Pointer to the data as a simple array
|
// Pointer to the data as a simple array
|
||||||
FI operator T* () { return pos; }
|
FI operator T* () { return pos; }
|
||||||
// If any element is true then it's true
|
// If any element is true then it's true
|
||||||
FI operator bool() { return 0 LOGICAL_AXIS_GANG(|| e, || x, || y, || z, || i, || j, || k, || u, || v, || w); }
|
FI operator bool() { return 0 LOGICAL_AXIS_GANG(|| e, || x, || y, || z, || i, || j, || k, || u, || v, || w); }
|
||||||
// Smallest element
|
// Smallest element
|
||||||
FI T small() const { return _MIN(LOGICAL_AXIS_LIST(e, x, y, z, i, j, k, u, v, w)); }
|
FI T _min() const { return _MIN(LOGICAL_AXIS_LIST(e, x, y, z, i, j, k, u, v, w)); }
|
||||||
// Largest element
|
// Largest element
|
||||||
FI T large() const { return _MAX(LOGICAL_AXIS_LIST(e, x, y, z, i, j, k, u, v, w)); }
|
FI T _max() const { return _MAX(LOGICAL_AXIS_LIST(e, x, y, z, i, j, k, u, v, w)); }
|
||||||
|
|
||||||
// Explicit copy and copies with conversion
|
// Explicit copy and copies with conversion
|
||||||
FI XYZEval<T> copy() const { XYZEval<T> v = *this; return v; }
|
FI XYZEval<T> copy() const { XYZEval<T> v = *this; return v; }
|
||||||
@@ -688,76 +688,76 @@ struct XYZEval {
|
|||||||
FI operator const XYZval<T>&() const { return *(const XYZval<T>*)this; }
|
FI operator const XYZval<T>&() const { return *(const XYZval<T>*)this; }
|
||||||
|
|
||||||
// Accessor via an AxisEnum (or any integer) [index]
|
// Accessor via an AxisEnum (or any integer) [index]
|
||||||
FI T& operator[](const int n) { return pos[n]; }
|
FI T& operator[](const int n) { return pos[n]; }
|
||||||
FI const T& operator[](const int n) const { return pos[n]; }
|
FI const T& operator[](const int n) const { return pos[n]; }
|
||||||
|
|
||||||
// Assignment operator overrides do the expected thing
|
// Assignment operator overrides do the expected thing
|
||||||
FI XYZEval<T>& operator= (const T v) { set(LOGICAL_AXIS_LIST_1(v)); return *this; }
|
FI XYZEval<T>& operator= (const T v) { set(LOGICAL_AXIS_LIST_1(v)); return *this; }
|
||||||
FI XYZEval<T>& operator= (const XYval<T> &rs) { set(rs.x, rs.y); return *this; }
|
FI XYZEval<T>& operator= (const XYval<T> &rs) { set(rs.x, rs.y); return *this; }
|
||||||
FI XYZEval<T>& operator= (const XYZval<T> &rs) { set(NUM_AXIS_ELEM(rs)); return *this; }
|
FI XYZEval<T>& operator= (const XYZval<T> &rs) { set(NUM_AXIS_ELEM(rs)); return *this; }
|
||||||
|
|
||||||
// Override other operators to get intuitive behaviors
|
// Override other operators to get intuitive behaviors
|
||||||
FI XYZEval<T> operator+ (const XYval<T> &rs) const { XYZEval<T> ls = *this; ls.x += rs.x; ls.y += rs.y; return ls; }
|
FI XYZEval<T> operator+ (const XYval<T> &rs) const { XYZEval<T> ls = *this; ls.x += rs.x; ls.y += rs.y; return ls; }
|
||||||
FI XYZEval<T> operator+ (const XYval<T> &rs) { XYZEval<T> ls = *this; ls.x += rs.x; ls.y += rs.y; return ls; }
|
FI XYZEval<T> operator+ (const XYval<T> &rs) { XYZEval<T> ls = *this; ls.x += rs.x; ls.y += rs.y; return ls; }
|
||||||
FI XYZEval<T> operator- (const XYval<T> &rs) const { XYZEval<T> ls = *this; ls.x -= rs.x; ls.y -= rs.y; return ls; }
|
FI XYZEval<T> operator- (const XYval<T> &rs) const { XYZEval<T> ls = *this; ls.x -= rs.x; ls.y -= rs.y; return ls; }
|
||||||
FI XYZEval<T> operator- (const XYval<T> &rs) { XYZEval<T> ls = *this; ls.x -= rs.x; ls.y -= rs.y; return ls; }
|
FI XYZEval<T> operator- (const XYval<T> &rs) { XYZEval<T> ls = *this; ls.x -= rs.x; ls.y -= rs.y; return ls; }
|
||||||
FI XYZEval<T> operator* (const XYval<T> &rs) const { XYZEval<T> ls = *this; ls.x *= rs.x; ls.y *= rs.y; return ls; }
|
FI XYZEval<T> operator* (const XYval<T> &rs) const { XYZEval<T> ls = *this; ls.x *= rs.x; ls.y *= rs.y; return ls; }
|
||||||
FI XYZEval<T> operator* (const XYval<T> &rs) { XYZEval<T> ls = *this; ls.x *= rs.x; ls.y *= rs.y; return ls; }
|
FI XYZEval<T> operator* (const XYval<T> &rs) { XYZEval<T> ls = *this; ls.x *= rs.x; ls.y *= rs.y; return ls; }
|
||||||
FI XYZEval<T> operator/ (const XYval<T> &rs) const { XYZEval<T> ls = *this; ls.x /= rs.x; ls.y /= rs.y; return ls; }
|
FI XYZEval<T> operator/ (const XYval<T> &rs) const { XYZEval<T> ls = *this; ls.x /= rs.x; ls.y /= rs.y; return ls; }
|
||||||
FI XYZEval<T> operator/ (const XYval<T> &rs) { XYZEval<T> ls = *this; ls.x /= rs.x; ls.y /= rs.y; return ls; }
|
FI XYZEval<T> operator/ (const XYval<T> &rs) { XYZEval<T> ls = *this; ls.x /= rs.x; ls.y /= rs.y; return ls; }
|
||||||
FI XYZEval<T> operator+ (const XYZval<T> &rs) const { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x += rs.x, ls.y += rs.y, ls.z += rs.z, ls.i += rs.i, ls.j += rs.j, ls.k += rs.k, ls.u += rs.u, ls.v += rs.v, ls.w += rs.w); return ls; }
|
FI XYZEval<T> operator+ (const XYZval<T> &rs) const { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x += rs.x, ls.y += rs.y, ls.z += rs.z, ls.i += rs.i, ls.j += rs.j, ls.k += rs.k, ls.u += rs.u, ls.v += rs.v, ls.w += rs.w); return ls; }
|
||||||
FI XYZEval<T> operator+ (const XYZval<T> &rs) { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x += rs.x, ls.y += rs.y, ls.z += rs.z, ls.i += rs.i, ls.j += rs.j, ls.k += rs.k, ls.u += rs.u, ls.v += rs.v, ls.w += rs.w); return ls; }
|
FI XYZEval<T> operator+ (const XYZval<T> &rs) { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x += rs.x, ls.y += rs.y, ls.z += rs.z, ls.i += rs.i, ls.j += rs.j, ls.k += rs.k, ls.u += rs.u, ls.v += rs.v, ls.w += rs.w); return ls; }
|
||||||
FI XYZEval<T> operator- (const XYZval<T> &rs) const { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x -= rs.x, ls.y -= rs.y, ls.z -= rs.z, ls.i -= rs.i, ls.j -= rs.j, ls.k -= rs.k, ls.u -= rs.u, ls.v -= rs.v, ls.w -= rs.w); return ls; }
|
FI XYZEval<T> operator- (const XYZval<T> &rs) const { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x -= rs.x, ls.y -= rs.y, ls.z -= rs.z, ls.i -= rs.i, ls.j -= rs.j, ls.k -= rs.k, ls.u -= rs.u, ls.v -= rs.v, ls.w -= rs.w); return ls; }
|
||||||
FI XYZEval<T> operator- (const XYZval<T> &rs) { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x -= rs.x, ls.y -= rs.y, ls.z -= rs.z, ls.i -= rs.i, ls.j -= rs.j, ls.k -= rs.k, ls.u -= rs.u, ls.v -= rs.v, ls.w -= rs.w); return ls; }
|
FI XYZEval<T> operator- (const XYZval<T> &rs) { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x -= rs.x, ls.y -= rs.y, ls.z -= rs.z, ls.i -= rs.i, ls.j -= rs.j, ls.k -= rs.k, ls.u -= rs.u, ls.v -= rs.v, ls.w -= rs.w); return ls; }
|
||||||
FI XYZEval<T> operator* (const XYZval<T> &rs) const { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x *= rs.x, ls.y *= rs.y, ls.z *= rs.z, ls.i *= rs.i, ls.j *= rs.j, ls.k *= rs.k, ls.u *= rs.u, ls.v *= rs.v, ls.w *= rs.w); return ls; }
|
FI XYZEval<T> operator* (const XYZval<T> &rs) const { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x *= rs.x, ls.y *= rs.y, ls.z *= rs.z, ls.i *= rs.i, ls.j *= rs.j, ls.k *= rs.k, ls.u *= rs.u, ls.v *= rs.v, ls.w *= rs.w); return ls; }
|
||||||
FI XYZEval<T> operator* (const XYZval<T> &rs) { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x *= rs.x, ls.y *= rs.y, ls.z *= rs.z, ls.i *= rs.i, ls.j *= rs.j, ls.k *= rs.k, ls.u *= rs.u, ls.v *= rs.v, ls.w *= rs.w); return ls; }
|
FI XYZEval<T> operator* (const XYZval<T> &rs) { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x *= rs.x, ls.y *= rs.y, ls.z *= rs.z, ls.i *= rs.i, ls.j *= rs.j, ls.k *= rs.k, ls.u *= rs.u, ls.v *= rs.v, ls.w *= rs.w); return ls; }
|
||||||
FI XYZEval<T> operator/ (const XYZval<T> &rs) const { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x /= rs.x, ls.y /= rs.y, ls.z /= rs.z, ls.i /= rs.i, ls.j /= rs.j, ls.k /= rs.k, ls.u /= rs.u, ls.v /= rs.v, ls.w /= rs.w); return ls; }
|
FI XYZEval<T> operator/ (const XYZval<T> &rs) const { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x /= rs.x, ls.y /= rs.y, ls.z /= rs.z, ls.i /= rs.i, ls.j /= rs.j, ls.k /= rs.k, ls.u /= rs.u, ls.v /= rs.v, ls.w /= rs.w); return ls; }
|
||||||
FI XYZEval<T> operator/ (const XYZval<T> &rs) { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x /= rs.x, ls.y /= rs.y, ls.z /= rs.z, ls.i /= rs.i, ls.j /= rs.j, ls.k /= rs.k, ls.u /= rs.u, ls.v /= rs.v, ls.w /= rs.w); return ls; }
|
FI XYZEval<T> operator/ (const XYZval<T> &rs) { XYZval<T> ls = *this; NUM_AXIS_CODE(ls.x /= rs.x, ls.y /= rs.y, ls.z /= rs.z, ls.i /= rs.i, ls.j /= rs.j, ls.k /= rs.k, ls.u /= rs.u, ls.v /= rs.v, ls.w /= rs.w); return ls; }
|
||||||
FI XYZEval<T> operator+ (const XYZEval<T> &rs) const { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(ls.e += rs.e, ls.x += rs.x, ls.y += rs.y, ls.z += rs.z, ls.i += rs.i, ls.j += rs.j, ls.k += rs.k, ls.u += rs.u, ls.v += rs.v, ls.w += rs.w); return ls; }
|
FI XYZEval<T> operator+ (const XYZEval<T> &rs) const { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(ls.e += rs.e, ls.x += rs.x, ls.y += rs.y, ls.z += rs.z, ls.i += rs.i, ls.j += rs.j, ls.k += rs.k, ls.u += rs.u, ls.v += rs.v, ls.w += rs.w); return ls; }
|
||||||
FI XYZEval<T> operator+ (const XYZEval<T> &rs) { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(ls.e += rs.e, ls.x += rs.x, ls.y += rs.y, ls.z += rs.z, ls.i += rs.i, ls.j += rs.j, ls.k += rs.k, ls.u += rs.u, ls.v += rs.v, ls.w += rs.w); return ls; }
|
FI XYZEval<T> operator+ (const XYZEval<T> &rs) { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(ls.e += rs.e, ls.x += rs.x, ls.y += rs.y, ls.z += rs.z, ls.i += rs.i, ls.j += rs.j, ls.k += rs.k, ls.u += rs.u, ls.v += rs.v, ls.w += rs.w); return ls; }
|
||||||
FI XYZEval<T> operator- (const XYZEval<T> &rs) const { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(ls.e -= rs.e, ls.x -= rs.x, ls.y -= rs.y, ls.z -= rs.z, ls.i -= rs.i, ls.j -= rs.j, ls.k -= rs.k, ls.u -= rs.u, ls.v -= rs.v, ls.w -= rs.w); return ls; }
|
FI XYZEval<T> operator- (const XYZEval<T> &rs) const { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(ls.e -= rs.e, ls.x -= rs.x, ls.y -= rs.y, ls.z -= rs.z, ls.i -= rs.i, ls.j -= rs.j, ls.k -= rs.k, ls.u -= rs.u, ls.v -= rs.v, ls.w -= rs.w); return ls; }
|
||||||
FI XYZEval<T> operator- (const XYZEval<T> &rs) { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(ls.e -= rs.e, ls.x -= rs.x, ls.y -= rs.y, ls.z -= rs.z, ls.i -= rs.i, ls.j -= rs.j, ls.k -= rs.k, ls.u -= rs.u, ls.v -= rs.v, ls.w -= rs.w); return ls; }
|
FI XYZEval<T> operator- (const XYZEval<T> &rs) { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(ls.e -= rs.e, ls.x -= rs.x, ls.y -= rs.y, ls.z -= rs.z, ls.i -= rs.i, ls.j -= rs.j, ls.k -= rs.k, ls.u -= rs.u, ls.v -= rs.v, ls.w -= rs.w); return ls; }
|
||||||
FI XYZEval<T> operator* (const XYZEval<T> &rs) const { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(ls.e *= rs.e, ls.x *= rs.x, ls.y *= rs.y, ls.z *= rs.z, ls.i *= rs.i, ls.j *= rs.j, ls.k *= rs.k, ls.u *= rs.u, ls.v *= rs.v, ls.w *= rs.w); return ls; }
|
FI XYZEval<T> operator* (const XYZEval<T> &rs) const { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(ls.e *= rs.e, ls.x *= rs.x, ls.y *= rs.y, ls.z *= rs.z, ls.i *= rs.i, ls.j *= rs.j, ls.k *= rs.k, ls.u *= rs.u, ls.v *= rs.v, ls.w *= rs.w); return ls; }
|
||||||
FI XYZEval<T> operator* (const XYZEval<T> &rs) { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(ls.e *= rs.e, ls.x *= rs.x, ls.y *= rs.y, ls.z *= rs.z, ls.i *= rs.i, ls.j *= rs.j, ls.k *= rs.k, ls.u *= rs.u, ls.v *= rs.v, ls.w *= rs.w); return ls; }
|
FI XYZEval<T> operator* (const XYZEval<T> &rs) { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(ls.e *= rs.e, ls.x *= rs.x, ls.y *= rs.y, ls.z *= rs.z, ls.i *= rs.i, ls.j *= rs.j, ls.k *= rs.k, ls.u *= rs.u, ls.v *= rs.v, ls.w *= rs.w); return ls; }
|
||||||
FI XYZEval<T> operator/ (const XYZEval<T> &rs) const { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(ls.e /= rs.e, ls.x /= rs.x, ls.y /= rs.y, ls.z /= rs.z, ls.i /= rs.i, ls.j /= rs.j, ls.k /= rs.k, ls.u /= rs.u, ls.v /= rs.v, ls.w /= rs.w); return ls; }
|
FI XYZEval<T> operator/ (const XYZEval<T> &rs) const { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(ls.e /= rs.e, ls.x /= rs.x, ls.y /= rs.y, ls.z /= rs.z, ls.i /= rs.i, ls.j /= rs.j, ls.k /= rs.k, ls.u /= rs.u, ls.v /= rs.v, ls.w /= rs.w); return ls; }
|
||||||
FI XYZEval<T> operator/ (const XYZEval<T> &rs) { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(ls.e /= rs.e, ls.x /= rs.x, ls.y /= rs.y, ls.z /= rs.z, ls.i /= rs.i, ls.j /= rs.j, ls.k /= rs.k, ls.u /= rs.u, ls.v /= rs.v, ls.w /= rs.w); return ls; }
|
FI XYZEval<T> operator/ (const XYZEval<T> &rs) { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(ls.e /= rs.e, ls.x /= rs.x, ls.y /= rs.y, ls.z /= rs.z, ls.i /= rs.i, ls.j /= rs.j, ls.k /= rs.k, ls.u /= rs.u, ls.v /= rs.v, ls.w /= rs.w); return ls; }
|
||||||
FI XYZEval<T> operator* (const float &p) const { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(ls.e *= p, ls.x *= p, ls.y *= p, ls.z *= p, ls.i *= p, ls.j *= p, ls.k *= p, ls.u *= p, ls.v *= p, ls.w *= p ); return ls; }
|
FI XYZEval<T> operator* (const float &v) const { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(ls.e *= v, ls.x *= v, ls.y *= v, ls.z *= v, ls.i *= v, ls.j *= v, ls.k *= v, ls.u *= v, ls.v *= v, ls.w *= v ); return ls; }
|
||||||
FI XYZEval<T> operator* (const float &p) { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(ls.e *= p, ls.x *= p, ls.y *= p, ls.z *= p, ls.i *= p, ls.j *= p, ls.k *= p, ls.u *= p, ls.v *= p, ls.w *= p ); return ls; }
|
FI XYZEval<T> operator* (const float &v) { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(ls.e *= v, ls.x *= v, ls.y *= v, ls.z *= v, ls.i *= v, ls.j *= v, ls.k *= v, ls.u *= v, ls.v *= v, ls.w *= v ); return ls; }
|
||||||
FI XYZEval<T> operator* (const int &p) const { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(ls.e *= p, ls.x *= p, ls.y *= p, ls.z *= p, ls.i *= p, ls.j *= p, ls.k *= p, ls.u *= p, ls.v *= p, ls.w *= p ); return ls; }
|
FI XYZEval<T> operator* (const int &v) const { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(ls.e *= v, ls.x *= v, ls.y *= v, ls.z *= v, ls.i *= v, ls.j *= v, ls.k *= v, ls.u *= v, ls.v *= v, ls.w *= v ); return ls; }
|
||||||
FI XYZEval<T> operator* (const int &p) { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(ls.e *= p, ls.x *= p, ls.y *= p, ls.z *= p, ls.i *= p, ls.j *= p, ls.k *= p, ls.u *= p, ls.v *= p, ls.w *= p ); return ls; }
|
FI XYZEval<T> operator* (const int &v) { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(ls.e *= v, ls.x *= v, ls.y *= v, ls.z *= v, ls.i *= v, ls.j *= v, ls.k *= v, ls.u *= v, ls.v *= v, ls.w *= v ); return ls; }
|
||||||
FI XYZEval<T> operator/ (const float &p) const { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(ls.e /= p, ls.x /= p, ls.y /= p, ls.z /= p, ls.i /= p, ls.j /= p, ls.k /= p, ls.u /= p, ls.v /= p, ls.w /= p ); return ls; }
|
FI XYZEval<T> operator/ (const float &v) const { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(ls.e /= v, ls.x /= v, ls.y /= v, ls.z /= v, ls.i /= v, ls.j /= v, ls.k /= v, ls.u /= v, ls.v /= v, ls.w /= v ); return ls; }
|
||||||
FI XYZEval<T> operator/ (const float &p) { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(ls.e /= p, ls.x /= p, ls.y /= p, ls.z /= p, ls.i /= p, ls.j /= p, ls.k /= p, ls.u /= p, ls.v /= p, ls.w /= p ); return ls; }
|
FI XYZEval<T> operator/ (const float &v) { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(ls.e /= v, ls.x /= v, ls.y /= v, ls.z /= v, ls.i /= v, ls.j /= v, ls.k /= v, ls.u /= v, ls.v /= v, ls.w /= v ); return ls; }
|
||||||
FI XYZEval<T> operator/ (const int &p) const { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(ls.e /= p, ls.x /= p, ls.y /= p, ls.z /= p, ls.i /= p, ls.j /= p, ls.k /= p, ls.u /= p, ls.v /= p, ls.w /= p ); return ls; }
|
FI XYZEval<T> operator/ (const int &v) const { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(ls.e /= v, ls.x /= v, ls.y /= v, ls.z /= v, ls.i /= v, ls.j /= v, ls.k /= v, ls.u /= v, ls.v /= v, ls.w /= v ); return ls; }
|
||||||
FI XYZEval<T> operator/ (const int &p) { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(ls.e /= p, ls.x /= p, ls.y /= p, ls.z /= p, ls.i /= p, ls.j /= p, ls.k /= p, ls.u /= p, ls.v /= p, ls.w /= p ); return ls; }
|
FI XYZEval<T> operator/ (const int &v) { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(ls.e /= v, ls.x /= v, ls.y /= v, ls.z /= v, ls.i /= v, ls.j /= v, ls.k /= v, ls.u /= v, ls.v /= v, ls.w /= v ); return ls; }
|
||||||
FI XYZEval<T> operator>>(const int &p) const { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(_RS(ls.e), _RS(ls.x), _RS(ls.y), _RS(ls.z), _RS(ls.i), _RS(ls.j), _RS(ls.k), _RS(ls.u), _RS(ls.v), _RS(ls.w) ); return ls; }
|
FI XYZEval<T> operator>>(const int &v) const { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(_RS(ls.e), _RS(ls.x), _RS(ls.y), _RS(ls.z), _RS(ls.i), _RS(ls.j), _RS(ls.k), _RS(ls.u), _RS(ls.v), _RS(ls.w) ); return ls; }
|
||||||
FI XYZEval<T> operator>>(const int &p) { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(_RS(ls.e), _RS(ls.x), _RS(ls.y), _RS(ls.z), _RS(ls.i), _RS(ls.j), _RS(ls.k), _RS(ls.u), _RS(ls.v), _RS(ls.w) ); return ls; }
|
FI XYZEval<T> operator>>(const int &v) { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(_RS(ls.e), _RS(ls.x), _RS(ls.y), _RS(ls.z), _RS(ls.i), _RS(ls.j), _RS(ls.k), _RS(ls.u), _RS(ls.v), _RS(ls.w) ); return ls; }
|
||||||
FI XYZEval<T> operator<<(const int &p) const { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(_LS(ls.e), _LS(ls.x), _LS(ls.y), _LS(ls.z), _LS(ls.i), _LS(ls.j), _LS(ls.k), _LS(ls.u), _LS(ls.v), _LS(ls.w) ); return ls; }
|
FI XYZEval<T> operator<<(const int &v) const { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(_LS(ls.e), _LS(ls.x), _LS(ls.y), _LS(ls.z), _LS(ls.i), _LS(ls.j), _LS(ls.k), _LS(ls.u), _LS(ls.v), _LS(ls.w) ); return ls; }
|
||||||
FI XYZEval<T> operator<<(const int &p) { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(_LS(ls.e), _LS(ls.x), _LS(ls.y), _LS(ls.z), _LS(ls.i), _LS(ls.j), _LS(ls.k), _LS(ls.u), _LS(ls.v), _LS(ls.w) ); return ls; }
|
FI XYZEval<T> operator<<(const int &v) { XYZEval<T> ls = *this; LOGICAL_AXIS_CODE(_LS(ls.e), _LS(ls.x), _LS(ls.y), _LS(ls.z), _LS(ls.i), _LS(ls.j), _LS(ls.k), _LS(ls.u), _LS(ls.v), _LS(ls.w) ); return ls; }
|
||||||
FI const XYZEval<T> operator-() const { return LOGICAL_AXIS_ARRAY(-e, -x, -y, -z, -i, -j, -k, -u, -v, -w); }
|
FI const XYZEval<T> operator-() const { return LOGICAL_AXIS_ARRAY(-e, -x, -y, -z, -i, -j, -k, -u, -v, -w); }
|
||||||
FI XYZEval<T> operator-() { return LOGICAL_AXIS_ARRAY(-e, -x, -y, -z, -i, -j, -k, -u, -v, -w); }
|
FI XYZEval<T> operator-() { return LOGICAL_AXIS_ARRAY(-e, -x, -y, -z, -i, -j, -k, -u, -v, -w); }
|
||||||
|
|
||||||
// Modifier operators
|
// Modifier operators
|
||||||
FI XYZEval<T>& operator+=(const XYval<T> &rs) { x += rs.x; y += rs.y; return *this; }
|
FI XYZEval<T>& operator+=(const XYval<T> &rs) { x += rs.x; y += rs.y; return *this; }
|
||||||
FI XYZEval<T>& operator-=(const XYval<T> &rs) { x -= rs.x; y -= rs.y; return *this; }
|
FI XYZEval<T>& operator-=(const XYval<T> &rs) { x -= rs.x; y -= rs.y; return *this; }
|
||||||
FI XYZEval<T>& operator*=(const XYval<T> &rs) { x *= rs.x; y *= rs.y; return *this; }
|
FI XYZEval<T>& operator*=(const XYval<T> &rs) { x *= rs.x; y *= rs.y; return *this; }
|
||||||
FI XYZEval<T>& operator/=(const XYval<T> &rs) { x /= rs.x; y /= rs.y; return *this; }
|
FI XYZEval<T>& operator/=(const XYval<T> &rs) { x /= rs.x; y /= rs.y; return *this; }
|
||||||
FI XYZEval<T>& operator+=(const XYZval<T> &rs) { NUM_AXIS_CODE(x += rs.x, y += rs.y, z += rs.z, i += rs.i, j += rs.j, k += rs.k, u += rs.u, v += rs.v, w += rs.w); return *this; }
|
FI XYZEval<T>& operator+=(const XYZval<T> &rs) { NUM_AXIS_CODE(x += rs.x, y += rs.y, z += rs.z, i += rs.i, j += rs.j, k += rs.k, u += rs.u, v += rs.v, w += rs.w); return *this; }
|
||||||
FI XYZEval<T>& operator-=(const XYZval<T> &rs) { NUM_AXIS_CODE(x -= rs.x, y -= rs.y, z -= rs.z, i -= rs.i, j -= rs.j, k -= rs.k, u -= rs.u, v -= rs.v, w -= rs.w); return *this; }
|
FI XYZEval<T>& operator-=(const XYZval<T> &rs) { NUM_AXIS_CODE(x -= rs.x, y -= rs.y, z -= rs.z, i -= rs.i, j -= rs.j, k -= rs.k, u -= rs.u, v -= rs.v, w -= rs.w); return *this; }
|
||||||
FI XYZEval<T>& operator*=(const XYZval<T> &rs) { NUM_AXIS_CODE(x *= rs.x, y *= rs.y, z *= rs.z, i *= rs.i, j *= rs.j, k *= rs.k, u *= rs.u, v *= rs.v, w *= rs.w); return *this; }
|
FI XYZEval<T>& operator*=(const XYZval<T> &rs) { NUM_AXIS_CODE(x *= rs.x, y *= rs.y, z *= rs.z, i *= rs.i, j *= rs.j, k *= rs.k, u *= rs.u, v *= rs.v, w *= rs.w); return *this; }
|
||||||
FI XYZEval<T>& operator/=(const XYZval<T> &rs) { NUM_AXIS_CODE(x /= rs.x, y /= rs.y, z /= rs.z, i /= rs.i, j /= rs.j, k /= rs.k, u /= rs.u, v /= rs.v, w /= rs.w); return *this; }
|
FI XYZEval<T>& operator/=(const XYZval<T> &rs) { NUM_AXIS_CODE(x /= rs.x, y /= rs.y, z /= rs.z, i /= rs.i, j /= rs.j, k /= rs.k, u /= rs.u, v /= rs.v, w /= rs.w); return *this; }
|
||||||
FI XYZEval<T>& operator+=(const XYZEval<T> &rs) { LOGICAL_AXIS_CODE(e += rs.e, x += rs.x, y += rs.y, z += rs.z, i += rs.i, j += rs.j, k += rs.k, u += rs.u, v += rs.v, w += rs.w); return *this; }
|
FI XYZEval<T>& operator+=(const XYZEval<T> &rs) { LOGICAL_AXIS_CODE(e += rs.e, x += rs.x, y += rs.y, z += rs.z, i += rs.i, j += rs.j, k += rs.k, u += rs.u, v += rs.v, w += rs.w); return *this; }
|
||||||
FI XYZEval<T>& operator-=(const XYZEval<T> &rs) { LOGICAL_AXIS_CODE(e -= rs.e, x -= rs.x, y -= rs.y, z -= rs.z, i -= rs.i, j -= rs.j, k -= rs.k, u -= rs.u, v -= rs.v, w -= rs.w); return *this; }
|
FI XYZEval<T>& operator-=(const XYZEval<T> &rs) { LOGICAL_AXIS_CODE(e -= rs.e, x -= rs.x, y -= rs.y, z -= rs.z, i -= rs.i, j -= rs.j, k -= rs.k, u -= rs.u, v -= rs.v, w -= rs.w); return *this; }
|
||||||
FI XYZEval<T>& operator*=(const XYZEval<T> &rs) { LOGICAL_AXIS_CODE(e *= rs.e, x *= rs.x, y *= rs.y, z *= rs.z, i *= rs.i, j *= rs.j, k *= rs.k, u *= rs.u, v *= rs.v, w *= rs.w); return *this; }
|
FI XYZEval<T>& operator*=(const XYZEval<T> &rs) { LOGICAL_AXIS_CODE(e *= rs.e, x *= rs.x, y *= rs.y, z *= rs.z, i *= rs.i, j *= rs.j, k *= rs.k, u *= rs.u, v *= rs.v, w *= rs.w); return *this; }
|
||||||
FI XYZEval<T>& operator/=(const XYZEval<T> &rs) { LOGICAL_AXIS_CODE(e /= rs.e, x /= rs.x, y /= rs.y, z /= rs.z, i /= rs.i, j /= rs.j, k /= rs.k, u /= rs.u, v /= rs.v, w /= rs.w); return *this; }
|
FI XYZEval<T>& operator/=(const XYZEval<T> &rs) { LOGICAL_AXIS_CODE(e /= rs.e, x /= rs.x, y /= rs.y, z /= rs.z, i /= rs.i, j /= rs.j, k /= rs.k, u /= rs.u, v /= rs.v, w /= rs.w); return *this; }
|
||||||
FI XYZEval<T>& operator*=(const T &p) { LOGICAL_AXIS_CODE(e *= p, x *= p, y *= p, z *= p, i *= p, j *= p, k *= p, u *= p, v *= p, w *= p); return *this; }
|
FI XYZEval<T>& operator*=(const T &v) { LOGICAL_AXIS_CODE(e *= v, x *= v, y *= v, z *= v, i *= v, j *= v, k *= v, u *= v, v *= v, w *= v); return *this; }
|
||||||
FI XYZEval<T>& operator>>=(const int &p) { LOGICAL_AXIS_CODE(_RS(e), _RS(x), _RS(y), _RS(z), _RS(i), _RS(j), _RS(k), _RS(u), _RS(v), _RS(w)); return *this; }
|
FI XYZEval<T>& operator>>=(const int &v) { LOGICAL_AXIS_CODE(_RS(e), _RS(x), _RS(y), _RS(z), _RS(i), _RS(j), _RS(k), _RS(u), _RS(v), _RS(w)); return *this; }
|
||||||
FI XYZEval<T>& operator<<=(const int &p) { LOGICAL_AXIS_CODE(_LS(e), _LS(x), _LS(y), _LS(z), _LS(i), _LS(j), _LS(k), _LS(u), _LS(v), _LS(w)); return *this; }
|
FI XYZEval<T>& operator<<=(const int &v) { LOGICAL_AXIS_CODE(_LS(e), _LS(x), _LS(y), _LS(z), _LS(i), _LS(j), _LS(k), _LS(u), _LS(v), _LS(w)); return *this; }
|
||||||
|
|
||||||
// Exact comparisons. For floats a "NEAR" operation may be better.
|
// Exact comparisons. For floats a "NEAR" operation may be better.
|
||||||
FI bool operator==(const XYZval<T> &rs) const { return true NUM_AXIS_GANG(&& x == rs.x, && y == rs.y, && z == rs.z, && i == rs.i, && j == rs.j, && k == rs.k, && u == rs.u, && v == rs.v, && w == rs.w); }
|
FI bool operator==(const XYZval<T> &rs) const { return true NUM_AXIS_GANG(&& x == rs.x, && y == rs.y, && z == rs.z, && i == rs.i, && j == rs.j, && k == rs.k, && u == rs.u, && v == rs.v, && w == rs.w); }
|
||||||
FI bool operator==(const XYZEval<T> &rs) const { return true LOGICAL_AXIS_GANG(&& e == rs.e, && x == rs.x, && y == rs.y, && z == rs.z, && i == rs.i, && j == rs.j, && k == rs.k, && u == rs.u, && v == rs.v, && w == rs.w); }
|
FI bool operator==(const XYZEval<T> &rs) const { return true LOGICAL_AXIS_GANG(&& e == rs.e, && x == rs.x, && y == rs.y, && z == rs.z, && i == rs.i, && j == rs.j, && k == rs.k, && u == rs.u, && v == rs.v, && w == rs.w); }
|
||||||
FI bool operator!=(const XYZval<T> &rs) const { return !operator==(rs); }
|
FI bool operator!=(const XYZval<T> &rs) const { return !operator==(rs); }
|
||||||
FI bool operator!=(const XYZEval<T> &rs) const { return !operator==(rs); }
|
FI bool operator!=(const XYZEval<T> &rs) const { return !operator==(rs); }
|
||||||
};
|
};
|
||||||
|
|
||||||
#undef _RECIP
|
#undef _RECIP
|
||||||
|
|||||||
@@ -72,6 +72,22 @@ void ControllerFan::update() {
|
|||||||
? settings.active_speed : settings.idle_speed
|
? settings.active_speed : settings.idle_speed
|
||||||
);
|
);
|
||||||
|
|
||||||
|
speed = CALC_FAN_SPEED(speed);
|
||||||
|
|
||||||
|
#if FAN_KICKSTART_TIME
|
||||||
|
static millis_t fan_kick_end = 0;
|
||||||
|
if (speed > FAN_OFF_PWM) {
|
||||||
|
if (!fan_kick_end) {
|
||||||
|
fan_kick_end = ms + FAN_KICKSTART_TIME; // May be longer based on slow update interval for controller fn check. Sets minimum
|
||||||
|
speed = FAN_KICKSTART_POWER;
|
||||||
|
}
|
||||||
|
else if (PENDING(ms, fan_kick_end))
|
||||||
|
speed = FAN_KICKSTART_POWER;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fan_kick_end = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ENABLED(FAN_SOFT_PWM)
|
#if ENABLED(FAN_SOFT_PWM)
|
||||||
thermalManager.soft_pwm_controller_speed = speed;
|
thermalManager.soft_pwm_controller_speed = speed;
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -111,29 +111,20 @@ void HostUI::action(FSTR_P const fstr, const bool eol) {
|
|||||||
if (eol) SERIAL_EOL();
|
if (eol) SERIAL_EOL();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HostUI::prompt_plus(const bool pgm, FSTR_P const ptype, const char * const str, const char extra_char/*='\0'*/) {
|
void HostUI::prompt_plus(FSTR_P const ptype, FSTR_P const fstr, const char extra_char/*='\0'*/) {
|
||||||
prompt(ptype, false);
|
prompt(ptype, false);
|
||||||
PORT_REDIRECT(SerialMask::All);
|
PORT_REDIRECT(SerialMask::All);
|
||||||
SERIAL_CHAR(' ');
|
SERIAL_CHAR(' ');
|
||||||
if (pgm)
|
SERIAL_ECHOF(fstr);
|
||||||
SERIAL_ECHOPGM_P(str);
|
|
||||||
else
|
|
||||||
SERIAL_ECHO(str);
|
|
||||||
if (extra_char != '\0') SERIAL_CHAR(extra_char);
|
if (extra_char != '\0') SERIAL_CHAR(extra_char);
|
||||||
SERIAL_EOL();
|
SERIAL_EOL();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HostUI::prompt_begin(const PromptReason reason, FSTR_P const fstr, const char extra_char/*='\0'*/) {
|
void HostUI::prompt_begin(const PromptReason reason, FSTR_P const fstr, const char extra_char/*='\0'*/) {
|
||||||
prompt_end();
|
prompt_end();
|
||||||
host_prompt_reason = reason;
|
host_prompt_reason = reason;
|
||||||
prompt_plus(F("begin"), fstr, extra_char);
|
prompt_plus(F("begin"), fstr, extra_char);
|
||||||
}
|
}
|
||||||
void HostUI::prompt_begin(const PromptReason reason, const char * const cstr, const char extra_char/*='\0'*/) {
|
void HostUI::prompt_button(FSTR_P const fstr) { prompt_plus(F("button"), fstr); }
|
||||||
prompt_end();
|
|
||||||
host_prompt_reason = reason;
|
|
||||||
prompt_plus(F("begin"), cstr, extra_char);
|
|
||||||
}
|
|
||||||
|
|
||||||
void HostUI::prompt_end() { prompt(F("end")); }
|
void HostUI::prompt_end() { prompt(F("end")); }
|
||||||
void HostUI::prompt_show() { prompt(F("show")); }
|
void HostUI::prompt_show() { prompt(F("show")); }
|
||||||
|
|
||||||
@@ -142,26 +133,14 @@ void HostUI::action(FSTR_P const fstr, const bool eol) {
|
|||||||
if (btn2) prompt_button(btn2);
|
if (btn2) prompt_button(btn2);
|
||||||
prompt_show();
|
prompt_show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HostUI::prompt_button(FSTR_P const fstr) { prompt_plus(F("button"), fstr); }
|
|
||||||
void HostUI::prompt_button(const char * const cstr) { prompt_plus(F("button"), cstr); }
|
|
||||||
|
|
||||||
void HostUI::prompt_do(const PromptReason reason, FSTR_P const fstr, FSTR_P const btn1/*=nullptr*/, FSTR_P const btn2/*=nullptr*/) {
|
void HostUI::prompt_do(const PromptReason reason, FSTR_P const fstr, FSTR_P const btn1/*=nullptr*/, FSTR_P const btn2/*=nullptr*/) {
|
||||||
prompt_begin(reason, fstr);
|
prompt_begin(reason, fstr);
|
||||||
_prompt_show(btn1, btn2);
|
_prompt_show(btn1, btn2);
|
||||||
}
|
}
|
||||||
void HostUI::prompt_do(const PromptReason reason, const char * const cstr, FSTR_P const btn1/*=nullptr*/, FSTR_P const btn2/*=nullptr*/) {
|
|
||||||
prompt_begin(reason, cstr);
|
|
||||||
_prompt_show(btn1, btn2);
|
|
||||||
}
|
|
||||||
void HostUI::prompt_do(const PromptReason reason, FSTR_P const fstr, const char extra_char, FSTR_P const btn1/*=nullptr*/, FSTR_P const btn2/*=nullptr*/) {
|
void HostUI::prompt_do(const PromptReason reason, FSTR_P const fstr, const char extra_char, FSTR_P const btn1/*=nullptr*/, FSTR_P const btn2/*=nullptr*/) {
|
||||||
prompt_begin(reason, fstr, extra_char);
|
prompt_begin(reason, fstr, extra_char);
|
||||||
_prompt_show(btn1, btn2);
|
_prompt_show(btn1, btn2);
|
||||||
}
|
}
|
||||||
void HostUI::prompt_do(const PromptReason reason, const char * const cstr, const char extra_char, FSTR_P const btn1/*=nullptr*/, FSTR_P const btn2/*=nullptr*/) {
|
|
||||||
prompt_begin(reason, cstr, extra_char);
|
|
||||||
_prompt_show(btn1, btn2);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||||
void HostUI::filament_load_prompt() {
|
void HostUI::filament_load_prompt() {
|
||||||
|
|||||||
@@ -79,14 +79,7 @@ class HostUI {
|
|||||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||||
private:
|
private:
|
||||||
static void prompt(FSTR_P const ptype, const bool eol=true);
|
static void prompt(FSTR_P const ptype, const bool eol=true);
|
||||||
static void prompt_plus(const bool pgm, FSTR_P const ptype, const char * const str, const char extra_char='\0');
|
static void prompt_plus(FSTR_P const ptype, FSTR_P const fstr, const char extra_char='\0');
|
||||||
static void prompt_plus(FSTR_P const ptype, FSTR_P const fstr, const char extra_char='\0') {
|
|
||||||
prompt_plus(true, ptype, FTOP(fstr), extra_char);
|
|
||||||
}
|
|
||||||
static void prompt_plus(FSTR_P const ptype, const char * const cstr, const char extra_char='\0') {
|
|
||||||
prompt_plus(false, ptype, cstr, extra_char);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void prompt_show();
|
static void prompt_show();
|
||||||
static void _prompt_show(FSTR_P const btn1, FSTR_P const btn2);
|
static void _prompt_show(FSTR_P const btn1, FSTR_P const btn2);
|
||||||
|
|
||||||
@@ -100,17 +93,10 @@ class HostUI {
|
|||||||
static void notify(const char * const message);
|
static void notify(const char * const message);
|
||||||
|
|
||||||
static void prompt_begin(const PromptReason reason, FSTR_P const fstr, const char extra_char='\0');
|
static void prompt_begin(const PromptReason reason, FSTR_P const fstr, const char extra_char='\0');
|
||||||
static void prompt_begin(const PromptReason reason, const char * const cstr, const char extra_char='\0');
|
|
||||||
static void prompt_end();
|
|
||||||
|
|
||||||
static void prompt_button(FSTR_P const fstr);
|
static void prompt_button(FSTR_P const fstr);
|
||||||
static void prompt_button(const char * const cstr);
|
static void prompt_end();
|
||||||
|
|
||||||
static void prompt_do(const PromptReason reason, FSTR_P const pstr, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr);
|
static void prompt_do(const PromptReason reason, FSTR_P const pstr, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr);
|
||||||
static void prompt_do(const PromptReason reason, const char * const cstr, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr);
|
|
||||||
static void prompt_do(const PromptReason reason, FSTR_P const pstr, const char extra_char, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr);
|
static void prompt_do(const PromptReason reason, FSTR_P const pstr, const char extra_char, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr);
|
||||||
static void prompt_do(const PromptReason reason, const char * const cstr, const char extra_char, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr);
|
|
||||||
|
|
||||||
static void prompt_open(const PromptReason reason, FSTR_P const pstr, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr) {
|
static void prompt_open(const PromptReason reason, FSTR_P const pstr, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr) {
|
||||||
if (host_prompt_reason == PROMPT_NOT_DEFINED) prompt_do(reason, pstr, btn1, btn2);
|
if (host_prompt_reason == PROMPT_NOT_DEFINED) prompt_do(reason, pstr, btn1, btn2);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,8 +54,7 @@ MMU2 mmu2;
|
|||||||
#define MMU_CMD_TIMEOUT 45000UL // 45s timeout for mmu commands (except P0)
|
#define MMU_CMD_TIMEOUT 45000UL // 45s timeout for mmu commands (except P0)
|
||||||
#define MMU_P0_TIMEOUT 3000UL // Timeout for P0 command: 3seconds
|
#define MMU_P0_TIMEOUT 3000UL // Timeout for P0 command: 3seconds
|
||||||
|
|
||||||
#define MMU2_SEND(S) tx_str(F(S "\n"))
|
#define MMU2_COMMAND(S) tx_str(F(S "\n"))
|
||||||
#define MMU2_RECV(S) rx_str(F(S "\n"))
|
|
||||||
|
|
||||||
#if ENABLED(MMU_EXTRUDER_SENSOR)
|
#if ENABLED(MMU_EXTRUDER_SENSOR)
|
||||||
uint8_t mmu_idl_sens = 0;
|
uint8_t mmu_idl_sens = 0;
|
||||||
@@ -132,7 +131,7 @@ void MMU2::reset() {
|
|||||||
safe_delay(20);
|
safe_delay(20);
|
||||||
WRITE(MMU2_RST_PIN, HIGH);
|
WRITE(MMU2_RST_PIN, HIGH);
|
||||||
#else
|
#else
|
||||||
MMU2_SEND("X0"); // Send soft reset
|
MMU2_COMMAND("X0"); // Send soft reset
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,9 +157,11 @@ void MMU2::mmu_loop() {
|
|||||||
case -1:
|
case -1:
|
||||||
if (rx_start()) {
|
if (rx_start()) {
|
||||||
prev_P0_request = millis(); // Initialize finda sensor timeout
|
prev_P0_request = millis(); // Initialize finda sensor timeout
|
||||||
|
|
||||||
DEBUG_ECHOLNPGM("MMU => 'start'");
|
DEBUG_ECHOLNPGM("MMU => 'start'");
|
||||||
DEBUG_ECHOLNPGM("MMU <= 'S1'");
|
DEBUG_ECHOLNPGM("MMU <= 'S1'");
|
||||||
MMU2_SEND("S1"); // Read Version
|
|
||||||
|
MMU2_COMMAND("S1"); // Read Version
|
||||||
state = -2;
|
state = -2;
|
||||||
}
|
}
|
||||||
else if (millis() > 30000) { // 30sec after reset disable MMU
|
else if (millis() > 30000) { // 30sec after reset disable MMU
|
||||||
@@ -172,8 +173,10 @@ void MMU2::mmu_loop() {
|
|||||||
case -2:
|
case -2:
|
||||||
if (rx_ok()) {
|
if (rx_ok()) {
|
||||||
sscanf(rx_buffer, "%huok\n", &version);
|
sscanf(rx_buffer, "%huok\n", &version);
|
||||||
|
|
||||||
DEBUG_ECHOLNPGM("MMU => ", version, "\nMMU <= 'S2'");
|
DEBUG_ECHOLNPGM("MMU => ", version, "\nMMU <= 'S2'");
|
||||||
MMU2_SEND("S2"); // Read Build Number
|
|
||||||
|
MMU2_COMMAND("S2"); // Read Build Number
|
||||||
state = -3;
|
state = -3;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -188,12 +191,14 @@ void MMU2::mmu_loop() {
|
|||||||
|
|
||||||
#if ENABLED(MMU2_MODE_12V)
|
#if ENABLED(MMU2_MODE_12V)
|
||||||
DEBUG_ECHOLNPGM("MMU <= 'M1'");
|
DEBUG_ECHOLNPGM("MMU <= 'M1'");
|
||||||
MMU2_SEND("M1"); // Stealth Mode
|
|
||||||
|
MMU2_COMMAND("M1"); // Stealth Mode
|
||||||
state = -5;
|
state = -5;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
DEBUG_ECHOLNPGM("MMU <= 'P0'");
|
DEBUG_ECHOLNPGM("MMU <= 'P0'");
|
||||||
MMU2_SEND("P0"); // Read FINDA
|
|
||||||
|
MMU2_COMMAND("P0"); // Read FINDA
|
||||||
state = -4;
|
state = -4;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -204,8 +209,10 @@ void MMU2::mmu_loop() {
|
|||||||
// response to M1
|
// response to M1
|
||||||
if (rx_ok()) {
|
if (rx_ok()) {
|
||||||
DEBUG_ECHOLNPGM("MMU => ok");
|
DEBUG_ECHOLNPGM("MMU => ok");
|
||||||
|
|
||||||
DEBUG_ECHOLNPGM("MMU <= 'P0'");
|
DEBUG_ECHOLNPGM("MMU <= 'P0'");
|
||||||
MMU2_SEND("P0"); // Read FINDA
|
|
||||||
|
MMU2_COMMAND("P0"); // Read FINDA
|
||||||
state = -4;
|
state = -4;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -243,13 +250,14 @@ void MMU2::mmu_loop() {
|
|||||||
else if (cmd == MMU_CMD_C0) {
|
else if (cmd == MMU_CMD_C0) {
|
||||||
// continue loading
|
// continue loading
|
||||||
DEBUG_ECHOLNPGM("MMU <= 'C0'");
|
DEBUG_ECHOLNPGM("MMU <= 'C0'");
|
||||||
MMU2_SEND("C0");
|
MMU2_COMMAND("C0");
|
||||||
state = 3; // wait for response
|
state = 3; // wait for response
|
||||||
}
|
}
|
||||||
else if (cmd == MMU_CMD_U0) {
|
else if (cmd == MMU_CMD_U0) {
|
||||||
// unload current
|
// unload current
|
||||||
DEBUG_ECHOLNPGM("MMU <= 'U0'");
|
DEBUG_ECHOLNPGM("MMU <= 'U0'");
|
||||||
MMU2_SEND("U0");
|
|
||||||
|
MMU2_COMMAND("U0");
|
||||||
state = 3; // wait for response
|
state = 3; // wait for response
|
||||||
}
|
}
|
||||||
else if (WITHIN(cmd, MMU_CMD_E0, MMU_CMD_E0 + EXTRUDERS - 1)) {
|
else if (WITHIN(cmd, MMU_CMD_E0, MMU_CMD_E0 + EXTRUDERS - 1)) {
|
||||||
@@ -262,7 +270,7 @@ void MMU2::mmu_loop() {
|
|||||||
else if (cmd == MMU_CMD_R0) {
|
else if (cmd == MMU_CMD_R0) {
|
||||||
// recover after eject
|
// recover after eject
|
||||||
DEBUG_ECHOLNPGM("MMU <= 'R0'");
|
DEBUG_ECHOLNPGM("MMU <= 'R0'");
|
||||||
MMU2_SEND("R0");
|
MMU2_COMMAND("R0");
|
||||||
state = 3; // wait for response
|
state = 3; // wait for response
|
||||||
}
|
}
|
||||||
else if (WITHIN(cmd, MMU_CMD_F0, MMU_CMD_F0 + EXTRUDERS - 1)) {
|
else if (WITHIN(cmd, MMU_CMD_F0, MMU_CMD_F0 + EXTRUDERS - 1)) {
|
||||||
@@ -277,7 +285,7 @@ void MMU2::mmu_loop() {
|
|||||||
cmd = MMU_CMD_NONE;
|
cmd = MMU_CMD_NONE;
|
||||||
}
|
}
|
||||||
else if (ELAPSED(millis(), prev_P0_request + 300)) {
|
else if (ELAPSED(millis(), prev_P0_request + 300)) {
|
||||||
MMU2_SEND("P0"); // Read FINDA
|
MMU2_COMMAND("P0"); // Read FINDA
|
||||||
state = 2; // wait for response
|
state = 2; // wait for response
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,7 +314,7 @@ void MMU2::mmu_loop() {
|
|||||||
if (mmu_idl_sens) {
|
if (mmu_idl_sens) {
|
||||||
if (FILAMENT_PRESENT() && mmu_loading_flag) {
|
if (FILAMENT_PRESENT() && mmu_loading_flag) {
|
||||||
DEBUG_ECHOLNPGM("MMU <= 'A'");
|
DEBUG_ECHOLNPGM("MMU <= 'A'");
|
||||||
MMU2_SEND("A"); // send 'abort' request
|
MMU2_COMMAND("A"); // send 'abort' request
|
||||||
mmu_idl_sens = 0;
|
mmu_idl_sens = 0;
|
||||||
DEBUG_ECHOLNPGM("MMU IDLER_SENSOR = 0 - ABORT");
|
DEBUG_ECHOLNPGM("MMU IDLER_SENSOR = 0 - ABORT");
|
||||||
}
|
}
|
||||||
@@ -319,9 +327,9 @@ void MMU2::mmu_loop() {
|
|||||||
const bool keep_trying = !mmu2s_triggered && last_cmd == MMU_CMD_C0;
|
const bool keep_trying = !mmu2s_triggered && last_cmd == MMU_CMD_C0;
|
||||||
if (keep_trying) {
|
if (keep_trying) {
|
||||||
// MMU ok received but filament sensor not triggered, retrying...
|
// MMU ok received but filament sensor not triggered, retrying...
|
||||||
DEBUG_ECHOLNPGM("MMU => 'ok' (no filament in gears)");
|
DEBUG_ECHOLNPGM("MMU => 'ok' (filament not present in gears)");
|
||||||
DEBUG_ECHOLNPGM("MMU <= 'C0' (keep trying)");
|
DEBUG_ECHOLNPGM("MMU <= 'C0' (keep trying)");
|
||||||
MMU2_SEND("C0");
|
MMU2_COMMAND("C0");
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
constexpr bool keep_trying = false;
|
constexpr bool keep_trying = false;
|
||||||
@@ -353,7 +361,7 @@ void MMU2::mmu_loop() {
|
|||||||
*/
|
*/
|
||||||
bool MMU2::rx_start() {
|
bool MMU2::rx_start() {
|
||||||
// check for start message
|
// check for start message
|
||||||
return MMU2_RECV("start");
|
return rx_str(F("start\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -432,7 +440,7 @@ void MMU2::clear_rx_buffer() {
|
|||||||
* Check if we received 'ok' from MMU
|
* Check if we received 'ok' from MMU
|
||||||
*/
|
*/
|
||||||
bool MMU2::rx_ok() {
|
bool MMU2::rx_ok() {
|
||||||
if (MMU2_RECV("ok")) {
|
if (rx_str(F("ok\n"))) {
|
||||||
prev_P0_request = millis();
|
prev_P0_request = millis();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -665,7 +673,7 @@ static void mmu2_not_responding() {
|
|||||||
// When (T0 rx->ok) load is ready, but in fact it did not load
|
// When (T0 rx->ok) load is ready, but in fact it did not load
|
||||||
// successfully or an overload created pressure in the extruder.
|
// successfully or an overload created pressure in the extruder.
|
||||||
// Send (C0) to load more and move E_AXIS a little to release pressure.
|
// Send (C0) to load more and move E_AXIS a little to release pressure.
|
||||||
if ((fil_present = FILAMENT_PRESENT())) MMU2_SEND("A");
|
if ((fil_present = FILAMENT_PRESENT())) MMU2_COMMAND("A");
|
||||||
} while (!fil_present && PENDING(millis(), expire_ms));
|
} while (!fil_present && PENDING(millis(), expire_ms));
|
||||||
stepper.disable_extruder();
|
stepper.disable_extruder();
|
||||||
manage_response(true, true);
|
manage_response(true, true);
|
||||||
@@ -874,7 +882,7 @@ void MMU2::filament_runout() {
|
|||||||
if (cmd == MMU_CMD_NONE && last_cmd == MMU_CMD_C0) {
|
if (cmd == MMU_CMD_NONE && last_cmd == MMU_CMD_C0) {
|
||||||
if (present && !mmu2s_triggered) {
|
if (present && !mmu2s_triggered) {
|
||||||
DEBUG_ECHOLNPGM("MMU <= 'A'");
|
DEBUG_ECHOLNPGM("MMU <= 'A'");
|
||||||
MMU2_SEND("A");
|
tx_str(F("A\n"));
|
||||||
}
|
}
|
||||||
// Slowly spin the extruder during C0
|
// Slowly spin the extruder during C0
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -167,6 +167,8 @@
|
|||||||
if (parser.seenval('T')) draw_area_max.y = parser.value_linear_units();
|
if (parser.seenval('T')) draw_area_max.y = parser.value_linear_units();
|
||||||
if (parser.seenval('B')) draw_area_min.y = parser.value_linear_units();
|
if (parser.seenval('B')) draw_area_min.y = parser.value_linear_units();
|
||||||
if (parser.seenval('H')) polargraph_max_belt_len = parser.value_linear_units();
|
if (parser.seenval('H')) polargraph_max_belt_len = parser.value_linear_units();
|
||||||
|
draw_area_size.x = draw_area_max.x - draw_area_min.x;
|
||||||
|
draw_area_size.y = draw_area_max.y - draw_area_min.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GcodeSuite::M665_report(const bool forReplay/*=true*/) {
|
void GcodeSuite::M665_report(const bool forReplay/*=true*/) {
|
||||||
|
|||||||
@@ -600,9 +600,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
|||||||
case 108: M108(); break; // M108: Cancel Waiting
|
case 108: M108(); break; // M108: Cancel Waiting
|
||||||
case 112: M112(); break; // M112: Full Shutdown
|
case 112: M112(); break; // M112: Full Shutdown
|
||||||
case 410: M410(); break; // M410: Quickstop - Abort all the planned moves.
|
case 410: M410(); break; // M410: Quickstop - Abort all the planned moves.
|
||||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
TERN_(HOST_PROMPT_SUPPORT, case 876:) // M876: Handle Host prompt responses
|
||||||
case 876: M876(); break; // M876: Handle Host prompt responses
|
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
case 108: case 112: case 410:
|
case 108: case 112: case 410:
|
||||||
TERN_(HOST_PROMPT_SUPPORT, case 876:)
|
TERN_(HOST_PROMPT_SUPPORT, case 876:)
|
||||||
@@ -795,10 +793,6 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
|||||||
case 250: M250(); break; // M250: Set LCD contrast
|
case 250: M250(); break; // M250: Set LCD contrast
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_GCODE_M255
|
|
||||||
case 255: M255(); break; // M255: Set LCD Sleep/Backlight Timeout (Minutes)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAS_LCD_BRIGHTNESS
|
#if HAS_LCD_BRIGHTNESS
|
||||||
case 256: M256(); break; // M256: Set LCD brightness
|
case 256: M256(); break; // M256: Set LCD brightness
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -85,12 +85,7 @@ void GcodeSuite::M0_M1() {
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, parser.codenum ? F("M1 Stop") : F("M0 Stop"), FPSTR(CONTINUE_STR)));
|
||||||
if (parser.string_arg)
|
|
||||||
hostui.prompt_do(PROMPT_USER_CONTINUE, parser.string_arg, FPSTR(CONTINUE_STR));
|
|
||||||
else
|
|
||||||
hostui.prompt_do(PROMPT_USER_CONTINUE, parser.codenum ? F("M1 Stop") : F("M0 Stop"), FPSTR(CONTINUE_STR));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response(ms));
|
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response(ms));
|
||||||
|
|
||||||
|
|||||||
@@ -1496,7 +1496,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#elif ENABLED(TFT_GENERIC)
|
#elif ENABLED(TFT_GENERIC)
|
||||||
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y)
|
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y)
|
||||||
#if NONE(TFT_RES_320x240, TFT_RES_480x272, TFT_RES_480x320, TFT_RES_1024x600)
|
#if NONE(TFT_RES_320x240, TFT_RES_480x272, TFT_RES_480x320)
|
||||||
#define TFT_RES_320x240
|
#define TFT_RES_320x240
|
||||||
#endif
|
#endif
|
||||||
#if NONE(TFT_INTERFACE_FSMC, TFT_INTERFACE_SPI)
|
#if NONE(TFT_INTERFACE_FSMC, TFT_INTERFACE_SPI)
|
||||||
@@ -1574,8 +1574,6 @@
|
|||||||
#elif TFT_HEIGHT == 600
|
#elif TFT_HEIGHT == 600
|
||||||
#if ENABLED(TFT_INTERFACE_LTDC)
|
#if ENABLED(TFT_INTERFACE_LTDC)
|
||||||
#define TFT_1024x600_LTDC
|
#define TFT_1024x600_LTDC
|
||||||
#else
|
|
||||||
#define TFT_1024x600_SIM // "Simulation" - for testing purposes only
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@@ -1586,7 +1584,7 @@
|
|||||||
#define HAS_UI_480x320 1
|
#define HAS_UI_480x320 1
|
||||||
#elif EITHER(TFT_480x272, TFT_480x272_SPI)
|
#elif EITHER(TFT_480x272, TFT_480x272_SPI)
|
||||||
#define HAS_UI_480x272 1
|
#define HAS_UI_480x272 1
|
||||||
#elif EITHER(TFT_1024x600_LTDC, TFT_1024x600_SIM)
|
#elif defined(TFT_1024x600_LTDC)
|
||||||
#define HAS_UI_1024x600 1
|
#define HAS_UI_1024x600 1
|
||||||
#endif
|
#endif
|
||||||
#if ANY(HAS_UI_320x240, HAS_UI_480x320, HAS_UI_480x272)
|
#if ANY(HAS_UI_320x240, HAS_UI_480x320, HAS_UI_480x272)
|
||||||
|
|||||||
@@ -1074,3 +1074,14 @@
|
|||||||
#if ANY(DISABLE_INACTIVE_X, DISABLE_INACTIVE_Y, DISABLE_INACTIVE_Z, DISABLE_INACTIVE_I, DISABLE_INACTIVE_J, DISABLE_INACTIVE_K, DISABLE_INACTIVE_U, DISABLE_INACTIVE_V, DISABLE_INACTIVE_W, DISABLE_INACTIVE_E)
|
#if ANY(DISABLE_INACTIVE_X, DISABLE_INACTIVE_Y, DISABLE_INACTIVE_Z, DISABLE_INACTIVE_I, DISABLE_INACTIVE_J, DISABLE_INACTIVE_K, DISABLE_INACTIVE_U, DISABLE_INACTIVE_V, DISABLE_INACTIVE_W, DISABLE_INACTIVE_E)
|
||||||
#define HAS_DISABLE_INACTIVE_AXIS 1
|
#define HAS_DISABLE_INACTIVE_AXIS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Fan Kickstart
|
||||||
|
#if FAN_KICKSTART_TIME && !defined(FAN_KICKSTART_POWER)
|
||||||
|
#define FAN_KICKSTART_POWER 180
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if FAN_MIN_PWM == 0 && FAN_MAX_PWM == 255
|
||||||
|
#define CALC_FAN_SPEED(f) (f ?: FAN_OFF_PWM)
|
||||||
|
#else
|
||||||
|
#define CALC_FAN_SPEED(f) (f ? map(f, 1, 255, FAN_MIN_PWM, FAN_MAX_PWM) : FAN_OFF_PWM)
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -155,7 +155,7 @@
|
|||||||
#define W_BED_SIZE W_MAX_LENGTH
|
#define W_BED_SIZE W_MAX_LENGTH
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Require 0,0 bed center for Delta, SCARA, and Polargraph
|
// Require 0,0 bed center for Delta and SCARA
|
||||||
#if IS_KINEMATIC
|
#if IS_KINEMATIC
|
||||||
#define BED_CENTER_AT_0_0
|
#define BED_CENTER_AT_0_0
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -829,7 +829,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
|||||||
/**
|
/**
|
||||||
* Granular software endstops (Marlin >= 1.1.7)
|
* Granular software endstops (Marlin >= 1.1.7)
|
||||||
*/
|
*/
|
||||||
#if ENABLED(MIN_SOFTWARE_ENDSTOPS) && NONE(MIN_SOFTWARE_ENDSTOP_Z, POLARGRAPH)
|
#if ENABLED(MIN_SOFTWARE_ENDSTOPS) && DISABLED(MIN_SOFTWARE_ENDSTOP_Z)
|
||||||
#if IS_KINEMATIC
|
#if IS_KINEMATIC
|
||||||
#error "MIN_SOFTWARE_ENDSTOPS on DELTA/SCARA also requires MIN_SOFTWARE_ENDSTOP_Z."
|
#error "MIN_SOFTWARE_ENDSTOPS on DELTA/SCARA also requires MIN_SOFTWARE_ENDSTOP_Z."
|
||||||
#elif NONE(MIN_SOFTWARE_ENDSTOP_X, MIN_SOFTWARE_ENDSTOP_Y)
|
#elif NONE(MIN_SOFTWARE_ENDSTOP_X, MIN_SOFTWARE_ENDSTOP_Y)
|
||||||
@@ -837,7 +837,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(MAX_SOFTWARE_ENDSTOPS) && NONE(MAX_SOFTWARE_ENDSTOP_Z, POLARGRAPH)
|
#if ENABLED(MAX_SOFTWARE_ENDSTOPS) && DISABLED(MAX_SOFTWARE_ENDSTOP_Z)
|
||||||
#if IS_KINEMATIC
|
#if IS_KINEMATIC
|
||||||
#error "MAX_SOFTWARE_ENDSTOPS on DELTA/SCARA also requires MAX_SOFTWARE_ENDSTOP_Z."
|
#error "MAX_SOFTWARE_ENDSTOPS on DELTA/SCARA also requires MAX_SOFTWARE_ENDSTOP_Z."
|
||||||
#elif NONE(MAX_SOFTWARE_ENDSTOP_X, MAX_SOFTWARE_ENDSTOP_Y)
|
#elif NONE(MAX_SOFTWARE_ENDSTOP_X, MAX_SOFTWARE_ENDSTOP_Y)
|
||||||
@@ -1513,6 +1513,11 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
|||||||
#error "To use BED_LIMIT_SWITCHING you must disable PIDTEMPBED."
|
#error "To use BED_LIMIT_SWITCHING you must disable PIDTEMPBED."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Fan Kickstart
|
||||||
|
#if FAN_KICKSTART_TIME && defined(FAN_KICKSTART_POWER) && !WITHIN(FAN_KICKSTART_POWER, 64, 255)
|
||||||
|
#error "FAN_KICKSTART_POWER must be an integer from 64 to 255."
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Synchronous M106/M107 checks
|
* Synchronous M106/M107 checks
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
* version was tagged.
|
* version was tagged.
|
||||||
*/
|
*/
|
||||||
#ifndef STRING_DISTRIBUTION_DATE
|
#ifndef STRING_DISTRIBUTION_DATE
|
||||||
#define STRING_DISTRIBUTION_DATE "2022-10-16"
|
#define STRING_DISTRIBUTION_DATE "2022-10-12"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -418,12 +418,6 @@ namespace Language_en {
|
|||||||
LSTR MSG_FILAMENT_DIAM_E = _UxGT("Fil. Dia. *");
|
LSTR MSG_FILAMENT_DIAM_E = _UxGT("Fil. Dia. *");
|
||||||
LSTR MSG_FILAMENT_UNLOAD = _UxGT("Unload mm");
|
LSTR MSG_FILAMENT_UNLOAD = _UxGT("Unload mm");
|
||||||
LSTR MSG_FILAMENT_LOAD = _UxGT("Load mm");
|
LSTR MSG_FILAMENT_LOAD = _UxGT("Load mm");
|
||||||
LSTR MSG_SEGMENTS_PER_SECOND = _UxGT("Segments/Sec");
|
|
||||||
LSTR MSG_DRAW_MIN_X = _UxGT("Draw Min X");
|
|
||||||
LSTR MSG_DRAW_MAX_X = _UxGT("Draw Max X");
|
|
||||||
LSTR MSG_DRAW_MIN_Y = _UxGT("Draw Min Y");
|
|
||||||
LSTR MSG_DRAW_MAX_Y = _UxGT("Draw Max Y");
|
|
||||||
LSTR MSG_MAX_BELT_LEN = _UxGT("Max Belt Len");
|
|
||||||
LSTR MSG_ADVANCE_K = _UxGT("Advance K");
|
LSTR MSG_ADVANCE_K = _UxGT("Advance K");
|
||||||
LSTR MSG_ADVANCE_K_E = _UxGT("Advance K *");
|
LSTR MSG_ADVANCE_K_E = _UxGT("Advance K *");
|
||||||
LSTR MSG_CONTRAST = _UxGT("LCD Contrast");
|
LSTR MSG_CONTRAST = _UxGT("LCD Contrast");
|
||||||
|
|||||||
@@ -1726,7 +1726,7 @@ void MarlinUI::init() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LCD_WITH_BLINK && DISABLED(HAS_GRAPHICAL_TFT)
|
#if LCD_WITH_BLINK
|
||||||
typedef void (*PrintProgress_t)();
|
typedef void (*PrintProgress_t)();
|
||||||
void MarlinUI::rotate_progress() { // Renew and redraw all enabled progress strings
|
void MarlinUI::rotate_progress() { // Renew and redraw all enabled progress strings
|
||||||
const PrintProgress_t progFunc[] = {
|
const PrintProgress_t progFunc[] = {
|
||||||
|
|||||||
@@ -222,10 +222,10 @@ void menu_backlash();
|
|||||||
void apply_PID_p(const int8_t e) {
|
void apply_PID_p(const int8_t e) {
|
||||||
switch (e) {
|
switch (e) {
|
||||||
#if ENABLED(PIDTEMPBED)
|
#if ENABLED(PIDTEMPBED)
|
||||||
case H_BED: thermalManager.temp_bed.pid.set_Kp(raw_Kp); break;
|
case H_BED: thermalManager.temp_bed.pid.set_Ki(raw_Ki); break;
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(PIDTEMPCHAMBER)
|
#if ENABLED(PIDTEMPCHAMBER)
|
||||||
case H_CHAMBER: thermalManager.temp_chamber.pid.set_Kp(raw_Kp); break;
|
case H_CHAMBER: thermalManager.temp_chamber.pid.set_Ki(raw_Ki); break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
#if ENABLED(PIDTEMP)
|
#if ENABLED(PIDTEMP)
|
||||||
@@ -632,20 +632,10 @@ void menu_advanced_settings() {
|
|||||||
|
|
||||||
#if DISABLED(SLIM_LCD_MENUS)
|
#if DISABLED(SLIM_LCD_MENUS)
|
||||||
|
|
||||||
#if ENABLED(POLARGRAPH)
|
|
||||||
// M665 - Polargraph Settings
|
|
||||||
if (!is_busy) {
|
|
||||||
EDIT_ITEM_FAST(float4, MSG_SEGMENTS_PER_SECOND, &segments_per_second, 100, 9999); // M665 S
|
|
||||||
EDIT_ITEM_FAST(float51sign, MSG_DRAW_MIN_X, &draw_area_min.x, X_MIN_POS, draw_area_max.x - 10); // M665 L
|
|
||||||
EDIT_ITEM_FAST(float51sign, MSG_DRAW_MAX_X, &draw_area_max.x, draw_area_min.x + 10, X_MAX_POS); // M665 R
|
|
||||||
EDIT_ITEM_FAST(float51sign, MSG_DRAW_MIN_Y, &draw_area_min.y, Y_MIN_POS, draw_area_max.y - 10); // M665 T
|
|
||||||
EDIT_ITEM_FAST(float51sign, MSG_DRAW_MAX_Y, &draw_area_max.y, draw_area_min.y + 10, Y_MAX_POS); // M665 B
|
|
||||||
EDIT_ITEM_FAST(float51sign, MSG_MAX_BELT_LEN, &polargraph_max_belt_len, 500, 2000); // M665 H
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAS_M206_COMMAND
|
#if HAS_M206_COMMAND
|
||||||
// M428 - Set Home Offsets
|
//
|
||||||
|
// Set Home Offsets
|
||||||
|
//
|
||||||
ACTION_ITEM(MSG_SET_HOME_OFFSETS, []{ queue.inject(F("M428")); ui.return_to_status(); });
|
ACTION_ITEM(MSG_SET_HOME_OFFSETS, []{ queue.inject(F("M428")); ui.return_to_status(); });
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -341,6 +341,7 @@ void report_current_position_projected() {
|
|||||||
can_reach = (
|
can_reach = (
|
||||||
a < polargraph_max_belt_len + 1
|
a < polargraph_max_belt_len + 1
|
||||||
&& b < polargraph_max_belt_len + 1
|
&& b < polargraph_max_belt_len + 1
|
||||||
|
&& (a + b) > _MIN(draw_area_size.x, draw_area_size.y)
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -561,8 +562,7 @@ void do_blocking_move_to(NUM_AXIS_ARGS(const float), const_feedRate_t fr_mm_s/*=
|
|||||||
const feedRate_t w_feedrate = fr_mm_s ?: homing_feedrate(W_AXIS)
|
const feedRate_t w_feedrate = fr_mm_s ?: homing_feedrate(W_AXIS)
|
||||||
);
|
);
|
||||||
|
|
||||||
#if IS_KINEMATIC && DISABLED(POLARGRAPH)
|
#if IS_KINEMATIC
|
||||||
// kinematic machines are expected to home to a point 1.5x their range? never reachable.
|
|
||||||
if (!position_is_reachable(x, y)) return;
|
if (!position_is_reachable(x, y)) return;
|
||||||
destination = current_position; // sync destination at the start
|
destination = current_position; // sync destination at the start
|
||||||
#endif
|
#endif
|
||||||
@@ -919,16 +919,11 @@ void restore_feedrate_and_scaling() {
|
|||||||
constexpr xy_pos_t offs{0};
|
constexpr xy_pos_t offs{0};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(POLARGRAPH)
|
if (TERN1(IS_SCARA, axis_was_homed(X_AXIS) && axis_was_homed(Y_AXIS))) {
|
||||||
LIMIT(target.x, draw_area_min.x, draw_area_max.x);
|
const float dist_2 = HYPOT2(target.x - offs.x, target.y - offs.y);
|
||||||
LIMIT(target.y, draw_area_min.y, draw_area_max.y);
|
if (dist_2 > delta_max_radius_2)
|
||||||
#else
|
target *= float(delta_max_radius / SQRT(dist_2)); // 200 / 300 = 0.66
|
||||||
if (TERN1(IS_SCARA, axis_was_homed(X_AXIS) && axis_was_homed(Y_AXIS))) {
|
}
|
||||||
const float dist_2 = HYPOT2(target.x - offs.x, target.y - offs.y);
|
|
||||||
if (dist_2 > delta_max_radius_2)
|
|
||||||
target *= float(delta_max_radius / SQRT(dist_2)); // 200 / 300 = 0.66
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
|||||||
@@ -1282,16 +1282,10 @@ void Planner::recalculate(TERN_(HINTS_SAFE_EXIT_SPEED, const_float_t safe_exit_s
|
|||||||
|
|
||||||
void Planner::sync_fan_speeds(uint8_t (&fan_speed)[FAN_COUNT]) {
|
void Planner::sync_fan_speeds(uint8_t (&fan_speed)[FAN_COUNT]) {
|
||||||
|
|
||||||
#if FAN_MIN_PWM != 0 || FAN_MAX_PWM != 255
|
|
||||||
#define CALC_FAN_SPEED(f) (fan_speed[f] ? map(fan_speed[f], 1, 255, FAN_MIN_PWM, FAN_MAX_PWM) : FAN_OFF_PWM)
|
|
||||||
#else
|
|
||||||
#define CALC_FAN_SPEED(f) (fan_speed[f] ?: FAN_OFF_PWM)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ENABLED(FAN_SOFT_PWM)
|
#if ENABLED(FAN_SOFT_PWM)
|
||||||
#define _FAN_SET(F) thermalManager.soft_pwm_amount_fan[F] = CALC_FAN_SPEED(F);
|
#define _FAN_SET(F) thermalManager.soft_pwm_amount_fan[F] = CALC_FAN_SPEED(fan_speed[F]);
|
||||||
#else
|
#else
|
||||||
#define _FAN_SET(F) hal.set_pwm_duty(pin_t(FAN##F##_PIN), CALC_FAN_SPEED(F));
|
#define _FAN_SET(F) hal.set_pwm_duty(pin_t(FAN##F##_PIN), CALC_FAN_SPEED(fan_speed[F]));
|
||||||
#endif
|
#endif
|
||||||
#define FAN_SET(F) do{ kickstart_fan(fan_speed, ms, F); _FAN_SET(F); }while(0)
|
#define FAN_SET(F) do{ kickstart_fan(fan_speed, ms, F); _FAN_SET(F); }while(0)
|
||||||
|
|
||||||
@@ -1306,13 +1300,13 @@ void Planner::recalculate(TERN_(HINTS_SAFE_EXIT_SPEED, const_float_t safe_exit_s
|
|||||||
|
|
||||||
void Planner::kickstart_fan(uint8_t (&fan_speed)[FAN_COUNT], const millis_t &ms, const uint8_t f) {
|
void Planner::kickstart_fan(uint8_t (&fan_speed)[FAN_COUNT], const millis_t &ms, const uint8_t f) {
|
||||||
static millis_t fan_kick_end[FAN_COUNT] = { 0 };
|
static millis_t fan_kick_end[FAN_COUNT] = { 0 };
|
||||||
if (fan_speed[f]) {
|
if (fan_speed[f] > FAN_OFF_PWM) {
|
||||||
if (fan_kick_end[f] == 0) {
|
if (fan_kick_end[f] == 0) {
|
||||||
fan_kick_end[f] = ms + FAN_KICKSTART_TIME;
|
fan_kick_end[f] = ms + FAN_KICKSTART_TIME;
|
||||||
fan_speed[f] = 255;
|
fan_speed[f] = FAN_KICKSTART_POWER;
|
||||||
}
|
}
|
||||||
else if (PENDING(ms, fan_kick_end[f]))
|
else if (PENDING(ms, fan_kick_end[f]))
|
||||||
fan_speed[f] = 255;
|
fan_speed[f] = FAN_KICKSTART_POWER;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fan_kick_end[f] = 0;
|
fan_kick_end[f] = 0;
|
||||||
@@ -2244,6 +2238,7 @@ bool Planner::_populate_block(
|
|||||||
|
|
||||||
TERN_(MIXING_EXTRUDER, mixer.populate_block(block->b_color));
|
TERN_(MIXING_EXTRUDER, mixer.populate_block(block->b_color));
|
||||||
|
|
||||||
|
|
||||||
#if HAS_FAN
|
#if HAS_FAN
|
||||||
FANS_LOOP(i) block->fan_speed[i] = thermalManager.fan_speed[i];
|
FANS_LOOP(i) block->fan_speed[i] = thermalManager.fan_speed[i];
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -37,12 +37,17 @@
|
|||||||
#include "../lcd/marlinui.h"
|
#include "../lcd/marlinui.h"
|
||||||
#include "../MarlinCore.h"
|
#include "../MarlinCore.h"
|
||||||
|
|
||||||
// Initialized by settings.load()
|
float segments_per_second; // Initialized by settings.load()
|
||||||
float segments_per_second, polargraph_max_belt_len;
|
|
||||||
xy_pos_t draw_area_min, draw_area_max;
|
xy_pos_t draw_area_min = { X_MIN_POS, Y_MIN_POS },
|
||||||
|
draw_area_max = { X_MAX_POS, Y_MAX_POS };
|
||||||
|
|
||||||
|
xy_float_t draw_area_size = { X_MAX_POS - X_MIN_POS, Y_MAX_POS - Y_MIN_POS };
|
||||||
|
|
||||||
|
float polargraph_max_belt_len = HYPOT(draw_area_size.x, draw_area_size.y);
|
||||||
|
|
||||||
void inverse_kinematics(const xyz_pos_t &raw) {
|
void inverse_kinematics(const xyz_pos_t &raw) {
|
||||||
const float x1 = raw.x - draw_area_min.x, x2 = draw_area_max.x - raw.x, y = raw.y - draw_area_max.y;
|
const float x1 = raw.x - (draw_area_min.x), x2 = (draw_area_max.x) - raw.x, y = raw.y - (draw_area_max.y);
|
||||||
delta.set(HYPOT(x1, y), HYPOT(x2, y), raw.z);
|
delta.set(HYPOT(x1, y), HYPOT(x2, y), raw.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
extern float segments_per_second;
|
extern float segments_per_second;
|
||||||
extern xy_pos_t draw_area_min, draw_area_max;
|
extern xy_pos_t draw_area_min, draw_area_max;
|
||||||
|
extern xy_float_t draw_area_size;
|
||||||
extern float polargraph_max_belt_len;
|
extern float polargraph_max_belt_len;
|
||||||
|
|
||||||
void inverse_kinematics(const xyz_pos_t &raw);
|
void inverse_kinematics(const xyz_pos_t &raw);
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ public:
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
static constexpr xyz_pos_t offset = xyz_pos_t(NUM_AXIS_ARRAY_1(0)); // See #16767
|
static constexpr xyz_pos_t offset = xyz_pos_t(NUM_AXIS_ARRAY(0, 0, 0, 0, 0, 0)); // See #16767
|
||||||
|
|
||||||
static bool set_deployed(const bool) { return false; }
|
static bool set_deployed(const bool) { return false; }
|
||||||
|
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ typedef struct SettingsDataStruct {
|
|||||||
// HAS_BED_PROBE
|
// HAS_BED_PROBE
|
||||||
//
|
//
|
||||||
|
|
||||||
xyz_pos_t probe_offset; // M851 X Y Z
|
xyz_pos_t probe_offset;
|
||||||
|
|
||||||
//
|
//
|
||||||
// ABL_PLANAR
|
// ABL_PLANAR
|
||||||
@@ -330,11 +330,7 @@ typedef struct SettingsDataStruct {
|
|||||||
delta_diagonal_rod; // M665 L
|
delta_diagonal_rod; // M665 L
|
||||||
abc_float_t delta_tower_angle_trim, // M665 X Y Z
|
abc_float_t delta_tower_angle_trim, // M665 X Y Z
|
||||||
delta_diagonal_rod_trim; // M665 A B C
|
delta_diagonal_rod_trim; // M665 A B C
|
||||||
#elif ENABLED(POLARGRAPH)
|
|
||||||
xy_pos_t draw_area_min, draw_area_max; // M665 L R T B
|
|
||||||
float polargraph_max_belt_len; // M665 H
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -472,7 +468,7 @@ typedef struct SettingsDataStruct {
|
|||||||
//
|
//
|
||||||
// SKEW_CORRECTION
|
// SKEW_CORRECTION
|
||||||
//
|
//
|
||||||
skew_factor_t planner_skew_factor; // M852 I J K
|
skew_factor_t planner_skew_factor; // M852 I J K planner.skew_factor
|
||||||
|
|
||||||
//
|
//
|
||||||
// ADVANCED_PAUSE_FEATURE
|
// ADVANCED_PAUSE_FEATURE
|
||||||
@@ -1005,11 +1001,6 @@ void MarlinSettings::postprocess() {
|
|||||||
EEPROM_WRITE(delta_diagonal_rod); // 1 float
|
EEPROM_WRITE(delta_diagonal_rod); // 1 float
|
||||||
EEPROM_WRITE(delta_tower_angle_trim); // 3 floats
|
EEPROM_WRITE(delta_tower_angle_trim); // 3 floats
|
||||||
EEPROM_WRITE(delta_diagonal_rod_trim); // 3 floats
|
EEPROM_WRITE(delta_diagonal_rod_trim); // 3 floats
|
||||||
#elif ENABLED(POLARGRAPH)
|
|
||||||
_FIELD_TEST(draw_area_min);
|
|
||||||
EEPROM_WRITE(draw_area_min); // 2 floats
|
|
||||||
EEPROM_WRITE(draw_area_max); // 2 floats
|
|
||||||
EEPROM_WRITE(polargraph_max_belt_len); // 1 float
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -1444,14 +1435,6 @@ void MarlinSettings::postprocess() {
|
|||||||
_FIELD_TEST(planner_skew_factor);
|
_FIELD_TEST(planner_skew_factor);
|
||||||
EEPROM_WRITE(planner.skew_factor);
|
EEPROM_WRITE(planner.skew_factor);
|
||||||
|
|
||||||
//
|
|
||||||
// POLARGRAPH
|
|
||||||
//
|
|
||||||
#if ENABLED(POLARGRAPH)
|
|
||||||
_FIELD_TEST(polargraph_max_belt_len);
|
|
||||||
EEPROM_WRITE(polargraph_max_belt_len);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Advanced Pause filament load & unload lengths
|
// Advanced Pause filament load & unload lengths
|
||||||
//
|
//
|
||||||
@@ -1953,11 +1936,6 @@ void MarlinSettings::postprocess() {
|
|||||||
EEPROM_READ(delta_diagonal_rod); // 1 float
|
EEPROM_READ(delta_diagonal_rod); // 1 float
|
||||||
EEPROM_READ(delta_tower_angle_trim); // 3 floats
|
EEPROM_READ(delta_tower_angle_trim); // 3 floats
|
||||||
EEPROM_READ(delta_diagonal_rod_trim); // 3 floats
|
EEPROM_READ(delta_diagonal_rod_trim); // 3 floats
|
||||||
#elif ENABLED(POLARGRAPH)
|
|
||||||
_FIELD_TEST(draw_area_min);
|
|
||||||
EEPROM_READ(draw_area_min); // 2 floats
|
|
||||||
EEPROM_READ(draw_area_max); // 2 floats
|
|
||||||
EEPROM_READ(polargraph_max_belt_len); // 1 float
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -3018,10 +2996,6 @@ void MarlinSettings::reset() {
|
|||||||
delta_diagonal_rod = DELTA_DIAGONAL_ROD;
|
delta_diagonal_rod = DELTA_DIAGONAL_ROD;
|
||||||
delta_tower_angle_trim = dta;
|
delta_tower_angle_trim = dta;
|
||||||
delta_diagonal_rod_trim = ddr;
|
delta_diagonal_rod_trim = ddr;
|
||||||
#elif ENABLED(POLARGRAPH)
|
|
||||||
draw_area_min.set(X_MIN_POS, Y_MIN_POS);
|
|
||||||
draw_area_max.set(X_MAX_POS, Y_MAX_POS);
|
|
||||||
polargraph_max_belt_len = POLARGRAPH_MAX_BELT_LEN;
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -3518,7 +3492,9 @@ void MarlinSettings::reset() {
|
|||||||
//
|
//
|
||||||
// LCD Preheat Settings
|
// LCD Preheat Settings
|
||||||
//
|
//
|
||||||
TERN_(HAS_PREHEAT, gcode.M145_report(forReplay));
|
#if HAS_PREHEAT
|
||||||
|
gcode.M145_report(forReplay);
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// PID
|
// PID
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
#include "../MarlinCore.h"
|
#include "../MarlinCore.h"
|
||||||
#include "../HAL/shared/Delay.h"
|
#include "../HAL/shared/Delay.h"
|
||||||
#include "../lcd/marlinui.h"
|
#include "../lcd/marlinui.h"
|
||||||
#include "../gcode/gcode.h"
|
|
||||||
|
|
||||||
#include "temperature.h"
|
#include "temperature.h"
|
||||||
#include "endstops.h"
|
#include "endstops.h"
|
||||||
@@ -64,6 +63,10 @@
|
|||||||
#include "../feature/host_actions.h"
|
#include "../feature/host_actions.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if EITHER(HAS_TEMP_SENSOR, LASER_FEATURE)
|
||||||
|
#include "../gcode/gcode.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ENABLED(NOZZLE_PARK_FEATURE)
|
#if ENABLED(NOZZLE_PARK_FEATURE)
|
||||||
#include "../libs/nozzle.h"
|
#include "../libs/nozzle.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -306,19 +309,19 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EITHER(AUTO_POWER_E_FANS, HAS_FANCHECK)
|
#if EITHER(AUTO_POWER_E_FANS, HAS_FANCHECK)
|
||||||
uint8_t Temperature::autofan_speed[HOTENDS]; // = { 0 }
|
uint8_t Temperature::autofan_speed[HOTENDS] = ARRAY_N_1(HOTENDS, FAN_OFF_PWM);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(AUTO_POWER_CHAMBER_FAN)
|
#if ENABLED(AUTO_POWER_CHAMBER_FAN)
|
||||||
uint8_t Temperature::chamberfan_speed; // = 0
|
uint8_t Temperature::chamberfan_speed = FAN_OFF_PWM;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(AUTO_POWER_COOLER_FAN)
|
#if ENABLED(AUTO_POWER_COOLER_FAN)
|
||||||
uint8_t Temperature::coolerfan_speed; // = 0
|
uint8_t Temperature::coolerfan_speed = FAN_OFF_PWM;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BOTH(FAN_SOFT_PWM, USE_CONTROLLER_FAN)
|
#if BOTH(FAN_SOFT_PWM, USE_CONTROLLER_FAN)
|
||||||
uint8_t Temperature::soft_pwm_controller_speed;
|
uint8_t Temperature::soft_pwm_controller_speed = FAN_OFF_PWM;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Init fans according to whether they're native PWM or Software PWM
|
// Init fans according to whether they're native PWM or Software PWM
|
||||||
@@ -342,11 +345,11 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED);
|
|||||||
// HAS_FAN does not include CONTROLLER_FAN
|
// HAS_FAN does not include CONTROLLER_FAN
|
||||||
#if HAS_FAN
|
#if HAS_FAN
|
||||||
|
|
||||||
uint8_t Temperature::fan_speed[FAN_COUNT]; // = { 0 }
|
uint8_t Temperature::fan_speed[FAN_COUNT] = ARRAY_N_1(FAN_COUNT, FAN_OFF_PWM);
|
||||||
|
|
||||||
#if ENABLED(EXTRA_FAN_SPEED)
|
#if ENABLED(EXTRA_FAN_SPEED)
|
||||||
|
|
||||||
Temperature::extra_fan_t Temperature::extra_fan_speed[FAN_COUNT];
|
Temperature::extra_fan_t Temperature::extra_fan_speed[FAN_COUNT] = ARRAY_N_1(FAN_COUNT, FAN_OFF_PWM);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the M106 P<fan> T<speed> command:
|
* Handle the M106 P<fan> T<speed> command:
|
||||||
@@ -373,7 +376,7 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED);
|
|||||||
|
|
||||||
#if EITHER(PROBING_FANS_OFF, ADVANCED_PAUSE_FANS_PAUSE)
|
#if EITHER(PROBING_FANS_OFF, ADVANCED_PAUSE_FANS_PAUSE)
|
||||||
bool Temperature::fans_paused; // = false;
|
bool Temperature::fans_paused; // = false;
|
||||||
uint8_t Temperature::saved_fan_speed[FAN_COUNT]; // = { 0 }
|
uint8_t Temperature::saved_fan_speed[FAN_COUNT] = ARRAY_N_1(FAN_COUNT, FAN_OFF_PWM);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(ADAPTIVE_FAN_SLOWING)
|
#if ENABLED(ADAPTIVE_FAN_SLOWING)
|
||||||
|
|||||||
@@ -917,7 +917,7 @@ void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0.
|
|||||||
#if HAS_FAN && TOOLCHANGE_FS_FAN >= 0
|
#if HAS_FAN && TOOLCHANGE_FS_FAN >= 0
|
||||||
thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = toolchange_settings.fan_speed;
|
thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = toolchange_settings.fan_speed;
|
||||||
gcode.dwell(SEC_TO_MS(toolchange_settings.fan_time));
|
gcode.dwell(SEC_TO_MS(toolchange_settings.fan_time));
|
||||||
thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = 0;
|
thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = FAN_OFF_PWM;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -450,19 +450,6 @@
|
|||||||
#ifndef TOUCH_OFFSET_Y
|
#ifndef TOUCH_OFFSET_Y
|
||||||
#define TOUCH_OFFSET_Y 1
|
#define TOUCH_OFFSET_Y 1
|
||||||
#endif
|
#endif
|
||||||
#elif ENABLED(TFT_RES_1024x600)
|
|
||||||
#ifndef TOUCH_CALIBRATION_X
|
|
||||||
#define TOUCH_CALIBRATION_X 65533
|
|
||||||
#endif
|
|
||||||
#ifndef TOUCH_CALIBRATION_Y
|
|
||||||
#define TOUCH_CALIBRATION_Y 38399
|
|
||||||
#endif
|
|
||||||
#ifndef TOUCH_OFFSET_X
|
|
||||||
#define TOUCH_OFFSET_X 2
|
|
||||||
#endif
|
|
||||||
#ifndef TOUCH_OFFSET_Y
|
|
||||||
#define TOUCH_OFFSET_Y 1
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -4,16 +4,16 @@
|
|||||||
import pioutil
|
import pioutil
|
||||||
if pioutil.is_pio_build():
|
if pioutil.is_pio_build():
|
||||||
|
|
||||||
Import("env", "projenv")
|
Import("env", "projenv")
|
||||||
|
|
||||||
flash_size = 0
|
flash_size = 0
|
||||||
vect_tab_addr = 0
|
vect_tab_addr = 0
|
||||||
|
|
||||||
for define in env['CPPDEFINES']:
|
for define in env['CPPDEFINES']:
|
||||||
if define[0] == "VECT_TAB_ADDR":
|
if define[0] == "VECT_TAB_ADDR":
|
||||||
vect_tab_addr = define[1]
|
vect_tab_addr = define[1]
|
||||||
if define[0] == "STM32_FLASH_SIZE":
|
if define[0] == "STM32_FLASH_SIZE":
|
||||||
flash_size = define[1]
|
flash_size = define[1]
|
||||||
|
|
||||||
print('Use the {0:s} address as the marlin app entry point.'.format(vect_tab_addr))
|
print('Use the {0:s} address as the marlin app entry point.'.format(vect_tab_addr))
|
||||||
print('Use the {0:d}KB flash version of stm32f103rct6 chip.'.format(flash_size))
|
print('Use the {0:d}KB flash version of stm32f103rct6 chip.'.format(flash_size))
|
||||||
|
|||||||
@@ -3,25 +3,25 @@
|
|||||||
#
|
#
|
||||||
import pioutil
|
import pioutil
|
||||||
if pioutil.is_pio_build():
|
if pioutil.is_pio_build():
|
||||||
from os.path import join
|
from os.path import join
|
||||||
from os.path import expandvars
|
from os.path import expandvars
|
||||||
Import("env")
|
Import("env")
|
||||||
|
|
||||||
# Custom HEX from ELF
|
# Custom HEX from ELF
|
||||||
env.AddPostAction(
|
env.AddPostAction(
|
||||||
join("$BUILD_DIR", "${PROGNAME}.elf"),
|
join("$BUILD_DIR", "${PROGNAME}.elf"),
|
||||||
env.VerboseAction(" ".join([
|
env.VerboseAction(" ".join([
|
||||||
"$OBJCOPY", "-O ihex", "$TARGET",
|
"$OBJCOPY", "-O ihex", "$TARGET",
|
||||||
"\"" + join("$BUILD_DIR", "${PROGNAME}.hex") + "\"", # Note: $BUILD_DIR is a full path
|
"\"" + join("$BUILD_DIR", "${PROGNAME}.hex") + "\"", # Note: $BUILD_DIR is a full path
|
||||||
]), "Building $TARGET"))
|
]), "Building $TARGET"))
|
||||||
|
|
||||||
# In-line command with arguments
|
# In-line command with arguments
|
||||||
UPLOAD_TOOL="stm32flash"
|
UPLOAD_TOOL="stm32flash"
|
||||||
platform = env.PioPlatform()
|
platform = env.PioPlatform()
|
||||||
if platform.get_package_dir("tool-stm32duino") != None:
|
if platform.get_package_dir("tool-stm32duino") != None:
|
||||||
UPLOAD_TOOL=expandvars("\"" + join(platform.get_package_dir("tool-stm32duino"),"stm32flash","stm32flash") + "\"")
|
UPLOAD_TOOL=expandvars("\"" + join(platform.get_package_dir("tool-stm32duino"),"stm32flash","stm32flash") + "\"")
|
||||||
|
|
||||||
env.Replace(
|
env.Replace(
|
||||||
UPLOADER=UPLOAD_TOOL,
|
UPLOADER=UPLOAD_TOOL,
|
||||||
UPLOADCMD=expandvars(UPLOAD_TOOL + " -v -i rts,-dtr,dtr -R -b 115200 -g 0x8000000 -w \"" + join("$BUILD_DIR","${PROGNAME}.hex")+"\"" + " $UPLOAD_PORT")
|
UPLOADCMD=expandvars(UPLOAD_TOOL + " -v -i rts,-dtr,dtr -R -b 115200 -g 0x8000000 -w \"" + join("$BUILD_DIR","${PROGNAME}.hex")+"\"" + " $UPLOAD_PORT")
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,29 +3,29 @@
|
|||||||
#
|
#
|
||||||
import pioutil
|
import pioutil
|
||||||
if pioutil.is_pio_build():
|
if pioutil.is_pio_build():
|
||||||
import shutil,marlin
|
import shutil,marlin
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
Import("env")
|
Import("env")
|
||||||
platform = env.PioPlatform()
|
platform = env.PioPlatform()
|
||||||
board = env.BoardConfig()
|
board = env.BoardConfig()
|
||||||
|
|
||||||
FRAMEWORK_DIR = Path(platform.get_package_dir("framework-arduinoststm32-maple"))
|
FRAMEWORK_DIR = Path(platform.get_package_dir("framework-arduinoststm32-maple"))
|
||||||
assert FRAMEWORK_DIR.is_dir()
|
assert FRAMEWORK_DIR.is_dir()
|
||||||
|
|
||||||
source_root = Path("buildroot/share/PlatformIO/variants")
|
source_root = Path("buildroot/share/PlatformIO/variants")
|
||||||
assert source_root.is_dir()
|
assert source_root.is_dir()
|
||||||
|
|
||||||
variant = board.get("build.variant")
|
variant = board.get("build.variant")
|
||||||
variant_dir = FRAMEWORK_DIR / "STM32F1/variants" / variant
|
variant_dir = FRAMEWORK_DIR / "STM32F1/variants" / variant
|
||||||
|
|
||||||
source_dir = source_root / variant
|
source_dir = source_root / variant
|
||||||
assert source_dir.is_dir()
|
assert source_dir.is_dir()
|
||||||
|
|
||||||
if variant_dir.is_dir():
|
if variant_dir.is_dir():
|
||||||
shutil.rmtree(variant_dir)
|
shutil.rmtree(variant_dir)
|
||||||
|
|
||||||
if not variant_dir.is_dir():
|
if not variant_dir.is_dir():
|
||||||
variant_dir.mkdir()
|
variant_dir.mkdir()
|
||||||
|
|
||||||
marlin.copytree(source_dir, variant_dir)
|
marlin.copytree(source_dir, variant_dir)
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
* Copyright (c) 2017 STMicroelectronics.
|
* <h2><center>© Copyright (c) 2017 STMicroelectronics.
|
||||||
* All rights reserved.
|
* All rights reserved.</center></h2>
|
||||||
*
|
*
|
||||||
* This software component is licensed by ST under BSD 3-Clause license,
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
* the "License"; You may not use this file except in compliance with the
|
* the "License"; You may not use this file except in compliance with the
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
** @attention
|
** @attention
|
||||||
**
|
**
|
||||||
** Copyright (c) 2014 Ac6
|
** <h2><center>© COPYRIGHT(c) 2014 Ac6</center></h2>
|
||||||
**
|
**
|
||||||
** Redistribution and use in source and binary forms, with or without modification,
|
** Redistribution and use in source and binary forms, with or without modification,
|
||||||
** are permitted provided that the following conditions are met:
|
** are permitted provided that the following conditions are met:
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015 STMicroelectronics
|
* <h2><center>© COPYRIGHT 2015 STMicroelectronics</center></h2>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
* are permitted provided that the following conditions are met:
|
* are permitted provided that the following conditions are met:
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
** @attention
|
** @attention
|
||||||
**
|
**
|
||||||
** Copyright (c) 2014 Ac6
|
** <h2><center>© COPYRIGHT(c) 2014 Ac6</center></h2>
|
||||||
**
|
**
|
||||||
** Redistribution and use in source and binary forms, with or without modification,
|
** Redistribution and use in source and binary forms, with or without modification,
|
||||||
** are permitted provided that the following conditions are met:
|
** are permitted provided that the following conditions are met:
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
** @attention
|
** @attention
|
||||||
**
|
**
|
||||||
** Copyright (c) 2014 Ac6
|
** <h2><center>© COPYRIGHT(c) 2014 Ac6</center></h2>
|
||||||
**
|
**
|
||||||
** Redistribution and use in source and binary forms, with or without modification,
|
** Redistribution and use in source and binary forms, with or without modification,
|
||||||
** are permitted provided that the following conditions are met:
|
** are permitted provided that the following conditions are met:
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
** @attention
|
** @attention
|
||||||
**
|
**
|
||||||
** Copyright (c) 2014 Ac6
|
** <h2><center>© COPYRIGHT(c) 2014 Ac6</center></h2>
|
||||||
**
|
**
|
||||||
** Redistribution and use in source and binary forms, with or without modification,
|
** Redistribution and use in source and binary forms, with or without modification,
|
||||||
** are permitted provided that the following conditions are met:
|
** are permitted provided that the following conditions are met:
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
** @attention
|
** @attention
|
||||||
**
|
**
|
||||||
** Copyright (c) 2014 Ac6
|
** <h2><center>© COPYRIGHT(c) 2014 Ac6</center></h2>
|
||||||
**
|
**
|
||||||
** Redistribution and use in source and binary forms, with or without modification,
|
** Redistribution and use in source and binary forms, with or without modification,
|
||||||
** are permitted provided that the following conditions are met:
|
** are permitted provided that the following conditions are met:
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
** @attention
|
** @attention
|
||||||
**
|
**
|
||||||
** Copyright (c) 2014 Ac6
|
** <h2><center>© COPYRIGHT(c) 2014 Ac6</center></h2>
|
||||||
**
|
**
|
||||||
** Redistribution and use in source and binary forms, with or without modification,
|
** Redistribution and use in source and binary forms, with or without modification,
|
||||||
** are permitted provided that the following conditions are met:
|
** are permitted provided that the following conditions are met:
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
** @attention
|
** @attention
|
||||||
**
|
**
|
||||||
** Copyright (c) 2014 Ac6
|
** <h2><center>© COPYRIGHT(c) 2014 Ac6</center></h2>
|
||||||
**
|
**
|
||||||
** Redistribution and use in source and binary forms, with or without modification,
|
** Redistribution and use in source and binary forms, with or without modification,
|
||||||
** are permitted provided that the following conditions are met:
|
** are permitted provided that the following conditions are met:
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
* Copyright (c) 2017 STMicroelectronics.
|
* <h2><center>© Copyright (c) 2017 STMicroelectronics.
|
||||||
* All rights reserved.
|
* All rights reserved.</center></h2>
|
||||||
*
|
*
|
||||||
* This software component is licensed by ST under BSD 3-Clause license,
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
* the "License"; You may not use this file except in compliance with the
|
* the "License"; You may not use this file except in compliance with the
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
** @attention
|
** @attention
|
||||||
**
|
**
|
||||||
** Copyright (c) 2019 STMicroelectronics
|
** <h2><center>© COPYRIGHT(c) 2019 STMicroelectronics</center></h2>
|
||||||
**
|
**
|
||||||
** Redistribution and use in source and binary forms, with or without modification,
|
** Redistribution and use in source and binary forms, with or without modification,
|
||||||
** are permitted provided that the following conditions are met:
|
** are permitted provided that the following conditions are met:
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
* Copyright (c) 2017 STMicroelectronics.
|
* <h2><center>© Copyright (c) 2017 STMicroelectronics.
|
||||||
* All rights reserved.
|
* All rights reserved.</center></h2>
|
||||||
*
|
*
|
||||||
* This software component is licensed by ST under BSD 3-Clause license,
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
* the "License"; You may not use this file except in compliance with the
|
* the "License"; You may not use this file except in compliance with the
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
** @attention
|
** @attention
|
||||||
**
|
**
|
||||||
** Copyright (c) 2014 Ac6
|
** <h2><center>© COPYRIGHT(c) 2014 Ac6</center></h2>
|
||||||
**
|
**
|
||||||
** Redistribution and use in source and binary forms, with or without modification,
|
** Redistribution and use in source and binary forms, with or without modification,
|
||||||
** are permitted provided that the following conditions are met:
|
** are permitted provided that the following conditions are met:
|
||||||
@@ -184,4 +184,4 @@ SECTIONS
|
|||||||
}
|
}
|
||||||
|
|
||||||
.ARM.attributes 0 : { *(.ARM.attributes) }
|
.ARM.attributes 0 : { *(.ARM.attributes) }
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
** @attention
|
** @attention
|
||||||
**
|
**
|
||||||
** Copyright (c) 2019 STMicroelectronics
|
** <h2><center>© COPYRIGHT(c) 2019 STMicroelectronics</center></h2>
|
||||||
**
|
**
|
||||||
** Redistribution and use in source and binary forms, with or without modification,
|
** Redistribution and use in source and binary forms, with or without modification,
|
||||||
** are permitted provided that the following conditions are met:
|
** are permitted provided that the following conditions are met:
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
** @attention
|
** @attention
|
||||||
**
|
**
|
||||||
** Copyright (c) 2019 STMicroelectronics
|
** <h2><center>© COPYRIGHT(c) 2019 STMicroelectronics</center></h2>
|
||||||
**
|
**
|
||||||
** Redistribution and use in source and binary forms, with or without modification,
|
** Redistribution and use in source and binary forms, with or without modification,
|
||||||
** are permitted provided that the following conditions are met:
|
** are permitted provided that the following conditions are met:
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
** @attention
|
** @attention
|
||||||
**
|
**
|
||||||
** Copyright (c) 2019 STMicroelectronics
|
** <h2><center>© COPYRIGHT(c) 2019 STMicroelectronics</center></h2>
|
||||||
**
|
**
|
||||||
** Redistribution and use in source and binary forms, with or without modification,
|
** Redistribution and use in source and binary forms, with or without modification,
|
||||||
** are permitted provided that the following conditions are met:
|
** are permitted provided that the following conditions are met:
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
* Copyright (c) 2017 STMicroelectronics.
|
* <h2><center>© Copyright (c) 2017 STMicroelectronics.
|
||||||
* All rights reserved.
|
* All rights reserved.</center></h2>
|
||||||
*
|
*
|
||||||
* This software component is licensed by ST under BSD 3-Clause license,
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
* the "License"; You may not use this file except in compliance with the
|
* the "License"; You may not use this file except in compliance with the
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
** @attention
|
** @attention
|
||||||
**
|
**
|
||||||
** Copyright (c) 2019 STMicroelectronics
|
** <h2><center>© COPYRIGHT(c) 2019 STMicroelectronics</center></h2>
|
||||||
**
|
**
|
||||||
** Redistribution and use in source and binary forms, with or without modification,
|
** Redistribution and use in source and binary forms, with or without modification,
|
||||||
** are permitted provided that the following conditions are met:
|
** are permitted provided that the following conditions are met:
|
||||||
|
|||||||
@@ -13,8 +13,8 @@
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
* Copyright (c) 2020 STMicroelectronics.
|
* <h2><center>© Copyright (c) 2020 STMicroelectronics.
|
||||||
* All rights reserved.
|
* All rights reserved.</center></h2>
|
||||||
*
|
*
|
||||||
* This software component is licensed by ST under BSD 3-Clause license,
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
* the "License"; You may not use this file except in compliance with the
|
* the "License"; You may not use this file except in compliance with the
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
* Copyright (c) 2017 STMicroelectronics.
|
* <h2><center>© Copyright (c) 2017 STMicroelectronics.
|
||||||
* All rights reserved.
|
* All rights reserved.</center></h2>
|
||||||
*
|
*
|
||||||
* This software component is licensed by ST under BSD 3-Clause license,
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
* the "License"; You may not use this file except in compliance with the
|
* the "License"; You may not use this file except in compliance with the
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
** @attention
|
** @attention
|
||||||
**
|
**
|
||||||
** Copyright (c) 2014 Ac6
|
** <h2><center>© COPYRIGHT(c) 2014 Ac6</center></h2>
|
||||||
**
|
**
|
||||||
** Redistribution and use in source and binary forms, with or without modification,
|
** Redistribution and use in source and binary forms, with or without modification,
|
||||||
** are permitted provided that the following conditions are met:
|
** are permitted provided that the following conditions are met:
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
** @attention
|
** @attention
|
||||||
**
|
**
|
||||||
** Copyright (c) 2014 Ac6
|
** <h2><center>© COPYRIGHT(c) 2014 Ac6</center></h2>
|
||||||
**
|
**
|
||||||
** Redistribution and use in source and binary forms, with or without modification,
|
** Redistribution and use in source and binary forms, with or without modification,
|
||||||
** are permitted provided that the following conditions are met:
|
** are permitted provided that the following conditions are met:
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
* Copyright (c) 2017 STMicroelectronics.
|
* <h2><center>© Copyright (c) 2017 STMicroelectronics.
|
||||||
* All rights reserved.
|
* All rights reserved.</center></h2>
|
||||||
*
|
*
|
||||||
* This software component is licensed by ST under BSD 3-Clause license,
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
* the "License"; You may not use this file except in compliance with the
|
* the "License"; You may not use this file except in compliance with the
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
** @attention
|
** @attention
|
||||||
**
|
**
|
||||||
** Copyright (c) 2019 STMicroelectronics
|
** <h2><center>© COPYRIGHT(c) 2019 STMicroelectronics</center></h2>
|
||||||
**
|
**
|
||||||
** Redistribution and use in source and binary forms, with or without modification,
|
** Redistribution and use in source and binary forms, with or without modification,
|
||||||
** are permitted provided that the following conditions are met:
|
** are permitted provided that the following conditions are met:
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
** @attention
|
** @attention
|
||||||
**
|
**
|
||||||
** Copyright (c) 2014 Ac6
|
** <h2><center>© COPYRIGHT(c) 2014 Ac6</center></h2>
|
||||||
**
|
**
|
||||||
** Redistribution and use in source and binary forms, with or without modification,
|
** Redistribution and use in source and binary forms, with or without modification,
|
||||||
** are permitted provided that the following conditions are met:
|
** are permitted provided that the following conditions are met:
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
* Copyright (c) 2017 STMicroelectronics.
|
* <h2><center>© Copyright (c) 2017 STMicroelectronics.
|
||||||
* All rights reserved.
|
* All rights reserved.</center></h2>
|
||||||
*
|
*
|
||||||
* This software component is licensed by ST under BSD 3-Clause license,
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
* the "License"; You may not use this file except in compliance with the
|
* the "License"; You may not use this file except in compliance with the
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
** @attention
|
** @attention
|
||||||
**
|
**
|
||||||
** Copyright (c) 2014 Ac6
|
** <h2><center>© COPYRIGHT(c) 2014 Ac6</center></h2>
|
||||||
**
|
**
|
||||||
** Redistribution and use in source and binary forms, with or without modification,
|
** Redistribution and use in source and binary forms, with or without modification,
|
||||||
** are permitted provided that the following conditions are met:
|
** are permitted provided that the following conditions are met:
|
||||||
@@ -184,4 +184,4 @@ SECTIONS
|
|||||||
}
|
}
|
||||||
|
|
||||||
.ARM.attributes 0 : { *(.ARM.attributes) }
|
.ARM.attributes 0 : { *(.ARM.attributes) }
|
||||||
}
|
}
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
** @attention
|
** @attention
|
||||||
**
|
**
|
||||||
** Copyright (c) 2014 Ac6
|
** <h2><center>© COPYRIGHT(c) 2014 Ac6</center></h2>
|
||||||
**
|
**
|
||||||
** Redistribution and use in source and binary forms, with or without modification,
|
** Redistribution and use in source and binary forms, with or without modification,
|
||||||
** are permitted provided that the following conditions are met:
|
** are permitted provided that the following conditions are met:
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
** @attention
|
** @attention
|
||||||
**
|
**
|
||||||
** Copyright (c) 2014 Ac6
|
** <h2><center>© COPYRIGHT(c) 2014 Ac6</center></h2>
|
||||||
**
|
**
|
||||||
** Redistribution and use in source and binary forms, with or without modification,
|
** Redistribution and use in source and binary forms, with or without modification,
|
||||||
** are permitted provided that the following conditions are met:
|
** are permitted provided that the following conditions are met:
|
||||||
|
|||||||
@@ -13,8 +13,8 @@
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
* Copyright (c) 2020 STMicroelectronics.
|
* <h2><center>© Copyright (c) 2020 STMicroelectronics.
|
||||||
* All rights reserved.
|
* All rights reserved.</center></h2>
|
||||||
*
|
*
|
||||||
* This software component is licensed by ST under BSD 3-Clause license,
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
* the "License"; You may not use this file except in compliance with the
|
* the "License"; You may not use this file except in compliance with the
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
** @attention
|
** @attention
|
||||||
**
|
**
|
||||||
** Copyright (c) 2019 STMicroelectronics
|
** <h2><center>© COPYRIGHT(c) 2019 STMicroelectronics</center></h2>
|
||||||
**
|
**
|
||||||
** Redistribution and use in source and binary forms, with or without modification,
|
** Redistribution and use in source and binary forms, with or without modification,
|
||||||
** are permitted provided that the following conditions are met:
|
** are permitted provided that the following conditions are met:
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
* Copyright (c) 2017 STMicroelectronics.
|
* <h2><center>© Copyright (c) 2017 STMicroelectronics.
|
||||||
* All rights reserved.
|
* All rights reserved.</center></h2>
|
||||||
*
|
*
|
||||||
* This software component is licensed by ST under BSD 3-Clause license,
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
* the "License"; You may not use this file except in compliance with the
|
* the "License"; You may not use this file except in compliance with the
|
||||||
@@ -493,4 +493,4 @@
|
|||||||
#endif /* __STM32F4xx_HAL_CONF_H */
|
#endif /* __STM32F4xx_HAL_CONF_H */
|
||||||
|
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
** @attention
|
** @attention
|
||||||
**
|
**
|
||||||
** Copyright (c) 2019 STMicroelectronics
|
** <h2><center>© COPYRIGHT(c) 2019 STMicroelectronics</center></h2>
|
||||||
**
|
**
|
||||||
** Redistribution and use in source and binary forms, with or without modification,
|
** Redistribution and use in source and binary forms, with or without modification,
|
||||||
** are permitted provided that the following conditions are met:
|
** are permitted provided that the following conditions are met:
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
* Copyright (c) 2017 STMicroelectronics.
|
* <h2><center>© Copyright (c) 2017 STMicroelectronics.
|
||||||
* All rights reserved.
|
* All rights reserved.</center></h2>
|
||||||
*
|
*
|
||||||
* This software component is licensed by ST under BSD 3-Clause license,
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
* the "License"; You may not use this file except in compliance with the
|
* the "License"; You may not use this file except in compliance with the
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
** @attention
|
** @attention
|
||||||
**
|
**
|
||||||
** Copyright (c) 2019 STMicroelectronics
|
** <h2><center>© COPYRIGHT(c) 2019 STMicroelectronics</center></h2>
|
||||||
**
|
**
|
||||||
** Redistribution and use in source and binary forms, with or without modification,
|
** Redistribution and use in source and binary forms, with or without modification,
|
||||||
** are permitted provided that the following conditions are met:
|
** are permitted provided that the following conditions are met:
|
||||||
|
|||||||
@@ -47,150 +47,150 @@ different_out_dir = not (output_examples_dir == input_examples_dir)
|
|||||||
#----------------------------------------------
|
#----------------------------------------------
|
||||||
def process_file(subdir: str, filename: str):
|
def process_file(subdir: str, filename: str):
|
||||||
#----------------------------------------------
|
#----------------------------------------------
|
||||||
global filenum
|
global filenum
|
||||||
filenum += 1
|
filenum += 1
|
||||||
|
|
||||||
print(str(filenum) + ' ' + filename + ': ' + subdir)
|
print(str(filenum) + ' ' + filename + ': ' + subdir)
|
||||||
|
|
||||||
def_line = (def_macro_name + ' "' + subdir.replace('\\', '/') + '"')
|
def_line = (def_macro_name + ' "' + subdir.replace('\\', '/') + '"')
|
||||||
|
|
||||||
#------------------------
|
#------------------------
|
||||||
# Read file
|
# Read file
|
||||||
#------------------------
|
#------------------------
|
||||||
lines = []
|
lines = []
|
||||||
infilepath = Path(input_examples_dir, subdir, filename)
|
infilepath = Path(input_examples_dir, subdir, filename)
|
||||||
try:
|
try:
|
||||||
# UTF-8 because some files contain unicode chars
|
# UTF-8 because some files contain unicode chars
|
||||||
with infilepath.open('rt', encoding="utf-8") as infile:
|
with infilepath.open('rt', encoding="utf-8") as infile:
|
||||||
lines = infile.readlines()
|
lines = infile.readlines()
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('Failed to read file: ' + str(e) )
|
print('Failed to read file: ' + str(e) )
|
||||||
raise Exception
|
raise Exception
|
||||||
|
|
||||||
lines = [line.rstrip('\r\n') for line in lines]
|
lines = [line.rstrip('\r\n') for line in lines]
|
||||||
|
|
||||||
#------------------------
|
#------------------------
|
||||||
# Process lines
|
# Process lines
|
||||||
#------------------------
|
#------------------------
|
||||||
file_modified = False
|
file_modified = False
|
||||||
|
|
||||||
# region state machine
|
# region state machine
|
||||||
# -1 = before pragma once;
|
# -1 = before pragma once;
|
||||||
# 0 = region to place define;
|
# 0 = region to place define;
|
||||||
# 1 = past region to place define
|
# 1 = past region to place define
|
||||||
region = -1
|
region = -1
|
||||||
|
|
||||||
outlines = []
|
outlines = []
|
||||||
for line in lines:
|
for line in lines:
|
||||||
outline = line
|
outline = line
|
||||||
|
|
||||||
if (region == -1) and (def_macro_name in line):
|
if (region == -1) and (def_macro_name in line):
|
||||||
outline = None
|
outline = None
|
||||||
file_modified = True
|
file_modified = True
|
||||||
|
|
||||||
elif (region == -1) and ('pragma once' in line):
|
elif (region == -1) and ('pragma once' in line):
|
||||||
region = 0
|
region = 0
|
||||||
|
|
||||||
elif (region == 0):
|
elif (region == 0):
|
||||||
if (line.strip() == ''):
|
if (line.strip() == ''):
|
||||||
pass
|
pass
|
||||||
elif (def_macro_name in line):
|
elif (def_macro_name in line):
|
||||||
region = 1
|
region = 1
|
||||||
if line == def_line: # leave it as is
|
if line == def_line: # leave it as is
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
outline = def_line
|
outline = def_line
|
||||||
file_modified = True
|
file_modified = True
|
||||||
else: # some other string
|
else: # some other string
|
||||||
outlines.append(def_line)
|
outlines.append(def_line)
|
||||||
outlines.append('')
|
outlines.append('')
|
||||||
region = 1
|
region = 1
|
||||||
file_modified = True
|
file_modified = True
|
||||||
|
|
||||||
elif (region == 1):
|
elif (region == 1):
|
||||||
if (def_macro_name in line):
|
if (def_macro_name in line):
|
||||||
outline = None
|
outline = None
|
||||||
file_modified = True
|
file_modified = True
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# end if
|
# end if
|
||||||
if outline is not None:
|
if outline is not None:
|
||||||
outlines.append(outline)
|
outlines.append(outline)
|
||||||
# end for
|
# end for
|
||||||
|
|
||||||
#-------------------------
|
#-------------------------
|
||||||
# Output file
|
# Output file
|
||||||
#-------------------------
|
#-------------------------
|
||||||
outdir = Path(output_examples_dir, subdir)
|
outdir = Path(output_examples_dir, subdir)
|
||||||
outfilepath = outdir / filename
|
outfilepath = outdir / filename
|
||||||
|
|
||||||
if file_modified:
|
if file_modified:
|
||||||
# Note: no need to create output dirs, as the initial copy_tree
|
# Note: no need to create output dirs, as the initial copy_tree
|
||||||
# will do that.
|
# will do that.
|
||||||
|
|
||||||
print(' writing ' + str(outfilepath))
|
print(' writing ' + str(outfilepath))
|
||||||
try:
|
try:
|
||||||
# Preserve unicode chars; Avoid CR-LF on Windows.
|
# Preserve unicode chars; Avoid CR-LF on Windows.
|
||||||
with outfilepath.open("w", encoding="utf-8", newline='\n') as outfile:
|
with outfilepath.open("w", encoding="utf-8", newline='\n') as outfile:
|
||||||
outfile.write("\n".join(outlines) + "\n")
|
outfile.write("\n".join(outlines) + "\n")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('Failed to write file: ' + str(e) )
|
print('Failed to write file: ' + str(e) )
|
||||||
raise Exception
|
raise Exception
|
||||||
else:
|
else:
|
||||||
print(' no change for ' + str(outfilepath))
|
print(' no change for ' + str(outfilepath))
|
||||||
|
|
||||||
#----------
|
#----------
|
||||||
def main():
|
def main():
|
||||||
#----------
|
#----------
|
||||||
global filenum
|
global filenum
|
||||||
global input_examples_dir
|
global input_examples_dir
|
||||||
global output_examples_dir
|
global output_examples_dir
|
||||||
filenum = 0
|
filenum = 0
|
||||||
|
|
||||||
#--------------------------------
|
#--------------------------------
|
||||||
# Check for requirements
|
# Check for requirements
|
||||||
#--------------------------------
|
#--------------------------------
|
||||||
input_examples_dir = input_examples_dir.strip()
|
input_examples_dir = input_examples_dir.strip()
|
||||||
input_examples_dir = input_examples_dir.rstrip('\\/')
|
input_examples_dir = input_examples_dir.rstrip('\\/')
|
||||||
output_examples_dir = output_examples_dir.strip()
|
output_examples_dir = output_examples_dir.strip()
|
||||||
output_examples_dir = output_examples_dir.rstrip('\\/')
|
output_examples_dir = output_examples_dir.rstrip('\\/')
|
||||||
|
|
||||||
for dir in (input_examples_dir, output_examples_dir):
|
for dir in (input_examples_dir, output_examples_dir):
|
||||||
if not Path(dir).exists():
|
if not Path(dir).exists():
|
||||||
print('Directory not found: ' + dir)
|
print('Directory not found: ' + dir)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
#--------------------------------
|
#--------------------------------
|
||||||
# Copy tree if necessary.
|
# Copy tree if necessary.
|
||||||
#--------------------------------
|
#--------------------------------
|
||||||
# This includes files that are not otherwise included in the
|
# This includes files that are not otherwise included in the
|
||||||
# insertion of the define statement.
|
# insertion of the define statement.
|
||||||
#
|
#
|
||||||
if different_out_dir:
|
if different_out_dir:
|
||||||
print('Copying files to new directory: ' + output_examples_dir)
|
print('Copying files to new directory: ' + output_examples_dir)
|
||||||
try:
|
try:
|
||||||
copy_tree(input_examples_dir, output_examples_dir)
|
copy_tree(input_examples_dir, output_examples_dir)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('Failed to copy directory: ' + str(e) )
|
print('Failed to copy directory: ' + str(e) )
|
||||||
raise Exception
|
raise Exception
|
||||||
|
|
||||||
#-----------------------------
|
#-----------------------------
|
||||||
# Find and process files
|
# Find and process files
|
||||||
#-----------------------------
|
#-----------------------------
|
||||||
len_input_examples_dir = 1 + len(input_examples_dir)
|
len_input_examples_dir = 1 + len(input_examples_dir)
|
||||||
|
|
||||||
for filename in files_to_mod:
|
for filename in files_to_mod:
|
||||||
input_path = Path(input_examples_dir)
|
input_path = Path(input_examples_dir)
|
||||||
filepathlist = input_path.rglob(filename)
|
filepathlist = input_path.rglob(filename)
|
||||||
|
|
||||||
for filepath in filepathlist:
|
for filepath in filepathlist:
|
||||||
fulldirpath = str(filepath.parent)
|
fulldirpath = str(filepath.parent)
|
||||||
subdir = fulldirpath[len_input_examples_dir:]
|
subdir = fulldirpath[len_input_examples_dir:]
|
||||||
|
|
||||||
process_file(subdir, filename)
|
process_file(subdir, filename)
|
||||||
|
|
||||||
#==============
|
#==============
|
||||||
print('--- Starting config-labels ---')
|
print('--- Starting config-labels ---')
|
||||||
|
|||||||
@@ -26,38 +26,38 @@ import sys,struct
|
|||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
def image2bin(image, output_file):
|
def image2bin(image, output_file):
|
||||||
if output_file.endswith(('.c', '.cpp')):
|
if output_file.endswith(('.c', '.cpp')):
|
||||||
f = open(output_file, 'wt')
|
f = open(output_file, 'wt')
|
||||||
is_cpp = True
|
is_cpp = True
|
||||||
f.write("const uint16_t image[%d] = {\n" % (image.size[1] * image.size[0]))
|
f.write("const uint16_t image[%d] = {\n" % (image.size[1] * image.size[0]))
|
||||||
else:
|
else:
|
||||||
f = open(output_file, 'wb')
|
f = open(output_file, 'wb')
|
||||||
is_cpp = False
|
is_cpp = False
|
||||||
pixs = image.load()
|
pixs = image.load()
|
||||||
for y in range(image.size[1]):
|
for y in range(image.size[1]):
|
||||||
for x in range(image.size[0]):
|
for x in range(image.size[0]):
|
||||||
R = pixs[x, y][0] >> 3
|
R = pixs[x, y][0] >> 3
|
||||||
G = pixs[x, y][1] >> 2
|
G = pixs[x, y][1] >> 2
|
||||||
B = pixs[x, y][2] >> 3
|
B = pixs[x, y][2] >> 3
|
||||||
rgb = (R << 11) | (G << 5) | B
|
rgb = (R << 11) | (G << 5) | B
|
||||||
if is_cpp:
|
if is_cpp:
|
||||||
strHex = '0x{0:04X}, '.format(rgb)
|
strHex = '0x{0:04X}, '.format(rgb)
|
||||||
f.write(strHex)
|
f.write(strHex)
|
||||||
else:
|
else:
|
||||||
f.write(struct.pack("B", (rgb & 0xFF)))
|
f.write(struct.pack("B", (rgb & 0xFF)))
|
||||||
f.write(struct.pack("B", (rgb >> 8) & 0xFF))
|
f.write(struct.pack("B", (rgb >> 8) & 0xFF))
|
||||||
if is_cpp:
|
if is_cpp:
|
||||||
f.write("\n")
|
f.write("\n")
|
||||||
if is_cpp:
|
if is_cpp:
|
||||||
f.write("};\n")
|
f.write("};\n")
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
if len(sys.argv) <= 2:
|
if len(sys.argv) <= 2:
|
||||||
print("Utility to export a image in Marlin TFT friendly format.")
|
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("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("Usage: gen-tft-image.py INPUT_IMAGE.(png|bmp|jpg) OUTPUT_FILE.(cpp|bin)")
|
||||||
print("Author: rhapsodyv")
|
print("Author: rhapsodyv")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
output_img = sys.argv[2]
|
output_img = sys.argv[2]
|
||||||
img = Image.open(sys.argv[1])
|
img = Image.open(sys.argv[1])
|
||||||
|
|||||||
+276
-276
@@ -25,320 +25,320 @@ import MarlinBinaryProtocol
|
|||||||
#-----------------#
|
#-----------------#
|
||||||
def Upload(source, target, env):
|
def Upload(source, target, env):
|
||||||
|
|
||||||
#-------#
|
#-------#
|
||||||
# Debug #
|
# Debug #
|
||||||
#-------#
|
#-------#
|
||||||
Debug = False # Set to True to enable script debug
|
Debug = False # Set to True to enable script debug
|
||||||
def debugPrint(data):
|
def debugPrint(data):
|
||||||
if Debug: print(f"[Debug]: {data}")
|
if Debug: print(f"[Debug]: {data}")
|
||||||
|
|
||||||
#------------------#
|
#------------------#
|
||||||
# Marlin functions #
|
# Marlin functions #
|
||||||
#------------------#
|
#------------------#
|
||||||
def _GetMarlinEnv(marlinEnv, feature):
|
def _GetMarlinEnv(marlinEnv, feature):
|
||||||
if not marlinEnv: return None
|
if not marlinEnv: return None
|
||||||
return marlinEnv[feature] if feature in marlinEnv else None
|
return marlinEnv[feature] if feature in marlinEnv else None
|
||||||
|
|
||||||
#----------------#
|
#----------------#
|
||||||
# Port functions #
|
# Port functions #
|
||||||
#----------------#
|
#----------------#
|
||||||
def _GetUploadPort(env):
|
def _GetUploadPort(env):
|
||||||
debugPrint('Autodetecting upload port...')
|
debugPrint('Autodetecting upload port...')
|
||||||
env.AutodetectUploadPort(env)
|
env.AutodetectUploadPort(env)
|
||||||
portName = env.subst('$UPLOAD_PORT')
|
portName = env.subst('$UPLOAD_PORT')
|
||||||
if not portName:
|
if not portName:
|
||||||
raise Exception('Error detecting the upload port.')
|
raise Exception('Error detecting the upload port.')
|
||||||
debugPrint('OK')
|
debugPrint('OK')
|
||||||
return portName
|
return portName
|
||||||
|
|
||||||
#-------------------------#
|
#-------------------------#
|
||||||
# Simple serial functions #
|
# Simple serial functions #
|
||||||
#-------------------------#
|
#-------------------------#
|
||||||
def _OpenPort():
|
def _OpenPort():
|
||||||
# Open serial port
|
# Open serial port
|
||||||
if port.is_open: return
|
if port.is_open: return
|
||||||
debugPrint('Opening upload port...')
|
debugPrint('Opening upload port...')
|
||||||
port.open()
|
port.open()
|
||||||
port.reset_input_buffer()
|
port.reset_input_buffer()
|
||||||
debugPrint('OK')
|
debugPrint('OK')
|
||||||
|
|
||||||
def _ClosePort():
|
def _ClosePort():
|
||||||
# Open serial port
|
# Open serial port
|
||||||
if port is None: return
|
if port is None: return
|
||||||
if not port.is_open: return
|
if not port.is_open: return
|
||||||
debugPrint('Closing upload port...')
|
debugPrint('Closing upload port...')
|
||||||
port.close()
|
port.close()
|
||||||
debugPrint('OK')
|
debugPrint('OK')
|
||||||
|
|
||||||
def _Send(data):
|
def _Send(data):
|
||||||
debugPrint(f'>> {data}')
|
debugPrint(f'>> {data}')
|
||||||
strdata = bytearray(data, 'utf8') + b'\n'
|
strdata = bytearray(data, 'utf8') + b'\n'
|
||||||
port.write(strdata)
|
port.write(strdata)
|
||||||
time.sleep(0.010)
|
time.sleep(0.010)
|
||||||
|
|
||||||
def _Recv():
|
def _Recv():
|
||||||
clean_responses = []
|
clean_responses = []
|
||||||
responses = port.readlines()
|
responses = port.readlines()
|
||||||
for Resp in responses:
|
for Resp in responses:
|
||||||
# Suppress invalid chars (coming from debug info)
|
# Suppress invalid chars (coming from debug info)
|
||||||
try:
|
try:
|
||||||
clean_response = Resp.decode('utf8').rstrip().lstrip()
|
clean_response = Resp.decode('utf8').rstrip().lstrip()
|
||||||
clean_responses.append(clean_response)
|
clean_responses.append(clean_response)
|
||||||
debugPrint(f'<< {clean_response}')
|
debugPrint(f'<< {clean_response}')
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
return clean_responses
|
return clean_responses
|
||||||
|
|
||||||
#------------------#
|
#------------------#
|
||||||
# SDCard functions #
|
# SDCard functions #
|
||||||
#------------------#
|
#------------------#
|
||||||
def _CheckSDCard():
|
def _CheckSDCard():
|
||||||
debugPrint('Checking SD card...')
|
debugPrint('Checking SD card...')
|
||||||
_Send('M21')
|
_Send('M21')
|
||||||
Responses = _Recv()
|
Responses = _Recv()
|
||||||
if len(Responses) < 1 or not any('SD card ok' in r for r in Responses):
|
if len(Responses) < 1 or not any('SD card ok' in r for r in Responses):
|
||||||
raise Exception('Error accessing SD card')
|
raise Exception('Error accessing SD card')
|
||||||
debugPrint('SD Card OK')
|
debugPrint('SD Card OK')
|
||||||
return True
|
return True
|
||||||
|
|
||||||
#----------------#
|
#----------------#
|
||||||
# File functions #
|
# File functions #
|
||||||
#----------------#
|
#----------------#
|
||||||
def _GetFirmwareFiles(UseLongFilenames):
|
def _GetFirmwareFiles(UseLongFilenames):
|
||||||
debugPrint('Get firmware files...')
|
debugPrint('Get firmware files...')
|
||||||
_Send(f"M20 F{'L' if UseLongFilenames else ''}")
|
_Send(f"M20 F{'L' if UseLongFilenames else ''}")
|
||||||
Responses = _Recv()
|
Responses = _Recv()
|
||||||
if len(Responses) < 3 or not any('file list' in r for r in Responses):
|
if len(Responses) < 3 or not any('file list' in r for r in Responses):
|
||||||
raise Exception('Error getting firmware files')
|
raise Exception('Error getting firmware files')
|
||||||
debugPrint('OK')
|
debugPrint('OK')
|
||||||
return Responses
|
return Responses
|
||||||
|
|
||||||
def _FilterFirmwareFiles(FirmwareList, UseLongFilenames):
|
def _FilterFirmwareFiles(FirmwareList, UseLongFilenames):
|
||||||
Firmwares = []
|
Firmwares = []
|
||||||
for FWFile in FirmwareList:
|
for FWFile in FirmwareList:
|
||||||
# For long filenames take the 3rd column of the firmwares list
|
# For long filenames take the 3rd column of the firmwares list
|
||||||
if UseLongFilenames:
|
if UseLongFilenames:
|
||||||
Space = 0
|
Space = 0
|
||||||
Space = FWFile.find(' ')
|
Space = FWFile.find(' ')
|
||||||
if Space >= 0: Space = FWFile.find(' ', Space + 1)
|
if Space >= 0: Space = FWFile.find(' ', Space + 1)
|
||||||
if Space >= 0: FWFile = FWFile[Space + 1:]
|
if Space >= 0: FWFile = FWFile[Space + 1:]
|
||||||
if not '/' in FWFile and '.BIN' in FWFile.upper():
|
if not '/' in FWFile and '.BIN' in FWFile.upper():
|
||||||
Firmwares.append(FWFile[:FWFile.upper().index('.BIN') + 4])
|
Firmwares.append(FWFile[:FWFile.upper().index('.BIN') + 4])
|
||||||
return Firmwares
|
return Firmwares
|
||||||
|
|
||||||
def _RemoveFirmwareFile(FirmwareFile):
|
def _RemoveFirmwareFile(FirmwareFile):
|
||||||
_Send(f'M30 /{FirmwareFile}')
|
_Send(f'M30 /{FirmwareFile}')
|
||||||
Responses = _Recv()
|
Responses = _Recv()
|
||||||
Removed = len(Responses) >= 1 and any('File deleted' in r for r in Responses)
|
Removed = len(Responses) >= 1 and any('File deleted' in r for r in Responses)
|
||||||
if not Removed:
|
if not Removed:
|
||||||
raise Exception(f"Firmware file '{FirmwareFile}' not removed")
|
raise Exception(f"Firmware file '{FirmwareFile}' not removed")
|
||||||
return Removed
|
return Removed
|
||||||
|
|
||||||
def _RollbackUpload(FirmwareFile):
|
def _RollbackUpload(FirmwareFile):
|
||||||
if not rollback: return
|
if not rollback: return
|
||||||
print(f"Rollback: trying to delete firmware '{FirmwareFile}'...")
|
print(f"Rollback: trying to delete firmware '{FirmwareFile}'...")
|
||||||
_OpenPort()
|
_OpenPort()
|
||||||
# Wait for SD card release
|
# Wait for SD card release
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
# Remount SD card
|
# Remount SD card
|
||||||
_CheckSDCard()
|
_CheckSDCard()
|
||||||
print(' OK' if _RemoveFirmwareFile(FirmwareFile) else ' Error!')
|
print(' OK' if _RemoveFirmwareFile(FirmwareFile) else ' Error!')
|
||||||
_ClosePort()
|
_ClosePort()
|
||||||
|
|
||||||
|
|
||||||
#---------------------#
|
#---------------------#
|
||||||
# Callback Entrypoint #
|
# Callback Entrypoint #
|
||||||
#---------------------#
|
#---------------------#
|
||||||
port = None
|
port = None
|
||||||
protocol = None
|
protocol = None
|
||||||
filetransfer = None
|
filetransfer = None
|
||||||
rollback = False
|
rollback = False
|
||||||
|
|
||||||
# Get Marlin evironment vars
|
# Get Marlin evironment vars
|
||||||
MarlinEnv = env['MARLIN_FEATURES']
|
MarlinEnv = env['MARLIN_FEATURES']
|
||||||
marlin_pioenv = _GetMarlinEnv(MarlinEnv, 'PIOENV')
|
marlin_pioenv = _GetMarlinEnv(MarlinEnv, 'PIOENV')
|
||||||
marlin_motherboard = _GetMarlinEnv(MarlinEnv, 'MOTHERBOARD')
|
marlin_motherboard = _GetMarlinEnv(MarlinEnv, 'MOTHERBOARD')
|
||||||
marlin_board_info_name = _GetMarlinEnv(MarlinEnv, 'BOARD_INFO_NAME')
|
marlin_board_info_name = _GetMarlinEnv(MarlinEnv, 'BOARD_INFO_NAME')
|
||||||
marlin_board_custom_build_flags = _GetMarlinEnv(MarlinEnv, 'BOARD_CUSTOM_BUILD_FLAGS')
|
marlin_board_custom_build_flags = _GetMarlinEnv(MarlinEnv, 'BOARD_CUSTOM_BUILD_FLAGS')
|
||||||
marlin_firmware_bin = _GetMarlinEnv(MarlinEnv, 'FIRMWARE_BIN')
|
marlin_firmware_bin = _GetMarlinEnv(MarlinEnv, 'FIRMWARE_BIN')
|
||||||
marlin_long_filename_host_support = _GetMarlinEnv(MarlinEnv, 'LONG_FILENAME_HOST_SUPPORT') is not None
|
marlin_long_filename_host_support = _GetMarlinEnv(MarlinEnv, 'LONG_FILENAME_HOST_SUPPORT') is not None
|
||||||
marlin_longname_write = _GetMarlinEnv(MarlinEnv, 'LONG_FILENAME_WRITE_SUPPORT') is not None
|
marlin_longname_write = _GetMarlinEnv(MarlinEnv, 'LONG_FILENAME_WRITE_SUPPORT') is not None
|
||||||
marlin_custom_firmware_upload = _GetMarlinEnv(MarlinEnv, 'CUSTOM_FIRMWARE_UPLOAD') is not None
|
marlin_custom_firmware_upload = _GetMarlinEnv(MarlinEnv, 'CUSTOM_FIRMWARE_UPLOAD') is not None
|
||||||
marlin_short_build_version = _GetMarlinEnv(MarlinEnv, 'SHORT_BUILD_VERSION')
|
marlin_short_build_version = _GetMarlinEnv(MarlinEnv, 'SHORT_BUILD_VERSION')
|
||||||
marlin_string_config_h_author = _GetMarlinEnv(MarlinEnv, 'STRING_CONFIG_H_AUTHOR')
|
marlin_string_config_h_author = _GetMarlinEnv(MarlinEnv, 'STRING_CONFIG_H_AUTHOR')
|
||||||
|
|
||||||
# Get firmware upload params
|
# Get firmware upload params
|
||||||
upload_firmware_source_name = str(source[0]) # Source firmware filename
|
upload_firmware_source_name = str(source[0]) # Source firmware filename
|
||||||
upload_speed = env['UPLOAD_SPEED'] if 'UPLOAD_SPEED' in env else 115200
|
upload_speed = env['UPLOAD_SPEED'] if 'UPLOAD_SPEED' in env else 115200
|
||||||
# baud rate of serial connection
|
# baud rate of serial connection
|
||||||
upload_port = _GetUploadPort(env) # Serial port to use
|
upload_port = _GetUploadPort(env) # Serial port to use
|
||||||
|
|
||||||
# Set local upload params
|
# Set local upload params
|
||||||
upload_firmware_target_name = os.path.basename(upload_firmware_source_name)
|
upload_firmware_target_name = os.path.basename(upload_firmware_source_name)
|
||||||
# Target firmware filename
|
# Target firmware filename
|
||||||
upload_timeout = 1000 # Communication timout, lossy/slow connections need higher values
|
upload_timeout = 1000 # Communication timout, lossy/slow connections need higher values
|
||||||
upload_blocksize = 512 # Transfer block size. 512 = Autodetect
|
upload_blocksize = 512 # Transfer block size. 512 = Autodetect
|
||||||
upload_compression = True # Enable compression
|
upload_compression = True # Enable compression
|
||||||
upload_error_ratio = 0 # Simulated corruption ratio
|
upload_error_ratio = 0 # Simulated corruption ratio
|
||||||
upload_test = False # Benchmark the serial link without storing the file
|
upload_test = False # Benchmark the serial link without storing the file
|
||||||
upload_reset = True # Trigger a soft reset for firmware update after the upload
|
upload_reset = True # Trigger a soft reset for firmware update after the upload
|
||||||
|
|
||||||
# Set local upload params based on board type to change script behavior
|
# Set local upload params based on board type to change script behavior
|
||||||
# "upload_delete_old_bins": delete all *.bin files in the root of SD Card
|
# "upload_delete_old_bins": delete all *.bin files in the root of SD Card
|
||||||
upload_delete_old_bins = marlin_motherboard in ['BOARD_CREALITY_V4', 'BOARD_CREALITY_V4210', 'BOARD_CREALITY_V422', 'BOARD_CREALITY_V423',
|
upload_delete_old_bins = marlin_motherboard in ['BOARD_CREALITY_V4', 'BOARD_CREALITY_V4210', 'BOARD_CREALITY_V422', 'BOARD_CREALITY_V423',
|
||||||
'BOARD_CREALITY_V427', 'BOARD_CREALITY_V431', 'BOARD_CREALITY_V452', 'BOARD_CREALITY_V453',
|
'BOARD_CREALITY_V427', 'BOARD_CREALITY_V431', 'BOARD_CREALITY_V452', 'BOARD_CREALITY_V453',
|
||||||
'BOARD_CREALITY_V24S1']
|
'BOARD_CREALITY_V24S1']
|
||||||
# "upload_random_name": generate a random 8.3 firmware filename to upload
|
# "upload_random_name": generate a random 8.3 firmware filename to upload
|
||||||
upload_random_filename = marlin_motherboard in ['BOARD_CREALITY_V4', 'BOARD_CREALITY_V4210', 'BOARD_CREALITY_V422', 'BOARD_CREALITY_V423',
|
upload_random_filename = marlin_motherboard in ['BOARD_CREALITY_V4', 'BOARD_CREALITY_V4210', 'BOARD_CREALITY_V422', 'BOARD_CREALITY_V423',
|
||||||
'BOARD_CREALITY_V427', 'BOARD_CREALITY_V431', 'BOARD_CREALITY_V452', 'BOARD_CREALITY_V453',
|
'BOARD_CREALITY_V427', 'BOARD_CREALITY_V431', 'BOARD_CREALITY_V452', 'BOARD_CREALITY_V453',
|
||||||
'BOARD_CREALITY_V24S1'] and not marlin_long_filename_host_support
|
'BOARD_CREALITY_V24S1'] and not marlin_long_filename_host_support
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
# Start upload job
|
# Start upload job
|
||||||
print(f"Uploading firmware '{os.path.basename(upload_firmware_target_name)}' to '{marlin_motherboard}' via '{upload_port}'")
|
print(f"Uploading firmware '{os.path.basename(upload_firmware_target_name)}' to '{marlin_motherboard}' via '{upload_port}'")
|
||||||
|
|
||||||
# Dump some debug info
|
# Dump some debug info
|
||||||
if Debug:
|
if Debug:
|
||||||
print('Upload using:')
|
print('Upload using:')
|
||||||
print('---- Marlin -----------------------------------')
|
print('---- Marlin -----------------------------------')
|
||||||
print(f' PIOENV : {marlin_pioenv}')
|
print(f' PIOENV : {marlin_pioenv}')
|
||||||
print(f' SHORT_BUILD_VERSION : {marlin_short_build_version}')
|
print(f' SHORT_BUILD_VERSION : {marlin_short_build_version}')
|
||||||
print(f' STRING_CONFIG_H_AUTHOR : {marlin_string_config_h_author}')
|
print(f' STRING_CONFIG_H_AUTHOR : {marlin_string_config_h_author}')
|
||||||
print(f' MOTHERBOARD : {marlin_motherboard}')
|
print(f' MOTHERBOARD : {marlin_motherboard}')
|
||||||
print(f' BOARD_INFO_NAME : {marlin_board_info_name}')
|
print(f' BOARD_INFO_NAME : {marlin_board_info_name}')
|
||||||
print(f' CUSTOM_BUILD_FLAGS : {marlin_board_custom_build_flags}')
|
print(f' CUSTOM_BUILD_FLAGS : {marlin_board_custom_build_flags}')
|
||||||
print(f' FIRMWARE_BIN : {marlin_firmware_bin}')
|
print(f' FIRMWARE_BIN : {marlin_firmware_bin}')
|
||||||
print(f' LONG_FILENAME_HOST_SUPPORT : {marlin_long_filename_host_support}')
|
print(f' LONG_FILENAME_HOST_SUPPORT : {marlin_long_filename_host_support}')
|
||||||
print(f' LONG_FILENAME_WRITE_SUPPORT : {marlin_longname_write}')
|
print(f' LONG_FILENAME_WRITE_SUPPORT : {marlin_longname_write}')
|
||||||
print(f' CUSTOM_FIRMWARE_UPLOAD : {marlin_custom_firmware_upload}')
|
print(f' CUSTOM_FIRMWARE_UPLOAD : {marlin_custom_firmware_upload}')
|
||||||
print('---- Upload parameters ------------------------')
|
print('---- Upload parameters ------------------------')
|
||||||
print(f' Source : {upload_firmware_source_name}')
|
print(f' Source : {upload_firmware_source_name}')
|
||||||
print(f' Target : {upload_firmware_target_name}')
|
print(f' Target : {upload_firmware_target_name}')
|
||||||
print(f' Port : {upload_port} @ {upload_speed} baudrate')
|
print(f' Port : {upload_port} @ {upload_speed} baudrate')
|
||||||
print(f' Timeout : {upload_timeout}')
|
print(f' Timeout : {upload_timeout}')
|
||||||
print(f' Block size : {upload_blocksize}')
|
print(f' Block size : {upload_blocksize}')
|
||||||
print(f' Compression : {upload_compression}')
|
print(f' Compression : {upload_compression}')
|
||||||
print(f' Error ratio : {upload_error_ratio}')
|
print(f' Error ratio : {upload_error_ratio}')
|
||||||
print(f' Test : {upload_test}')
|
print(f' Test : {upload_test}')
|
||||||
print(f' Reset : {upload_reset}')
|
print(f' Reset : {upload_reset}')
|
||||||
print('-----------------------------------------------')
|
print('-----------------------------------------------')
|
||||||
|
|
||||||
# Custom implementations based on board parameters
|
# Custom implementations based on board parameters
|
||||||
# Generate a new 8.3 random filename
|
# Generate a new 8.3 random filename
|
||||||
if upload_random_filename:
|
if upload_random_filename:
|
||||||
upload_firmware_target_name = f"fw-{''.join(random.choices('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', k=5))}.BIN"
|
upload_firmware_target_name = f"fw-{''.join(random.choices('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', k=5))}.BIN"
|
||||||
print(f"Board {marlin_motherboard}: Overriding firmware filename to '{upload_firmware_target_name}'")
|
print(f"Board {marlin_motherboard}: Overriding firmware filename to '{upload_firmware_target_name}'")
|
||||||
|
|
||||||
# Delete all *.bin files on the root of SD Card (if flagged)
|
# Delete all *.bin files on the root of SD Card (if flagged)
|
||||||
if upload_delete_old_bins:
|
if upload_delete_old_bins:
|
||||||
# CUSTOM_FIRMWARE_UPLOAD is needed for this feature
|
# CUSTOM_FIRMWARE_UPLOAD is needed for this feature
|
||||||
if not marlin_custom_firmware_upload:
|
if not marlin_custom_firmware_upload:
|
||||||
raise Exception(f"CUSTOM_FIRMWARE_UPLOAD must be enabled in 'Configuration_adv.h' for '{marlin_motherboard}'")
|
raise Exception(f"CUSTOM_FIRMWARE_UPLOAD must be enabled in 'Configuration_adv.h' for '{marlin_motherboard}'")
|
||||||
|
|
||||||
# Init & Open serial port
|
# Init & Open serial port
|
||||||
port = serial.Serial(upload_port, baudrate = upload_speed, write_timeout = 0, timeout = 0.1)
|
port = serial.Serial(upload_port, baudrate = upload_speed, write_timeout = 0, timeout = 0.1)
|
||||||
_OpenPort()
|
_OpenPort()
|
||||||
|
|
||||||
# Check SD card status
|
# Check SD card status
|
||||||
_CheckSDCard()
|
_CheckSDCard()
|
||||||
|
|
||||||
# Get firmware files
|
# Get firmware files
|
||||||
FirmwareFiles = _GetFirmwareFiles(marlin_long_filename_host_support)
|
FirmwareFiles = _GetFirmwareFiles(marlin_long_filename_host_support)
|
||||||
if Debug:
|
if Debug:
|
||||||
for FirmwareFile in FirmwareFiles:
|
for FirmwareFile in FirmwareFiles:
|
||||||
print(f'Found: {FirmwareFile}')
|
print(f'Found: {FirmwareFile}')
|
||||||
|
|
||||||
# Get all 1st level firmware files (to remove)
|
# Get all 1st level firmware files (to remove)
|
||||||
OldFirmwareFiles = _FilterFirmwareFiles(FirmwareFiles[1:len(FirmwareFiles)-2], marlin_long_filename_host_support) # Skip header and footers of list
|
OldFirmwareFiles = _FilterFirmwareFiles(FirmwareFiles[1:len(FirmwareFiles)-2], marlin_long_filename_host_support) # Skip header and footers of list
|
||||||
if len(OldFirmwareFiles) == 0:
|
if len(OldFirmwareFiles) == 0:
|
||||||
print('No old firmware files to delete')
|
print('No old firmware files to delete')
|
||||||
else:
|
else:
|
||||||
print(f"Remove {len(OldFirmwareFiles)} old firmware file{'s' if len(OldFirmwareFiles) != 1 else ''}:")
|
print(f"Remove {len(OldFirmwareFiles)} old firmware file{'s' if len(OldFirmwareFiles) != 1 else ''}:")
|
||||||
for OldFirmwareFile in OldFirmwareFiles:
|
for OldFirmwareFile in OldFirmwareFiles:
|
||||||
print(f" -Removing- '{OldFirmwareFile}'...")
|
print(f" -Removing- '{OldFirmwareFile}'...")
|
||||||
print(' OK' if _RemoveFirmwareFile(OldFirmwareFile) else ' Error!')
|
print(' OK' if _RemoveFirmwareFile(OldFirmwareFile) else ' Error!')
|
||||||
|
|
||||||
# Close serial
|
# Close serial
|
||||||
_ClosePort()
|
_ClosePort()
|
||||||
|
|
||||||
# Cleanup completed
|
# Cleanup completed
|
||||||
debugPrint('Cleanup completed')
|
debugPrint('Cleanup completed')
|
||||||
|
|
||||||
# WARNING! The serial port must be closed here because the serial transfer that follow needs it!
|
# WARNING! The serial port must be closed here because the serial transfer that follow needs it!
|
||||||
|
|
||||||
# Upload firmware file
|
# Upload firmware file
|
||||||
debugPrint(f"Copy '{upload_firmware_source_name}' --> '{upload_firmware_target_name}'")
|
debugPrint(f"Copy '{upload_firmware_source_name}' --> '{upload_firmware_target_name}'")
|
||||||
protocol = MarlinBinaryProtocol.Protocol(upload_port, upload_speed, upload_blocksize, float(upload_error_ratio), int(upload_timeout))
|
protocol = MarlinBinaryProtocol.Protocol(upload_port, upload_speed, upload_blocksize, float(upload_error_ratio), int(upload_timeout))
|
||||||
#echologger = MarlinBinaryProtocol.EchoProtocol(protocol)
|
#echologger = MarlinBinaryProtocol.EchoProtocol(protocol)
|
||||||
protocol.connect()
|
protocol.connect()
|
||||||
# Mark the rollback (delete broken transfer) from this point on
|
# Mark the rollback (delete broken transfer) from this point on
|
||||||
rollback = True
|
rollback = True
|
||||||
filetransfer = MarlinBinaryProtocol.FileTransferProtocol(protocol)
|
filetransfer = MarlinBinaryProtocol.FileTransferProtocol(protocol)
|
||||||
transferOK = filetransfer.copy(upload_firmware_source_name, upload_firmware_target_name, upload_compression, upload_test)
|
transferOK = filetransfer.copy(upload_firmware_source_name, upload_firmware_target_name, upload_compression, upload_test)
|
||||||
protocol.disconnect()
|
protocol.disconnect()
|
||||||
|
|
||||||
# Notify upload completed
|
# Notify upload completed
|
||||||
protocol.send_ascii('M117 Firmware uploaded' if transferOK else 'M117 Firmware upload failed')
|
protocol.send_ascii('M117 Firmware uploaded' if transferOK else 'M117 Firmware upload failed')
|
||||||
|
|
||||||
# Remount SD card
|
# Remount SD card
|
||||||
print('Wait for SD card release...')
|
print('Wait for SD card release...')
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
print('Remount SD card')
|
print('Remount SD card')
|
||||||
protocol.send_ascii('M21')
|
protocol.send_ascii('M21')
|
||||||
|
|
||||||
# Transfer failed?
|
# Transfer failed?
|
||||||
if not transferOK:
|
if not transferOK:
|
||||||
protocol.shutdown()
|
protocol.shutdown()
|
||||||
_RollbackUpload(upload_firmware_target_name)
|
_RollbackUpload(upload_firmware_target_name)
|
||||||
else:
|
else:
|
||||||
# Trigger firmware update
|
# Trigger firmware update
|
||||||
if upload_reset:
|
if upload_reset:
|
||||||
print('Trigger firmware update...')
|
print('Trigger firmware update...')
|
||||||
protocol.send_ascii('M997', True)
|
protocol.send_ascii('M997', True)
|
||||||
protocol.shutdown()
|
protocol.shutdown()
|
||||||
|
|
||||||
print('Firmware update completed' if transferOK else 'Firmware update failed')
|
print('Firmware update completed' if transferOK else 'Firmware update failed')
|
||||||
return 0 if transferOK else -1
|
return 0 if transferOK else -1
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print('Aborted by user')
|
print('Aborted by user')
|
||||||
if filetransfer: filetransfer.abort()
|
if filetransfer: filetransfer.abort()
|
||||||
if protocol:
|
if protocol:
|
||||||
protocol.disconnect()
|
protocol.disconnect()
|
||||||
protocol.shutdown()
|
protocol.shutdown()
|
||||||
_RollbackUpload(upload_firmware_target_name)
|
_RollbackUpload(upload_firmware_target_name)
|
||||||
_ClosePort()
|
_ClosePort()
|
||||||
raise
|
raise
|
||||||
|
|
||||||
except serial.SerialException as se:
|
except serial.SerialException as se:
|
||||||
# This exception is raised only for send_ascii data (not for binary transfer)
|
# This exception is raised only for send_ascii data (not for binary transfer)
|
||||||
print(f'Serial excepion: {se}, transfer aborted')
|
print(f'Serial excepion: {se}, transfer aborted')
|
||||||
if protocol:
|
if protocol:
|
||||||
protocol.disconnect()
|
protocol.disconnect()
|
||||||
protocol.shutdown()
|
protocol.shutdown()
|
||||||
_RollbackUpload(upload_firmware_target_name)
|
_RollbackUpload(upload_firmware_target_name)
|
||||||
_ClosePort()
|
_ClosePort()
|
||||||
raise Exception(se)
|
raise Exception(se)
|
||||||
|
|
||||||
except MarlinBinaryProtocol.FatalError:
|
except MarlinBinaryProtocol.FatalError:
|
||||||
print('Too many retries, transfer aborted')
|
print('Too many retries, transfer aborted')
|
||||||
if protocol:
|
if protocol:
|
||||||
protocol.disconnect()
|
protocol.disconnect()
|
||||||
protocol.shutdown()
|
protocol.shutdown()
|
||||||
_RollbackUpload(upload_firmware_target_name)
|
_RollbackUpload(upload_firmware_target_name)
|
||||||
_ClosePort()
|
_ClosePort()
|
||||||
raise
|
raise
|
||||||
|
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
print(f"\nException: {ex}, transfer aborted")
|
print(f"\nException: {ex}, transfer aborted")
|
||||||
if protocol:
|
if protocol:
|
||||||
protocol.disconnect()
|
protocol.disconnect()
|
||||||
protocol.shutdown()
|
protocol.shutdown()
|
||||||
_RollbackUpload(upload_firmware_target_name)
|
_RollbackUpload(upload_firmware_target_name)
|
||||||
_ClosePort()
|
_ClosePort()
|
||||||
print('Firmware not updated')
|
print('Firmware not updated')
|
||||||
raise
|
raise
|
||||||
|
|
||||||
# Attach custom upload callback
|
# Attach custom upload callback
|
||||||
env.Replace(UPLOADCMD=Upload)
|
env.Replace(UPLOADCMD=Upload)
|
||||||
|
|||||||
Reference in New Issue
Block a user