   }  
 }
 
+bool calculate_error_light() {
+  byte len = 20; //sizeof(allGauges);
+  unsigned long badCount;
+  unsigned long totalCount;
+  byte percent;
+  
+  for(byte i = 0; i < len; i++) {
+    badCount = allGauges[i]->lowCount + allGauges[i]->highCount;
+    totalCount = badCount + allGauges[i]->goodCount;
+    percent = badCount * 100 / totalCount;
+    if(percent > 9) {
+      Serial.println(allGauges[i]->shortLabel);
+      Serial.println(allGauges[i]->lowCount);
+      Serial.println(allGauges[i]->highCount);
+      Serial.println(allGauges[i]->goodCount);
+      return true;
+    }
+  }
+  return false;
+}
+

EngineVariable engine_tcr   = {"TCR", 0.0, 0.0, 0.0, 50.0, 1, 0, 0};      //traction control ignition retard
EngineVariable engine_lct   = {"LCT", 0.0, 0.0, 0.0, 50.0, 1, 0, 0};      //launch control timing

byte interval = 100;
unsigned long lastMillis = 0;
unsigned long currentMillis = 0;

const int SPI_CS_PIN = 10;


  quadModeGauges[0][2] = &engine_afr;
  quadModeGauges[0][3] = &engine_tps;
  
  allGauges[0] = &engine_map;
  allGauges[1] = &engine_rpm;
  allGauges[2] = &engine_clt;
  allGauges[3] = &engine_tps;
  allGauges[4] = &engine_pw1;
  allGauges[5] = &engine_pw2;
  allGauges[6] = &engine_iat;
  allGauges[7] = &engine_adv;
  allGauges[8] = &engine_tgt;
  allGauges[9] = &engine_afr;
  allGauges[10] = &engine_ego;
  allGauges[11] = &engine_egt;
  allGauges[12] = &engine_pws;
  allGauges[13] = &engine_bat;
  allGauges[14] = &engine_sr1;
  allGauges[15] = &engine_sr2;
  allGauges[16] = &engine_knk;
  allGauges[17] = &engine_vss;
  allGauges[18] = &engine_tcr;
  allGauges[19] = &engine_lct;
  
  lcd.begin(20, 4);

  Serial.begin(115200);
  while (CAN_OK != CAN.begin(CAN_500KBPS)) {
    Serial.println(F("CAN bus init fail"));
    delay(100);
  }
  Serial.println(F("COMM OK"));

  lcd.clear();
