mirror of https://github.com/Desuuuu/klipper.git
command: Allow count parameter of DECL_ENUMERATION_RANGE() to be an expression
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
84fd89b8cf
commit
7d014933ce
|
@ -86,12 +86,9 @@ class HandleEnumerations:
|
||||||
enum, name, value = req.split()[1:]
|
enum, name, value = req.split()[1:]
|
||||||
self.add_enumeration(enum, name, decode_integer(value))
|
self.add_enumeration(enum, name, decode_integer(value))
|
||||||
def decl_enumeration_range(self, req):
|
def decl_enumeration_range(self, req):
|
||||||
enum, name, count, value = req.split()[1:]
|
enum, name, value, count = req.split()[1:]
|
||||||
try:
|
vc = (decode_integer(value), decode_integer(count))
|
||||||
count = int(count, 0)
|
self.add_enumeration(enum, name, vc)
|
||||||
except ValueError as e:
|
|
||||||
error("Invalid enumeration count in '%s'" % (req,))
|
|
||||||
self.add_enumeration(enum, name, (decode_integer(value), count))
|
|
||||||
def decl_static_str(self, req):
|
def decl_static_str(self, req):
|
||||||
msg = req.split(None, 1)[1]
|
msg = req.split(None, 1)[1]
|
||||||
if msg not in self.static_strings:
|
if msg not in self.static_strings:
|
||||||
|
|
|
@ -25,8 +25,8 @@
|
||||||
#define DECL_ENUMERATION(ENUM, NAME, VALUE) \
|
#define DECL_ENUMERATION(ENUM, NAME, VALUE) \
|
||||||
DECL_CTR_INT("_DECL_ENUMERATION " ENUM " " NAME, 1, CTR_INT(VALUE))
|
DECL_CTR_INT("_DECL_ENUMERATION " ENUM " " NAME, 1, CTR_INT(VALUE))
|
||||||
#define DECL_ENUMERATION_RANGE(ENUM, NAME, VALUE, COUNT) \
|
#define DECL_ENUMERATION_RANGE(ENUM, NAME, VALUE, COUNT) \
|
||||||
DECL_CTR_INT("_DECL_ENUMERATION_RANGE " ENUM " " NAME \
|
DECL_CTR_INT("_DECL_ENUMERATION_RANGE " ENUM " " NAME, \
|
||||||
" " __stringify(COUNT), 1, CTR_INT(VALUE))
|
2, CTR_INT(VALUE), CTR_INT(COUNT))
|
||||||
|
|
||||||
// Send an output message (and declare a static message type for it)
|
// Send an output message (and declare a static message type for it)
|
||||||
#define output(FMT, args...) \
|
#define output(FMT, args...) \
|
||||||
|
|
Loading…
Reference in New Issue