@@ -274,6 +274,9 @@ void OvmsVehicleSmartEQ::ReCalcADCfactor(float can12V, OvmsWriter* writer) {
274274 MyConfig.SetParamValueBool (" xsq" , " calc.adcfactor" , false );
275275 }
276276 if (writer) writer->printf (" New ADC factor stored: %.3f (prev %.3f, history size %u)\n " , adc_factor_new, adc_factor_prev, (unsigned )n);
277+ // Send data log XSQ-ADC-FactorLog
278+ // V1: <new factor>,<prev factor>
279+ MyNotify.NotifyStringf (" data" , " xsq.adc.log.factor" , " XSQ-ADC-FactorLog,1,%d,%.3f,%.3f" , 86400 * 30 , adc_factor_new, adc_factor_prev);
277280 #else
278281 ESP_LOGD (TAG , " ADC support not enabled" );
279282 if (writer) writer->puts (" ADC support not enabled" );
@@ -318,48 +321,21 @@ void OvmsVehicleSmartEQ::DoorOpenState() {
318321
319322void OvmsVehicleSmartEQ::smart12VHistory ()
320323{
321- // On first call after reboot: restore previous entries from persistent vec metric
322- if (m_12v_undervolt_history.empty ())
323- {
324- size_t vn = mt_12v_undervolt_history_vec->GetSize ();
325- for (size_t i = 0 ; i < vn && i < 10 ; ++i)
326- {
327- float v = mt_12v_undervolt_history_vec->GetElemValue (i);
328- if (v > 0 .0f )
329- {
330- char entry[16 ];
331- snprintf (entry, sizeof (entry), " reboot=%.2fV" , v);
332- m_12v_undervolt_history.push_back (entry);
333- }
334- }
335- }
336- float volt = StdMetrics.ms_v_bat_12v_voltage ->AsFloat (0 .0f );
337- time_t ts = (time_t )StdMetrics.ms_m_timeutc ->AsInt ();
338- if (ts < 86400 ) // UTC not yet synced (still at/near 1970-01-01)
339- {
340- ESP_LOGD (TAG , " smart12VHistory: UTC time not synced, skipping entry" );
341- m_12v_alerted = false ;
342- return ;
343- }
344- struct tm t;
345- localtime_r (&ts, &t);
346- char buf[32 ];
347- strftime (buf, sizeof (buf)-8 , " %Y-%m-%dT%H:%M:%S" , &t);
348- snprintf (buf + 19 , sizeof (buf) - 19 , " =%.2fV" , volt);
349- m_12v_undervolt_history.push_back (buf);
324+ float volt = StdMetrics.ms_v_bat_12v_voltage ->AsFloat (0 .0f );
325+ float bms12v = mt_bms_voltages->GetElemValue (6 ); // 12V BMS clamp 30
326+ float usm12v = mt_evc_dcdc->GetElemValue (3 ); // 12V USM voltage
327+ m_12v_undervolt_history.push_back (volt);
350328 if (m_12v_undervolt_history.size () > 10 )
351329 m_12v_undervolt_history.pop_front ();
352- std::string hist_str;
353- float hist_vec[10 ];
330+ float hist[10 ];
354331 size_t n = m_12v_undervolt_history.size ();
355- for (size_t i=0 ; i<n; ++i)
356- {
357- if (i > 0 ) hist_str += ' |' ;
358- hist_str += m_12v_undervolt_history[i];
359- hist_vec[i] = atof (strchr (m_12v_undervolt_history[i].c_str (), ' =' ) + 1 );
360- }
361- mt_12v_undervolt_history->SetValue (hist_str);
362- mt_12v_undervolt_history_vec->SetElemValues (0 , n, hist_vec);
332+ for (size_t i = 0 ; i < n; ++i)
333+ hist[i] = m_12v_undervolt_history[i];
334+ if (n > 0 )
335+ mt_12v_undervolt_history->SetElemValues (0 , n, hist);
336+ // Send data log XSQ-12V-undervoltagelog
337+ // V1: <12Vvoltage>,<USM12V>,<BMS12V>
338+ MyNotify.NotifyStringf (" data" , " xsq.12v.log.undervoltage" , " XSQ-12V-undervoltagelog,1,%d,%.2f,%.2f,%.2f" , 86400 * 30 , volt, usm12v, bms12v);
363339}
364340
365341void OvmsVehicleSmartEQ::smartOn ()
@@ -416,7 +392,7 @@ void OvmsVehicleSmartEQ::smartSleep()
416392
417393void OvmsVehicleSmartEQ::smartChargeStart ()
418394{
419- smartCoolDownPolling (20 );
395+ smartCoolDownPolling (15 );
420396 if (m_charge_finished)
421397 {
422398 ResetChargingValues ();
0 commit comments