parent
75992bfe79
commit
ab080c8435
|
@ -60,7 +60,7 @@ codegen-units = 1
|
||||||
debug = 2
|
debug = 2
|
||||||
debug-assertions = false # <-
|
debug-assertions = false # <-
|
||||||
incremental = false
|
incremental = false
|
||||||
lto = 'fat'
|
#lto = 'fat'
|
||||||
opt-level = 3 # <-
|
opt-level = 3 # <-
|
||||||
overflow-checks = false # <-
|
overflow-checks = false # <-
|
||||||
|
|
||||||
|
|
|
@ -18,12 +18,14 @@ impl App {
|
||||||
if let Some(result) = self.gps_parser.parse_from_byte(byte) {
|
if let Some(result) = self.gps_parser.parse_from_byte(byte) {
|
||||||
match result {
|
match result {
|
||||||
Ok(ParseResult::GGA(Some(gga))) => {
|
Ok(ParseResult::GGA(Some(gga))) => {
|
||||||
time::set(&gga.time);
|
if !self.transmitting {
|
||||||
self.locator = loc::locator_from_coordinates(
|
time::set(&gga.time);
|
||||||
gga.latitude.as_f64(),
|
self.locator = loc::locator_from_coordinates(
|
||||||
gga.longitude.as_f64(),
|
gga.latitude.as_f64(),
|
||||||
);
|
gga.longitude.as_f64(),
|
||||||
defmt::info!("Got GGA. New locator: {}", self.locator.as_str());
|
);
|
||||||
|
defmt::info!("Got GGA. New locator: {}", self.locator.as_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Ok(_) => {} // Some other sentences..
|
Ok(_) => {} // Some other sentences..
|
||||||
Err(_) => {} // Got parse error
|
Err(_) => {} // Got parse error
|
||||||
|
|
|
@ -41,6 +41,7 @@ pub struct App {
|
||||||
>,
|
>,
|
||||||
gps_parser: Parser,
|
gps_parser: Parser,
|
||||||
locator: arrayvec::ArrayString<6>,
|
locator: arrayvec::ArrayString<6>,
|
||||||
|
transmitting: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
// For PLL with 800MHz
|
// For PLL with 800MHz
|
||||||
|
@ -87,7 +88,6 @@ impl App {
|
||||||
|
|
||||||
defmt::info!("PLL setup complete.");
|
defmt::info!("PLL setup complete.");
|
||||||
|
|
||||||
let mut transmitting = false;
|
|
||||||
let mut symbol_start = time::get();
|
let mut symbol_start = time::get();
|
||||||
let mut symbol_idx: usize = 0;
|
let mut symbol_idx: usize = 0;
|
||||||
let mut message: [u8; 162] = [0; 162];
|
let mut message: [u8; 162] = [0; 162];
|
||||||
|
@ -95,7 +95,7 @@ impl App {
|
||||||
loop {
|
loop {
|
||||||
self.poll_gps();
|
self.poll_gps();
|
||||||
|
|
||||||
if !transmitting {
|
if !self.transmitting {
|
||||||
let ts = time::get();
|
let ts = time::get();
|
||||||
if self.locator.len() > 0
|
if self.locator.len() > 0
|
||||||
&& ts.minutes % 2 == 0
|
&& ts.minutes % 2 == 0
|
||||||
|
@ -103,6 +103,7 @@ impl App {
|
||||||
&& ts.seconds < 2.0
|
&& ts.seconds < 2.0
|
||||||
{
|
{
|
||||||
defmt::info!("Starting tranmission");
|
defmt::info!("Starting tranmission");
|
||||||
|
self.transmitting = true;
|
||||||
message = wspr::encode_message(&callsign, &self.locator, 27);
|
message = wspr::encode_message(&callsign, &self.locator, 27);
|
||||||
symbol_start = ts;
|
symbol_start = ts;
|
||||||
symbol_idx = 0;
|
symbol_idx = 0;
|
||||||
|
@ -115,22 +116,27 @@ impl App {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let ts = time::get();
|
let ts = time::get();
|
||||||
if (ts.seconds - symbol_start.seconds) >= 0.683 {
|
let delta_sec = (ts.seconds - symbol_start.seconds)
|
||||||
|
+ (ts.minutes - symbol_start.minutes) as f32 * 60.0;
|
||||||
|
if delta_sec >= 0.683 {
|
||||||
symbol_start = ts;
|
symbol_start = ts;
|
||||||
symbol_idx += 1;
|
symbol_idx += 1;
|
||||||
|
|
||||||
if symbol_idx < 162 {
|
if symbol_idx < 162 {
|
||||||
si_pll.write_synth_params(
|
si_pll.write_synth_params(
|
||||||
&mut self.i2c,
|
&mut self.i2c,
|
||||||
si5153::Multisynth::MS0,
|
si5153::Multisynth::MS0,
|
||||||
&WSPR_SYMBOLS[message[symbol_idx] as usize],
|
&WSPR_SYMBOLS[message[symbol_idx] as usize],
|
||||||
);
|
);
|
||||||
|
defmt::info!("Tranmitting Symbol {}", symbol_idx);
|
||||||
} else {
|
} else {
|
||||||
si_pll.disable_ms_output(&mut self.i2c, si5153::Multisynth::MS0);
|
si_pll.disable_ms_output(&mut self.i2c, si5153::Multisynth::MS0);
|
||||||
transmitting = false;
|
self.transmitting = false;
|
||||||
|
defmt::info!("Transmission ended");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wfi();
|
//wfi();
|
||||||
}
|
}
|
||||||
|
|
||||||
//exit();
|
//exit();
|
||||||
|
|
|
@ -86,5 +86,6 @@ pub fn setup(cp: cortex_m::peripheral::Peripherals, dp: stm32::Peripherals) -> A
|
||||||
i2c,
|
i2c,
|
||||||
gps_parser,
|
gps_parser,
|
||||||
locator: arrayvec::ArrayString::new(),
|
locator: arrayvec::ArrayString::new(),
|
||||||
|
transmitting: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue