From 25f89ee6ab68024f5da4474c88bbd93511996d2a Mon Sep 17 00:00:00 2001
From: Cem Aksoylar <caksoylar@gmail.com>
Date: Mon, 16 May 2022 21:51:28 -0700
Subject: [PATCH] feat(battery): Add Kconfig setting for battery level report
 interval

---
 app/Kconfig       | 5 +++++
 app/src/battery.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/app/Kconfig b/app/Kconfig
index 9b47c4c2..0879e5dc 100644
--- a/app/Kconfig
+++ b/app/Kconfig
@@ -518,6 +518,11 @@ config ZMK_SETTINGS_SAVE_DEBOUNCE
 #SETTINGS
 endif
 
+config ZMK_BATTERY_REPORT_INTERVAL
+	depends on ZMK_BLE
+	int "Battery level report interval in seconds"
+	default 60
+
 #Advanced
 endmenu
 
diff --git a/app/src/battery.c b/app/src/battery.c
index 51f96c12..3f662241 100644
--- a/app/src/battery.c
+++ b/app/src/battery.c
@@ -104,7 +104,7 @@ static int zmk_battery_init(const struct device *_arg) {
         return rc;
     }
 
-    k_timer_start(&battery_timer, K_MINUTES(1), K_MINUTES(1));
+    k_timer_start(&battery_timer, K_MINUTES(1), K_SECONDS(CONFIG_ZMK_BATTERY_REPORT_INTERVAL));
 
     return 0;
 }