jakkra / ZSWatch

ZSWatch - the Open Source Zephyr™ based Smartwatch, including both HW and FW.
https://forms.gle/G48Sm5zDe9aCaYtT9
GNU General Public License v3.0
2.18k stars 178 forks source link

Generic history for different sensors #263

Closed Kampi closed 1 month ago

Kampi commented 2 months ago

First idea and not tested.

Kampi commented 2 months ago

Looks awesome!

But doesn´t work yet :D

jakkra commented 1 month ago

I think we should include num_stored_samples in the zsw_history_t to allow the user to know how many of the samples are actually valid. Since the num param today is always the max number of samples. Or can num be changed to actually reflect the number of valid samples?

jakkra commented 1 month ago

I think we should include num_stored_samples in the zsw_history_t to allow the user to know how many of the samples are actually valid. Since the num param today is always the max number of samples. Or can num be changed to actually reflect the number of valid samples?

Because in the battery app now it plots all samples, which are all 0 so it's hard to see anything.

Kampi commented 1 month ago

I think we should include num_stored_samples in the zsw_history_t to allow the user to know how many of the samples are actually valid. Since the num param today is always the max number of samples. Or can num be changed to actually reflect the number of valid samples?

Because in the battery app now it plots all samples, which are all 0 so it's hard to see anything.

I think we should keep num (but rename it to length) to have an indicator about the maximum length. Then we add a sample counter. Or we can use write_index for it?

jakkra commented 1 month ago

I think we should include num_stored_samples in the zsw_history_t to allow the user to know how many of the samples are actually valid. Since the num param today is always the max number of samples. Or can num be changed to actually reflect the number of valid samples?

Because in the battery app now it plots all samples, which are all 0 so it's hard to see anything.

I think we should keep num (but rename it to length) to have an indicator about the maximum length. Then we add a sample counter. Or we can use write_index for it?

Sounds good, or even max_samples or sample_buffer_size so it's clear it's a different length

jakkra commented 1 month ago

Not working yet

Kampi commented 1 month ago

What's the issue?

jakkra commented 1 month ago

What's the issue?

I thunk the get sample function I did not get correct. IMG20240524204938

jakkra commented 1 month ago

Ok, it's my voltage compressions int mV => byte which is bad, nothing wrong with history code I think. And a bug in get sampel i.

Now fixed