`eval` in BLE callback resets board
-
I have some code like this:
def exec_handler(chr): try: result = eval(command_buffer) except Exception as e: result = "{}: - {}".format(type(e).__name__, e) print("Exec result: '{}'".format(result))exec_handleris set as the callback for a characteristic write event.If I pass it something like
1 + 1or"hello" * 5it works fine.If I pass it something more complex like
list(range(10))orpycom.rgbled(0xff0000), the board resets.If I call the handler directly from the REPL, it works fine in all cases I have tried.
Any ideas where I'm doing something wrong or if it's a firmware bug?
(sysname='WiPy', nodename='WiPy', release='1.6.7.b1', version='v1.8.6-493-g99ac80fe on 2017-03-03', machine='WiPy with E SP32') -
We just got some expansion boards in, so I could upgrade the firmware, and now it seems to work.
(sysname='WiPy', nodename='WiPy', release='1.7.3.b2', version='v1.8.6-667-gea97eb7e on 2017-06-16', machine='WiPy with E SP32') -
So this morning when I tried again it still doesn't work for
pycom.rgbled(...).list(range(30))works now, and everything else seems to work. Syntax errors and name errors seem to work fine, buteval'ingpycom.rgbled(0xff0000)makes the board restart. -
-
Yes. I disable the heartbeat and set a color as part of the BLE initialization.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login