-
Notifications
You must be signed in to change notification settings - Fork 8
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
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #947 +/- ##
========================================
Coverage 96.04% 96.04%
========================================
Files 133 133
Lines 3183 3183
========================================
Hits 3057 3057
Misses 126 126
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
File comparision analysis report🔖 Info
Click to show memory sections
📝 SummaryClick to show summary
🗺️ Map files diff outputClick to show diff list
|
File comparision analysis report🔖 Info
Click to show memory sections
📝 SummaryClick to show summary
🗺️ Map files diff outputClick to show diff list
|
ef0d612
to
a133b89
Compare
66ad008
to
d0b265d
Compare
5df390b
to
5685ef2
Compare
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.
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.
5685ef2
to
02c6812
Compare
|
d0b265d
to
3421be3
Compare
02c6812
to
137ca2b
Compare
3421be3
to
11f1d7b
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
137ca2b
to
12c4aed
Compare
dae583a
to
24f6655
Compare
24f6655
to
14245cc
Compare
Please fix conflicts on this PR |
600917b
to
a76bd47
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Sum-up existing bugs of TouchPrevious review
Peer-programming meeting
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).
Might come from to too high sensiblity.
See |
829e762
to
b91f49a
Compare
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.
Good work! 👍 Almost done, a few comments/suggestions and we're good to go ;)
spikes/lk_core_touch_sensor/main.cpp
Outdated
auto currentState = bool {false}; | ||
while (true) { | ||
currentState = sensor.read(); | ||
if (currentState) { | ||
log_info("Touched"); | ||
} else { | ||
log_info("."); | ||
} | ||
rtos::ThisThread::sleep_for(100ms); | ||
} | ||
} |
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.
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); | |
} | |
} |
spikes/lk_core_touch_sensor/main.cpp
Outdated
auto resetByTouchAndRelease() | ||
{ | ||
log_info("Put your hand on the sensor then release !\n\n"); | ||
rtos::ThisThread::sleep_for(100ms); |
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.
100ms
is too short for the sensor to "not work" and allow for reset by touch
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); |
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.
rtos::ThisThread::sleep_for(100ms); | |
log_info("Waiting for hand..."); | |
rtos::ThisThread::sleep_for(100ms); |
spikes/lk_core_touch_sensor/main.cpp
Outdated
sensor.init(); | ||
sensor.setSensitivity(0x0FF0); | ||
|
||
resetByTouchAndRelease(); // To continue with the bug |
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.
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(); |
rtos::ThisThread::sleep_for(2s); | ||
|
||
sensor.init(); | ||
sensor.setSensitivity(0x0FF0); |
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.
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:
- create an
enum class Sensitivity
with different levels:low/medium/high
so that it's easier to set/understand - use a named constant for the value -->
auto kDefault{High/Low}Sensitivity = 0x0FF0;
- 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 thefloat --> uint16_t
mapping in the implementation
I favor 2.
and 3.
and they can be combined
This can be implemented in a followup PR.
ae43f7c
to
8fe0d09
Compare
8fe0d09
to
22e8006
Compare
Kudos, SonarCloud Quality Gate passed! |
Need :