Commit a35e4ac9 authored by schneider's avatar schneider
Browse files

Merge branch 'rahix/low-bat-disable' into 'master'

Add config option to disable low battery check

Closes #227

See merge request !464
parents cce77607 d5b39b18
Pipeline #5186 passed with stages
in 1 minute and 17 seconds
......@@ -62,4 +62,6 @@ Option name Type Description
``bsec_debug`` Boolean Turn on debug output of the BSEC system. Prints each meaurement on the console.
------------------ ---------- -----------
``bsec_offset`` Integer Temperature offset in .1 K. Example: Set to `-14` if temperature reads 1.4 "C" to high. Default: -2.2 K (appropriate for a card10 without a case, connected to USB and with BLE active in vertical orientation).
------------------ ---------- -----------
``battery_check`` Boolean Whether the low battery check should be enabled (default ``true``). **Warning**: Do not use this unless you know what you're doing. This option is only meant to be used on devices with a broken PMIC ADMUX connection.
================== ========== ===========
#include "epicardium.h"
#include "modules/modules.h"
#include "modules/log.h"
#include "modules/config.h"
#include "card10.h"
#include "pmic.h"
......@@ -173,6 +174,30 @@ static void pmic_check_battery()
float u_batt;
int res;
/**
* 0 = uncertain, ask config
* 1 = disabled
* 2 = enabled
*/
static int pmic_do_battery_check = 0;
if (pmic_do_battery_check == 0) {
if (config_get_boolean_with_default("battery_check", true)) {
pmic_do_battery_check = 2;
} else {
pmic_do_battery_check = 1;
LOG_WARN(
"pmic",
"Battery check was disabled by config!"
);
}
}
if (pmic_do_battery_check == 1) {
/* Disabled, ignore */
return;
}
res = pmic_read_amux(PMIC_AMUX_BATT_U, &u_batt);
if (res < 0) {
LOG_ERR("pmic",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment