Update clang-tidy configuration and fix some warnings (#1474)

Don't enable coding conventions from unrelated projects. Only enable
generic checks.
This commit is contained in:
Riku Isokoski
2022-12-18 19:14:36 +02:00
committed by GitHub
parent bfedf47d1a
commit afea7ca0d1
24 changed files with 153 additions and 151 deletions

View File

@@ -16,8 +16,8 @@ Battery::Battery() {
}
void Battery::ReadPowerState() {
isCharging = !nrf_gpio_pin_read(PinMap::Charging);
isPowerPresent = !nrf_gpio_pin_read(PinMap::PowerPresent);
isCharging = (nrf_gpio_pin_read(PinMap::Charging) == 0);
isPowerPresent = (nrf_gpio_pin_read(PinMap::PowerPresent) == 0);
if (isPowerPresent && !isCharging) {
isFull = true;
@@ -81,10 +81,8 @@ void Battery::SaadcEventHandler(nrfx_saadc_evt_t const* p_event) {
// p_event->data.done.p_buffer[0] = (adc_voltage / reference_voltage) * 1024
voltage = p_event->data.done.p_buffer[0] * (8 * 600) / 1024;
uint8_t newPercent;
if (isFull) {
newPercent = 100;
} else {
uint8_t newPercent = 100;
if (!isFull) {
newPercent = std::min(aprox.GetValue(voltage), isCharging ? uint8_t {99} : uint8_t {100});
}