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

mmyster/feature/lk core touch sensor #947

Merged
merged 2 commits into from
Nov 15, 2022

Conversation

MMyster
Copy link
Contributor

@MMyster MMyster commented Jul 22, 2022

  • ✨ (interface): Add QDAC
  • ✨ (drivers): Add CoreQDAC
  • 🎨 (drivers): Update QDAC
  • 🎨 (drivers): Update QDAC
  • 🔒 (mocks): edit CoreI2C header reference
  • ✨ (interface): Add TouchSensor
  • ✨ (drivers): Add CoreTouchSensor
  • ✨ (spikes): Add lk_core_touch_sensor

Need :

@codecov
Copy link

codecov bot commented Jul 22, 2022

Codecov Report

Merging #947 (8fe0d09) into develop (d14d36b) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff            @@
##           develop     #947   +/-   ##
========================================
  Coverage    96.04%   96.04%           
========================================
  Files          133      133           
  Lines         3183     3183           
========================================
  Hits          3057     3057           
  Misses         126      126           
Impacted Files Coverage Δ
drivers/CoreIOExpander/source/CoreIOExpander.cpp 100.00% <100.00%> (ø)
drivers/CoreTouchSensor/source/CoreTouchSensor.cpp 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@github-actions
Copy link

github-actions bot commented Jul 22, 2022

File comparision analysis report

🔖 Info

Target Flash Used (%) Flash Available (%) Static RAM (%)
bootloader 169508 (64%) 92636 (35%) 30920 (5%)
os 410792 (26%) 1153880 (73%) 79608 (15%)
Click to show memory sections
| -          |      Hex |     Bytes |  KiB |
|------------|---------:|----------:|-----:|
| Flash      | 0x200000 | 2 097 152 | 2048 |
| SRAM       |  0x80000 |   524 288 |  512 |
| Bootloader |  0x40000 |   262 144 |  256 |
| Header     |   0x1000 |     4 096 |    4 |
| OS         | 0x17E000 | 1 564 672 | 1528 |
| Tail       |   0x1000 |     4 096 |    4 |
| Scratch    |  0x40000 |   262 144 |  256 |

📝 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 ✔️ 410792 (19%) ø 79608 (15%) ø
bootloader ✔️ 169508 (8%) ø 30920 (5%) ø
functional_ut_boost_ut ✔️ 384496 (18%) ø 20424 (3%) ø
functional_ut_file_manager ✔️ 373280 (17%) ø 20664 (3%) ø
functional_ut_io_expander ✔️ 360200 (17%) ø 20392 (3%) ø
functional_ut_qdac ✔️ 361448 (17%) ø 20392 (3%) ø
spike_lk_audio ✔️ 125076 (5%) ø 14568 (2%) ø
spike_lk_behavior_kit ✔️ 189752 (9%) ø 48120 (9%) ø
spike_lk_ble ✔️ 228768 (10%) ø 28200 (5%) ø
spike_lk_bluetooth ✔️ 82948 (3%) ø 11544 (2%) ø
spike_lk_cg_animations ✔️ 144696 (6%) ø 46528 (8%) ø
spike_lk_color_kit ✔️ 65776 (3%) ø 13744 (2%) ø
spike_lk_command_kit ✔️ 192520 (9%) ø 50944 (9%) ø
spike_lk_config_kit ✔️ 126956 (6%) ø 14312 (2%) ø
spike_lk_coreled ✔️ 76164 (3%) ø 13688 (2%) ø
spike_lk_core_touch_sensor - - 80228 (3%) - 12256 (2%) -
spike_lk_event_queue ✔️ 74800 (3%) ø 12072 (2%) ø
spike_lk_file_manager_kit ✔️ 139016 (6%) ø 14416 (2%) ø
spike_lk_file_reception ✔️ 327112 (15%) ø 27576 (5%) ø
spike_lk_flash_memory ✔️ 63880 (3%) ø 11448 (2%) ø
spike_lk_fs ✔️ 174616 (8%) ø 47888 (9%) ø
spike_lk_lcd ✔️ 162236 (7%) ø 46616 (8%) ø
spike_lk_led_kit ✔️ 103992 (4%) ø 14608 (2%) ø
spike_lk_log_kit ✔️ 63288 (3%) ø 12256 (2%) ø
spike_lk_motors ✔️ 62600 (2%) ø 11488 (2%) ø
spike_lk_qdac ✔️ 78628 (3%) ø 11816 (2%) ø
spike_lk_reinforcer ✔️ 103480 (4%) ø 14608 (2%) ø
spike_lk_rfid ✔️ 80920 (3%) ø 11520 (2%) ø
spike_lk_sensors_battery ✔️ 78196 (3%) ø 12568 (2%) ø
spike_lk_sensors_light ✔️ 60056 (2%) ø 11440 (2%) ø
spike_lk_sensors_microphone ✔️ 72496 (3%) ø 11504 (2%) ø
spike_lk_sensors_temperature_humidity ✔️ 67048 (3%) ø 11424 (2%) ø
spike_lk_sensors_touch ✔️ 68600 (3%) ø 11432 (2%) ø
spike_lk_serial_number ✔️ 114244 (5%) ø 14056 (2%) ø
spike_lk_ticker_timeout ✔️ 69052 (3%) ø 11632 (2%) ø
spike_lk_update_process_app_base ✔️ 126092 (6%) ø 15296 (2%) ø
spike_lk_update_process_app_update ✔️ 77632 (3%) ø 12352 (2%) ø
spike_lk_watchdog_isr ✔️ 82032 (3%) ø 13288 (2%) ø
spike_lk_wifi ✔️ 116392 (5%) ø 14808 (2%) ø
spike_mbed_blinky ✔️ 58032 (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
functional_ut_io_expander (click to expand)
--- build_artifacts/base_ref-build-enable_log_debug-OFF/functional_ut_io_expander-map.txt	2022-11-15 15:29:50.622828464 +0000
+++ build_artifacts/head_ref-build-enable_log_debug-OFF/functional_ut_io_expander-map.txt	2022-11-15 15:29:50.890827822 +0000
@@ -1,17 +1,17 @@
 | Module                    |           .text |       .data |          .bss |
 |---------------------------|-----------------|-------------|---------------|
-| [fill]                    |       208(+208) |     16(+16) |       31(+31) |
+| [fill]                    |       216(+216) |     16(+16) |       31(+31) |
 | [lib]/CoreI2C.a           |         90(+90) |       0(+0) |         0(+0) |
-| [lib]/CoreIOExpander.a    |       512(+512) |       0(+0) |         0(+0) |
+| [lib]/CoreIOExpander.a    |       504(+504) |       0(+0) |         0(+0) |
 | [lib]/c.a                 |   73780(+73780) | 2574(+2574) |       97(+97) |
 | [lib]/gcc.a               |     7416(+7416) |       0(+0) |         0(+0) |
 | [lib]/mbed-os-static.a    |   53492(+53492) |   460(+460) | 10213(+10213) |
 | [lib]/misc                |       188(+188) |       4(+4) |       28(+28) |
 | [lib]/nosys.a             |         32(+32) |       0(+0) |         0(+0) |
 | [lib]/stdc++.a            | 174740(+174740) |   145(+145) |   5720(+5720) |
 | __/__                     |     2392(+2392) |       1(+1) |     789(+789) |
 | suite_io_expander.cpp.obj |     2250(+2250) |       0(+0) |         2(+2) |
 | Subtotals                 | 315100(+315100) | 3200(+3200) | 16880(+16880) |
 Total Static RAM memory (data + bss): 20080(+20080) bytes
 Total Flash memory (text + data): 318300(+318300) bytes
 
spike_lk_core_touch_sensor (click to expand)

Flash used: 80228&nbsp;(3%) / total: 2097152
SRAM used: 12256&nbsp;(2%) / total: 524288

@github-actions
Copy link

github-actions bot commented Jul 22, 2022

File comparision analysis report

🔖 Info

Target Flash Used (%) Flash Available (%) Static RAM (%)
bootloader 181900 (69%) 80244 (30%) 37456 (7%)
os 451764 (28%) 1112908 (71%) 86664 (16%)
Click to show memory sections
| -          |      Hex |     Bytes |  KiB |
|------------|---------:|----------:|-----:|
| Flash      | 0x200000 | 2 097 152 | 2048 |
| SRAM       |  0x80000 |   524 288 |  512 |
| Bootloader |  0x40000 |   262 144 |  256 |
| Header     |   0x1000 |     4 096 |    4 |
| OS         | 0x17E000 | 1 564 672 | 1528 |
| Tail       |   0x1000 |     4 096 |    4 |
| Scratch    |  0x40000 |   262 144 |  256 |

📝 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 ✔️ 451764 (21%) ø 86664 (16%) ø
bootloader ✔️ 181900 (8%) ø 37456 (7%) ø
functional_ut_boost_ut ✔️ 396064 (18%) ø 27088 (5%) ø
functional_ut_file_manager ✔️ 385800 (18%) ø 27336 (5%) ø
functional_ut_io_expander ✔️ 371768 (17%)
371704 (17%)
📉
-64 (0%)
27056 (5%) ø
functional_ut_qdac ✔️ 373016 (17%) ø 27056 (5%) ø
spike_lk_audio ✔️ 135132 (6%) ø 20984 (4%) ø
spike_lk_behavior_kit ✔️ 198252 (9%) ø 54536 (10%) ø
spike_lk_ble ✔️ 236652 (11%) ø 34856 (6%) ø
spike_lk_bluetooth ✔️ 92300 (4%) ø 18064 (3%) ø
spike_lk_cg_animations ✔️ 152264 (7%) ø 53064 (10%) ø
spike_lk_color_kit ✔️ 88352 (4%) ø 20216 (3%) ø
spike_lk_command_kit ✔️ 202780 (9%) ø 57872 (11%) ø
spike_lk_config_kit ✔️ 138868 (6%) ø 20976 (4%) ø
spike_lk_coreled ✔️ 87916 (4%) ø 20104 (3%) ø
spike_lk_core_touch_sensor - - 92668 (4%) - 18672 (3%) -
spike_lk_event_queue ✔️ 84088 (4%) ø 18744 (3%) ø
spike_lk_file_manager_kit ✔️ 153984 (7%) ø 21336 (4%) ø
spike_lk_file_reception ✔️ 331244 (15%) ø 34072 (6%) ø
spike_lk_flash_memory ✔️ 86712 (4%) ø 18056 (3%) ø
spike_lk_fs ✔️ 173976 (8%) ø 47976 (9%) ø
spike_lk_lcd ✔️ 171852 (8%) ø 53288 (10%) ø
spike_lk_led_kit ✔️ 115708 (5%) ø 21024 (4%) ø
spike_lk_log_kit ✔️ 84712 (4%) ø 19248 (3%) ø
spike_lk_motors ✔️ 86008 (4%) ø 18088 (3%) ø
spike_lk_qdac ✔️ 91508 (4%) ø 18616 (3%) ø
spike_lk_reinforcer ✔️ 112188 (5%) ø 21024 (4%) ø
spike_lk_rfid ✔️ 84700 (4%) ø 18024 (3%) ø
spike_lk_sensors_battery ✔️ 87056 (4%) ø 19120 (3%) ø
spike_lk_sensors_light ✔️ 84008 (4%) ø 18056 (3%) ø
spike_lk_sensors_microphone ✔️ 84696 (4%) ø 18056 (3%) ø
spike_lk_sensors_temperature_humidity ✔️ 90336 (4%) ø 18032 (3%) ø
spike_lk_sensors_touch ✔️ 91608 (4%) ø 18296 (3%) ø
spike_lk_serial_number ✔️ 136188 (6%) ø 20896 (3%) ø
spike_lk_ticker_timeout ✔️ 82648 (3%) ø 18072 (3%) ø
spike_lk_update_process_app_base ✔️ 147916 (7%) ø 21904 (4%) ø
spike_lk_update_process_app_update ✔️ 100328 (4%) ø 19080 (3%) ø
spike_lk_watchdog_isr ✔️ 87940 (4%) ø 19960 (3%) ø
spike_lk_wifi ✔️ 130768 (6%) ø 21368 (4%) ø
spike_mbed_blinky ✔️ 57616 (2%) ø 11496 (2%) ø
spike_mbed_watchdog_ticker_vs_thread ✔️ 84112 (4%) ø 18920 (3%) ø
spike_stl_cxxsupport ✔️ 83424 (3%) ø 18144 (3%) ø

🗺️ Map files diff output

Click to show diff list
functional_ut_io_expander (click to expand)
--- build_artifacts/base_ref-build-enable_log_debug-ON/functional_ut_io_expander-map.txt	2022-11-15 15:29:50.535396418 +0000
+++ build_artifacts/head_ref-build-enable_log_debug-ON/functional_ut_io_expander-map.txt	2022-11-15 15:29:50.883398554 +0000
@@ -1,19 +1,19 @@
 | Module                    |           .text |       .data |          .bss |
 |---------------------------|-----------------|-------------|---------------|
-| [fill]                    |       232(+232) |     16(+16) |       35(+35) |
+| [fill]                    |       176(+176) |     16(+16) |       35(+35) |
 | [lib]/CoreI2C.a           |         90(+90) |       0(+0) |         0(+0) |
-| [lib]/CoreIOExpander.a    |       512(+512) |       0(+0) |         0(+0) |
+| [lib]/CoreIOExpander.a    |       504(+504) |       0(+0) |         0(+0) |
 | [lib]/CriticalSection.a   |           8(+8) |       0(+0) |         0(+0) |
 | [lib]/c.a                 |   72688(+72688) | 2574(+2574) |       97(+97) |
 | [lib]/gcc.a               |     7416(+7416) |       0(+0) |         0(+0) |
 | [lib]/m.a                 |       372(+372) |       0(+0) |         0(+0) |
 | [lib]/mbed-os-static.a    |   61288(+61288) |   460(+460) | 10337(+10337) |
 | [lib]/misc                |       188(+188) |       4(+4) |       28(+28) |
 | [lib]/nosys.a             |         32(+32) |       0(+0) |         0(+0) |
 | [lib]/stdc++.a            | 175248(+175248) |   145(+145) |   5720(+5720) |
 | __/__                     |     4704(+4704) |       1(+1) |   7325(+7325) |
 | suite_io_expander.cpp.obj |     2250(+2250) |       0(+0) |         2(+2) |
-| Subtotals                 | 325028(+325028) | 3200(+3200) | 23544(+23544) |
+| Subtotals                 | 324964(+324964) | 3200(+3200) | 23544(+23544) |
 Total Static RAM memory (data + bss): 26744(+26744) bytes
-Total Flash memory (text + data): 328228(+328228) bytes
+Total Flash memory (text + data): 328164(+328164) bytes
 
Flash used: 371704&nbsp;(17%) / total: 2097152
SRAM used: 27056&nbsp;(5%) / total: 524288
spike_lk_core_touch_sensor (click to expand)

Flash used: 92668&nbsp;(4%) / total: 2097152
SRAM used: 18672&nbsp;(3%) / total: 524288

@MMyster MMyster changed the base branch from develop to mmyster/feature/add-core-touch-sensor July 22, 2022 16:17
@MMyster MMyster force-pushed the mmyster/feature/add-core-touch-sensor branch 2 times, most recently from ef0d612 to a133b89 Compare July 22, 2022 16:36
@MMyster MMyster force-pushed the mmyster/feature/lk-core-touch-sensor branch 7 times, most recently from 66ad008 to d0b265d Compare July 26, 2022 15:13
@MMyster MMyster force-pushed the mmyster/feature/add-core-touch-sensor branch from 5df390b to 5685ef2 Compare July 27, 2022 09:18
Copy link
Member

@YannLocatelli YannLocatelli left a comment

Choose a reason for hiding this comment

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

Il y a quelque chose de majeur ici: ça ne marche pas à tous les coups

  • le reset qui est parfois nécessaire, parfois non
  • la calibration qui donne une valeur étonnante de aucune sensibilité comme toucher détecté
  • un capteur qui se bloque à "Toucher" alors qu'on a plus la main dessus

C'est l'occasion idéale pour creuser et expliquer le pourquoi en ayant les cartes qu'il faut en main et sans en avoir trop non plus.

Note. Il s'agit là de soucis lié à la compréhension du matériel et non du code. La suite avec TouchSensorKit est donc tout à fait faisable.

spikes/lk_core_touch_sensor/main.cpp Outdated Show resolved Hide resolved
spikes/lk_core_touch_sensor/main.cpp Outdated Show resolved Hide resolved
spikes/lk_core_touch_sensor/main.cpp Outdated Show resolved Hide resolved
spikes/lk_core_touch_sensor/main.cpp Outdated Show resolved Hide resolved
@MMyster MMyster force-pushed the mmyster/feature/add-core-touch-sensor branch from 5685ef2 to 02c6812 Compare July 27, 2022 09:50
@MMyster
Copy link
Contributor Author

MMyster commented Jul 27, 2022

Il y a quelque chose de majeur ici: ça ne marche pas à tous les coups

  • le reset qui est parfois nécessaire, parfois non
  • la calibration qui donne une valeur étonnante de aucune sensibilité comme toucher détecté
  • un capteur qui se bloque à "Toucher" alors qu'on a plus la main dessus

C'est l'occasion idéale pour creuser et expliquer le pourquoi en ayant les cartes qu'il faut en main et sans en avoir trop non plus.

Note. Il s'agit là de soucis lié à la compréhension du matériel et non du code. La suite avec TouchSensorKit est donc tout à fait faisable.

  • Le stuck mechanism du MTCH101 est assez imprévisible. Le reset est plus une garantie afin de palier au problème
  • Ce point m'avait également surpris. J'avais déjà vérifié sur le schema, il ne semble pas avoir d'erreur d'attribution de channel. Peut-être une tension faible délivré par le dac
  • Le reset via MTPM qui sera donc obligatoire pour la suite

@MMyster MMyster force-pushed the mmyster/feature/lk-core-touch-sensor branch from d0b265d to 3421be3 Compare August 1, 2022 14:00
@MMyster MMyster force-pushed the mmyster/feature/add-core-touch-sensor branch from 02c6812 to 137ca2b Compare August 1, 2022 14:46
@MMyster MMyster force-pushed the mmyster/feature/lk-core-touch-sensor branch from 3421be3 to 11f1d7b Compare August 1, 2022 14:47
@sonarcloud
Copy link

sonarcloud bot commented Aug 1, 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 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@MMyster MMyster force-pushed the mmyster/feature/add-core-touch-sensor branch from 137ca2b to 12c4aed Compare August 24, 2022 13:01
@MMyster MMyster force-pushed the mmyster/feature/add-core-touch-sensor branch from dae583a to 24f6655 Compare September 5, 2022 14:11
@ladislas ladislas force-pushed the mmyster/feature/add-core-touch-sensor branch from 24f6655 to 14245cc Compare September 5, 2022 14:27
Base automatically changed from mmyster/feature/add-core-touch-sensor to develop September 5, 2022 14:29
@YannLocatelli
Copy link
Member

Please fix conflicts on this PR

@MMyster MMyster force-pushed the mmyster/feature/lk-core-touch-sensor branch 4 times, most recently from 600917b to a76bd47 Compare October 5, 2022 15:47
@sonarcloud
Copy link

sonarcloud bot commented Oct 7, 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 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@YannLocatelli
Copy link
Member

YannLocatelli commented Nov 8, 2022

Sum-up existing bugs of Touch

Previous review

  • le reset qui est parfois nécessaire, parfois non / reset is sometime necessary, sometimes not
  • la calibration qui donne une valeur étonnante de aucune sensibilité comme toucher détecté / calibration process give an unexpected value of lowest sensibility for "Touched"
  • un capteur qui se bloque à "Toucher" alors qu'on a plus la main dessus / sensor stuck at "Touched" while no hand on sensor

Peer-programming meeting

  • "Touched" stuck at init for an infinite time
  • "Touched" stuck without being touched for a limited duration sometimes
  • Best value for calibration found to be lowest sensibility
  • Sensor does not work if touched at initialization (sometimes)

  • calibration process give an unexpected value of lowest sensibility for "Touched"
  • Best value for calibration found to be lowest sensibility

2 QDAC used for left and right sensors were inversed. Fixed in d5032d5.

Moreover, calibration process is set at start of spike, and might consider the bug of sensor stuck to "Touched" at init (see #1112).

  • "Touched" stuck without being touched for a limited duration sometimes
  • sensor stuck at "Touched" while no hand on sensor

Might come from to too high sensiblity.

  • reset is sometime necessary, sometimes not

reset described in datasheet to reset sensor if it’s stucked does not work. Does not seem to be an issue.

  • "Touched" stuck at init for an infinite time
  • Sensor does not work if touched at initialization (sometimes)

See

@MMyster MMyster force-pushed the mmyster/feature/lk-core-touch-sensor branch 4 times, most recently from 829e762 to b91f49a Compare November 14, 2022 14:31
spikes/lk_core_touch_sensor/main.cpp Outdated Show resolved Hide resolved
@ladislas ladislas added the 01 - type: task Something to do label Nov 15, 2022
@ladislas ladislas added this to the Future Release milestone Nov 15, 2022
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.

Good work! 👍 Almost done, a few comments/suggestions and we're good to go ;)

Comment on lines 136 to 155
auto currentState = bool {false};
while (true) {
currentState = sensor.read();
if (currentState) {
log_info("Touched");
} else {
log_info(".");
}
rtos::ThisThread::sleep_for(100ms);
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
auto currentState = bool {false};
while (true) {
currentState = sensor.read();
if (currentState) {
log_info("Touched");
} else {
log_info(".");
}
rtos::ThisThread::sleep_for(100ms);
}
}
while (true) {
auto is_touched = sensor.read();
if (is_touched) {
log_info("Sensor touched");
} else {
log_info(".");
}
rtos::ThisThread::sleep_for(100ms);
}
}

auto resetByTouchAndRelease()
{
log_info("Put your hand on the sensor then release !\n\n");
rtos::ThisThread::sleep_for(100ms);
Copy link
Member

Choose a reason for hiding this comment

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

100ms is too short for the sensor to "not work" and allow for reset by touch

Suggested change
rtos::ThisThread::sleep_for(100ms);
rtos::ThisThread::sleep_for(1000ms);

log_info("Put your hand on the sensor then release !\n\n");
rtos::ThisThread::sleep_for(100ms);
while (sensor.read()) {
rtos::ThisThread::sleep_for(100ms);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
rtos::ThisThread::sleep_for(100ms);
log_info("Waiting for hand...");
rtos::ThisThread::sleep_for(100ms);

sensor.init();
sensor.setSensitivity(0x0FF0);

resetByTouchAndRelease(); // To continue with the bug
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
resetByTouchAndRelease(); // To continue with the bug
// ? Current workaround for bug #1112
// TODO(@leka/dev-embedded) - Try to find solution w/ software or ui/ux
resetByTouchAndRelease();

spikes/lk_core_touch_sensor/main.cpp Show resolved Hide resolved
rtos::ThisThread::sleep_for(2s);

sensor.init();
sensor.setSensitivity(0x0FF0);
Copy link
Member

Choose a reason for hiding this comment

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

this number doesn't mean much for someone reviewing the code. Is it a magic number? Is it "au doigt mouillé"? Is it high sensitivity or low sensitivity? why 0x0FF0 and not 0x0FF1?

solutions:

  1. create an enum class Sensitivity with different levels: low/medium/high so that it's easier to set/understand
  2. use a named constant for the value --> auto kDefault{High/Low}Sensitivity = 0x0FF0;
  3. have setSensitivity(value) take a float --> setSensitivity(float value) with values between 0.0 (super low sensitivity) to 1.0 (super high sensitivity) and do the float --> uint16_t mapping in the implementation

I favor 2. and 3. and they can be combined

This can be implemented in a followup PR.

@MMyster MMyster force-pushed the mmyster/feature/lk-core-touch-sensor branch 2 times, most recently from ae43f7c to 8fe0d09 Compare November 15, 2022 15:18
@ladislas ladislas force-pushed the mmyster/feature/lk-core-touch-sensor branch from 8fe0d09 to 22e8006 Compare November 15, 2022 16:01
@ladislas ladislas merged commit ce396ab into develop Nov 15, 2022
@ladislas ladislas deleted the mmyster/feature/lk-core-touch-sensor branch November 15, 2022 16:01
@sonarcloud
Copy link

sonarcloud bot commented Nov 15, 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

No Coverage information No Coverage information
No Duplication information No Duplication information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
01 - type: task Something to do
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants