-
Notifications
You must be signed in to change notification settings - Fork 57
Closed
Labels
Description
Found a potential logic error here:
| if (battLevel < 10) |
Code execution never reaches the final else statement - actual code:
if (battLevel < 10)
snprintf(tempStr, sizeof(tempStr), "Red");
else if (battLevel < 50)
snprintf(tempStr, sizeof(tempStr), "Yellow");
else if (battLevel >= 50)
snprintf(tempStr, sizeof(tempStr), "Green");
else
snprintf(tempStr, sizeof(tempStr), "No batt");I think it should be something like this:
if (battLevel < 10)
snprintf(tempStr, sizeof(tempStr), "Red");
else if (battLevel < 50)
snprintf(tempStr, sizeof(tempStr), "Yellow");
else if (battLevel < 105)
snprintf(tempStr, sizeof(tempStr), "Green");
else
snprintf(tempStr, sizeof(tempStr), "No batt");I found on the DL board that if the value returned from getSOC() is > ~105, then a battery isn't connected, and the system is being powered by USB. But this could be subjective.
-K