From 01a9d5f2c93a0eff17881b8d3ff20d0d5888056d Mon Sep 17 00:00:00 2001 From: Piotr Wilkon Date: Sat, 11 Jun 2022 14:49:28 +0200 Subject: [PATCH] bug fix --- CHANGELOG.md | 9 +++++++++ Src/ax25.c | 3 ++- Src/common.c | 2 +- Src/digipeater.c | 8 ++++++-- Src/main.c | 7 ++++--- Src/terminal.c | 4 ++++ 6 files changed, 26 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 49164fa..e73bade 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +# 1.2.2 (2022-06-11) +## New features +* none +## Bug fixes +* Default de-dupe time was 0, backspace was sometimes stored in config, frame length was not checked in viscous delay mode +## Other +* none +## Known bugs +* none as far # 1.2.1 (2021-10-13) ## New features * none diff --git a/Src/ax25.c b/Src/ax25.c index 4e4c139..7463b03 100644 --- a/Src/ax25.c +++ b/Src/ax25.c @@ -225,7 +225,7 @@ void Ax25_bitParse(uint8_t bit, uint8_t modemNo) if(++rx->rBitIdx >= 8) //received full byte { - if(rx->frameIdx > FRAMELEN) //frame is top long + if(rx->frameIdx > FRAMELEN) //frame is too long { rx->rx = RX_STAGE_IDLE; rx->recByte = 0; @@ -233,6 +233,7 @@ void Ax25_bitParse(uint8_t bit, uint8_t modemNo) rx->frameIdx = 0; rx->crc = 0xFFFF; Afsk_clearRMS(modemNo); + return; } if(rx->frameIdx >= 2) //more than 2 bytes received, calculate CRC { diff --git a/Src/common.c b/Src/common.c index 9c49842..c646e09 100644 --- a/Src/common.c +++ b/Src/common.c @@ -25,7 +25,7 @@ uint8_t callSsid = 0; const uint8_t dest[7] = {130, 160, 156, 172, 96, 98, 96}; //APNV01-0 -const uint8_t *versionString = (const uint8_t*)"VP-Digi v. 1.2.1\r\nThe open-source standalone APRS digipeater controller and KISS TNC\r\n"; +const uint8_t *versionString = (const uint8_t*)"VP-Digi v. 1.2.2\r\nThe open-source standalone APRS digipeater controller and KISS TNC\r\n"; uint8_t autoReset = 0; uint32_t autoResetTimer = 0; diff --git a/Src/digipeater.c b/Src/digipeater.c index c0d7d49..2695993 100644 --- a/Src/digipeater.c +++ b/Src/digipeater.c @@ -177,6 +177,10 @@ static void makeFrame(uint8_t *frame, uint16_t elStart, uint16_t len, uint32_t h break; } } + + if((len + 7) > FRAMELEN) //if frame length (+ 7 bytes for inserted call) is bigger than buffer size + return; //drop + buf = viscousBuf[viscousSlot]; } else //normal mode @@ -207,7 +211,7 @@ static void makeFrame(uint8_t *frame, uint16_t elStart, uint16_t len, uint32_t h } } - if(simple) //if this is a simple alias, our own call or we treat n-N as a simple alias OR it + if(simple) //if this is a simple alias, our own call or we treat n-N as a simple alias { while(bufidx < (len)) //copy whole frame { @@ -308,8 +312,8 @@ static void makeFrame(uint8_t *frame, uint16_t elStart, uint16_t len, uint32_t h term_sendMonitor((uint8_t*)"(AX.25) Digipeating frame: ", 0); term_sendMonitor(buf, 0); term_sendMonitor((uint8_t*)"\r\n", 0); - free(buf); } + free(buf); } } diff --git a/Src/main.c b/Src/main.c index b687e41..939a561 100644 --- a/Src/main.c +++ b/Src/main.c @@ -162,7 +162,7 @@ void handleFrame(void) //that should give a RMS of around 2900 for pure sine wave //for pure square wave it should be equal to the amplitude (around 4095) //real data contains lots of imperfections (especially mark/space amplitude imbalance) and this value is far smaller than 2900 for standard frames - //division by 9 was selected by trial and error to provide a value of 100(%) when the input signal having peak-peak voltage of almost 3.3V + //division by 9 was selected by trial and error to provide a value of 100(%) when the input signal had peak-peak voltage of 3.3V //this probably should be done in a different way, like some peak amplitude tracing ax25.sLvl /= 9; @@ -192,8 +192,8 @@ void handleFrame(void) else t[1] = 'P'; } - else t - [1] = '_'; + else + t[1] = '_'; term_sendMonitor(t, 3); term_sendMonitor((uint8_t*)"], signal level ", 0); @@ -275,6 +275,7 @@ int main(void) ax25Cfg.quietTime = 300; ax25Cfg.txDelayLength = 300; ax25Cfg.txTailLength = 30; + digi.dupeTime = 30; Config_read(); diff --git a/Src/terminal.c b/Src/terminal.c index 7e1790f..2de3d2d 100644 --- a/Src/terminal.c +++ b/Src/terminal.c @@ -55,6 +55,8 @@ void term_handleSpecial(Terminal_stream src) if(spLastIdx[0] > 0) spLastIdx[0]--; //1 character was removed } + else //there was only a backspace + usbcdcidx = 0; } uint16_t t = usbcdcidx; //store last index if(spLastIdx[0] < t) //local echo handling @@ -93,6 +95,8 @@ void term_handleSpecial(Terminal_stream src) if(spLastIdx[nr] > 0) spLastIdx[nr]--; //1 character was removed } + else //there was only a backspace + u->bufrxidx = 0; } uint16_t t = u->bufrxidx; //store last index if(spLastIdx[nr] < t) //local echo handling