Skip to content
Snippets Groups Projects
Commit 51507c13 authored by Stephen D's avatar Stephen D
Browse files

configurable uart

parent 307e6567
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,9 @@ callsign = "NOCALL"
# Max image dimension. Comment this out to send full-sized images
max_img_dimension = 1024
# radio uart
uart = "/dev/ttyAMA0"
# Comment this section out if you're not using
# APRS for control
[control]
......
......@@ -14,6 +14,7 @@ pub struct ControlConfig {
pub struct Config {
pub paths: Vec<PathBuf>,
pub callsign: String,
pub uart: String,
pub max_img_dimension: Option<u32>,
pub control: Option<ControlConfig>,
......
......@@ -33,7 +33,11 @@ impl Controller {
let (telem_tx, telem_rx) = mpsc::channel();
let (cmd_tx, cmd_rx) = mpsc::channel();
thread::spawn(|| Self::tx_thread(img_rx, telem_rx));
{
let uart = self.config.uart.clone();
thread::spawn(|| Self::tx_thread(uart, img_rx, telem_rx));
}
{
let config = self.config.clone();
thread::spawn(|| Self::aprs_thread(config, cmd_tx, telem_tx));
......@@ -81,10 +85,9 @@ impl Controller {
}
// manages our transceiver
fn tx_thread(image_rx: Receiver<FecPacket>, telem_rx: Receiver<Packet>) {
fn tx_thread(uart: String, image_rx: Receiver<FecPacket>, telem_rx: Receiver<Packet>) {
let mut radio = loop {
// TODO this should be configurable
let r = UartRadio::new("/dev/ttyAMA0");
let r = UartRadio::new(&uart);
match r {
Ok(r) => break r,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment