From 6b262a9a548b39639a793357ecb48654cee7acaf Mon Sep 17 00:00:00 2001 From: William Harrington Date: Sun, 28 Jul 2019 01:41:59 -0500 Subject: Adjust DEBUG definition. --- conf.h | 2 ++ main.c | 32 ++++++++++++++++++++------------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/conf.h b/conf.h index 6f5c652..4f5f5b3 100755 --- a/conf.h +++ b/conf.h @@ -14,6 +14,8 @@ // Use internal crystal at 8MHz #define _XTAL_FREQ 20000000 +//#define DEBUG 1 + // Define baud rate of 9600 #define Baud_rate 9600 diff --git a/main.c b/main.c index 9c1020b..e93e992 100755 --- a/main.c +++ b/main.c @@ -1,7 +1,5 @@ #include // included for sprintf -#define DEBUG 0 // Enable/Disable debugging via UART - #include "conf.h" //Configuration settings #include "main.h" //Declarations for main #include "lcd.h" //Declaratons for LCD @@ -9,7 +7,7 @@ #include "ds3231.h" //Declarations for RTC #include "beep.h" //Declarations for BEEP -#if DEBUG +#ifdef DEBUG #include "uart.h" //Declarations for UART #include "term.h" //Declarations for Escape codes #endif @@ -21,7 +19,7 @@ int main() { TRISD = 0x00; // Set PORTD as outputs PORTD = 0x00; // Set all PORTD pins LOW -#if DEBUG +#ifdef DEBUG Initialize_UART(); //Initialize UART module UART_send_string(CLS); // Clear screen UART_send_string(CURSOR(12, 23)); // Set cursor at line 12, column 23 @@ -31,7 +29,7 @@ int main() { #endif I2C_Master_Init(100000); // Init I2C Master with 100KHz Clock -#if DEBUG +#ifdef DEBUG UART_send_string(CURSOR(13, 24)); // Set cursor at line 12, column 23 UART_send_string(GREEN); // Set Green UART_send_string("I2C Module Initialized and active\r\n"); @@ -39,7 +37,7 @@ int main() { #endif Lcd_Init(); -#if DEBUG +#ifdef DEBUG UART_send_string(CURSOR(14, 24)); // Set cursor at line 12, column 23 UART_send_string(GREEN); // Set Green UART_send_string("LCD Module Initialized and active\r\n"); @@ -76,26 +74,36 @@ int main() { while (1) { // Set time and date variables from DS3231 - //UART_send_string("Updating current date time from DS3231\r\n"); +#ifdef DEBUG + UART_send_string("Updating current date time from DS3231\r\n"); +#endif Update_Current_Date_Time(); // Read temp - //UART_send_string("Reading Alarms and Temperature"); +#ifdef DEBUG + UART_send_string("Reading Alarms and Temperature"); +#endif Read_Alarms_Temp(); // Get Alarm Status Get_Alarm_Status(); // Separate the int timedate variables into chars - //UART_send_string("Formatting chars"); +#ifdef DEBUG + UART_send_string("Formatting chars"); +#endif format_DateTimeChars(); // Format temperature - //UART_send_string("Formating temperature"); +#ifdef DEBUG + UART_send_string("Formating temperature"); +#endif format_Temperature(); // Determine day of the week - //UART_send_string("Determining day of week"); +#ifdef DEBUG + UART_send_string("Determining day of week"); +#endif getWeekDay(dayOfWeek); // Enter loop and update display if sec changes from DS3231 @@ -106,7 +114,7 @@ int main() { // Set temp_sec to current sec from DS3231 sec_chg = sec; -#if DEBUG +#ifdef DEBUG UART_send_string(CURSOR(19, 1)); sprintf(buf, "%sTIME:%s\t%02d:%02d:%02d\r\n", YELLOW, CLRATTR, hour, min, sec); -- cgit v1.2.3-54-g00ecf