GCC Code Coverage Report


Directory: ./
File: sensors/ADS7828.h
Date: 2026-10-29 08:11:58
Exec Total Coverage
Lines: 5 5 100.0%
Functions: 2 2 100.0%
Branches: 2 4 50.0%

Line Branch Exec Source
1 #pragma once
2 /*
3 * This file is part of the Falcon Player (FPP) and is Copyright (C)
4 * 2013-2022 by the Falcon Player Developers.
5 *
6 * The Falcon Player (FPP) is free software, and is covered under
7 * multiple Open Source licenses. Please see the included 'LICENSES'
8 * file for descriptions of what files are covered by each license.
9 *
10 * This source file is covered under the LGPL v2.1 as described in the
11 * included LICENSE.LGPL file.
12 */
13
14 #include <array>
15 #include "fpp-json-fwd.h"
16 #include <mutex>
17
18 #include "Sensors.h"
19
20 class I2CUtils;
21
22 class ADS7828Sensor : public SensorSource {
23 public:
24 ADS7828Sensor(Json::Value& config);
25 ~ADS7828Sensor();
26
27 7 virtual void update(bool forceInstant = false) override {}
28
29 1 virtual void enable(int id) override {
30
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 if (id >= 0 && id < (int)enabled.size()) {
31 1 enabled[id] = true;
32 }
33 1 }
34 virtual int32_t getValue(int id) override;
35
36 private:
37 I2CUtils* i2c = nullptr;
38 int i2cBus = 0;
39 int i2cAddress = 0x48;
40 bool internalRefVoltage = true;
41 int bits = 12;
42 std::mutex updateMutex;
43
44 std::array<bool, 8> enabled;
45 // Last successfully read value per channel. A failed transfer is nearly
46 // always transient (one NAK on a marginal bus), and the next status poll
47 // re-reads a second later, so hold the previous reading rather than
48 // reporting 0 and blipping the displayed value down and back up.
49 std::array<int32_t, 8> lastValue = { 0 };
50 };
51