-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Deprecate blocking read sensor APIs #70651
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
If you have one application that has blocking read, and convert that to this new async. method, can you list the RAM and flash usages for both of these so the 2 can be compared? |
Generally what you will find, past the really simple temp sensor polled once in a great long while type setups... is a cost add in rom and cost reduction in ram from what I've seen. There's some things we haven't done to minimize that rom cost add and potentially reduce ram usage even further. |
Sensor WG:
|
Is there a reasoning behind the exclusive usage of fixed-point floats instead of native float? A lot of modern cores, especially the popular "consumer" ones, have a FPU and using FP-floats might even be slower on these systems than using native f32. |
The reasoning is mostly overhead for the driver implementors. You're free to use
In your case, we could easily cast the q31 to floats by creating a mirror struct (it would look roughly like this): struct sensor_three_axis_data {
struct sensor_header;
struct sensor_three_axis_sample_data {
uint32_t timestamp_offset;
int8_t shift;
union {
q31_t values[3];
struct {
q31_t x;
q31_t y;
q31_t z;
};
};
};
#ifdef CONFIG_FPU
struct sensor_three_axis_float_data {
struct sensor_header;
struct sensor_three_axis_float_sample_data {
uint32_t timestamp_offset;
union {
float values[3];
struct {
float x;
float y;
float z;
};
};
};
static inline void sensor_three_axis_data_to_float(
const struct sensor_three_axis_data *src,
struct sensor_three_axis_float_data *dst
) {
...
}
#endif |
WG 05/06/2024 Top level doc lays out pieces, and terminology, what each thing does at a high level. Followed by a story driven documentation around solving sensor related problems...
These docs can tie in both the driver API (how it helps build a foundation to solving these problems) leading into the subsystem and how it allows for additional features in our vision. Subsystem leads to...
Doxygen provides the nitty gritty of what is there and how it works. |
@yperess I have a few questions on the legacy sensor API deprecation proposal:
|
Putting my updated thoughts on this issue for continuity: In the context of #86835 I think we should agree on what the ultimate plan is:
My impression based on what's been discussed is that we want developers to use and adopt the read/decode API, however I think (from a code-size/execution aspect) it may not make sense to deprecate one and not the other. Let me explain:
To get aligned, I suggest the following plan of action:
|
I'm not sure I agree. I see your concern about the bloat of these intermediate steps (1) fallback submit implementation and (2) deprecated API shim. But I think that with the size of this migration there's no way around it. I guess my point is that whatever the benchmarking says, do we really think it's best to keep both APIs around? I would think not, the maintenance and overhead of writing drivers that support both is very big. I would say instead, we should be focusing on how can we get through the migration as quickly as possible so that overhead is short lived. I 100% agree that we should have someone own the migration. I'm happy to volunteer. And we need to be able to demonstrate that we're making good progress on that migration during every release. The roadmap I'd like to see is:
|
I'd like to present the following to the Architecture WG as a first step Sensor async API migration.pdf (this might not be the final slide deck, just the current draft. I'll post here any updates.) |
@yperess when would be a good date for you? |
Any day of the Arch WG works for me. Whenever you have time to squeeze me in. |
What about adding #77100 as another soft requirement? |
Introduction
The introduction of the asynchronous sensor read and stream APIs have resolved a lot of the previous issues involved with sensors. Though at the current state of things, there are 2 different ways for applications to read sensor data. The redundancy becomes the burden of the driver authors. In order to alleviate this, we propose that after the upcoming 3.7 LTS release, we deprecate the following functions:
sensor_sample_fetch()
sensor_sample_fetch_chan()
sensor_channel_get()
The first two functions can be replaced by the asynchronous
sensor_read()
functionality, while the latter is replaced by the decoder API. In order to deprecate these, the following conditions must be met:Hard requirements:
sensor_read()
. This function (sensor_read_blocking()
will allow developers to migrate more easily by effectively fetching, waiting, and decoding). We should also have a backwards compatibility function to convert the new q31_t values to the legacy sensor_value struct such that apps have the easiest time migrating to the new APIs.Soft requirements:
The above are considered "soft" requirements, because they're only hard requirements for streaming implementations. We could deprecate the existing fetch/get paths without them.
Enhancements:
The text was updated successfully, but these errors were encountered: