Pārlūkot izejas kodu

the command for getting BATTERY LIMITS has been updated to bitmasked and added additional previous_cycle_number received from Pi

namrota ghosh 7 mēneši atpakaļ
vecāks
revīzija
a8b8868600
1 mainītis faili ar 3 papildinājumiem un 1 dzēšanām
  1. 3 1
      src/pi/i2c_pi_target.c

+ 3 - 1
src/pi/i2c_pi_target.c

@@ -94,7 +94,7 @@ void pi_i2c_mcu(){
     else if((receivedCommand & 0x0F)== 0x03){
 
         //slot_id is another element
-        //Example i2ctools: i2cset -y 1 0x20 0x03 0x2C 0x01 0x68 0x10 0xFA 0xD0 0x07 0x19 i
+        //Example i2ctools: i2cset -y 1 0x20 0x03 0x2C 0x01 0x68 0x10 0xFA 0xD0 0x07 0x19 0x00 i
         /*
         * min_voltage: 300 (2C 01)
         * max_voltage: 4200 (68 10)
@@ -123,6 +123,8 @@ void pi_i2c_mcu(){
                 battery->cut_off_current = battery_limit_received.cut_off_current;
                 battery->capacitance = battery_limit_received.capacitance;
                 battery->charge_fraction = battery_limit_received.charge_fraction;
+                // this is when WWDT resets the MCU during the charging cycle
+                battery->cycle_number = battery_limit_received.previous_cycle_number;
                 battery->batteryLimitReceived= true;
             }    
         }