Maybe use a constant for this length?

```C
#define BATTERY_LEN 8
...
#undef BATTERY_LEN
```