-
Notifications
You must be signed in to change notification settings - Fork 2k
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
tests/drivers/at: add check if device is initialized before sending command #20140
Conversation
6a3ee00
to
619ee31
Compare
tests/drivers/at/main.c
Outdated
initialized = false; | ||
is_power_on = false; |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I move initialization form main
function to the static variable initializer.
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.
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. |
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.
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/at
send... functions checks if AT device is initialized and power on.Testing procedure
Flash device with
tests/driver/at
program 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.