|
@@ -60,28 +60,29 @@ static SemaphoreHandle_t xRadioTXSemaphore;
|
|
uint8_t ax25_rx_buf[1024];
|
|
uint8_t ax25_rx_buf[1024];
|
|
RingbufHandle_t ax25_tx_buf;
|
|
RingbufHandle_t ax25_tx_buf;
|
|
|
|
|
|
-uint32_t freq_table[16] = { 144390000, // APRS - North America
|
|
|
|
- 145512500, // Arrow Test Freqs...
|
|
|
|
- 145537500,
|
|
|
|
- 145562500,
|
|
|
|
- 145587500,
|
|
|
|
- 145612500,
|
|
|
|
- 145637500,
|
|
|
|
- 145662500,
|
|
|
|
- 145687500,
|
|
|
|
- 145712500,
|
|
|
|
- 145737500,
|
|
|
|
- 145762500,
|
|
|
|
- 145787500,
|
|
|
|
- 145812500,
|
|
|
|
- 145837500, // ...145.5 to 145.8 is experimential band
|
|
|
|
- 145862500 }; // 25kHz spacing
|
|
|
|
|
|
+uint32_t ax_freq_table[16] = { 144390000, // APRS - North America
|
|
|
|
+ 145512500, // Arrow - AX25 test frequencies...
|
|
|
|
+ 145537500,
|
|
|
|
+ 145562500,
|
|
|
|
+ 145587500,
|
|
|
|
+ 145612500,
|
|
|
|
+ 145637500,
|
|
|
|
+ 145662500,
|
|
|
|
+ 145687500,
|
|
|
|
+ 145712500,
|
|
|
|
+ 145737500,
|
|
|
|
+ 145762500,
|
|
|
|
+ 145787500,
|
|
|
|
+ 145812500,
|
|
|
|
+ 145837500, // ...145.5 to 145.8 is experimental band
|
|
|
|
+ 145862500 }; // 25kHz spacing
|
|
|
|
+
|
|
|
|
|
|
/* Radio Callback Functions */
|
|
/* Radio Callback Functions */
|
|
|
|
|
|
void radio_rx_ax25_cb(uint8_t *frame, uint32_t len)
|
|
void radio_rx_ax25_cb(uint8_t *frame, uint32_t len)
|
|
{
|
|
{
|
|
- // TODO: move kiss processing to other core
|
|
|
|
|
|
+ // TODO: move kiss processing to other core??
|
|
kiss_transmit(KISS_DATAFRAME, frame, len);
|
|
kiss_transmit(KISS_DATAFRAME, frame, len);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -93,16 +94,7 @@ void radio_tx_ax25_cb(void)
|
|
|
|
|
|
/* KISS callback Functions */
|
|
/* KISS callback Functions */
|
|
|
|
|
|
-void kiss_tx_cb(uint8_t *frame, uint32_t len)
|
|
|
|
-{
|
|
|
|
- // TODO: move function to other core
|
|
|
|
- // TODO: Add functionality which indicates if BLE connection is present or not
|
|
|
|
- // send data to UART via bluetooth
|
|
|
|
- bt_spp_tx(frame, len);
|
|
|
|
- ESP_LOGI("tnc", "kiss packet sent");
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-void print_tnc_settings(void)
|
|
|
|
|
|
+void tnc_print_settings(void)
|
|
{
|
|
{
|
|
ESP_LOGI("tnc", "TX Delay: %d", tnc_settings.tx_delay*10);
|
|
ESP_LOGI("tnc", "TX Delay: %d", tnc_settings.tx_delay*10);
|
|
ESP_LOGI("tnc", "TX Tail: %d", tnc_settings.tx_tail*10);
|
|
ESP_LOGI("tnc", "TX Tail: %d", tnc_settings.tx_tail*10);
|
|
@@ -111,6 +103,14 @@ void print_tnc_settings(void)
|
|
ESP_LOGI("tnc", "Frequency: %d", tnc_settings.freq);
|
|
ESP_LOGI("tnc", "Frequency: %d", tnc_settings.freq);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void kiss_tx_cb(uint8_t *frame, uint32_t len)
|
|
|
|
+{
|
|
|
|
+ // TODO: move function to other core
|
|
|
|
+ // TODO: Add functionality which indicates if BLE connection is present or not
|
|
|
|
+ // send data to UART via bluetooth
|
|
|
|
+ bt_spp_tx(frame, len);
|
|
|
|
+ ESP_LOGI("tnc", "kiss packet sent");
|
|
|
|
+}
|
|
|
|
|
|
void kiss_rx_cb(uint8_t *frame, uint32_t len)
|
|
void kiss_rx_cb(uint8_t *frame, uint32_t len)
|
|
{
|
|
{
|
|
@@ -155,7 +155,7 @@ void kiss_rx_cb(uint8_t *frame, uint32_t len)
|
|
case KISS_CMD_SETHARDWARE:
|
|
case KISS_CMD_SETHARDWARE:
|
|
{
|
|
{
|
|
uint8_t freq_index = frame[1] & 0x0F;
|
|
uint8_t freq_index = frame[1] & 0x0F;
|
|
- tnc_settings.freq = freq_table[freq_index];
|
|
|
|
|
|
+ tnc_settings.freq = ax_freq_table[freq_index];
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
default:
|
|
default:
|
|
@@ -169,13 +169,14 @@ void kiss_rx_cb(uint8_t *frame, uint32_t len)
|
|
vTaskDelay(100 / portTICK_PERIOD_MS); // wait 100ms and try again
|
|
vTaskDelay(100 / portTICK_PERIOD_MS); // wait 100ms and try again
|
|
}
|
|
}
|
|
|
|
|
|
- print_tnc_settings();
|
|
|
|
|
|
+ // show user new settings
|
|
|
|
+ tnc_print_settings();
|
|
|
|
|
|
// disable TNC task
|
|
// disable TNC task
|
|
vTaskSuspend(tnc_settings.tnc_task);
|
|
vTaskSuspend(tnc_settings.tnc_task);
|
|
ESP_LOGW("tnc", "disabled tnc");
|
|
ESP_LOGW("tnc", "disabled tnc");
|
|
|
|
|
|
- // re-initalize radio
|
|
|
|
|
|
+ // re-initialize radio
|
|
ax25_param_t ax25_param;
|
|
ax25_param_t ax25_param;
|
|
ax25_param.tx_tail = tnc_settings.tx_tail;
|
|
ax25_param.tx_tail = tnc_settings.tx_tail;
|
|
ax25_param.tx_delay = tnc_settings.tx_delay;
|
|
ax25_param.tx_delay = tnc_settings.tx_delay;
|
|
@@ -281,7 +282,7 @@ void tnc_task(void *para)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-void IRAM_ATTR app_main()
|
|
|
|
|
|
+void app_main()
|
|
{
|
|
{
|
|
// Inter-Task Communication
|
|
// Inter-Task Communication
|
|
ax25_tx_buf = xRingbufferCreate(1028, RINGBUF_TYPE_NOSPLIT);
|
|
ax25_tx_buf = xRingbufferCreate(1028, RINGBUF_TYPE_NOSPLIT);
|
|
@@ -311,7 +312,6 @@ void IRAM_ATTR app_main()
|
|
|
|
|
|
// Radio Initialize
|
|
// Radio Initialize
|
|
ax25_param_t ax25_param;
|
|
ax25_param_t ax25_param;
|
|
-
|
|
|
|
ax25_param.tx_tail = tnc_settings.tx_tail;
|
|
ax25_param.tx_tail = tnc_settings.tx_tail;
|
|
ax25_param.tx_delay = tnc_settings.tx_delay;
|
|
ax25_param.tx_delay = tnc_settings.tx_delay;
|
|
ax25_param.sample_rate = 13200;
|
|
ax25_param.sample_rate = 13200;
|
|
@@ -323,10 +323,9 @@ void IRAM_ATTR app_main()
|
|
ax25_param.rx_buf_len = sizeof(ax25_rx_buf) / sizeof(ax25_rx_buf[0]);
|
|
ax25_param.rx_buf_len = sizeof(ax25_rx_buf) / sizeof(ax25_rx_buf[0]);
|
|
ax25_param.cpu_core = 1;
|
|
ax25_param.cpu_core = 1;
|
|
|
|
|
|
- // TODO: setup switch statement for settings parameters or simplify....
|
|
|
|
- print_tnc_settings();
|
|
|
|
|
|
+ // TODO: setup switch statement for settings parameters or for mode....
|
|
|
|
+ tnc_print_settings();
|
|
radio_init(AX25, &ax25_param);
|
|
radio_init(AX25, &ax25_param);
|
|
-
|
|
|
|
radio_set_frequency(tnc_settings.freq);
|
|
radio_set_frequency(tnc_settings.freq);
|
|
|
|
|
|
// Kiss Decoder and Encoder
|
|
// Kiss Decoder and Encoder
|