You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## 4. Checking the data for anomalies with the `uv_alarm` function
85
+
86
+
In this task, you will implement the `uv_alarm` function to determine whether an alarm should be triggered based on UV light exposure levels and sensor activity.
87
+
The `uv_alarm` function should use the provided `uv_light_heuristic` function, which operates on a vector of data and returns a value based on certain thresholds.
88
+
This is a mockup version of the complex code that will run during production, please don't change the interface.
89
+
90
+
### Task
91
+
92
+
Define the `uv_alarm` function in the `speedywagon` namespace. It should:
93
+
94
+
- Take a pointer to a `pillar_men_sensor`_struct_ as its parameter.
95
+
- Return `false` if the sensor pointer is null.
96
+
- Call the `uv_light_heuristic` function, passing the address of the sensor's `data` array.
97
+
- Return `true` if the value returned by `uv_light_heuristic` is greater than the `sensor->activity` level, otherwise return `false`.
98
+
84
99
## Wrapping Up
85
100
86
101
You’ve been entrusted with an essential task for the Speedywagon Foundation.
87
102
By testing for valid sensor connections, counting activity, and implementing alarm controls, you’ve ensured that the Foundation's battle against the Pillar Men can continue uninterrupted.
88
103
89
104
As a modern C++ engineer, you’d prefer using smart pointers, but alas, legacy code demands respect for the old ways.
90
105
The fate of humanity may rest on these pointers, so proceed carefully, and may the Hamon energy guide you.
0 commit comments