From 206d55cefe73551ed8bd64acbbbfa29ae12d7951 Mon Sep 17 00:00:00 2001 From: Ole Artz Date: Thu, 30 Jun 2022 14:57:05 +0200 Subject: [PATCH] DCDC MDC Converter Board: 0x00d1 answer fixed --- atmega32u4/dcdc_mdc/main.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/atmega32u4/dcdc_mdc/main.c b/atmega32u4/dcdc_mdc/main.c index a203613..74690db 100644 --- a/atmega32u4/dcdc_mdc/main.c +++ b/atmega32u4/dcdc_mdc/main.c @@ -90,7 +90,7 @@ uint16_t time; uint8_t rxcnt = 0, txpoint = 0; -uint8_t rxbuf[11]; +uint8_t rxbuf[15]; uint8_t txbuf[12]; uint16_t adc[16]; // raw values from ADC uint16_t V_in = 0; @@ -328,9 +328,7 @@ void getdata(uint8_t buf) { txbuf[length + 2] = 0; send_answer_buf(txbuf); rxcnt = 0; - } else if (rxcnt == 11 && is_my_address(10)) { - // message is for this uC -// } else if (is_my_address(10)) { //answer 0x00d1 works with this line + } else if (rxcnt == 11 && is_my_address(10)) {// message with correct length is for this uC if (rxbuf[0] == 'W') { // write @@ -483,10 +481,11 @@ void getdata(uint8_t buf) { } } } - if (rxcnt >= 11 || buf == '\n' || buf == '\r') { - rxcnt = 0; - } } + if (rxcnt >= 11 || buf == '\n' || buf == '\r') { + rxcnt = 0; + } + } -- 2.43.0