tests/drivers/at: add check if device is initialized before sending command#20140
tests/drivers/at: add check if device is initialized before sending command#20140kfessel merged 2 commits intoRIOT-OS:masterfrom
Conversation
6a3ee00 to
619ee31
Compare
tests/drivers/at/main.c
Outdated
| initialized = false; | ||
| is_power_on = false; |
There was a problem hiding this comment.
I am not sure about this PR
but for initialization you should just use the initializer instead of setting the value at the start of the program
l 36 and l 37
false (0) should also be the default initializer, in c static values are initialized (unless you tell the compiler it should not) -> not writing the initializer might also be OK
There was a problem hiding this comment.
I move initialization form main function to the static variable initializer.
There was a problem hiding this comment.
Checking for initialization is fine, since using the at_* methods without proper initialization would be UB. I'm not sure about the power state tho. What if we want to test an error case, e.g. proper command timeout if the module is powered off?
|
@derMihai I could remove checks for power off or maybe add ability to switch on/off this check. The reason for this PR is that when testing few clones of HM-10 in various configurations, few times I do not properly initialize/power on device - and searching for a longer while where is a problem ;). |
c70d617 to
59d5af7
Compare
|
Dear all, I observe that from my last activity in this PR there are some changes in the code which lead to merge conflicts. Could we move this PR little forward? |
|
Hi, On a second thought, the |
|
@derMihai so should I leave this PR as is? |
|
from my side, yes. |
kfessel
left a comment
There was a problem hiding this comment.
simplify the test usage -someone testing their setup,
special tests (timeout behavior) might be added later.
|
The merge queue is empty ... maybe we can use this ;) |
Contribution description
This PR adds to the
tests/driver/atsend... functions checks if AT device is initialized and power on.Testing procedure
Flash device with
tests/driver/atprogram and try to send some AT command without initialization and power on.Without this PR send... commands waits for timeout.
With this PR appropriate error message is shown.
Issues/PRs references
None.