Browse Source

declare a flag in battery.h for measurement

namrota ghosh 7 months ago
parent
commit
22f5e1f079
2 changed files with 8 additions and 2 deletions
  1. 4 1
      src/battery_data/battery.c
  2. 4 1
      src/battery_data/battery.h

+ 4 - 1
src/battery_data/battery.c

@@ -4,6 +4,9 @@
 
 
 BatteryInfo battery_data[NUM_SLOTS];
 BatteryInfo battery_data[NUM_SLOTS];
 
 
+
+
+
 //Initialize battery struct
 //Initialize battery struct
 void Battery_Init(){
 void Battery_Init(){
     for(uint8_t i=0; i<NUM_SLOTS; i++){
     for(uint8_t i=0; i<NUM_SLOTS; i++){
@@ -29,7 +32,7 @@ void Battery_ReadState(uint8_t slot_id){
        battery_data[slot_id].max_voltage==0 &&
        battery_data[slot_id].max_voltage==0 &&
        battery_data[slot_id].cut_off_current==0){
        battery_data[slot_id].cut_off_current==0){
         battery_data[slot_id].battery_state = STATE_WAITING_FOR_LIMITS;
         battery_data[slot_id].battery_state = STATE_WAITING_FOR_LIMITS;
-        printf("Waiting to receive battery limits to start charging/discharging\n");
+        //printf("Waiting to receive battery limits to start charging/discharging\n");
     }
     }
     else if(battery_data[slot_id].battery_measurement.voltage < BATTERY_THRESHOLD){
     else if(battery_data[slot_id].battery_measurement.voltage < BATTERY_THRESHOLD){
         battery_data[slot_id].battery_state = STATE_EMPTY;
         battery_data[slot_id].battery_state = STATE_EMPTY;

+ 4 - 1
src/battery_data/battery.h

@@ -8,7 +8,10 @@
 #define PWM_INCREMENT_VALUE (1)
 #define PWM_INCREMENT_VALUE (1)
 #define PWM_DECREMENT_VALUE (1)
 #define PWM_DECREMENT_VALUE (1)
 #define PWM_MAX_VALUE (1000)
 #define PWM_MAX_VALUE (1000)
-#define NUM_SLOTS (1)
+#define NUM_SLOTS (4)
+
+//Variables to read all the battery measurements from all the slots
+extern volatile bool scanInProgress;
 
 
 //Battery states read by Pi
 //Battery states read by Pi
 typedef enum{
 typedef enum{