#Is uint8_t battery_level in a 0~100 range?

1 messages · Page 1 of 1 (latest)

pine nexus
#

I am implementing a custom battery level display and would like to be sure about the range the battery level values are expected to be in.

For example, in app/src/split/bluetooth/central.c:322
uint8_t battery_level = ((uint8_t *)data)[0];

or in app/boards/shields/nice_view/widgets/util.c:35
lv_canvas_draw_rect(canvas, 2, 4, (state->battery + 2) / 4, 8, &rect_white_dsc);

or app/src/display/widgets/battery_status.c:45

        strcat(text, LV_SYMBOL_BATTERY_FULL);
    } else if (level > 65) {
        strcat(text, LV_SYMBOL_BATTERY_3);
    } else if (level > 35) {
        strcat(text, LV_SYMBOL_BATTERY_2);
    } else if (level > 5) {
        strcat(text, LV_SYMBOL_BATTERY_1);
    } else {
        strcat(text, LV_SYMBOL_BATTERY_EMPTY);
    }```

(I am assuming all these take values in the same range)

These seem to indicate fairly certainly that the value range is 0~100, but it would be nice to know for sure.
torpid frost
#

That is the case, yes