Skip to content

Commit b14c47e

Browse files
authored
Cleanup common and useless debug logs (#2183)
* cleanup common logs * cleanup puth2
1 parent 165dd66 commit b14c47e

File tree

6 files changed

+24
-26
lines changed

6 files changed

+24
-26
lines changed

board/drivers/harness.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,8 @@ void harness_init(void) {
100100
set_gpio_output(current_board->harness_config->GPIO_relay_SBU1, current_board->harness_config->pin_relay_SBU1, 1);
101101
set_gpio_output(current_board->harness_config->GPIO_relay_SBU2, current_board->harness_config->pin_relay_SBU2, 1);
102102

103-
// try to detect orientation
103+
// detect initial orientation
104104
harness.status = harness_detect_orientation();
105-
if (harness.status != HARNESS_STATUS_NC) {
106-
print("detected car harness with orientation "); puth2(harness.status); print("\n");
107-
} else {
108-
print("failed to detect car harness!\n");
109-
}
110105

111106
// keep buses connected by default
112107
set_intercept_relay(false, false);

board/drivers/spi.h

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ void spi_rx_done(void) {
108108
response_len = 1U;
109109
} else {
110110
// response: NACK and reset state machine
111-
print("- incorrect header sync or checksum "); hexdump(spi_buf_rx, SPI_HEADER_SIZE);
111+
#ifdef DEBUG_SPI
112+
print("- incorrect header sync or checksum "); hexdump(spi_buf_rx, SPI_HEADER_SIZE);
113+
#endif
112114
spi_buf_tx[0] = SPI_NACK;
113115
next_rx_state = SPI_STATE_HEADER_NACK;
114116
response_len = 1U;
@@ -160,12 +162,14 @@ void spi_rx_done(void) {
160162
} else {
161163
// Checksum was incorrect
162164
response_ack = false;
163-
print("- incorrect data checksum ");
164-
puth4(spi_data_len_mosi);
165-
print("\n");
166-
hexdump(spi_buf_rx, SPI_HEADER_SIZE);
167-
hexdump(&(spi_buf_rx[SPI_HEADER_SIZE]), MIN(spi_data_len_mosi, 64));
168-
print("\n");
165+
#ifdef DEBUG_SPI
166+
print("- incorrect data checksum ");
167+
puth4(spi_data_len_mosi);
168+
print("\n");
169+
hexdump(spi_buf_rx, SPI_HEADER_SIZE);
170+
hexdump(&(spi_buf_rx[SPI_HEADER_SIZE]), MIN(spi_data_len_mosi, 64));
171+
print("\n");
172+
#endif
169173
}
170174

171175
if (!response_ack) {

board/drivers/uart.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,6 @@ void puth(unsigned int i) {
145145
puthx(i, 8U);
146146
}
147147

148-
void puth2(unsigned int i) {
149-
puthx(i, 2U);
150-
}
151-
152148
#if defined(ENABLE_SPI) || defined(BOOTSTUB) || defined(DEBUG)
153149
void puth4(unsigned int i) {
154150
puthx(i, 4U);
@@ -160,7 +156,7 @@ void hexdump(const void *a, int l) {
160156
if (a != NULL) {
161157
for (int i=0; i < l; i++) {
162158
if ((i != 0) && ((i & 0xf) == 0)) print("\n");
163-
puth2(((const unsigned char*)a)[i]);
159+
puthx(((const unsigned char*)a)[i], 2U);
164160
print(" ");
165161
}
166162
}

board/drivers/uart_declarations.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ void putch(const char a);
3333
void print(const char *a);
3434
void puthx(uint32_t i, uint8_t len);
3535
void puth(unsigned int i);
36-
void puth2(unsigned int i);
3736
#if defined(ENABLE_SPI) || defined(BOOTSTUB) || defined(DEBUG)
3837
void puth4(unsigned int i);
3938
#endif

board/drivers/usb.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -538,21 +538,26 @@ void usb_irqhandler(void) {
538538
}
539539

540540
if ((gintsts & USB_OTG_GINTSTS_USBRST) != 0U) {
541-
print("USB reset\n");
541+
#ifdef DEBUG_USB
542+
print("USB reset\n");
543+
#endif
542544
usb_reset();
543545
}
544546

545547
if ((gintsts & USB_OTG_GINTSTS_ENUMDNE) != 0U) {
546-
print("enumeration done");
548+
#ifdef DEBUG_USB
549+
print("enumeration done\n");
550+
#endif
547551
// Full speed, ENUMSPD
548552
//puth(USBx_DEVICE->DSTS);
549-
print("\n");
550553
}
551554

552555
if ((gintsts & USB_OTG_GINTSTS_OTGINT) != 0U) {
553-
print("OTG int:");
554-
puth(USBx->GOTGINT);
555-
print("\n");
556+
#ifdef DEBUG_USB
557+
print("OTG int:");
558+
puth(USBx->GOTGINT);
559+
print("\n");
560+
#endif
556561

557562
// getting ADTOCHG
558563
//USBx->GOTGINT = USBx->GOTGINT;

board/main_declarations.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// ******************** Prototypes ********************
44
void print(const char *a);
55
void puth(unsigned int i);
6-
void puth2(unsigned int i);
76
void puth4(unsigned int i);
87
void hexdump(const void *a, int l);
98
typedef struct board board;

0 commit comments

Comments
 (0)