|
|
@@ -4,7 +4,10 @@
|
|
|
#include "src/config.h"
|
|
|
#ifndef BATTERY_H
|
|
|
#define BATTERY_H
|
|
|
-#define HYSTERISIS (50)
|
|
|
+#define INITIAL_PWM_VALUE (0)
|
|
|
+#define PWM_INCREMENT_VALUE (1)
|
|
|
+#define PWM_DECREMENT_VALUE (1)
|
|
|
+#define MAX_DEVICE_THRESHOLD (6000)
|
|
|
|
|
|
//Battery states read by Pi
|
|
|
typedef enum{
|
|
|
@@ -22,7 +25,6 @@ typedef enum __attribute((packed))__{
|
|
|
SLOT_STATE_OK= 0x00,
|
|
|
SLOT_STATE_SOV= 0x01,
|
|
|
SLOT_ERR_HOV= (0x02 | 0x80),
|
|
|
-
|
|
|
SLOT_ERR_OVERTEMPERATURE= (0x03 | 0x80), // first bit indicates complete error
|
|
|
|
|
|
// Control error states
|
|
|
@@ -59,6 +61,7 @@ typedef struct __attribute__((packed)){
|
|
|
|
|
|
typedef struct{
|
|
|
uint8_t slot_id;
|
|
|
+ uint16_t pwm_value; //for Power Burning PWM
|
|
|
int16_t charge_discharge;
|
|
|
BatteryState battery_state;
|
|
|
BatteryMeasurement battery_measurement;
|