ASMESDC2018
/home/swerve/Github/sdc_2018/omni_robot/Logger.cpp
Go to the documentation of this file.
1 
8 #include "Logger.h"
9 
10 int logger::displayError(int error_code) {
11 
12  Serial.print("[ERROR] ");
13 
14  switch (error_code) {
15  case MOTOR_TYPE_ERROR:
16  Serial.println("Provided motor type not recognized");
17  return MOTOR_TYPE_ERROR;
19  Serial.println("Requesting information from encoder when it has not been setup yet");
20  return ENCODER_SETUP_ERROR;
21  case SENSOR_TYPE_ERROR:
22  Serial.println("Provided sensor type not recognized");
23  return SENSOR_TYPE_ERROR;
24  case SENSOR_INT_ERROR:
25  Serial.println("Sensor is interruptable but no interrupt function was provided");
26  return SENSOR_INT_ERROR;
27  case LED_STATE_ERROR:
28  Serial.println("Provided LED state is not valid");
29  return LED_STATE_ERROR;
30  }
31 
32  return error_code;
33 
34 }
35 
36 void logger::displayInfo(String message) {
37 
38  Serial.print("[INFO] ");
39  Serial.println(message);
40 
41 }
42 
43 void logger::displayDebug(String message) {
44 
45  if (DEBUG_LOGGER_LEVEL) {
46  Serial.print("[DEBUG] ");
47  Serial.println(message);
48  }
49 
50 }
51 
52 
void displayDebug(String)
int void displayInfo(String)
Definition: Logger.cpp:43
void displayInfo(String)
int displayError(int)
Definition: Logger.cpp:36
#define SENSOR_INT_ERROR
Definition: Logger.h:19
#define SENSOR_TYPE_ERROR
Definition: Logger.h:18
#define ENCODER_SETUP_ERROR
Definition: Logger.h:17
#define MOTOR_TYPE_ERROR
Definition: Logger.h:16
int displayError(int)
Definition: Logger.cpp:10
#define LED_STATE_ERROR
Definition: Logger.h:20
#define DEBUG_LOGGER_LEVEL
Definition: Logger.h:13
Header file for error codes