kopia lustrzana https://github.com/sq8vps/vp-digi
setting uart default modes
rodzic
8adf034d26
commit
55f524509a
|
@ -2,6 +2,7 @@
|
|||
## New features
|
||||
* New modems: AFSK Bell 103 (300 Bd, 1600/1800 Hz), GFSK G3RUH (9600 Bd), AFSK V.23 (1200 Bd, 1300/2100 Hz)
|
||||
* FX.25 (AX.25 with Reed-Solomon FEC) support
|
||||
* Default UART/USB modes can be configured
|
||||
## Bug fixes
|
||||
* none
|
||||
## Other
|
||||
|
|
|
@ -53,6 +53,7 @@ typedef struct
|
|||
uint16_t txBufferHead, txBufferTail;
|
||||
uint8_t txBufferFull : 1;
|
||||
enum UartMode mode;
|
||||
enum UartMode defaultMode;
|
||||
uint16_t lastRxBufferHead; //for special characters handling
|
||||
uint8_t kissBuffer[AX25_FRAME_MAX_SIZE + 1];
|
||||
uint16_t kissBufferHead;
|
||||
|
|
11
Src/config.c
11
Src/config.c
|
@ -97,7 +97,10 @@ along with VP-DigiConfig. If not, see <http://www.gnu.org/licenses/>.
|
|||
#define CONFIG_ALLOWNONAPRS 1214
|
||||
#define CONFIG_FX25 1216
|
||||
#define CONFIG_MODEM 1218
|
||||
#define CONFIG_XXX 1220 //next address (not used)
|
||||
#define CONFIG_MODE_USB 1220
|
||||
#define CONFIG_MODE_UART1 1222
|
||||
#define CONFIG_MODE_UART2 1224
|
||||
#define CONFIG_XXX 1226 //next address (not used)
|
||||
|
||||
|
||||
/**
|
||||
|
@ -267,6 +270,9 @@ void ConfigWrite(void)
|
|||
write(CONFIG_ALLOWNONAPRS, Ax25Config.allowNonAprs);
|
||||
write(CONFIG_FX25, Ax25Config.fx25 | (Ax25Config.fx25Tx << 1));
|
||||
write(CONFIG_MODEM, ModemConfig.modem);
|
||||
write(CONFIG_MODE_USB, UartUsb.defaultMode);
|
||||
write(CONFIG_MODE_UART1, Uart1.defaultMode);
|
||||
write(CONFIG_MODE_UART2, Uart2.defaultMode);
|
||||
|
||||
write(CONFIG_FLAG, CONFIG_FLAG_WRITTEN);
|
||||
|
||||
|
@ -359,6 +365,9 @@ uint8_t ConfigRead(void)
|
|||
Ax25Config.fx25 = t & 1;
|
||||
Ax25Config.fx25Tx = (t & 2) > 0;
|
||||
ModemConfig.modem = read(CONFIG_MODEM);
|
||||
UartUsb.defaultMode = read(CONFIG_MODE_USB);
|
||||
Uart1.defaultMode = read(CONFIG_MODE_UART1);
|
||||
Uart2.defaultMode = read(CONFIG_MODE_UART2);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ along with VP-Digi. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "digipeater.h"
|
||||
#include "kiss.h"
|
||||
|
||||
Uart Uart1, Uart2, UartUsb;
|
||||
Uart Uart1 = {.defaultMode = MODE_KISS}, Uart2 = {.defaultMode = MODE_KISS}, UartUsb= {.defaultMode = MODE_KISS};
|
||||
|
||||
static void handleInterrupt(Uart *port)
|
||||
{
|
||||
|
@ -147,7 +147,9 @@ void UartInit(Uart *port, USART_TypeDef *uart, uint32_t baud)
|
|||
port->txBufferHead = 0;
|
||||
port->txBufferTail = 0;
|
||||
port->txBufferFull = 0;
|
||||
port->mode = MODE_KISS;
|
||||
if(port->defaultMode > MODE_MONITOR)
|
||||
port->defaultMode = MODE_KISS;
|
||||
port->mode = port->defaultMode;
|
||||
port->enabled = 0;
|
||||
port->kissBufferHead = 0;
|
||||
port->lastRxBufferHead = 0;
|
||||
|
|
166
Src/terminal.c
166
Src/terminal.c
|
@ -93,56 +93,78 @@ 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"
|
||||
"\tlow - transmits MARK tone, high - transmits SPACE tone, alt - transmits alternating tones (null bytes)\r\n"
|
||||
"beacon <beacon_number> - immediately transmits selected beacon (number from 0 to 7)\r\n"
|
||||
"kiss - switches to KISS mode\r\n"
|
||||
"config - switches to config mode\r\n"
|
||||
"reboot - reboots the device\r\n"
|
||||
static const char monitorHelp[] = "\r\nCommands available in monitor mode:\r\n"
|
||||
"help - show this help page\r\n"
|
||||
"cal {low|high|alt|stop} - transmit/stop transmitter calibration pattern\r\n"
|
||||
"\tlow - transmit MARK tone, high - transmit SPACE tone, alt - transmit alternating tones (null bytes)\r\n"
|
||||
"beacon <beacon_number> - immediately transmit selected beacon (number from 0 to 7)\r\n"
|
||||
"kiss - switch to KISS mode\r\n"
|
||||
"config - switch to config mode\r\n"
|
||||
"reboot - reboot the device\r\n"
|
||||
"time - show time since boot\r\n"
|
||||
"version - shows full firmware version info\r\n\r\n\r\n";
|
||||
"version - show full firmware version info\r\n\r\n\r\n";
|
||||
|
||||
static const char configHelp[] = "\r\nCommands available in config mode:\r\n"
|
||||
"print - prints all configuration parameters\r\n"
|
||||
"list - prints callsign filter list\r\n"
|
||||
"save - saves configuration and reboots the device\r\n"
|
||||
"eraseall - erases all configurations and reboots the device\r\n"
|
||||
"help - shows this help page\r\n"
|
||||
"reboot - reboots the device\r\n"
|
||||
"print - print all configuration parameters\r\n"
|
||||
"list - print callsign filter list\r\n"
|
||||
"save - save configuration and reboot the device\r\n"
|
||||
"eraseall - erase all configurations and reboot the device\r\n"
|
||||
"help - show this help page\r\n"
|
||||
"reboot - reboot the device\r\n"
|
||||
"time - show time since boot\r\n"
|
||||
"version - shows full firmware version info\r\n\r\n"
|
||||
"modem <type> - sets modem type: 1200, 1200_V23, 300 or 9600\r\n"
|
||||
"call <callsign-SSID> - sets callsign with optional SSID\r\n"
|
||||
"dest <address> - sets destination address\r\n"
|
||||
"txdelay <50-2550> - sets TXDelay time (ms)\r\n"
|
||||
"txtail <10-2550> - sets TXTail time (ms)\r\n"
|
||||
"quiet <100-2550> - sets quiet time (ms)\r\n"
|
||||
"rs1baud/rs2baud <1200-115200> - sets UART1/UART2 baudrate\r\n"
|
||||
"pwm [on/off] - enables/disables PWM. If PWM is off, R2R will be used instead\r\n"
|
||||
"version - show full firmware version info\r\n\r\n"
|
||||
"modem <type> - set modem type: 1200, 1200_V23, 300 or 9600\r\n"
|
||||
"call <callsign-SSID> - set callsign with optional SSID\r\n"
|
||||
"dest <address> - set destination address\r\n"
|
||||
"txdelay <50-2550> - set TXDelay time (ms)\r\n"
|
||||
"txtail <10-2550> - set TXTail time (ms)\r\n"
|
||||
"quiet <100-2550> - set quiet time (ms)\r\n"
|
||||
"uart <1/2> baud <1200-115200> - set UART baud rate\r\n"
|
||||
"uart <0/1/2> mode [kiss/monitor/config] - set UART default mode (0 for USB)\r\n"
|
||||
"pwm [on/off] - enable/disable PWM. If PWM is off, R2R will be used instead\r\n"
|
||||
"flat [on/off] - set to \"on\" if flat audio input is used\r\n"
|
||||
"beacon <0-7> [on/off] - enables/disables specified beacon\r\n"
|
||||
"beacon <0-7> [iv/dl] <0-720> - sets interval/delay for the specified beacon (min)\r\n"
|
||||
"beacon <0-7> path <el1,[el2]>/none - sets path for the specified beacon\r\n"
|
||||
"beacon <0-7> data <data> - sets information field for the specified beacon\r\n"
|
||||
"digi [on/off] - enables/disables whole digipeater\r\n"
|
||||
"digi <0-7> [on/off] - enables/disables specified slot\r\n"
|
||||
"digi <0-7> alias <alias> - sets alias for the specified slot\r\n"
|
||||
"digi <0-3> [max/rep] <0/1-7> - sets maximum/replacement N for the specified slot\r\n"
|
||||
"digi <0-7> trac [on/off] - enables/disables packet tracing for the specified slot\r\n"
|
||||
"digi <0-7> viscous [on/off] - enables/disables viscous-delay digipeating for the specified slot\r\n"
|
||||
"digi <0-7> direct [on/off] - enables/disables direct-only digipeating for the specified slot\r\n"\
|
||||
"digi <0-7> filter [on/off] - enables/disables packet filtering for the specified slot\r\n"
|
||||
"digi filter [black/white] - sets filtering type to blacklist/whitelist\r\n"
|
||||
"digi dupe <5-255> - sets anti-dupe buffer time (s)\r\n"
|
||||
"digi list <0-19> [set <call>/remove] - sets/clears specified callsign slot in filter list\r\n"
|
||||
"beacon <0-7> [on/off] - enable/disable specified beacon\r\n"
|
||||
"beacon <0-7> [iv/dl] <0-720> - set interval/delay for the specified beacon (min)\r\n"
|
||||
"beacon <0-7> path <el1,[el2]>/none - set path for the specified beacon\r\n"
|
||||
"beacon <0-7> data <data> - set information field for the specified beacon\r\n"
|
||||
"digi [on/off] - enable/disable whole digipeater\r\n"
|
||||
"digi <0-7> [on/off] - enable/disable specified slot\r\n"
|
||||
"digi <0-7> alias <alias> - set alias for the specified slot\r\n"
|
||||
"digi <0-3> [max/rep] <0/1-7> - set maximum/replacement N for the specified slot\r\n"
|
||||
"digi <0-7> trac [on/off] - enable/disable packet tracing for the specified slot\r\n"
|
||||
"digi <0-7> viscous [on/off] - enable/disable viscous-delay digipeating for the specified slot\r\n"
|
||||
"digi <0-7> direct [on/off] - enable/disable direct-only digipeating for the specified slot\r\n"\
|
||||
"digi <0-7> filter [on/off] - enable/disable packet filtering for the specified slot\r\n"
|
||||
"digi filter [black/white] - set filter type to blacklist/whitelist\r\n"
|
||||
"digi dupe <5-255> - set duplicate protection buffer time (s)\r\n"
|
||||
"digi list <0-19> [set <call>/remove] - set/clear given callsign slot in filter list\r\n"
|
||||
"monkiss [on/off] - send own and digipeated frames to KISS ports\r\n"
|
||||
"nonaprs [on/off] - enable reception of non-APRS frames\r\n"
|
||||
"fx25 [on/off] - enable FX.25 protocol (AX.25 + FEC)\r\n"
|
||||
"fx25tx [on/off] - enable TX in FX.25 mode\r\n";
|
||||
|
||||
|
||||
static void sendUartParams(Uart *output, Uart *uart)
|
||||
{
|
||||
if(!uart->isUsb)
|
||||
{
|
||||
UartSendNumber(output, uart->baudrate);
|
||||
UartSendString(output, " baud, ", 0);
|
||||
}
|
||||
UartSendString(output, "default mode: ", 0);
|
||||
switch(uart->defaultMode)
|
||||
{
|
||||
case MODE_KISS:
|
||||
UartSendString(output, "KISS", 0);
|
||||
break;
|
||||
case MODE_MONITOR:
|
||||
UartSendString(output, "monitor", 0);
|
||||
break;
|
||||
case MODE_TERM:
|
||||
UartSendString(output, "configuration", 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void printConfig(Uart *src)
|
||||
{
|
||||
|
@ -184,10 +206,12 @@ static void printConfig(Uart *src)
|
|||
UartSendNumber(src, Ax25Config.txTailLength);
|
||||
UartSendString(src, "\r\nQuiet time (ms): ", 0);
|
||||
UartSendNumber(src, Ax25Config.quietTime);
|
||||
UartSendString(src, "\r\nUART1 baudrate: ", 0);
|
||||
UartSendNumber(src, Uart1.baudrate);
|
||||
UartSendString(src, "\r\nUART2 baudrate: ", 0);
|
||||
UartSendNumber(src, Uart2.baudrate);
|
||||
UartSendString(src, "\r\nUSB: ", 0);
|
||||
sendUartParams(src, &UartUsb);
|
||||
UartSendString(src, "\r\nUART1: ", 0);
|
||||
sendUartParams(src, &Uart1);
|
||||
UartSendString(src, "\r\nUART2: ", 0);
|
||||
sendUartParams(src, &Uart2);
|
||||
UartSendString(src, "\r\nDAC type: ", 0);
|
||||
if(ModemConfig.usePWM)
|
||||
UartSendString(src, "PWM", 0);
|
||||
|
@ -652,24 +676,54 @@ void TermParse(Uart *src)
|
|||
Ax25Config.quietTime = (uint16_t)t;
|
||||
}
|
||||
}
|
||||
else if(!strncmp(cmd, "rs1baud", 7) || !strncmp(cmd, "rs2baud", 7))
|
||||
else if(!strncmp(cmd, "uart", 4))
|
||||
{
|
||||
int64_t t = StrToInt(&cmd[8], len - 8);
|
||||
if((t > 115200) || (t < 1200))
|
||||
Uart *u = NULL;
|
||||
if((cmd[5] - '0') == 1)
|
||||
u = &Uart1;
|
||||
else if((cmd[5] - '0') == 2)
|
||||
u = &Uart2;
|
||||
else if((cmd[5] - '0') == 0)
|
||||
u = &UartUsb;
|
||||
else
|
||||
{
|
||||
UartSendString(src, "Incorrect baudrate!\r\n", 0);
|
||||
UartSendString(src, "Incorrect UART number!\r\n", 0);
|
||||
return;
|
||||
}
|
||||
if(!strncmp(&cmd[7], "baud", 4))
|
||||
{
|
||||
int64_t t = StrToInt(&cmd[12], len - 12);
|
||||
if((t > 115200) || (t < 1200))
|
||||
{
|
||||
UartSendString(src, "Incorrect baud rate!\r\n", 0);
|
||||
return;
|
||||
}
|
||||
u->baudrate = (uint32_t)t;
|
||||
}
|
||||
else if(!strncmp(&cmd[7], "mode", 4))
|
||||
{
|
||||
if(!strncmp(&cmd[12], "kiss", 4))
|
||||
{
|
||||
u->defaultMode = MODE_KISS;
|
||||
}
|
||||
else if(!strncmp(&cmd[12], "monitor", 7))
|
||||
{
|
||||
u->defaultMode = MODE_MONITOR;
|
||||
}
|
||||
else if(!strncmp(&cmd[12], "config", 6))
|
||||
{
|
||||
u->defaultMode = MODE_TERM;
|
||||
}
|
||||
else
|
||||
{
|
||||
UartSendString(src, "Incorrect UART mode!\r\n", 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(cmd[2] == '1')
|
||||
Uart1.baudrate = (uint32_t)t;
|
||||
else if(cmd[2] == '2')
|
||||
Uart2.baudrate = (uint32_t)t;
|
||||
else
|
||||
{
|
||||
UartSendString(src, "Incorrect port number!\r\n", 0);
|
||||
return;
|
||||
}
|
||||
UartSendString(src, "Incorrect option!\r\n", 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if(!strncmp(cmd, "beacon", 6))
|
||||
|
|
|
@ -85,8 +85,8 @@ The following commands are available in configuration mode:
|
|||
- `txdelay TIME` – sets the preamble length before transmitting a frame. Value in milliseconds, ranging from 30 to 2550.
|
||||
- `txtail TIME` – sets the tail length after a frame transmission. Value in milliseconds, ranging from 10 to 2550. Set to the minimum value if not needed.
|
||||
- `quiet TIME` – sets the time that must elapse between channel release and transmission start. Value in milliseconds, ranging from 100 to 2550.
|
||||
- `rs1baud BAUDRATE` – sets the baud rate for UART1 port. Value ranging from 1200 to 115200.
|
||||
- `rs2baud BAUDRATE` – sets the baud rate for UART2 port. Value ranging from 1200 to 115200.
|
||||
- `uart NUMBER baud RATE` - sets the baud rate (1200-115200 Bd) for the selected serial port.
|
||||
- `uart NUMBER mode <kiss/monitor/config>` - sets the default operating mode for the selected serial port (0 for USB).
|
||||
- `pwm <on/off>` – sets the DAC type. *on* when a PWM filter is installed, *off* when an R2R ladder is installed. Starting from version 2.0.0, it is recommended to use only PWM.
|
||||
- `flat <on/off>` – configures the modem for use with a radio with *flat audio* output. *on* when the signal is fed from the *flat audio* connector, *off* when the signal is fed from the headphone jack. This option only affects 1200 Bd modems.
|
||||
- `beacon NUMBER <on/off>` – *on* activates, *off* deactivates the beacon with the specified number, ranging from 0 to 7.
|
||||
|
|
|
@ -88,8 +88,8 @@ W trybie konfiguracji dostępne są następujące polecenia:
|
|||
- `txdelay CZAS` – ustawia długość preambuły do nadania przed ramką. Wartość w milisekundach z zakresu od 30 do 2550
|
||||
- `txtail CZAS` – ustawia ogona nadawanego po ramce. Wartość w milisekundach, z zakresu od 10 do 2550. Jeśli nie zachodzi potrzeba, należy ustawić wartość minimalną.
|
||||
- `quiet CZAS` – ustawia czas, który musi upłynąć pomiędzy zwolnieniem się kanału a włączeniem nadawania. Wartość w milisekundach z zakresu od 100 do 2550.
|
||||
- `rs1baud PREDKOSC` – ustawia prędkość (*baudrate*) portu UART1. Wartość z zakresu od 1200 do 115200.
|
||||
- `rs2baud PREDKOSC` – ustawia prędkość (*baudrate*) portu UART2. Wartość z zakresu od 1200 do 115200.
|
||||
- `uart NUMER baud PREDKOSC` - ustawia prędkość (1200-115200 Bd) pracy wybranego portu szeregowego.
|
||||
- `uart NUMBER mode <kiss/monitor/config` - ustawia domyślny tryb pracy wybranego portu szeregowego (0 dla USB).
|
||||
- `pwm <on/off>` – ustawia typ DAC. *on*, gdy zainstalowany jest filtr PWM, *off* gdy zainstalowana jest drabinka R2R. Od wersji 2.0.0 zalecane jest użycie wyłącznie PWM.
|
||||
- `flat <on/off>` – konfiguruje modem do użycia z radiem z wyjściem *flat audio*. *on* gdy sygnał podawany jest ze złącza *flat audio*, *off* gdy sygnał podawany jest ze złącza słuchawkowego. Opcja ma wpływ jedynie na modemy 1200 Bd.
|
||||
- `beacon NUMER <on/off>` – *on* włącza, *off* wyłącza beacon o podanym numerze z zakresu od 0 do 7.
|
||||
|
|
Ładowanie…
Reference in New Issue