Commit graph

67 commits

Author SHA1 Message Date
rbaron
9fdd15626a Better error handling for SHTC3 reading 2023-07-15 11:07:35 +02:00
rbaron
c70eb600a3 [zigbee sample] Introduce watchdog for sensor task 2023-07-15 09:45:34 +02:00
rbaron
bc3d834b20 Make it mandatory to select a factory reset method
... in order to avoid unhappy surprises
2023-07-01 08:26:21 +02:00
rbaron
37aff683ad LOG_INF -> LOG_DBG 2023-07-01 08:04:17 +02:00
rbaron
c86f04e406 Nuclear reset option if recurring sensor task cannot be rescheduled
Famous last words: "this should never happen"
2023-07-01 08:04:17 +02:00
rbaron
7f42dd0c00 Add missing prst_led_off after stopping LED flashing timer 2023-07-01 08:04:17 +02:00
rbaron
46feb542cc More fixes to the ZigBee sample
- 🚨 Missing `break` statements in `zboss_signal_handler`
- Makes `zboss_signal_handler` return fast. According to the
  [docs](https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.thread_zigbee.v2.0.0%2Fgroup__zb__comm__signals.html):
  "Signal processing should not do long operations synchronously". I
  removed calls to `prst_flash_led` (essentially a huge sync delay) and `debug_counters_increment`,
  which were blocking. I'll try migrating the debug_counters to
  non-blocking separately
- Main sensor reading task is started for the first time upon
  the `ZB_ZDO_SIGNAL_SKIP_STARTUP` signal. This is what the
  [weather_station sample](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/applications/zigbee_weather_station/README.html) does. It should have no functional difference, but there's [some special handling for alarms started from the ZigBee task](0469247dc4/subsys/zigbee/osif/zb_nrf_platform.c (L426))
2023-07-01 08:04:17 +02:00
rbaron
62a99cc716 Reintroduced accidentally deleted comment 2023-07-01 08:04:17 +02:00
rbaron
90f99bd5b0 Fixes (minor?) issues with the ZigBee sample
1. zigbee_configure_sleepy_behavior must be called before zigbee_enable - [source
docs](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/libraries/zigbee/zigbee_app_utils.html#c.zigbee_configure_sleepy_behavior)

2. zb_zdo_pim_set_long_poll_interval must be called after the network is joined - [source docs](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/zboss/3.5.2.0/group__zdo__poll__control.html#ga3aae8929b30e71c872f937771b89c768).
On top of that, the argument for the call was incorrect - it expects ms directly.

3. Removed the unecessary CONFIG_PM, seems like there's no impact in power consumption. Could it cause some weirdness?

4. Implemented CONFIG_PRST_ZB_FACTORY_RESET_DISABLED=y to fully disable factory resetting. May aid debugging.

5. Implemented multi/single channel support. Helps with battery life when scanning networks
2023-07-01 08:04:15 +02:00
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
Ole Odendahl
20d6c893bf
Added callback for handling identify button action as declared in identify cluster. 2023-03-27 12:20:03 +02: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
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
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
3d68e5c689 Better docs 2022-12-24 10:06:35 +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
Ole Odendahl
580f425b01
Added hardware version config value. 2022-12-18 17:15:58 +01:00
Ole Odendahl
ac8677f3e8
Renamed basic cluster attributes to comply with library defaults. 2022-12-18 17:12:25 +01:00
Ole Odendahl
0933c4a2a6
Fixed default sleep duration in Kconfig to 600s.
Removed specific Kconfig values from prj*.conf files.
2022-12-18 16:57:50 +01:00
Ole Odendahl
412188502b
Changed name of config value for prstlib default log level. 2022-12-18 16:55:32 +01:00
Ole Odendahl
891a63a1b3
Added separate debug config to better separate flags during development. 2022-12-16 13:15:51 +01:00
Ole Odendahl
61729aa81a
Made more basic attributes compile time configurable. 2022-12-16 12:16:42 +01:00
Ole Odendahl
3b91d7525c
Improved basic attribute list to include more properties. 2022-12-16 12:15:36 +01:00
Ole Odendahl
0a3d711787
Fixed bug in cluster list not connecting power cluster. 2022-12-16 12:10:08 +01:00
Ole Odendahl
96e1e85179
Making zigbee main log level configurable. 2022-12-16 11:21:52 +01:00
rbaron
5da4ad836f Update description 2022-12-10 16:52:35 +01:00
rbaron
37237a4301 More accurate power profile 2022-12-10 15:48:02 +01:00