Closed rbaron closed 1 year ago
Hey @jhbruhn, I implemented support for the nRF52833 variant, but I don't have one to test. As you worked on #13, can I bug you to help me test it when you have some time?
I added some instructions on how to build in this PR's description (just use --board bparasite_nrf52833
instead), or you can also get some pre-built binaries as product of the workflow runs on this branch (example). Inside the sample-binaries
artifact there's a ble_nrf52833_bthomev1.hex
that's hopefully convenient. It uses a 10m sleep interval with the BTHome v1 BLE encoding (just like the one implemented in the legacy app).
Oh this looks very nice! I don't know when I have the time to test this as I got a lot on my plate right now, but I also have some b-parasites waiting for their coating and then deployment with the new firmware revision (and nrf52833), so I'll test it there.
I noticed that the code does not support LDRs anymore. I have a lot of old b-parasites with a photoresistor and would love to flash the new firmware to these as well, do you think we can bring back the functions for that? They are unfortunately also using a different Pin for the resistor than the 1.2.0 boards are using for the phototransistor, but it looks like this can easily be fixed through the different board configurations in this project?
@jhbruhn I think I found a nice way to do it. I added board revisions for 1.0.0
, 1.1.0
(with LDR) and 1.2.0
(with phototransistor). We can just select the variant + revision in the VSCode UI:
For building from the command line, we can just append @$revision
to the --board
switch. For example to build for nRF52833@1.1.0 using the BTHome v1 protocol with sleep time of 1s for quick testing:
$ docker run --rm -v ${PWD}:/code -w /code/samples/ble nordicplayground/nrfconnect-sdk:v2.1-branch west build --build-dir ./build --pristine --board bparasite_nrf52833@1.1.0 -- -DCONFIG_PRST_BLE_ENCODING_BTHOME_V1=y -DCONFIG_PRST_SLEEP_DURATION_SEC=1
I had started on the same effort, but this is much nicer than what I have. Kudos for the reusable lib part and the board revisions. Awesome addition to an awesome project.
Thanks for the kind words @kzyapkov. I will finish writing the updated docs and merge this in.
Tks for trying this out @jhbruhn. I will take a closer look today. From the logs it looks like the ADC channels are not set up properly (in addition too the wrong fast discharge pin).
Did you build the firmware with VSCode or Docker? For the 1.1.0 revision, right?
This PR rewrites all the code from the legacy nRF SDK to the nRF Connect SDK. I will keep pushing updates to this PR and merge it when all tasks are finished and tested. I am only going for feature parity with this rewrite, but I'm factoring out a common core that can be reused in different applications/samples.
All help is welcome in testing the parts that are already implemented.
Tasks
code/nrf-connect/prstlib/boards/arm/bparasite_nrf52840/
)code/nrf-connect/prstlib/boards/arm/bparasite_nrf52833/
)code/nrf-connect/prstlib
)code/nrf-connect/samples/blinky
)code/nrf-connect/samples/soil_read_loop
)code/nrf-connect/samples/ble
) (this is the rewrite of the old firmware)code/b-parasite/
Notes
Building the Samples
With nRF Connect for Desktop + Visual Studio Code
This is the usual way of building the nRF Connect SDK samples. The only caveat is that, for each sample here, you also need to add the
code/nrf-connect/prstlib
directory to your workspace in addition to the sample directory itself. Theprstlib/
contains common source code for reading sensors and also common board definitions. There is a.code-workspace
file inside each sample that does this automatically.With Docker
To build the
ble
sample for thenRF52840
, revision1.2.0
,cd
intocode/nrf-connect/
and run:The output will be in
code/nrf-connect/samples/ble/build/zephyr/zephyr.hex
.[Experimental but super cool] With GitHub Codespaces
GitHub Codespaces let you run an instance of VS Code directly in your browser. More importantly, it also supports plugins, including nRF Connect for VS Code! This PR introduces
.devcontainer/devcontainer.json
, which configures a Codespace with both the nRF VS Code plugin, as well as the whole nRF Connect SDK + toolchain. This lets you edit code and build the sample straight in your browser.rbaron/b-parasite
, branchnrf-connect
code/nrf-connect/samples/ble
, selectble.code-workspace
and click on "Open workspace". This makes sure both theble
sample and theprstlib
are present in the workspaceble/build/zephyr/zephyr.hex
Prebuilt Binaries
The GitHub workflow in this PR clang-format-checks, builds and store the built binaries for all sample as artifacts. You can download them here (example). These are built with the default settings, but we may extend this machinery to build a few variants with different configs for each sample.