1
2
3
4
5
6
7
8
9
10
11
12
int battery_time(void)
{
#if ((CONFIG_BATTERY_MEASURE & TIME_MEASURE) == 0)
  #ifndef CURRENT_NORMAL /* no estimation without current */
    return -1;
  #else
    if (battery_capacity <= 0) /* nor without capacity */
        return -1;
  #endif
#endif
    return _battery_time();
}