Commit graph

125 commits

Author SHA1 Message Date
rbaron
5882312a77 [zb] Debugging changes:
- Disables double reset
- Fully reset with zb_reset() on reset watchdog instead of
  user_input_indicate()
- Debug counters before/after sensors read
2023-07-01 08:03:42 +02:00
rbaron
f9f122b818 Formatting 2023-06-27 21:34:49 +02:00
rbaron
d5891f4a6f [ZigBee sample] Implements factory reset via SW1 button (hardware v2.0.0+) 2023-06-27 21:28:56 +02:00
rbaron
56c5fa7ba0
Merge pull request #133 from rbaron/zb_debug_counters
[ZigBee Sample] Introduce debug counters
2023-06-27 19:08:53 +02:00
rbaron
afa53f0e94 Introduce CONFIG_BOARD_REVISION_CODE
Beside having a `CONFIG_BOARD_REVISION` Kconfig string that represents
our semantic versioning for board revisions, the ZigBee sample requires
an integer representation of it. Instead of conditioning the integer
version on the string version only for that sample and having to touch
the ZigBee sample whenever we add a revision, I decided to have a
board-wide config, so that both string and int versions live close to
each other.

Fixes #138.
2023-06-15 07:45:55 +02:00
rbaron
930239e385 Cleanup + double_reset counter 2023-06-07 08:26:05 +02:00
rbaron
015ce94bbd Cleanup 2023-06-07 08:10:23 +02:00
rbaron
987c4f52c0 Removes async debug counters API - not needed 2023-06-07 08:08:34 +02:00
rbaron
509350457f [ZigBee sample] Introduce debug counters
In the effort to increse reliability of the Zigbee sample, #126 and #130
introduced handling for possibly rare, hard-to-debug events that may be
occurring. While these changes seem to help in practive, we don't know
exactly how often, if ever, they are triggered.

This PR introduces debug_counters in hope to add some visilibty in these
hard-to-debug, rare conditions.

Calling `prst_debug_counters_increment("some_counter")` will increment a
value stored in flash. These values are then dumped via logging when the
device boots. Moving forward we can also consider exposing these values
via a ZigBee cluster.
2023-06-07 08:08:34 +02:00
Ole Odendahl
3aa33cdd89
Fixed api of restart watchdog. 2023-06-02 11:39:52 +02:00
Ole Odendahl
ce748c4759
Added restart watchdog timeout to Kconfig. 2023-06-02 11:31:58 +02:00
Ole Odendahl
5cede82dc5
Changing api of restart handler to only expose needed functions.
This encapsulates the low level timer logic from the caller.
2023-06-02 11:16:49 +02:00
Ole Odendahl
9285a6bc41
Added comment to describe nordic funny function name. 2023-06-02 11:15:46 +02:00
Ole Odendahl
6f10dc9e19
Fixed clang format. 2023-06-02 11:07:47 +02:00
Ole Odendahl
c52d5f7a48
Added steering restart handler to signal handler steering branch.
Made the device flash less frequently to save power on unexpected connection drops.
2023-06-02 11:07:47 +02:00
Ole Odendahl
727138415e
Added restart handler module. 2023-06-02 11:07:46 +02:00
Ole Odendahl
69c0ed3694
Separated two signals for better debugging and possibly different handling. 2023-06-02 11:07:46 +02:00
Ole Odendahl
ba786eb298
Moving steering successful flashing to success if branch. 2023-06-02 11:00:17 +02:00
Matthew Dawson
54b1c48638
Implement workaround for errata KRKNWK-12017
Nordic has published an errata for the nRF Connect SDK for versions
>1.8.0 where a Zigbee End Device can end up getting stuck if the
parent device does not acknowledge the "Device Announcement packet".

They have a suggested workaround to implement in the SDK, which has
been adapted for the custom signal handler used here.

This is an effort to solve issues where my parasites would occasionally
drop off my network and require a reboot.  After 24Hrs, I've not yet
had a device disappear but it has taken >weeks before a device would
fail.  Unforunately it's hard to debug the board as the chips are in a
low power state when this occurs.
2023-05-10 10:45:30 -04:00
rbaron
7ac6d98b3b [ble] Make advertising non-connectable
I've been debugging a Shelly [bluetooth
proxy](https://www.home-assistant.io/integrations/shelly/#bluetooth-support)
feature, which didn't like b-parasite's advertising. It swallowed it before proxying it to HA.

I compared to both ATC and the legacy b-parasite advertising
(pre-nrf-connect) and found it to be related to the
non-connectable/non-scannable settings. Until this PR, we were
mistankenly settings the advertising to scannable, although with no
scannable data. The Zephyr code that sets this parameter based on the
scannable data is [here](c0fcd35531/subsys/bluetooth/host/adv.c (L860)).

My bet is that some scanners like ESPHome are okay with this, but Shelly
is not. Either way, I believe this PR makes the advertisements more
compliant.
2023-04-16 12:28:23 +02:00
rbaron
9ff5180cd7
Merge pull request #117 from rbaron/hardware-v2
Version 2.0.0
2023-03-30 19:30:06 +02:00
rbaron
cb40173b6b Remove debug info 2023-03-29 21:46:41 +02:00
rbaron
ebc26fcccd Cleanups 2023-03-29 21:42:41 +02:00
rbaron
e82c1b6bc1 Implements button handling
- DTS bindings
- Debouncing logic
- New `input` for testing and interrupt power profiling
2023-03-29 21:28:24 +02:00
Ole Odendahl
20d6c893bf
Added callback for handling identify button action as declared in identify cluster. 2023-03-27 12:20:03 +02:00
rbaron
02b3970ffc Shorten job names 2023-03-19 16:45:55 +01:00
rbaron
5cc40a41f6 Set calibration coefficients for 2.0.0 2023-03-19 15:06:39 +01:00
rbaron
b34bc60a0a Actually use the devicetree calibration coeffs 2023-03-19 15:06:39 +01:00
rbaron
2f7a25e266 Add devicetree calibration coeffs to nrf52833 board 2023-03-19 15:06:39 +01:00
rbaron
e24530b7c3 Fix devicetree-coeffs bug 2023-03-19 15:06:39 +01:00
rbaron
1983f31af9 Store calibration polynomial in devicetree
This will enable us to transparently use different calibration for
different board revisions. The 2.0.0 revision changes the sensing
circuitry and will need its own coeffs.

In this commit, both models are run in parallel for debugging.
2023-03-19 15:06:39 +01:00
rbaron
dbf288138e Add 2.0.0 board revision & CONFIG_BOARD_REVISION Kconfig 2023-03-19 15:06:39 +01:00
rbaron
5e315ba9cd [ble] Update connection interval docs & power profile
Closes #98
2023-02-12 16:13:55 +01:00
rbaron
7be5fe1669 [ble] Bumps default advertising interval to [30, 40] ms
This makes the BLE sample use the same parameters as the legacy
firmware, and immproves the range.
2023-02-12 16:02:51 +01:00
rbaron
d292190d31
Merge pull request #103 from MJDSys/fix_battery_information 2023-02-02 08:14:47 +01:00
Matthew Dawson
d3bcc13749
Fix battery quantity/size reporting
The API for reporting information requires a pointer to the data value,
and cannot deal with a constant directly.  The current quantity/size
returned by the device are random values from memory.

Instead move these values into the prst_batt_attrs_t struct and
set their values in prst_zb_attrs_init.
2023-02-02 00:43:13 -05:00
rbaron
28db7224a6 Make advertisement intervals configurable
We were previously relying on the default values (100ms, 150ms). This
PR makes it easier to test and configure parameters for different
tradeoffs between range / power consumption (#98).
2023-01-28 11:44:17 +01:00
rbaron
41ba531fba
Merge pull request #101 from MJDSys/zigbee_2.2_sdk 2023-01-23 11:12:55 +01:00
Matthew Dawson
af47848b80
Update Zigbee example to work with SDK 2.2.0
The new SDK requires 802.15.4 to be enabled in the board DTS file.

Also disable IPv6 explicitly to avoid compile errors related to its
network stack, since it is not used currently.

Closes #94
2023-01-22 02:51:24 -05:00
Marvin Rohrbach
ee38d4561a Fix: Counter was missing 2023-01-12 08:12:18 +00:00
rbaron
5d25499ae1 [zb] Implement double-reset factory resetting method 2022-12-27 19:22:01 +01:00
rbaron
8105bfcd7b Ensures sensor-reading callback is always rescheduled 2022-12-26 11:06:26 +01:00
rbaron
98433502af Default PRST_ZB_SLEEP_DURATION_SEC to 60s 2022-12-24 18:37:00 +01:00
rbaron
54792ce35f
Merge pull request #81 from rbaron/zigbee-sample
Introduce an experimental/educactional/exploratory Zigbee firmware sample
2022-12-24 10:29:38 +01:00
rbaron
3d68e5c689 Better docs 2022-12-24 10:06:35 +01:00
rbaron
c76b8dc289 Fix ADC config for nRF52833 2022-12-21 18:40:48 +01:00
rbaron
fe63fda2f1 Setup Kconfig for prstlib 2022-12-19 18:34:03 +01:00
rbaron
c567408861 Fix prst_zb_attrs.c format 2022-12-19 09:33:18 +01:00
Ole Odendahl
54382e3356
Removed log level config from board definition.
Moved prst lib log level config to application layer with prst lib default fallback behaviour.
2022-12-18 21:23:10 +01:00
Ole Odendahl
0f859c77cd
Slightly improved power cluster with more values. 2022-12-18 17:27:43 +01:00