Skip to content
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

✨ (battery): Get battery level #435

Merged
merged 6 commits into from
Jan 21, 2022

Conversation

YannLocatelli
Copy link
Member

@YannLocatelli YannLocatelli commented Jan 20, 2022

  • Validated on robot

@YannLocatelli YannLocatelli self-assigned this Jan 20, 2022
@YannLocatelli YannLocatelli force-pushed the yann/feature/battery/get-battery-level branch from 4c816d0 to 579c891 Compare January 20, 2022 16:02
@codecov
Copy link

codecov bot commented Jan 20, 2022

Codecov Report

Merging #435 (13f0242) into develop (cf8c08c) will not change coverage.
The diff coverage is 100.00%.

❗ Current head 13f0242 differs from pull request most recent head 4a21e39. Consider uploading reports for the commit 4a21e39 to get more accurate results
Impacted file tree graph

@@            Coverage Diff            @@
##           develop      #435   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           68        69    +1     
  Lines         1192      1207   +15     
=========================================
+ Hits          1192      1207   +15     
Impacted Files Coverage Δ
drivers/CoreBattery/include/CoreBattery.h 100.00% <ø> (ø)
drivers/CoreBattery/source/CoreBattery.cpp 100.00% <100.00%> (ø)
include/interface/drivers/Battery.h 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cf8c08c...4a21e39. Read the comment docs.

@github-actions
Copy link

github-actions bot commented Jan 20, 2022

File comparision analysis report

🔖 Info

  • Flash: 2 097 152 Bytes (2048 KiB) / SRAM: 524 288 Bytes (512 KiB)
  • base: develop / d3c95df + mbed-os-6.15.1 + -std=c++20
  • head: yann/feature/battery/get-battery-level / d3c95df + mbed-os-6.15.1 + -std=c++20
  • toolchain: GNU Arm Embedded Toolchain 10.3-2021.10 - 10.3.1 20210824
  • enable_log_debug: ON

📝 Summary

Click to show summary
  • ✔️ - existing target
  • ✨ - new target
  • ⚰️ - deleted target
  • ✅ - files are the same
  • ❌ - files are different
Target Status .bin .map Total Flash (base/head) Total Flash Δ Static RAM (base/head) Static RAM Δ
LekaOS ✔️ 82200 (3%) ø 17472 (3%) ø
bootloader ✔️ 93328 (4%)
93680 (4%)
📈
352 (0%)
26200 (4%) ø
certs_emc_ble_bt_lcd_led_motors ✔️ 251644 (11%) ø 36144 (6%) ø
certs_emc_ble_led_motors ✔️ 191600 (9%) ø 30976 (5%) ø
certs_emc_bt_lcd_qspi_rfid_touch_wifi ✔️ 165248 (7%) ø 28680 (5%) ø
certs_emc_lcd_led_motors ✔️ 91928 (4%) ø 16168 (3%) ø
hardware_motors_test_reduction_and_wheels ✔️ 194032 (9%) ø 30384 (5%) ø
spike_lk_ble ✔️ 183688 (8%) ø 28856 (5%) ø
spike_lk_bluetooth ✔️ 91192 (4%) ø 17472 (3%) ø
spike_lk_cg_animations ✔️ 149336 (7%) ø 30464 (5%) ø
spike_lk_file_manager ✔️ 125884 (6%) ø 19984 (3%) ø
spike_lk_file_reception ✔️ 333692 (15%) ø 25272 (4%) ø
spike_lk_flash_memory ✔️ 87352 (4%) ø 17512 (3%) ø
spike_lk_lcd ✔️ 149808 (7%) ø 30088 (5%) ø
spike_lk_led ✔️ 88808 (4%) ø 19400 (3%) ø
spike_lk_log_kit ✔️ 92000 (4%) ø 18168 (3%) ø
spike_lk_motors ✔️ 86576 (4%) ø 17552 (3%) ø
spike_lk_rfid ✔️ 91008 (4%) ø 17472 (3%) ø
spike_lk_sensors_battery ✔️ 85088 (4%)
85448 (4%)
📈
360 (0%)
17512 (3%) ø
spike_lk_sensors_light ✔️ 84584 (4%) ø 17512 (3%) ø
spike_lk_sensors_microphone ✔️ 85336 (4%) ø 17512 (3%) ø
spike_lk_sensors_temperature_humidity ✔️ 90896 (4%) ø 17496 (3%) ø
spike_lk_sensors_touch ✔️ 92248 (4%) ø 17632 (3%) ø
spike_lk_update_process_app_base ✔️ 143764 (6%) ø 21352 (4%) ø
spike_lk_update_process_app_update ✔️ 100968 (4%) ø 18472 (3%) ø
spike_lk_wifi ✔️ 131280 (6%) ø 20832 (3%) ø
spike_mbed_blinky ✔️ 57968 (2%) ø 11400 (2%) ø
spike_mbed_watchdog_ticker_vs_thread ✔️ 84688 (4%) ø 18448 (3%) ø
spike_stl_cxxsupport ✔️ 84000 (4%) ø 17536 (3%) ø

🗺️ Map files diff output

Click to show diff list
bootloader (click to expand)
--- build_artifacts/base_ref-build-enable_log_debug-ON/bootloader-map.txt	2022-01-21 15:47:51.565441188 +0000
+++ build_artifacts/head_ref-build-enable_log_debug-ON/bootloader-map.txt	2022-01-21 15:47:51.793439879 +0000
@@ -1,18 +1,18 @@
 | Module                 |         .text |       .data |          .bss |
 |------------------------|---------------|-------------|---------------|
-| [fill]                 |     146(+146) |       4(+4) |       28(+28) |
-| [lib]/CoreBattery.a    |     146(+146) |       0(+0) |         0(+0) |
+| [fill]                 |     134(+134) |       4(+4) |       24(+24) |
+| [lib]/CoreBattery.a    |     434(+434) |       0(+0) |         0(+0) |
 | [lib]/bootutil.a       |   5898(+5898) |     16(+16) | 13816(+13816) |
 | [lib]/c.a              | 27020(+27020) | 2472(+2472) |       58(+58) |
 | [lib]/gcc.a            |   3116(+3116) |       0(+0) |         0(+0) |
 | [lib]/mbed-os-static.a | 47468(+47468) |   512(+512) |   8286(+8286) |
 | [lib]/misc             |     188(+188) |       4(+4) |       28(+28) |
 | [lib]/nosys.a          |       32(+32) |       0(+0) |         0(+0) |
 | [lib]/stdc++.a         |         0(+0) |       0(+0) |         0(+0) |
 | default_bd.cpp.obj     |     242(+242) |       0(+0) |     568(+568) |
-| main.cpp.obj           |     452(+452) |       0(+0) |     120(+120) |
+| main.cpp.obj           |     496(+496) |       0(+0) |     124(+124) |
 | signing_keys.c.obj     |         0(+0) |       0(+0) |         0(+0) |
-| Subtotals              | 84708(+84708) | 3008(+3008) | 22904(+22904) |
+| Subtotals              | 85028(+85028) | 3008(+3008) | 22904(+22904) |
 Total Static RAM memory (data + bss): 25912(+25912) bytes
-Total Flash memory (text + data): 87716(+87716) bytes
+Total Flash memory (text + data): 88036(+88036) bytes
 
Flash used: 93680&nbsp;(4%) / total: 2097152
SRAM used: 26200&nbsp;(4%) / total: 524288
spike_lk_sensors_battery (click to expand)
--- build_artifacts/base_ref-build-enable_log_debug-ON/spike_lk_sensors_battery-map.txt	2022-01-21 15:48:01.629373045 +0000
+++ build_artifacts/head_ref-build-enable_log_debug-ON/spike_lk_sensors_battery-map.txt	2022-01-21 15:48:01.861371230 +0000
@@ -1,18 +1,18 @@
 | Module                  |         .text |       .data |          .bss |
 |-------------------------|---------------|-------------|---------------|
-| [fill]                  |     170(+170) |       8(+8) |       20(+20) |
-| [lib]/CoreBattery.a     |     146(+146) |       0(+0) |         0(+0) |
+| [fill]                  |     122(+122) |       8(+8) |       20(+20) |
+| [lib]/CoreBattery.a     |     626(+626) |       0(+0) |         0(+0) |
 | [lib]/CriticalSection.a |         8(+8) |       0(+0) |         0(+0) |
 | [lib]/HelloWorld.a      |       94(+94) |       0(+0) |         0(+0) |
 | [lib]/c.a               | 26052(+26052) | 2472(+2472) |       58(+58) |
 | [lib]/gcc.a             |   7148(+7148) |       0(+0) |         0(+0) |
 | [lib]/m.a               |     360(+360) |       0(+0) |         0(+0) |
-| [lib]/mbed-os-static.a  | 33194(+33194) |   444(+444) |   8178(+8178) |
+| [lib]/mbed-os-static.a  | 33046(+33046) |   444(+444) |   8178(+8178) |
 | [lib]/misc              |     188(+188) |       4(+4) |       28(+28) |
 | [lib]/nosys.a           |       32(+32) |       0(+0) |         0(+0) |
 | [lib]/stdc++.a          |   5424(+5424) |       8(+8) |       44(+44) |
-| main.cpp.obj            |   2468(+2468) |       0(+0) |   5960(+5960) |
-| Subtotals               | 75284(+75284) | 2936(+2936) | 14288(+14288) |
+| main.cpp.obj            |   2504(+2504) |       0(+0) |   5960(+5960) |
+| Subtotals               | 75604(+75604) | 2936(+2936) | 14288(+14288) |
 Total Static RAM memory (data + bss): 17224(+17224) bytes
-Total Flash memory (text + data): 78220(+78220) bytes
+Total Flash memory (text + data): 78540(+78540) bytes
 
Flash used: 85448&nbsp;(4%) / total: 2097152
SRAM used: 17512&nbsp;(3%) / total: 524288

@github-actions
Copy link

github-actions bot commented Jan 20, 2022

File comparision analysis report

🔖 Info

  • Flash: 2 097 152 Bytes (2048 KiB) / SRAM: 524 288 Bytes (512 KiB)
  • base: develop / d3c95df + mbed-os-6.15.1 + -std=c++20
  • head: yann/feature/battery/get-battery-level / d3c95df + mbed-os-6.15.1 + -std=c++20
  • toolchain: GNU Arm Embedded Toolchain 10.3-2021.10 - 10.3.1 20210824
  • enable_log_debug: OFF

📝 Summary

Click to show summary
  • ✔️ - existing target
  • ✨ - new target
  • ⚰️ - deleted target
  • ✅ - files are the same
  • ❌ - files are different
Target Status .bin .map Total Flash (base/head) Total Flash Δ Static RAM (base/head) Static RAM Δ
LekaOS ✔️ 58328 (2%) ø 11400 (2%) ø
bootloader ✔️ 93328 (4%)
93680 (4%)
📈
352 (0%)
26200 (4%) ø
certs_emc_ble_bt_lcd_led_motors ✔️ 234668 (11%) ø 30056 (5%) ø
certs_emc_ble_led_motors ✔️ 174568 (8%) ø 24952 (4%) ø
certs_emc_bt_lcd_qspi_rfid_touch_wifi ✔️ 148840 (7%) ø 22528 (4%) ø
certs_emc_lcd_led_motors ✔️ 91928 (4%) ø 16168 (3%) ø
hardware_motors_test_reduction_and_wheels ✔️ 177960 (8%) ø 24360 (4%) ø
spike_lk_ble ✔️ 162616 (7%) ø 22792 (4%) ø
spike_lk_bluetooth ✔️ 73256 (3%) ø 11448 (2%) ø
spike_lk_cg_animations ✔️ 141064 (6%) ø 24464 (4%) ø
spike_lk_file_manager ✔️ 102036 (4%) ø 13672 (2%) ø
spike_lk_file_reception ✔️ 328916 (15%) ø 19312 (3%) ø
spike_lk_flash_memory ✔️ 63880 (3%) ø 11448 (2%) ø
spike_lk_lcd ✔️ 136928 (6%) ø 24016 (4%) ø
spike_lk_led ✔️ 65744 (3%) ø 13392 (2%) ø
spike_lk_log_kit ✔️ 68528 (3%) ø 11912 (2%) ø
spike_lk_motors ✔️ 62528 (2%) ø 11488 (2%) ø
spike_lk_rfid ✔️ 73072 (3%) ø 11448 (2%) ø
spike_lk_sensors_battery ✔️ 60280 (2%)
61776 (2%)
📈
1496 (2%)
11440 (2%) ø
spike_lk_sensors_light ✔️ 60056 (2%) ø 11440 (2%) ø
spike_lk_sensors_microphone ✔️ 72496 (3%) ø 11504 (2%) ø
spike_lk_sensors_temperature_humidity ✔️ 66968 (3%) ø 11424 (2%) ø
spike_lk_sensors_touch ✔️ 68600 (3%) ø 11432 (2%) ø
spike_lk_update_process_app_base ✔️ 121348 (5%) ø 15288 (2%) ø
spike_lk_update_process_app_update ✔️ 77632 (3%) ø 12352 (2%) ø
spike_lk_wifi ✔️ 116392 (5%) ø 14808 (2%) ø
spike_mbed_blinky ✔️ 57968 (2%) ø 11400 (2%) ø
spike_mbed_watchdog_ticker_vs_thread ✔️ 63208 (3%) ø 12448 (2%) ø
spike_stl_cxxsupport ✔️ 58456 (2%) ø 11400 (2%) ø

🗺️ Map files diff output

Click to show diff list
bootloader (click to expand)
--- build_artifacts/base_ref-build-enable_log_debug-OFF/bootloader-map.txt	2022-01-21 15:46:39.015448436 +0000
+++ build_artifacts/head_ref-build-enable_log_debug-OFF/bootloader-map.txt	2022-01-21 15:46:39.191451461 +0000
@@ -1,18 +1,18 @@
 | Module                 |         .text |       .data |          .bss |
 |------------------------|---------------|-------------|---------------|
-| [fill]                 |     146(+146) |       4(+4) |       28(+28) |
-| [lib]/CoreBattery.a    |     146(+146) |       0(+0) |         0(+0) |
+| [fill]                 |     134(+134) |       4(+4) |       24(+24) |
+| [lib]/CoreBattery.a    |     434(+434) |       0(+0) |         0(+0) |
 | [lib]/bootutil.a       |   5898(+5898) |     16(+16) | 13816(+13816) |
 | [lib]/c.a              | 27020(+27020) | 2472(+2472) |       58(+58) |
 | [lib]/gcc.a            |   3116(+3116) |       0(+0) |         0(+0) |
 | [lib]/mbed-os-static.a | 47468(+47468) |   512(+512) |   8286(+8286) |
 | [lib]/misc             |     188(+188) |       4(+4) |       28(+28) |
 | [lib]/nosys.a          |       32(+32) |       0(+0) |         0(+0) |
 | [lib]/stdc++.a         |         0(+0) |       0(+0) |         0(+0) |
 | default_bd.cpp.obj     |     242(+242) |       0(+0) |     568(+568) |
-| main.cpp.obj           |     452(+452) |       0(+0) |     120(+120) |
+| main.cpp.obj           |     496(+496) |       0(+0) |     124(+124) |
 | signing_keys.c.obj     |         0(+0) |       0(+0) |         0(+0) |
-| Subtotals              | 84708(+84708) | 3008(+3008) | 22904(+22904) |
+| Subtotals              | 85028(+85028) | 3008(+3008) | 22904(+22904) |
 Total Static RAM memory (data + bss): 25912(+25912) bytes
-Total Flash memory (text + data): 87716(+87716) bytes
+Total Flash memory (text + data): 88036(+88036) bytes
 
Flash used: 93680&nbsp;(4%) / total: 2097152
SRAM used: 26200&nbsp;(4%) / total: 524288
spike_lk_sensors_battery (click to expand)
--- build_artifacts/base_ref-build-enable_log_debug-OFF/spike_lk_sensors_battery-map.txt	2022-01-21 15:46:46.567584789 +0000
+++ build_artifacts/head_ref-build-enable_log_debug-OFF/spike_lk_sensors_battery-map.txt	2022-01-21 15:46:46.735588069 +0000
@@ -1,15 +1,15 @@
 | Module                 |         .text |       .data |        .bss |
 |------------------------|---------------|-------------|-------------|
-| [fill]                 |     126(+126) |       8(+8) |     16(+16) |
-| [lib]/CoreBattery.a    |       18(+18) |       0(+0) |       0(+0) |
+| [fill]                 |       88(+88) |       8(+8) |     16(+16) |
+| [lib]/CoreBattery.a    |     626(+626) |       0(+0) |       0(+0) |
 | [lib]/HelloWorld.a     |       94(+94) |       0(+0) |       0(+0) |
 | [lib]/c.a              | 25296(+25296) | 2472(+2472) |     58(+58) |
 | [lib]/gcc.a            |   3116(+3116) |       0(+0) |       0(+0) |
-| [lib]/mbed-os-static.a | 24422(+24422) |   444(+444) | 8130(+8130) |
+| [lib]/mbed-os-static.a | 25316(+25316) |   444(+444) | 8130(+8130) |
 | [lib]/misc             |     188(+188) |       4(+4) |     28(+28) |
 | [lib]/nosys.a          |       32(+32) |       0(+0) |       0(+0) |
-| main.cpp.obj           |     180(+180) |       0(+0) |       0(+0) |
-| Subtotals              | 53472(+53472) | 2928(+2928) | 8232(+8232) |
+| main.cpp.obj           |     188(+188) |       0(+0) |       0(+0) |
+| Subtotals              | 54944(+54944) | 2928(+2928) | 8232(+8232) |
 Total Static RAM memory (data + bss): 11160(+11160) bytes
-Total Flash memory (text + data): 56400(+56400) bytes
+Total Flash memory (text + data): 57872(+57872) bytes
 
Flash used: 61776&nbsp;(2%) / total: 2097152
SRAM used: 11440&nbsp;(2%) / total: 524288

Copy link
Member

@ladislas ladislas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 👍

j'ai juste une petite question de style pas très importante.

drivers/CoreBattery/source/CoreBattery.cpp Outdated Show resolved Hide resolved
include/interface/drivers/Battery.h Outdated Show resolved Hide resolved
@ladislas ladislas self-requested a review January 20, 2022 22:55
Copy link
Member

@ladislas ladislas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

drivers/CoreBattery/source/CoreBattery.cpp Outdated Show resolved Hide resolved
drivers/CoreBattery/source/CoreBattery.cpp Outdated Show resolved Hide resolved
drivers/CoreBattery/source/CoreBattery.cpp Outdated Show resolved Hide resolved
@ladislas
Copy link
Member

ladislas commented Jan 20, 2022

@YannLocatelli pour l'erreur sonarcloud

implicit conversion loses integer precision: 'int' to 'uint8_t' (aka 'unsigned char')

il faut que tu fasses

level = utils::math::map(volt, Capacity::empty, Capacity::quarter, uint8_t {0}, uint8_t {25});

@YannLocatelli YannLocatelli force-pushed the yann/feature/battery/get-battery-level branch 2 times, most recently from 13f0242 to b0a109e Compare January 21, 2022 09:56
@ladislas ladislas force-pushed the yann/feature/battery/get-battery-level branch from b0a109e to 0b8df96 Compare January 21, 2022 15:21
@ladislas ladislas force-pushed the yann/feature/battery/get-battery-level branch from 0b8df96 to 4a21e39 Compare January 21, 2022 15:40
@ladislas ladislas merged commit d3c95df into develop Jan 21, 2022
@ladislas ladislas deleted the yann/feature/battery/get-battery-level branch January 21, 2022 15:44
@sonarcloud
Copy link

sonarcloud bot commented Jan 21, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants