1
0
mirror of https://github.com/Oleg-Stepanenko-owo/IEBUS synced 2025-06-29 10:46:10 +00:00

If error occured system should to after sometime tried to work as usuial

This commit is contained in:
Oleg Stepanenko 2016-04-08 16:32:48 +03:00
parent ef73f5eb69
commit 76036cfb4d

View File

@ -19,22 +19,33 @@ char BUFFF[15];
char buf[12]; //buffer to store AT commands char buf[12]; //buffer to store AT commands
int len = 0; //stores the length of the commands int len = 0; //stores the length of the commands
//------ Error time updating -----------------------------------------------------
unsigned long waitErrorTime;
bool beforeErrorComute;
#define ERROR_TIME 4000
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
void setup() void setup()
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
{ {
HONDA_DIS_ON;
HONDA_DIS_ON;
HONDA_DIS_ON;
LED_ON;
// Serial.begin(9600); // Serial.begin(9600);
avclan.begin(); avclan.begin();
avclanHonda.begin(); avclanHonda.begin();
errorID = 0; errorID = 0;
error_count = 0; error_count = 0;
beforeErrorComute = 0;
waitErrorTime = 0;
avclanBT.begin(); avclanBT.begin();
avclanBT.print("Start HONDA avclan.#"); avclanBT.print("Start HONDA avclan.#");
sprintf( BUFFF, "%s", IEBUS_VERSION ); sprintf( BUFFF, "%s", IEBUS_VERSION );
avclanBT.println( BUFFF ); avclanBT.println( BUFFF );
LED_ON;
} }
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
@ -84,7 +95,15 @@ void loop()
if ( avclanHonda.bFirstStart_20 ) avclanBT.println(">>FIRST_SKIP<<"); if ( avclanHonda.bFirstStart_20 ) avclanBT.println(">>FIRST_SKIP<<");
else if ( avclanHonda.bFreeze ) avclanBT.println(">>FREEZE_SKIP<<"); else if ( avclanHonda.bFreeze ) avclanBT.println(">>FREEZE_SKIP<<");
} }
LED_ON; LED_ON;
if ( (0 != waitErrorTime) && (waitErrorTime < millis()) )
{
waitErrorTime = 0;
if ( !avclanHonda.isShowRearCam() )
avclanHonda.setHondaDis( beforeErrorComute );
}
} }
else else
{ {
@ -112,18 +131,21 @@ void loop()
} }
} }
//------- ERROR CHECKING BLOCK ----------------------------------
if ( error_count > MAX_ERROR_COUNT ) { if ( error_count > MAX_ERROR_COUNT ) {
avclanHonda.bFirstStart_20 = false; avclanHonda.bFirstStart_20 = false;
error_count = 0; error_count = 0;
avclanHonda.setHondaDis(true);
beforeErrorComute = avclanHonda.getCommute();
avclanHonda.setHondaDis(true); // Show Honda displ
waitErrorTime = millis() + ERROR_TIME;
LED_OFF; LED_OFF;
HONDA_DIS_ON; HONDA_DIS_ON;
sprintf(BUFFF, "Error: %d", errorID ); sprintf(BUFFF, "Error: %d", errorID );
avclanBT.println( BUFFF ); avclanBT.println( BUFFF );
//avclan.begin();
//cli();
} }
} }