5 #include "oXs_config_basic.h"
6 #include "oXs_config_advanced.h"
7 #include "oXs_config_macros.h"
10 // bool available; // to remove afterward
11 uint16_t vrefMilliVolts
; // in mV the internal measured voltage Reference ; to remove afterward
13 struct ONE_MEASUREMENT mVolt
[6] ; // in mV
14 // int32_t mVolt[6] ; // in mV
15 // bool mVoltAvailable[6] ;
17 byte mVoltPin
[6] ; // Arduino pin number to use to read each voltage (See hardware setting in oXs_config.h)
18 int offset
[6] ; // offset to apply while converting ADC to millivolt (See setting in oXs_config.h)
19 float mVoltPerStep
[6] ; // rate to apply while converting ADC to millivolt (See setting in oXs_config.h)
21 bool atLeastOneVolt
; // true if there is at least one voltage to measure (added because otherwise a while in cpp never end)
23 int32_t sumVoltage
[6] ; // used to calculate average voltage
25 uint8_t maxNumberOfCells
; // used to fill in the max number of cells
26 uint32_t mVoltCell
[6] ;
27 bool mVoltCell_Available
[6];
28 uint32_t mVoltCellMin
;
29 bool mVoltCellMin_Available
;
30 uint32_t mVoltCellTot
;
31 bool mVoltCellTot_Available
;
33 #if defined(PROTOCOL) && ( (PROTOCOL == FRSKY_SPORT) || ( PROTOCOL == FRSKY_HUB ) || (PROTOCOL == FRSKY_SPORT_HUB ) ) //if Frsky protocol is used
34 struct ONE_MEASUREMENT mVoltCell_1_2
;
35 struct ONE_MEASUREMENT mVoltCell_3_4
;
36 struct ONE_MEASUREMENT mVoltCell_5_6
;
44 OXS_VOLTAGE(HardwareSerial
&print
);
46 OXS_VOLTAGE( uint8_t x
);
48 VOLTAGEDATA voltageData
;
49 void setupVoltage( void );
52 void convertNtcVoltToTemp (int32_t &voltage
) ;
56 HardwareSerial
* printer
;
58 int readVoltage( int value
) ; // read the voltage from the sensor specify by value
59 void voltageNrIncrease() ;
60 uint32_t calculateCell(int32_t V0
, int32_t V1
, int32_t V2
, uint8_t cellId
, uint8_t maxNumberOfCells
) ;
63 extern bool lowVoltage
;