Closed mrquincle closed 2 years ago
Are you sure the crownstone was in setup mode? Because this seems to suggest it wasn't:
raise CrownstoneBleException(BleError.DIFFERENT_MODE_THAN_REQUIRED, f'During the {scanDuration} seconds of scanning, the Crownstone was not in the required mode..')
crownstone_core.Exceptions.CrownstoneBleException: (<BleError.DIFFERENT_MODE_THAN_REQUIRED: 'DIFFERENT_MODE_THAN_REQUIRED'>, 'During the 10 seconds of scanning, the Crownstone was not in the required mode..')
The line refers to https://github.com/mrquincle/csutil/blob/master/csutil#L59
# Wait for setup to finish and the crownstone to reboot in normal mode.
if await core.waitForMode(address, CrownstoneOperationMode.NORMAL, scanDuration=10):
await asyncio.sleep(1)
else:
print("Something went wrong? Crownstone didn't come in normal mode")
I don't understand how you conclude that it's in normal mode.
The python lib works with exceptions, you don't get a boolean return here. See https://github.com/crownstone/crownstone-lib-python-ble/blob/e7c04da4649ba0551dbc1444acac80a4bdd1b432/crownstone_ble/core/CrownstoneBle.py#L199
Then it still is the case that after setup the Crownstone is not in normal mode. Hence, that the setup failed.
PS: You should adjust your example then as well: https://github.com/crownstone/crownstone-lib-python-ble/blob/master/examples/setup_example.md
Good point, I updated the example. Can you check if that works for you?
With the updated example code this works. It would be great to have a bunch of python tools that can be used for these common tasks like setup, factory reset, and eventually updating the firmware or microapps.
Calling
make setup
(aftermake write_config
andmake reset
) calls under the hood in the build directory:The csutil code (https://github.com/mrquincle/csutil) is updated to use all new BLE python stuff with async etc. and is quite similar to https://github.com/crownstone/crownstone-lib-python-ble/blob/master/examples/setup_example.md.
Still, setup doesn't succeed. There's some
ABORT_NOTIFICATION_STREAM_W_ERROR
error on setup.