-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add Corewifi #245
Add Corewifi #245
Conversation
f778716
to
5fb5de1
Compare
5fb5de1
to
743bb93
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.
First review, it looks good to me modulo the different comments.
I'm wondering what is the use of this class, where in the chain is it used? How connecting to wifi will impact the rest of the program? What is the difference with say using Ethernet for that. Is it wifi for local network or wifi to access the internet?
Wifi being just a mean, it might be better to have a ConnectivityKit or WebKit to handle "internet" related tasks (downloading a file, uploading a file, pinging an url, etc.) and having the wifi just being the "pipe".
Maybe that's the goal here, but it's not that clear from reading the code, so a bit of explanation would greatly help :)
e6b8d7f
to
085749a
Compare
Codecov Report
@@ Coverage Diff @@
## develop #245 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 44 44
Lines 878 878
=========================================
Hits 878 878 Continue to review full report at Codecov.
|
c7bfa2c
to
9a8e893
Compare
9a8e893
to
d7d26ff
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.
quelques questions (voir slack) puis on est bon 👍
spikes/lk_wifi/main.cpp
Outdated
|
||
rtos::ThisThread::sleep_for(2s); | ||
|
||
wifi_thread.start({&leka_wifi, &Wifi::start}); | ||
if (not(corewifi.connect(wifi_network))) { |
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.
je connaissais pas le not
https://en.cppreference.com/w/cpp/language/operator_alternative
les discussions ici sont intéressantes: https://stackoverflow.com/questions/2376448/the-written-versions-of-the-logical-operators
if (not(corewifi.connect(wifi_network))) { | |
if (not corewifi.connect(wifi_network)) { |
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.
Oui effectivement j'avais essayé un peu par hasard le not
, un héritage de python.
Je rejoins aussi la réponse validé de la discussion avec &&
et ||
qui à mon sens reflète l'idée d'opération binaire / booléenne et donc préféré à and
et or
.
Maintenant pour le not
, je le trouve plus visuel que !
: j'ai souvent loupé en lecture le !
if (not corewifi.connect(wifi_network)) {
}
if (!corewifi.connect(wifi_network)) {
}
e0540f9
to
c5f1f42
Compare
361d231
to
3a4221c
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.
LGTM! 👍
if (auto is_not_connected = !corewifi.connect(wifi_network); is_not_connected) { | ||
log_error("Wifi connection failed"); |
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 un déjà un message d'échec de connexion dans la fonction corewifi.connect
log_debug("Connection failure.\n"); |
Le log_error ici peut être redondant
spikes/lk_wifi/main.cpp
Outdated
auto wifi_enable = mbed::DigitalOut {WIFI_ENABLE, 1}; | ||
auto wifi_module = CoreESP8266 {WIFI_USART_TX, WIFI_USART_RX, false, WIFI_USART_RTS, WIFI_USART_CTS, WIFI_RESET}; | ||
auto corewifi = leka::CoreWifi {wifi_module, wifi_enable}; | ||
auto corewifi = leka::CoreWifi::get_default_instance(); |
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.
Super 👍
A voir si il n'y a pas de conflit si la fonction est appelée 2 fois
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.
J'ai fait des tests sur le robot, le dernier commit où cette modification apparait ne permet plus le bon fonctionnement de l'exemple: le robot ne se connecte plus du tout au réseau wifi indiqué.
Je propose de revenir au commit précédent 06bd0a8 et de penser au (vrai) singleton pour une autre PR pour faciliter l'utilisation du wifi.
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.
ok parfait! je te laisse fixup et on merge :)
3a4221c
to
744d7c8
Compare
744d7c8
to
dd99164
Compare
SonarCloud Quality Gate failed. |
Co-Authored-By: ladislas <ladislas@detoldi.me>
Co-authored-by: ladislas <ladislas@detoldi.me>
dd99164
to
d739c30
Compare
No description provided.