[New Feature] I2C position encoder support (#6946)

* [New Feature] I2C position encoder support

I plan to continue improving/cleaning this up, as there areas that need work.

* let the cleanups begin.

* progress

* more progress

* comments, rename files, etc.

* clean

* Cleanups per thinkyhead

* a few more cleanups

* cleanups, bugfixes, etc.

* remove unnecessary passes_test(), additional cleanups/optimizations

* cleanups

* misc.

* Fix up I2CPEM.init() and a few other things.

* organize, fix, rename, etc.

* more optimization

* a few more tweaks
This commit is contained in:
bgort 2017-06-09 08:06:23 -04:00 committed by GitHub
parent f7dacd1f50
commit 2f55870edb
8 changed files with 1684 additions and 17 deletions

View file

@ -128,6 +128,12 @@ public:
return b;
}
static volatile bool seen_any() {
return codebits[3] || codebits[2] || codebits[1] || codebits[0];
}
#define SEEN_TEST(L) TEST(codebits[(L - 'A') >> 3], (L - 'A') & 0x7)
#else
// Code is found in the string. If not found, value_ptr is unchanged.
@ -139,6 +145,12 @@ public:
return b;
}
static volatile bool seen_any() {
return *command_args == '\0';
}
#define SEEN_TEST(L) !!strchr(command_args, L)
#endif // FASTER_GCODE_PARSER
// Populate all fields by parsing a single line of GCode
@ -148,6 +160,13 @@ public:
// Code value pointer was set
FORCE_INLINE static bool has_value() { return value_ptr != NULL; }
// Seen and has value
FORCE_INLINE static bool seenval(const char c) { return seen(c) && has_value(); }
static volatile bool seen_axis() {
return SEEN_TEST('X') || SEEN_TEST('Y') || SEEN_TEST('Z') || SEEN_TEST('E');
}
// Float removes 'E' to prevent scientific notation interpretation
inline static float value_float() {
if (value_ptr) {