cmd_hf_15: fix & simplify flag parsing

This commit is contained in:
Yann GASCUEL 2024-01-24 13:56:38 +01:00
parent 7c44337941
commit 7f666d445c

View file

@ -532,15 +532,13 @@ static uint8_t arg_add_default(void *at[]) {
} }
static uint16_t arg_get_raw_flag(uint8_t uidlen, bool unaddressed, bool scan, bool add_option) { static uint16_t arg_get_raw_flag(uint8_t uidlen, bool unaddressed, bool scan, bool add_option) {
uint16_t flags = 0; uint16_t flags = 0;
if (unaddressed) { ;
// unaddressed mode may not be supported by all vendors if (uidlen == 8 || scan || unaddressed) {
flags |= (ISO15_REQ_SUBCARRIER_SINGLE | ISO15_REQ_DATARATE_HIGH | ISO15_REQ_NONINVENTORY); flags = (ISO15_REQ_SUBCARRIER_SINGLE | ISO15_REQ_DATARATE_HIGH | ISO15_REQ_NONINVENTORY);
} }
if (uidlen == 8) { if ((!unaddressed) || scan)
flags |= (ISO15_REQ_SUBCARRIER_SINGLE | ISO15_REQ_DATARATE_HIGH | ISO15_REQ_NONINVENTORY | ISO15_REQ_ADDRESS); {
} flags |= ISO15_REQ_ADDRESS;
if (scan) {
flags |= (ISO15_REQ_SUBCARRIER_SINGLE | ISO15_REQ_DATARATE_HIGH | ISO15_REQ_NONINVENTORY | ISO15_REQ_ADDRESS);
} }
if (add_option) { if (add_option) {
flags |= (ISO15_REQ_OPTION); flags |= (ISO15_REQ_OPTION);