-
Notifications
You must be signed in to change notification settings - Fork 21
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
[WIP] Feature/#2 accelerometer #53
Conversation
@endian-albin If you wanna try on your watch. |
hypnos/src/accelerometer.c
Outdated
LOG_DBG("Accelerometer init: Done"); | ||
} | ||
|
||
void accelerometer_show_health_data() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't call it "health" data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed it
@@ -126,17 +127,21 @@ void button_pressed_isr(struct device *gpiobtn, struct gpio_callback *cb, uint32 | |||
bt_on(); | |||
} | |||
gfx_update(); | |||
backlight_enable(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's probably better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thought, this appears to make the GUI feel less responsive. I prefer to have the screen light up fast, even if some data and graphics have not yet been updated. Please compare yourself by putting backlight_enable(true);
before clock_increment_local_time();
I understand that this is a work-in-progress branch, but rather than restoring the state with 7baaf2a ("Remove mess from dts"), it's better to delete the commit that introduced the change in the first place. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's really cool that you've made the accelerometer work this well. It needs to be cleaned up a bit, both to conform with the coding style and to make each commit meaningful (you can use interactive rebase to fix the latter). In addition, I'd like this to be interrupt driven before merging. Right now, the step counter gets disabled if you switch between BT mode on or off. I'd be happy to have a look again after you've worked on this a bit more.
drivers/sensor/bma421/bma421.c
Outdated
} else { | ||
switch((u16_t)chan) { | ||
case SENSOR_CHAN_ACCEL_X: | ||
// val->val1 = drv_data->accel_data.x; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use only C89-style comments (Zephyr style guidelines).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
hypnos/src/accelerometer.c
Outdated
} | ||
|
||
snprintf(step_label_str, 32, "%d steps", step_count.val1); | ||
snprintf(temperature_label_str, 32, "%d'C", temperature.val1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The degrees symbol ° should be available in ASCII.
We discussed the accelerometer in the PineTime Matrix chat today and it was mentioned that a lot of things can be done without the so-called "configuration", but not step counting for example. |
Alright.. So I will write MY own blob, with credit on my name and give that to the project. All nicely documented.. Would that be okay to have that config file here then ? |
I’m no lawyer, but if you could somehow, without violating copyright law, write a documented application that generates the blob, then it should be OK I think. Such a tool would also be beneficial to the other PineTime projects by the way. Using information that’s been made available without violating an NDA that you’ve signed yourself or stealing should be fine I believe. Thanks again for your efforts! |
* Copy work from Daniel Thompson/Bosch Sensor Tech * Trying to use it as it is. Signed-off-by: Stephane Dorre <[email protected]>
* Seems to work now * Need to make sense of the values * Need to test step counter * implements #48 Signed-off-by: Stephane Dorre <[email protected]>
Signed-off-by: Stephane Dorre <[email protected]>
Signed-off-by: Stephane Dorre <[email protected]>
* Fetch data from the BMA421 driver * Update screen with new value Signed-off-by: Stephane Dorre <[email protected]>
7baaf2a
to
d04b486
Compare
I don't get The step counter is disabled when we disable/enable BLE.. I. tried to generate a new config blob. Could you try on your side if that step counter still work for you as well ? |
* take review comments into account Signed-off-by: Stephane Dorre <[email protected]>
Signed-off-by: Stephane Dorre <[email protected]>
The physical button toggles BLE advertising (and switches between two different threads. When I tested your code the last time, step counting always worked in the initial state, before BLE had been enabled by pressing the button, but it stopped incrementing the counter after pressing it.
No, it always stays at 0 unfortunately. The temperature value varies though. Does it work for you? What is your setup by the way? |
I've now tested two commits a couple of times. Checking out, building and flashing "Add custom config blob" gives me a constant |
Okay. that is what I feared: The 5000+ following bytes would then be the initialization sequence of the internal ASIC and I guess provided by Bosch Sensor Tech directly.. Is that really impossible to use a blob ? If you think there is no solution to get that blob in this FW, I'll make you a simple accelerometer driver.. but I really don't like the idea of computing steps directly on the main uC. |
I see. Would these still be useful if we excluded the undocumented bytes?
Right, so it's a plain blob used to obscure how the hardware works.
There are two reasons why I don't want blobs in this project: 1) for philosophical reasons (I'm a Free Software supporter); 2) I want to work with upstream projects and eventually mainline all the out-of-tree drivers. I doubt blobs can be sent to upstream Zephyr.
How about dropping the steps counter feature for now and focus on other accelerometer features? It was mentioned in the Matrix chat that a lift-to-wake (light up the display) feature could be developed using timer interrupts every 100 ms or so that checks the XYZ values. Apparently, there is no explicit hardware support available for such a feature and so the implementation would need to be done this way anyway. Personally, I don't care about a step counter, but it would be really nice if the screen lights up by itself exactly when you want to look at it. I'm sure there are other features beside this that could be implemented without the blob. What do you think? |
More discussion took place on the PineTime chat tonight. The BMA421 blob used is apparently not under the BSD-3-Clause license but under a very restrictive license that we can certainly not redistribute. The author of the ATC1441 firmware also mentioned that he had rewritten the accelerometer library from scratch and integrated it directly with his Arduino-based project. |
Signed-off-by: Stephane Dorre <[email protected]>
Signed-off-by: Stephane Dorre <[email protected]>
Signed-off-by: Stephane Dorre <[email protected]>
Signed-off-by: Stephane Dorre <[email protected]>
Signed-off-by: Stephane Dorre <[email protected]>
Signed-off-by: Stephane Dorre <[email protected]>
Import files from Bosch BMA4 library.
Prototypes that shows step counter and sensor temperature on screen
Fixes #48
TODO: