kscheff / BlueBasic

BASIC interpreter for CC2540 and CC2541 Bluetooth LE chips
11 stars 9 forks source link

keyword MIN_CONN_INTERVAL confuses the parser #5

Closed kscheff closed 5 years ago

kscheff commented 7 years ago

Using the constant MIN_CONN_INTERVAL in a program leads to undesired behavior

10 BTPOKE MIN_CONN_INTERVAL, 24
20 BTPOKE MAX_CONN_INTERVAL, 24
LIST
10 BTPOKE MIN_CONN_INTERVAL, 24
 BTPOKE MAX_CONN_INTERVAL, 24
20 BTPOKE MAX_CONN_INTERVAL, 24
OK
RUN
Bad expression
>> 10 BTPOKE MIN_CONN_INTERVAL, 24
 BTPOKE MAX_CONN_INTERVAL, 24

MIN_CONN_INTERVAL is defined in keyword_tables.h as the last keyword in keywords_12[]. This might lead to this behavior, MAX_CONN_INTERVAL works fine.

Workaround: use directly the constant 0x311 for MIN_CONN_INTERVAL e.g.

10 BTPOKE 0X311, 24
20 BTPOKE MAX_CONN_INTERVAL, 24
LIST
10 BTPOKE 0X311, 24
20 BTPOKE MAX_CONN_INTERVAL, 24
OK
RUN
OK
kscheff commented 5 years ago

not used...