Initial commit - sync AliceRC to Gitea

This commit is contained in:
2026-08-03 15:54:25 +08:00
commit 493b7d81d7
1510 changed files with 185319 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
/**
* @file battery.c
* @brief Battery monitoring utilities
*/
#include "esp_log.h"
#include "app_main.h"
static const char *TAG = "battery";
/* Battery percentage lookup table (simple linear for now) */
uint8_t battery_get_percent(uint16_t mv)
{
if (mv >= BAT_FULL_MV) return 100;
if (mv <= BAT_EMPTY_MV) return 0;
/* Linear interpolation between EMPTY and FULL */
return (uint8_t)((mv - BAT_EMPTY_MV) * 100 / (BAT_FULL_MV - BAT_EMPTY_MV));
}