summaryrefslogtreecommitdiff
path: root/minion/src/wifi_module.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'minion/src/wifi_module.cpp')
-rw-r--r--minion/src/wifi_module.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/minion/src/wifi_module.cpp b/minion/src/wifi_module.cpp
index 5174168..953e9fa 100644
--- a/minion/src/wifi_module.cpp
+++ b/minion/src/wifi_module.cpp
@@ -498,22 +498,29 @@ auto WiFiModule::_read(uint64_t timeout, char *response_out) noexcept
{
char character = _read_byte();
+ if (has_end)
+ {
+ continue;
+ }
+
+ const auto end_pos = index + 1U;
+
response_out[index] = character;
- response_out[index + 1] = '\0';
+ response_out[end_pos] = '\0';
- if (util::str_ends_with(response_out, "OK"))
+ if (util::str_ends_with(response_out, end_pos, "OK"))
{
status = WiFiModuleResponseStatus::OK;
has_end = true;
}
- if (util::str_ends_with(response_out, "ERROR"))
+ if (util::str_ends_with(response_out, end_pos, "ERROR"))
{
status = WiFiModuleResponseStatus::ERROR;
has_end = true;
}
- if (util::str_ends_with(response_out, "FAIL"))
+ if (util::str_ends_with(response_out, end_pos, "FAIL"))
{
status = WiFiModuleResponseStatus::FAIL;
has_end = true;