Implemented RBAT (Battery impedance measurement)

Removed ISOL
Added LOWBATT message in APRS position packet
Develop
Sven Steudte 2017-09-01 02:02:30 +02:00
rodzic fe68f49820
commit 94aaa434cf
13 zmienionych plików z 130 dodań i 82 usunięć

Wyświetl plik

@ -73,13 +73,13 @@ uint8_t ssdv_buffer[256*1024] __attribute__((aligned(32)));
* (required) There are possible options:
* - TEL_SATS GPS Satellites
* - TEL_TTFF Time to first fix (amount of seconds which it needed to aquire a GPS fix)
* - TEL_VBAT Battery voltage
* - TEL_VSOL Solar voltage
* - TEL_VBAT Battery voltage (in mV)
* - TEL_VSOL Solar voltage (in mV)
* - TEL_PBAT Battery power (positive charge, negative discharge)
* - TEL_ISOL Solar short current (works only if USB is unattached)
* - TEL_PRESS Air pressure (by BME280)
* - TEL_TEMP Air temperature (by BME280)
* - TEL_HUM Air humidity (by BME280)
* - TEL_RBAT Battery impedance (in mOhm)
* - TEL_PRESS Air pressure (in Pa)
* - TEL_TEMP Air temperature (in degC*100)
* - TEL_HUM Air humidity (in %*10)
*
* aprs_conf.tel_enc bool The telemetry in the position packets do only contain the raw values. Receivers (like aprs.fi) dont know what these
* (default false) values stands for. So we must tell them (e.g. that value 1 is air pressure measured in Pascal). If set to true, the
@ -184,8 +184,8 @@ void start_user_modules(void)
config[0].aprs_conf.preamble = 300; // APRS Preamble
config[0].aprs_conf.tel[0] = TEL_VBAT; // APRS Telemetry parameter 1
config[0].aprs_conf.tel[1] = TEL_PBAT; // APRS Telemetry parameter 2
config[0].aprs_conf.tel[2] = TEL_TEMP; // APRS Telemetry parameter 3
config[0].aprs_conf.tel[3] = TEL_PRESS; // APRS Telemetry parameter 4
config[0].aprs_conf.tel[2] = TEL_RBAT; // APRS Telemetry parameter 3
config[0].aprs_conf.tel[3] = TEL_TEMP; // APRS Telemetry parameter 4
config[0].aprs_conf.tel[4] = TEL_HUM; // APRS Telemetry parameter 5
config[0].aprs_conf.tel_enc = TRUE; // Transmit Telemetry encoding information activated
config[0].aprs_conf.tel_enc_cycle = 3600; // Transmit Telemetry encoding information every 3600sec
@ -248,7 +248,7 @@ void start_user_modules(void)
chsnprintf(config[3].ssdv_conf.callsign, 7, "DL7AD"); // SSDV Callsign
config[3].ssdv_conf.ram_buffer = ssdv_buffer; // Camera buffer
config[3].ssdv_conf.ram_size = sizeof(ssdv_buffer); // Buffer size
config[3].ssdv_conf.res = RES_QVGA; // Resolution VGA
config[3].ssdv_conf.res = RES_QVGA; // Resolution QVGA
config[3].ssdv_conf.redundantTx = true; // Transmit packets twice
//start_image_thread(&config[3]);
@ -282,7 +282,7 @@ void start_user_modules(void)
chsnprintf(config[5].ssdv_conf.callsign, 7, "DL7AD2"); // SSDV Callsign
config[5].ssdv_conf.ram_buffer = ssdv_buffer; // Camera buffer
config[5].ssdv_conf.ram_size = sizeof(ssdv_buffer); // Buffer size
config[5].ssdv_conf.res = RES_QVGA; // Resolution XGA
config[5].ssdv_conf.res = RES_VGA; // Resolution XGA
//config[5].ssdv_conf.redundantTx = true; // Transmit packets twice
//start_image_thread(&config[5]);

Wyświetl plik

@ -21,7 +21,7 @@
#define TRACE_TIME TRUE /* Enables time tracing on debugging port */
#define TRACE_FILE FALSE /* Enables file and line tracing on debugging port */
#define RUN_3V FALSE /* Lets the tracker run a 3V otherwise 1.8V. 3V is needed to do 20dBm radio output power.
#define RUN_3V TRUE /* Lets the tracker run a 3V otherwise 1.8V. 3V is needed to do 20dBm radio output power.
* With 1.8V only 15dBm can be done. Some serial-USB adapters also need a 3V IO level in
* order to work. However 3V takes a lot of power in idle. You can save energy using 1.8V. */

Wyświetl plik

@ -993,7 +993,7 @@ CH_IRQ_HANDLER(Vector5C) {
if (LptimRdy) {
// VSYNC handling
if(!vsync) {
// Increase AHB clock to 6 MHz
// Increase AHB clock to 48 MHz
uint32_t new = (FLASH->ACR & ~FLASH_ACR_LATENCY_Msk) | FLASH_ACR_LATENCY_3WS;
FLASH->ACR = new;
while(FLASH->ACR != new);

Wyświetl plik

@ -4,6 +4,7 @@
#include "pi2c.h"
#include "pac1720.h"
#include "padc.h"
#include <stdlib.h>
/*
* FSP = FSC * FSV
@ -19,6 +20,8 @@
static int32_t pac1720_pbat;
static int32_t pac1720_pbat_counter;
static int32_t pac1720_rbat;
static int32_t pac1720_rbat_counter;
int16_t pac1720_getPbat(void) {
int32_t fsp = FSV * FSC;
@ -27,40 +30,18 @@ int16_t pac1720_getPbat(void) {
if(I2C_read16(PAC1720_ADDRESS, PAC1720_CH2_PWR_RAT_HIGH, (uint16_t*)&val)) {
I2C_read8(PAC1720_ADDRESS, PAC1720_CH2_VSENSE_HIGH, &sign);
TRACE_DEBUG("%016x %02x", val, sign >> 7);
return (sign >> 7 ? -1 : 1) * (val * fsp / 65535);
} else {
TRACE_DEBUG("bla");
return 0; // PAC1720 not available (maybe Vcc too low)
}
}
int16_t pac1720_getIsol(void) {
if(isUsbConnected()) // USB not connected
{
// Short solar cells
palClearLine(LINE_SOL_SHORT_EN);
chThdSleepMilliseconds(300); // Wait a little bit to measure a correct value
int16_t val;
uint8_t ret = I2C_read16(PAC1720_ADDRESS, PAC1720_CH1_VSENSE_HIGH, (uint16_t*)&val);
// Unshort solar cells
palSetLine(LINE_SOL_SHORT_EN);
// Calculate solar current
if(ret) {
val = val < 0 ? 0 : val >> 4; // Current can only flow in one direction (negative values are inaccurate readings)
return val * FSC / DENO;
} else {
return 0; // PAC1720 not available (maybe Vcc too low)
}
}
return 0; // USB connected (we dont want to short USB)
}
int16_t pac1720_getAvgPbat(void) {
// Return current value if time interval too short
if(!pac1720_pbat_counter)
pac1720_getPbat();
return pac1720_getPbat();
// Calculate average power
int16_t ret = pac1720_pbat / pac1720_pbat_counter;
@ -72,7 +53,7 @@ int16_t pac1720_getAvgPbat(void) {
return ret;
}
uint16_t pac1720_getBatteryVoltage(void) {
uint16_t pac1720_getVbat(void) {
uint16_t val;
if(!I2C_read16(PAC1720_ADDRESS, PAC1720_CH2_VSOURCE_HIGH, &val))
return 0; // PAC1720 not available (maybe Vcc too low)
@ -80,7 +61,22 @@ uint16_t pac1720_getBatteryVoltage(void) {
return (val >> 5) * 20000 / 0x400;
}
uint16_t pac1720_getSolarVoltage(void) {
int16_t pac1720_getAvgRbat(void) {
// Return current value if time interval too short
if(!pac1720_rbat_counter)
return 0;
// Calculate average power
int16_t ret = pac1720_rbat / pac1720_rbat_counter;
// Reset current measurement
pac1720_rbat = 0;
pac1720_rbat_counter = 0;
return ret;
}
uint16_t pac1720_getVsol(void) {
uint16_t val;
if(!I2C_read16(PAC1720_ADDRESS, PAC1720_CH1_VSOURCE_HIGH, &val))
return 0; // PAC1720 not available (maybe Vcc too low)
@ -101,12 +97,42 @@ THD_FUNCTION(pac1720_thd, arg)
{
(void)arg;
uint32_t counter = 0;
int32_t u1 = 999999;
int32_t p1 = 999999;
int32_t u2 = -999999;
int32_t p2 = -999999;
while(true)
{
// Sample data
int32_t v = pac1720_getVbat();
int32_t p = pac1720_getPbat();
// Measure battery power
pac1720_pbat += pac1720_getPbat();
pac1720_pbat += p;
pac1720_pbat_counter++;
// Measure battery impedance
if(p < p1) {
u1 = v;
p1 = p;
}
if(p > p2) {
u2 = v;
p2 = p;
}
if(++counter%10 == 0 && abs(p1-p2) > 100 && abs(u1-u2) > 0 && p1*u2 != p2*u1)
{
int32_t rbat = abs((u1*u2*(u1-u2)) / (p1*u2 - p2*u1));
pac1720_rbat += rbat;
pac1720_rbat_counter++;
u1 = 999999;
p1 = 999999;
u2 = -999999;
p2 = -999999;
}
chThdSleepMilliseconds(50);
}
}
@ -131,3 +157,4 @@ void pac1720_init(void)
TRACE_INFO("PAC > Init PAC1720 continuous measurement");
chThdCreateFromHeap(NULL, THD_WORKING_AREA_SIZE(256), "PAC1720", NORMALPRIO, pac1720_thd, NULL);
}

Wyświetl plik

@ -40,9 +40,9 @@
#define PAC1720_CH2_VSENSE_LIMIT_LOW 0x1C
#define PAC1720_CH1_VSOURCE_LIMIT_HIGH 0x1D
#define PAC1720_CH2_VSOURCE_LIMIT_HIGH 0x1E
#define PAC1720_CH1_VSOURCE_LIMIT_LOW 0x1F
#define PAC1720_CH2_VSOURCE_LIMIT_LOW 0x20
#define PAC1720_CH2_VSOURCE_LIMIT_HIGH 0x1E
#define PAC1720_CH1_VSOURCE_LIMIT_LOW 0x1F
#define PAC1720_CH2_VSOURCE_LIMIT_LOW 0x20
#define PAC1720_PRODUCT_ID 0xFD
#define PAC1720_MANUFACTURER_ID 0xFE
@ -53,8 +53,9 @@ void pac1720_init(void);
int16_t pac1720_getIsol(void);
int16_t pac1720_getPbat(void);
int16_t pac1720_getAvgPbat(void);
uint16_t pac1720_getBatteryVoltage(void);
uint16_t pac1720_getSolarVoltage(void);
uint16_t pac1720_getVbat(void);
int16_t pac1720_getAvgRbat(void);
uint16_t pac1720_getVsol(void);
bool pac1720_isAvailable(void);
#endif

Wyświetl plik

@ -68,15 +68,20 @@ void doConversion(void)
deinitADC();
}
uint16_t getBatteryVoltageMV(void)
uint16_t getBatteryVoltageMV_STM32(void)
{
doConversion();
uint16_t vbat = samples[2] * vcc_ref * DIVIDER_VBAT / 4096;
return samples[2] * vcc_ref * DIVIDER_VBAT / 4096;
}
uint16_t getBatteryVoltageMV(void)
{
uint16_t vbat = getBatteryVoltageMV_STM32();
// Get voltage from PAC1720 (PAC1720 returns false redings below 2.35V)
if(vbat >= 2500)
{
uint16_t vbat_pac = pac1720_getBatteryVoltage(); // Get value from PAC1720
uint16_t vbat_pac = pac1720_getVbat(); // Get value from PAC1720
if(vbat_pac) // Apply it if valid
vbat = vbat_pac;
}
@ -86,10 +91,12 @@ uint16_t getBatteryVoltageMV(void)
uint16_t getSolarVoltageMV(void)
{
uint16_t vbat = getBatteryVoltageMV_STM32();
// Get voltage from PAC1720 (PAC1720 returns false redings below 2.35V)
if(getBatteryVoltageMV() >= 2500)
if(vbat >= 2500)
{
uint16_t vsol_pac = pac1720_getSolarVoltage(); // Get value from PAC1720
uint16_t vsol_pac = pac1720_getVsol(); // Get value from PAC1720
if(vsol_pac)
return vsol_pac;
}

Wyświetl plik

@ -8,6 +8,7 @@
void initADC(void);
void deinitADC(void);
uint16_t getBatteryVoltageMV_STM32(void);
uint16_t getBatteryVoltageMV(void);
uint16_t getSolarVoltageMV(void);
uint16_t getUSBVoltageMV(void);

Wyświetl plik

@ -93,8 +93,8 @@ void replace_placeholders(char* fskmsg, uint16_t size, trackPoint_t *tp) {
str_replace(fskmsg, size, "<VSOL>", buf);
chsnprintf(buf, sizeof(buf), "%d.%03d", tp->adc_pbat/1000, (tp->adc_pbat >= 0 ? 1 : -1) * (tp->adc_pbat%1000));
str_replace(fskmsg, size, "<PBAT>", buf);
chsnprintf(buf, sizeof(buf), "%d.%03d", tp->adc_isol/1000, (tp->adc_isol >= 0 ? 1 : -1) * (tp->adc_isol%1000));
str_replace(fskmsg, size, "<ISOL>", buf);
chsnprintf(buf, sizeof(buf), "%d.%03d", tp->adc_rbat/1000, (tp->adc_rbat >= 0 ? 1 : -1) * (tp->adc_rbat%1000));
str_replace(fskmsg, size, "<RBAT>", buf);
chsnprintf(buf, sizeof(buf), "%d", tp->air_press/10);
str_replace(fskmsg, size, "<PRESS>", buf);
chsnprintf(buf, sizeof(buf), "%d.%d", tp->air_temp/100, (tp->air_temp%100)/10);

Wyświetl plik

@ -179,7 +179,7 @@ THD_FUNCTION(trackingThread, arg) {
lastTrackPoint->gps_alt = lastLogPoint.gps_alt;
}
lastTrackPoint->gps_lock = 0; // But tell the user that there is no current lock nor any GPS sats locked
lastTrackPoint->gps_lock = GPS_LOSS; // But tell the user that there is no current lock nor any GPS sats locked
lastTrackPoint->gps_sats = 0;
lastTrackPoint->gps_ttff = 0;
@ -202,7 +202,6 @@ THD_FUNCTION(trackingThread, arg) {
lastTrackPoint->adc_vsol = getSolarVoltageMV();
lastTrackPoint->adc_vbat = getBatteryVoltageMV();
lastTrackPoint->adc_vusb = getUSBVoltageMV();
lastTrackPoint->adc_isol = pac1720_getIsol();
lastTrackPoint->adc_pbat = pac1720_getPbat();
bme280_t bme280;
@ -278,13 +277,17 @@ THD_FUNCTION(trackingThread, arg) {
tp->gps_lon = gpsFix.lon;
tp->gps_alt = gpsFix.alt;
tp->gps_lock = isGPSLocked(&gpsFix);
tp->gps_lock = GPS_LOCKED;
tp->gps_sats = gpsFix.num_svs;
} else { // GPS lost (keep GPS switched on)
// Debug
TRACE_WARN("TRAC > GPS sampling finished GPS LOSS");
if(batt < GPS_OFF_VBAT) {
TRACE_WARN("TRAC > GPS sampling finished GPS LOW BATT");
} else {
TRACE_WARN("TRAC > GPS sampling finished GPS LOSS");
}
// Take time from internal RTC
getTime(&rtc);
@ -300,8 +303,8 @@ THD_FUNCTION(trackingThread, arg) {
tp->gps_lon = ltp->gps_lon;
tp->gps_alt = ltp->gps_alt;
// Mark gpsloss
tp->gps_lock = false;
// Mark GPS loss (or low batt)
tp->gps_lock = batt < GPS_OFF_VBAT ? GPS_LOWBATT : GPS_LOSS;
tp->gps_sats = 0;
}
@ -313,8 +316,8 @@ THD_FUNCTION(trackingThread, arg) {
tp->adc_vsol = getSolarVoltageMV();
tp->adc_vbat = getBatteryVoltageMV();
tp->adc_vusb = getUSBVoltageMV();
tp->adc_isol = pac1720_getIsol();
tp->adc_pbat = pac1720_getAvgPbat();
tp->adc_rbat = pac1720_getAvgRbat();
bme280_t bme280;
@ -336,13 +339,13 @@ THD_FUNCTION(trackingThread, arg) {
"%s Time %04d-%02d-%02d %02d:%02d:%02d\r\n"
"%s Pos %d.%05d %d.%05d Alt %dm\r\n"
"%s Sats %d TTFF %dsec\r\n"
"%s ADC Vbat=%d.%03dV Vsol=%d.%03dV VUSB=%d.%03dV Pbat=%dmW Isol=%dmA\r\n"
"%s ADC Vbat=%d.%03dV Vsol=%d.%03dV VUSB=%d.%03dV Pbat=%dmW Rbat=%dmOhm\r\n"
"%s AIR p=%6d.%01dPa T=%2d.%02ddegC phi=%2d.%01d%%",
tp->id,
TRACE_TAB, tp->time.year, tp->time.month, tp->time.day, tp->time.hour, tp->time.minute, tp->time.day,
TRACE_TAB, tp->gps_lat/10000000, (tp->gps_lat > 0 ? 1:-1)*(tp->gps_lat/100)%100000, tp->gps_lon/10000000, (tp->gps_lon > 0 ? 1:-1)*(tp->gps_lon/100)%100000, tp->gps_alt,
TRACE_TAB, tp->gps_sats, tp->gps_ttff,
TRACE_TAB, tp->adc_vbat/1000, (tp->adc_vbat%1000), tp->adc_vsol/1000, (tp->adc_vsol%1000), tp->adc_vusb/1000, (tp->adc_vusb%1000), tp->adc_pbat, tp->adc_isol,
TRACE_TAB, tp->adc_vbat/1000, (tp->adc_vbat%1000), tp->adc_vsol/1000, (tp->adc_vsol%1000), tp->adc_vusb/1000, (tp->adc_vusb%1000), tp->adc_pbat, tp->adc_rbat,
TRACE_TAB, tp->air_press/10, tp->air_press%10, tp->air_temp/100, tp->air_temp%100, tp->air_hum/10, tp->air_hum%10
);

Wyświetl plik

@ -5,12 +5,16 @@
#include "hal.h"
#include "ptime.h"
#define GPS_LOCKED 0 /* GPS is locked and could aquire a fix */
#define GPS_LOSS 1 /* GPS was switched on all time but it couln't aquire a fix */
#define GPS_LOWBATT 2 /* GPS was switched on but had to be switched off prematurely while the battery is almost empty (or is too cold) */
typedef struct {
uint32_t id; // Serial ID
ptime_t time; // GPS time
// GPS
bool gps_lock; // True = on last try GPS has been locked
uint8_t gps_lock; // 0: locked, 1: GPS loss, 2: low power (switched off)
int32_t gps_lat; // Latitude in °*10^7
int32_t gps_lon; // Longitude in °*10^7
int32_t gps_alt; // Altitude in meter
@ -22,7 +26,7 @@ typedef struct {
uint16_t adc_vbat; // Current battery voltage in mV
uint16_t adc_vusb; // Current USB voltage in mV
int16_t adc_pbat; // Average battery current (since last track point)
int16_t adc_isol; // Current solar shot current
int16_t adc_rbat; // Battery impedance
// BME280 (on board)
uint32_t air_press; // Airpressure in Pa*10 (in 0.1Pa)

Wyświetl plik

@ -77,7 +77,7 @@ uint32_t aprs_encode_position(uint8_t* message, mod_t mod, const aprs_conf_t *co
uint32_t a1 = a / 91;
uint32_t a1r = a % 91;
uint8_t gpsFix = trackPoint->gps_lock ? GSP_FIX_CURRENT : GSP_FIX_OLD;
uint8_t gpsFix = trackPoint->gps_lock ? GSP_FIX_OLD : GSP_FIX_CURRENT;
uint8_t src = NMEA_SRC_GGA;
uint8_t origin = ORIGIN_PICO;
@ -103,7 +103,7 @@ uint32_t aprs_encode_position(uint8_t* message, mod_t mod, const aprs_conf_t *co
chsnprintf(temp, sizeof(temp), "%d", trackPoint->gps_sats);
ax25_send_string(&packet, temp);
if(trackPoint->gps_lock)
if(trackPoint->gps_lock == GPS_LOCKED) // GPS is locked
{
// TTFF (Time to first fix)
ax25_send_string(&packet, " TTFF ");
@ -112,12 +112,18 @@ uint32_t aprs_encode_position(uint8_t* message, mod_t mod, const aprs_conf_t *co
ax25_send_string(&packet, "sec");
}
// GPS Loss counter
if(!trackPoint->gps_lock)
{
if(trackPoint->gps_lock == GPS_LOSS) { // No GPS lock
ax25_send_string(&packet, " GPS LOSS ");
chsnprintf(temp, sizeof(temp), "%d", ++loss_of_gps_counter);
ax25_send_string(&packet, temp);
} else if(trackPoint->gps_lock == GPS_LOWBATT) { // GPS switched off prematurely
ax25_send_string(&packet, " GPS LOWBATT ");
chsnprintf(temp, sizeof(temp), "%d", ++loss_of_gps_counter);
ax25_send_string(&packet, temp);
} else {
loss_of_gps_counter = 0;
}
@ -140,7 +146,7 @@ uint32_t aprs_encode_position(uint8_t* message, mod_t mod, const aprs_conf_t *co
case TEL_VBAT: t = trackPoint->adc_vbat; break;
case TEL_VSOL: t = trackPoint->adc_vsol; break;
case TEL_PBAT: t = trackPoint->adc_pbat+4096; break;
case TEL_ISOL: t = trackPoint->adc_isol; break;
case TEL_RBAT: t = trackPoint->adc_rbat; break;
case TEL_HUM: t = trackPoint->air_hum; break;
case TEL_PRESS: t = trackPoint->air_press/125 - 40; break;
case TEL_TEMP: t = trackPoint->air_temp/10 + 1000; break;
@ -259,7 +265,7 @@ uint32_t aprs_encode_telemetry_configuration(uint8_t* message, mod_t mod, const
case TEL_VBAT: ax25_send_string(&packet, "Vbat"); break;
case TEL_VSOL: ax25_send_string(&packet, "Vsol"); break;
case TEL_PBAT: ax25_send_string(&packet, "Pbat"); break;
case TEL_ISOL: ax25_send_string(&packet, "Isol"); break;
case TEL_RBAT: ax25_send_string(&packet, "Rbat"); break;
case TEL_HUM: ax25_send_string(&packet, "Humidity"); break;
case TEL_PRESS: ax25_send_string(&packet, "Airpressure"); break;
case TEL_TEMP: ax25_send_string(&packet, "Temperature"); break;
@ -292,8 +298,8 @@ uint32_t aprs_encode_telemetry_configuration(uint8_t* message, mod_t mod, const
ax25_send_string(&packet, "W");
break;
case TEL_ISOL:
ax25_send_string(&packet, "A");
case TEL_RBAT:
ax25_send_string(&packet, "Ohm");
break;
case TEL_HUM:
@ -325,10 +331,9 @@ uint32_t aprs_encode_telemetry_configuration(uint8_t* message, mod_t mod, const
ax25_send_string(&packet, "0,1,0");
break;
case TEL_ISOL:
case TEL_VBAT:
case TEL_VSOL:
case TEL_RBAT:
ax25_send_string(&packet, "0,.001,0");
break;

Wyświetl plik

@ -17,14 +17,14 @@ bool p_sleep(const sleep_conf_t *config)
case SLEEP_WHEN_VBAT_BELOW_THRES:
return getBatteryVoltageMV() < config->vbat_thres;
case SLEEP_WHEN_ISOL_BELOW_THRES:
return pac1720_getIsol() < config->isol_thres;
case SLEEP_WHEN_RBAT_BELOW_THRES:
return 0 < config->rbat_thres; // FIXME
case SLEEP_WHEN_VBAT_ABOVE_THRES:
return getBatteryVoltageMV() > config->vbat_thres;
case SLEEP_WHEN_ISOL_ABOVE_THRES:
return pac1720_getIsol() > config->isol_thres;
case SLEEP_WHEN_RBAT_ABOVE_THRES:
return 0 > config->rbat_thres; // FIXME
case SLEEP_WHEN_DISCHARGING:
case SLEEP_WHEN_CHARGING:

Wyświetl plik

@ -31,7 +31,7 @@ typedef enum {
TEL_VBAT,
TEL_VSOL,
TEL_PBAT,
TEL_ISOL,
TEL_RBAT,
TEL_PRESS,
TEL_TEMP,
TEL_HUM
@ -52,9 +52,9 @@ typedef struct {
typedef enum {
SLEEP_DISABLED,
SLEEP_WHEN_VBAT_BELOW_THRES,
SLEEP_WHEN_ISOL_BELOW_THRES,
SLEEP_WHEN_RBAT_BELOW_THRES,
SLEEP_WHEN_VBAT_ABOVE_THRES,
SLEEP_WHEN_ISOL_ABOVE_THRES,
SLEEP_WHEN_RBAT_ABOVE_THRES,
SLEEP_WHEN_DISCHARGING,
SLEEP_WHEN_CHARGING
} sleep_type_t;
@ -62,7 +62,7 @@ typedef enum {
typedef struct {
sleep_type_t type;
uint16_t vbat_thres;
uint16_t isol_thres;
uint16_t rbat_thres;
} sleep_conf_t;
typedef struct {