Commit a11623b7 authored by Theodor-Adrian Stana's avatar Theodor-Adrian Stana

Using USB debug only when DEBUG symbol is set

parent df3d2847
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
* TODO: - * TODO: -
*============================================================================== *==============================================================================
*/ */
#include <stdio.h>
#include <string.h> #include <string.h>
#include <em_device.h> #include <em_device.h>
...@@ -46,7 +45,9 @@ ...@@ -46,7 +45,9 @@
#include <drivers/gps.h> #include <drivers/gps.h>
#include <nmea/nmea.h> #include <nmea/nmea.h>
#ifdef DEBUG
#include <usbdbg.h> #include <usbdbg.h>
#endif
static char rxbuf[GPS_RXBUF_SIZE]; static char rxbuf[GPS_RXBUF_SIZE];
static volatile int idx = 0; static volatile int idx = 0;
...@@ -153,7 +154,11 @@ void gps_parse_nmea(const char *buf) ...@@ -153,7 +154,11 @@ void gps_parse_nmea(const char *buf)
{ {
// TODO: check return of nmea_parse // TODO: check return of nmea_parse
nmea_parse(&parser, buf, strlen(buf), &info); nmea_parse(&parser, buf, strlen(buf), &info);
#if defined(GPS_DBG) #ifdef DEBUG
/*
* NOTE: usbdbg_init() should be called EXTERNALLY, BEFORE gps_init() is
* called
* */
usbdbg_puts(buf); usbdbg_puts(buf);
#endif #endif
} }
......
...@@ -43,8 +43,6 @@ ...@@ -43,8 +43,6 @@
/*=============*/ /*=============*/
/* GPS defines */ /* GPS defines */
/*=============*/ /*=============*/
//#define GPS_DBG 1
#define GPS_OK_TO_SEND "$PSRF150,1*3E\r\n" #define GPS_OK_TO_SEND "$PSRF150,1*3E\r\n"
#define GPS_RXBUF_SIZE 128 #define GPS_RXBUF_SIZE 128
......
...@@ -29,7 +29,10 @@ ...@@ -29,7 +29,10 @@
#include <drivers/lsm303c.h> #include <drivers/lsm303c.h>
#include <bitmaps.h> #include <bitmaps.h>
#include <sincos.h> #include <sincos.h>
#ifdef DEBUG
#include <usbdbg.h> #include <usbdbg.h>
#endif
#define COMP_R 50.0 #define COMP_R 50.0
#define COMP_X0 64 #define COMP_X0 64
...@@ -174,7 +177,10 @@ void compass_main(void *params) ...@@ -174,7 +177,10 @@ void compass_main(void *params)
pitch = -small_atan(acc.x, small_sqrt(acc.y*acc.y + acc.z*acc.z)); pitch = -small_atan(acc.x, small_sqrt(acc.y*acc.y + acc.z*acc.z));
roll = small_atan(acc.y, small_sqrt(acc.x*acc.x + acc.z*acc.z)); roll = small_atan(acc.y, small_sqrt(acc.x*acc.x + acc.z*acc.z));
sprintf(buf, "p: %d, r: %d\n\r", pitch, roll); sprintf(buf, "p: %d, r: %d\n\r", pitch, roll);
#if defined(DEBUG)
// NOTE: usbdbg_init() called in main.c
usbdbg_puts(buf); usbdbg_puts(buf);
#endif
/* work with compass readout, first revert it because magnetic south is north */ /* work with compass readout, first revert it because magnetic south is north */
mag.x *= -1; mag.x *= -1;
mag.y *= -1; mag.y *= -1;
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include "widgets/status_bar.h" #include "widgets/status_bar.h"
#include <drivers/lsm303c.h> #include <drivers/lsm303c.h>
#include <sincos.h> #include <sincos.h>
#include <usbdbg.h>
#define S_WIN_X0 5 #define S_WIN_X0 5
#define S_WIN_Y0 25 #define S_WIN_Y0 25
......
...@@ -28,9 +28,12 @@ ...@@ -28,9 +28,12 @@
#include <drivers/gps.h> #include <drivers/gps.h>
#include <event.h> #include <event.h>
#include <time.h>
#ifdef DEBUG
#include <usbdbg.h> #include <usbdbg.h>
#include <stdio.h> #include <stdio.h>
#include <time.h> #endif
#include "application.h" #include "application.h"
#include "clock.h" #include "clock.h"
......
...@@ -38,8 +38,6 @@ ...@@ -38,8 +38,6 @@
#include <drivers/vibra.h> #include <drivers/vibra.h>
#include <drivers/gps.h> #include <drivers/gps.h>
#include <usbdbg.h>
#include <gfx/ui.h> #include <gfx/ui.h>
#include <apps/app_list.h> #include <apps/app_list.h>
#include "battery_task.h" #include "battery_task.h"
...@@ -47,6 +45,10 @@ ...@@ -47,6 +45,10 @@
#include "state.h" #include "state.h"
#include "gpsbkgnd_task.h" #include "gpsbkgnd_task.h"
#ifdef DEBUG
#include <usbdbg.h>
#endif
int main(void) int main(void)
{ {
// Chip errata // Chip errata
...@@ -60,7 +62,9 @@ int main(void) ...@@ -60,7 +62,9 @@ int main(void)
I2C_Init_TypeDef i2cInit = I2C_INIT_DEFAULT; I2C_Init_TypeDef i2cInit = I2C_INIT_DEFAULT;
I2CDRV_Init(&i2cInit); I2CDRV_Init(&i2cInit);
#ifdef DEBUG
usbdbg_init(); usbdbg_init();
#endif
backlight_init(); backlight_init();
buttons_init(); buttons_init();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment