From 4341ba3cec297e31dda3b5849f17a13def217018 Mon Sep 17 00:00:00 2001 From: Piotr Wilkon Date: Wed, 30 Aug 2023 16:52:27 +0200 Subject: [PATCH] modem configuration --- CHANGELOG.md | 34 +++++++++++++++++++++++----------- Src/common.c | 2 +- Src/config.c | 5 ++++- Src/drivers/modem.c | 3 +++ Src/main.c | 2 +- Src/terminal.c | 43 +++++++++++++++++++++++++++++++++++++------ 6 files changed, 69 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b9f3e1..77c933d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,25 @@ -# 1.2.6 (2023-08-29) +# 1.3.0 (2023-08-30) +## New features +* Callsign is now set together with SSID using ```call ``` +* ```time``` command to show uptime +## Removed features +* ```ssid``` command is removed +* Auto-reset functionality and ```autoreset``` command is removed +## Bug fixes +* When beacon *n* delay hadn't passed yet, beacon *n+1*, *n+2*, ... were not sent regardless of their delay +* Bugs with line ending parsing +## Other +* Major code refactoring and rewrite +* Got rid of *uart_transmitStart()* routine +* USB sending is handled the same way as UART +* New way of TX and RX frame handling to improve non-APRS compatibility +* Much bigger frame buffer +* Minimized number of temporary buffers +* All *malloc()*s removed +* Added copyright notice as required by GNU GPL +## Known bugs +* none +# 1.2.6 (2023-07-29) ## New features * Added ```nonaprs [on/off]``` command that enables reception of non-APRS frames, e.g. for full Packet Radio use ## Bug fixes @@ -43,15 +64,6 @@ * none ## Known bugs * USB in KISS mode has problem with TX frames -# 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 -* USB in KISS mode has problem with TX frames # 1.2.1 (2021-10-13) ## New features * none @@ -73,4 +85,4 @@ This is the very first open-source VP-Digi release. ## Other * Code was partially rewritten (especially digipeater, modem and AX.25 layer) ## Known bugs -* none +* none \ No newline at end of file diff --git a/Src/common.c b/Src/common.c index 3f9dae0..2a7ecda 100644 --- a/Src/common.c +++ b/Src/common.c @@ -32,7 +32,7 @@ struct _GeneralConfig GeneralConfig = const char versionString[] = "VP-Digi v. 2.0.0\r\nThe open-source standalone APRS digipeater controller and KISS TNC\r\n" #ifdef ENABLE_FX25 - "with FX.25 support compiled-in\r\n" + "With FX.25 support compiled-in\r\n" #endif ; diff --git a/Src/config.c b/Src/config.c index 7d48fa3..96efb31 100644 --- a/Src/config.c +++ b/Src/config.c @@ -95,7 +95,8 @@ along with VP-DigiConfig. If not, see . #define CONFIG_DEST 1208 #define CONFIG_ALLOWNONAPRS 1214 #define CONFIG_FX25 1216 -#define CONFIG_XXX 1218 //next address (not used) +#define CONFIG_MODEM 1218 +#define CONFIG_XXX 1220 //next address (not used) /** @@ -264,6 +265,7 @@ void ConfigWrite(void) write(CONFIG_KISSMONITOR, GeneralConfig.kissMonitor); write(CONFIG_ALLOWNONAPRS, Ax25Config.allowNonAprs); write(CONFIG_FX25, Ax25Config.fx25 | (Ax25Config.fx25Tx << 1)); + write(CONFIG_MODEM, ModemConfig.modem); write(CONFIG_FLAG, CONFIG_FLAG_WRITTEN); @@ -355,6 +357,7 @@ uint8_t ConfigRead(void) t = (uint8_t)read(CONFIG_FX25); Ax25Config.fx25 = t & 1; Ax25Config.fx25Tx = (t & 2) > 0; + ModemConfig.modem = read(CONFIG_MODEM); return 1; } diff --git a/Src/drivers/modem.c b/Src/drivers/modem.c index 4f94fa2..9272379 100644 --- a/Src/drivers/modem.c +++ b/Src/drivers/modem.c @@ -775,6 +775,9 @@ void ModemInit(void) TIM3->PSC = 71; //72/72=1 MHz TIM3->DIER |= TIM_DIER_UIE; + if(ModemConfig.modem > MODEM_9600) + ModemConfig.modem = MODEM_1200; + if((ModemConfig.modem == MODEM_1200) || (ModemConfig.modem == MODEM_1200_V23) #ifdef ENABLE_PSK || (ModemConfig.modem == MODEM_BPSK_1200) || (ModemConfig.modem == MODEM_QPSK_1200) diff --git a/Src/main.c b/Src/main.c index aa635af..696fc89 100644 --- a/Src/main.c +++ b/Src/main.c @@ -234,6 +234,7 @@ int main(void) ConfigRead(); + ModemInit(); Ax25Init(); #ifdef ENABLE_FX25 Fx25Init(); @@ -247,7 +248,6 @@ int main(void) UartConfig(&Uart2, 1); UartConfig(&UartUsb, 1); - ModemInit(); BeaconInit(); /* USER CODE END 2 */ diff --git a/Src/terminal.c b/Src/terminal.c index 6bf6527..a25ecc4 100644 --- a/Src/terminal.c +++ b/Src/terminal.c @@ -104,8 +104,6 @@ void TermSendNumberToAll(enum UartMode mode, int32_t n) } - - static const char monitorHelp[] = "\r\nCommans available in monitor mode:\r\n" "help - shows this help page\r\n" "cal {low|high|alt|stop} - transmits/stops transmitter calibration pattern\r\n" @@ -126,6 +124,7 @@ static const char configHelp[] = "\r\nCommands available in config mode:\r\n" "reboot - reboots the device\r\n" "time - show time since boot\r\n" "version - shows full firmware version info\r\n\r\n" + "modem - sets modem type: 1200, 1200_V23, 300 or 9600\r\n" "call - sets callsign with optional SSID\r\n" "dest
- sets destination address\r\n" "txdelay <50-2550> - sets TXDelay time (ms)\r\n" @@ -158,7 +157,23 @@ static const char configHelp[] = "\r\nCommands available in config mode:\r\n" static void printConfig(Uart *src) { - UartSendString(src, "Callsign: ", 0); + UartSendString(src, "Modem: ", 0); + switch(ModemConfig.modem) + { + case MODEM_1200: + UartSendString(src, "AFSK Bell 202 1200 Bd 1200/2200 Hz", 0); + break; + case MODEM_1200_V23: + UartSendString(src, "AFSK V.23 1200 Bd 1300/2100 Hz", 0); + break; + case MODEM_300: + UartSendString(src, "AFSK Bell 103 300 Bd 1600/1800 Hz", 0); + break; + case MODEM_9600: + UartSendString(src, "GFSK G3RUH 9600 Bd", 0); + break; + } + UartSendString(src, "\r\nCallsign: ", 0); for(uint8_t i = 0; i < 6; i++) { if(GeneralConfig.call[i] != (' ' << 1)) @@ -376,8 +391,9 @@ void TermParse(Uart *src) else if(!strncmp(cmd, "config", 6)) { UartSendString(src, (uint8_t*)"Switched to configuration mode\r\n" - "Most settings will take effect immediately, but\r\n" - "remember to save the configuration using \"save\"\r\n", 0); + "Some settings require the device to be rebooted\r\n" + "in order to behave correctly" + "Always use \"save\" to save and reboot", 0); src->mode = MODE_TERM; return; } @@ -584,9 +600,24 @@ void TermParse(Uart *src) /* * Settings insertion handling */ + else if(!strncmp(cmd, "modem", 5)) + { + if(!strncmp(&cmd[6], "1200", 4)) + ModemConfig.modem = MODEM_1200; + else if(!strncmp(&cmd[6], "1200_V23", 8)) + ModemConfig.modem = MODEM_1200_V23; + else if(!strncmp(&cmd[6], "300", 3)) + ModemConfig.modem = MODEM_300; + else if(!strncmp(&cmd[6], "9600", 4)) + ModemConfig.modem = MODEM_9600; + else + { + UartSendString(src, "Incorrect modem type!\r\n", 0); + return; + } + } else if(!strncmp(cmd, "call", 4)) { - if(!ParseCallsignWithSsid(&cmd[5], len - 5, GeneralConfig.call, &GeneralConfig.callSsid)) { UartSendString(src, "Incorrect callsign!\r\n", 0);