Hi,
runnning my soft I use a function that set startTime:
void FunctionalTasks::set_m_msgInfo_currentlevel ( int pm_msgInfo_currentlevel ) {
// level is priority : priority level 1 is higher than priority level 3
if(pm_msgInfo_currentlevel<=m_msgInfo_currentlevel)
{
// is the current message has been displayed
if(m_onemsg_to_display==false)
{
// FURTIVE MSG
m_msgInfo_duration = 5000;
// record start time to ensure interval
m_msgInfo_startT=millis();
But sometime m_msgInfo_startT's value is negative as this log shows:
22:23:57 m_onemsg_to_display:0
22:23:58 m_Date_isAlreadyDisplayed:1
39015
-26522
IN
22:23:58 m_onemsg_to_display:0
22:23:58 m_Date_isAlreadyDisplayed:0
22:23:59 m_onemsg_to_display:0
22:23:59 m_Date_isAlreadyDisplayed:1
22:23:59 m_onemsg_to_display:0
22:23:59 m_Date_isAlreadyDisplayed:1
relative code is :
void FunctionalTasks::check_msgInfo_TimeDurationElapsed() {
if ( m_onemsg_to_display )
{
Serial.println(millis());
Serial.println(m_msgInfo_startT);
//
//a log show that a startT time has been set to negative value
// 22:23:58 m_Date_isAlreadyDisplayed:1
// 39015
// -26522
// IN
// 22:23:58 m_onemsg_to_display:0
// 22:23:58 m_Date_isAlreadyDisplayed:0
if( m_msgInfo_startT>0 )
{
if ((millis()-m_msgInfo_startT) > m_msgInfo_duration)
{
// m_msgInfo_startT=-1;
m_onemsg_to_display =false;
Serial.println("IN");
// set vars to enable display of date
m_Date_isAlreadyDisplayed=false;
}
}
}
}