mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-18 04:52:18 +02:00
fix(esp_modem): Fix battery status parse
Variable `pos` was meant to hold position of first `,` (comma) appearance in the parsed string, but due to wrong parantheses it contained the boolean representation of not equal to `string::npos`
This commit is contained in:
@ -167,7 +167,7 @@ command_result get_battery_status(CommandableIf *t, int &voltage, int &bcs, int
|
||||
// Parsing +CBC: <bcs>,<bcl>,<voltage>
|
||||
out = out.substr(pattern.size());
|
||||
int pos, value, property = 0;
|
||||
while ((pos = out.find(',') != std::string::npos)) {
|
||||
while ((pos = out.find(',')) != std::string::npos) {
|
||||
if (std::from_chars(out.data(), out.data() + pos, value).ec == std::errc::invalid_argument) {
|
||||
return command_result::FAIL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user