add sd unavailable error

This commit is contained in:
interfisch 2023-07-10 16:25:19 +02:00
parent 298532b3d3
commit 8dd552111c
4 changed files with 14 additions and 1 deletions

View File

@ -64,6 +64,7 @@ unsigned long brake_ok_time=0;
bool error_throttle_outofrange=false;
bool error_brake_outofrange=false;
bool error_ads_max_read_interval=false;
bool error_sdfile_unavailable=false;
#define REVERSE_ENABLE_TIME 1000 //ms. how long standstill to be able to drive backward
#define REVERSE_SPEED 0.25 //reverse driving speed //0 to 1

View File

@ -51,7 +51,7 @@ void display_update(ESCSerialComm& escFront, ESCSerialComm& escRear){
display.print(F(" / ")); display.println(escRear.getFeedback_batVoltage());
*/
if ( (error_brake_outofrange || error_throttle_outofrange || error_ads_max_read_interval ) && ((loopmillis/2000)%2==0)) {
if ( (error_brake_outofrange || error_throttle_outofrange || error_ads_max_read_interval || error_sdfile_unavailable) && ((loopmillis/2000)%2==0)) {
//Error Messages
display.setFont();
@ -70,6 +70,8 @@ void display_update(ESCSerialComm& escFront, ESCSerialComm& escRear){
}
if (error_ads_max_read_interval) {
errorstring+="ads_max_read_interval\n";
}if (error_sdfile_unavailable) {
errorstring+="error_sdfile_unavailable\n";
}
display.print(errorstring);
@ -87,6 +89,7 @@ void display_update(ESCSerialComm& escFront, ESCSerialComm& escRear){
}else{
display_standingDisarmedDisplay(escFront,escRear);
}
}

View File

@ -59,6 +59,7 @@ void loggingLoop(unsigned long loopmillis,ESCSerialComm& escFront, ESCSerialComm
File dataFile = SD.open(datalogging_filename, FILE_WRITE);
if (dataFile) { // if the file is available, write to it
if (!logging_headerWritten) {
dataFile.print("time,cmd_FrontL,cmd_FrontR,cmd_RearL,cmd_RearR,");
@ -106,6 +107,8 @@ void loggingLoop(unsigned long loopmillis,ESCSerialComm& escFront, ESCSerialComm
dataFile.println("");
dataFile.close();
}else{ //dataFile not available
error_sdfile_unavailable=true;
}
}
}

View File

@ -529,6 +529,12 @@ void failChecks() {
//Serial.print("Error ADS Max read interval="); Serial.println(loopmillis-last_adsread);
}
boolean logged_error_sdfile_unavailable=false;
if (error_sdfile_unavailable && !logged_error_sdfile_unavailable) {
logged_error_sdfile_unavailable=true;
writeLogComment(loopmillis, "Error SDFile Unavailable");
}
if (!controllers_connected || error_brake_outofrange || error_throttle_outofrange || error_ads_max_read_interval) { //any errors?
armed=false; //disarm
throttle_pos=0;