@@ -45,7 +45,8 @@ LeafMultiPack::LeafMultiPack(
4545 m_shutdown_callback_count (0 ),
4646 m_fully_charged (true ),
4747 m_fully_discharged (true ),
48- m_display_shutdown_status (true )
48+ m_display_shutdown_status (true ),
49+ m_zero_current_count (0 )
4950{
5051 m_timer.registerPeriodicCallback (&m_periodic_callback, CALLBACK_PERIOD_ms, " LeafMultiPackPeriodic" );
5152 if (m_log) m_log->info (" LeafMultiPack: status set to STARTUP" );
@@ -159,6 +160,15 @@ void LeafMultiPack::periodicCallback()
159160 }
160161 }
161162
163+ if (m_zero_current_count > 0 )
164+ {
165+ m_zero_current_count--;
166+ std::ostringstream ss;
167+ ss << " LeafMultiPack: current set to 0 for " << m_zero_current_count << " more callbacks" ;
168+ if (m_log) m_log->info (ss);
169+ }
170+
171+
162172 m_start_button_state = m_start_button.get ();
163173 if (m_start_button_state != m_prev_sb_state)
164174 {
@@ -343,14 +353,16 @@ float LeafMultiPack::getMinDischargeVoltage() const
343353
344354float LeafMultiPack::getChargeCurrentLimit () const
345355{
346- // if shutting down return 0
347- if (getPackStatus () == Monitor::SHUTTING_DOWN ) return 0.0 ;
356+ // if shutting down or in zero state return 0
357+ if (getPackStatus () == Monitor::SHUTTING_DOWN || (m_zero_current_count > 0 ) ) return 0.0 ;
348358
349359 // if full, no charging allowed
350360 if (m_fully_charged) return 0.0 ;
351361
352362 // THIS IS A STOP GAP. NEED TO FIGURE OUT WHY THIS WAS REPORTING HIGH CCL (>40A) TO INVERTER
353363 // DISPITE LEAF BATTERIES REPORTING <2A EACH FOR CCL
364+ // I believe this was being caused by faulty current smoothing code in LeafMonitor.cpp
365+ // Code has been changed (in previous version) but leaving this here for now
354366 const float CRITICALLY_HIGH_VOLTAGE (4.15 );
355367 const float WARN_HIGH_VOLTAGE (4.1 );
356368 if (getMaxCellVolts () >= WARN_HIGH_VOLTAGE + 0.01 )
@@ -389,7 +401,7 @@ float LeafMultiPack::getChargeCurrentLimit() const
389401float LeafMultiPack::getDischargeCurrentLimit () const
390402{
391403 // if shutting down return 0
392- if (getPackStatus () == Monitor::SHUTTING_DOWN ) return 0.0 ;
404+ if (getPackStatus () == Monitor::SHUTTING_DOWN || (m_zero_current_count > 0 ) ) return 0.0 ;
393405
394406 // if empty, no discharging allowed
395407 if (m_fully_discharged) return 0.0 ;
@@ -570,6 +582,7 @@ void LeafMultiPack::setTriggerBatReboot()
570582 // 1,2,3 are on the same power relay, 4,5 are on the same power relay
571583 m_vmonitor[0 ]->setTriggerBatReboot ();
572584 m_vmonitor[3 ]->setTriggerBatReboot ();
585+ m_zero_current_count = 15 ;
573586}
574587
575588bool LeafMultiPack::getTriggerBatReboot ()
0 commit comments