You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "acassis (via GitHub)" <gi...@apache.org> on 2023/12/03 17:24:14 UTC
[PR] examples/modbus: Fix modbus example to keep running [nuttx-apps]
acassis opened a new pull request, #2217:
URL: https://github.com/apache/nuttx-apps/pull/2217
## Summary
examples/modbus: Fix modbus example to keep running
More info: https://github.com/apache/nuttx/issues/11305
## Impact
Users will be able to use modbus example
## Testing
STM32F4Discovery
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] examples/modbus: Fix modbus example to keep running [nuttx-apps]
Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on code in PR #2217:
URL: https://github.com/apache/nuttx-apps/pull/2217#discussion_r1413208922
##########
examples/modbus/modbus_main.c:
##########
@@ -432,20 +432,22 @@ int main(int argc, FAR char *argv[])
/* Handle command line arguments */
- g_modbus.quit = false;
+ g_modbus.quit = true;
Review Comment:
Yes, I think we don't need it to be shared between threads, I will remove it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] examples/modbus: Fix modbus example to keep running [nuttx-apps]
Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on code in PR #2217:
URL: https://github.com/apache/nuttx-apps/pull/2217#discussion_r1413201771
##########
examples/modbus/modbus_main.c:
##########
@@ -432,20 +432,22 @@ int main(int argc, FAR char *argv[])
/* Handle command line arguments */
- g_modbus.quit = false;
+ g_modbus.quit = true;
Review Comment:
Because now I use it to decide if the program needs to finishes normally or keep waiting. The only option where it keeps waiting is when user passes "modbus -e". Initially I was using "g_modbus.quit = true" inside each switch/case option except the case 'e'. So I realized it was better to invert the value to simplify the code.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] examples/modbus: Fix modbus example to keep running [nuttx-apps]
Posted by "pkarashchenko (via GitHub)" <gi...@apache.org>.
pkarashchenko commented on code in PR #2217:
URL: https://github.com/apache/nuttx-apps/pull/2217#discussion_r1413205370
##########
examples/modbus/modbus_main.c:
##########
@@ -432,20 +432,22 @@ int main(int argc, FAR char *argv[])
/* Handle command line arguments */
- g_modbus.quit = false;
+ g_modbus.quit = true;
Review Comment:
But looks like `quit` was intended to handle status sharing between the threads because it is `volatile bool quit;` in state structure. If that is unused, so maybe better to remove it from the struct and switch to local variable here?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] examples/modbus: Fix modbus example to keep running [nuttx-apps]
Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on code in PR #2217:
URL: https://github.com/apache/nuttx-apps/pull/2217#discussion_r1413203615
##########
examples/modbus/modbus_main.c:
##########
@@ -432,20 +432,22 @@ int main(int argc, FAR char *argv[])
/* Handle command line arguments */
- g_modbus.quit = false;
+ g_modbus.quit = true;
Review Comment:
Ah ok, I forgot to update the comment
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] examples/modbus: Fix modbus example to keep running [nuttx-apps]
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 merged PR #2217:
URL: https://github.com/apache/nuttx-apps/pull/2217
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] examples/modbus: Fix modbus example to keep running [nuttx-apps]
Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on code in PR #2217:
URL: https://github.com/apache/nuttx-apps/pull/2217#discussion_r1413201771
##########
examples/modbus/modbus_main.c:
##########
@@ -432,20 +432,22 @@ int main(int argc, FAR char *argv[])
/* Handle command line arguments */
- g_modbus.quit = false;
+ g_modbus.quit = true;
Review Comment:
Because now I use it to decide if the program needs to finishes normally or keep waiting. The only option where it keeps waiting is when user passes "modbus -e". Initially I was "g_modbus.quit = true" inside each switch/case option except the case 'e'. So I realized it was better to invert the value to simplify the code.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] examples/modbus: Fix modbus example to keep running [nuttx-apps]
Posted by "pkarashchenko (via GitHub)" <gi...@apache.org>.
pkarashchenko commented on code in PR #2217:
URL: https://github.com/apache/nuttx-apps/pull/2217#discussion_r1413204513
##########
examples/modbus/modbus_main.c:
##########
@@ -432,20 +432,22 @@ int main(int argc, FAR char *argv[])
/* Handle command line arguments */
- g_modbus.quit = false;
+ g_modbus.quit = true;
Review Comment:
Yeah. Now looks much better
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] examples/modbus: Fix modbus example to keep running [nuttx-apps]
Posted by "pkarashchenko (via GitHub)" <gi...@apache.org>.
pkarashchenko commented on code in PR #2217:
URL: https://github.com/apache/nuttx-apps/pull/2217#discussion_r1413197227
##########
examples/modbus/modbus_main.c:
##########
@@ -432,20 +432,22 @@ int main(int argc, FAR char *argv[])
/* Handle command line arguments */
- g_modbus.quit = false;
+ g_modbus.quit = true;
Review Comment:
why `quit` is defaulted to `true`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] examples/modbus: Fix modbus example to keep running [nuttx-apps]
Posted by "pkarashchenko (via GitHub)" <gi...@apache.org>.
pkarashchenko commented on code in PR #2217:
URL: https://github.com/apache/nuttx-apps/pull/2217#discussion_r1413202506
##########
examples/modbus/modbus_main.c:
##########
@@ -432,20 +432,22 @@ int main(int argc, FAR char *argv[])
/* Handle command line arguments */
- g_modbus.quit = false;
+ g_modbus.quit = true;
Review Comment:
I didn't deep dive into the code, but as a reviewer I feel a bit confused when I read
```
/* Keep running, otherwise the thread will die */
g_modbus.quit = true;
```
I mean that `quit == true` does not align to me with `Keep running`. Maybe you can consider renaming `quit` -> `wait` or something similar?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] examples/modbus: Fix modbus example to keep running [nuttx-apps]
Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on code in PR #2217:
URL: https://github.com/apache/nuttx-apps/pull/2217#discussion_r1413204136
##########
examples/modbus/modbus_main.c:
##########
@@ -432,20 +432,22 @@ int main(int argc, FAR char *argv[])
/* Handle command line arguments */
- g_modbus.quit = false;
+ g_modbus.quit = true;
Review Comment:
wait, it was a mistake! Probably I inverted in the top, removed the others quit = true and inverted that from false to true...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org