Compare commits

...

2 commits

Author SHA1 Message Date
Stephan I. Böttcher
b50205b62b Fix rfen(0)
Do not turn off rfen() when there is a trigger, waiting for mclk_delay.
2024-09-20 22:12:30 +02:00
Stephan I. Böttcher
98cc6148f3 Add rfen_status()
The preamble was repeated mclk_delay times, unnecessarily.
Test the rfen status to enable/send only once.
2024-09-20 21:58:13 +02:00

View file

@ -65,6 +65,12 @@ void rfen(uint8_t on)
RFEN_P.OUT &=~ RFEN_B; RFEN_P.OUT &=~ RFEN_B;
} }
static inline
uint8_t rfen_status()
{
return RFEN_P.OUT & RFEN_B;
}
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// BATE, read data from an MS5534C pressure sensor // BATE, read data from an MS5534C pressure sensor
@ -501,9 +507,6 @@ int main()
wdt_reset(); wdt_reset();
rfen(0);
led(0);
if (uart_tick()) { if (uart_tick()) {
trigger |= TRIGGER_UART; trigger |= TRIGGER_UART;
// We woke up for a blibb on Rx. // We woke up for a blibb on Rx.
@ -520,6 +523,8 @@ int main()
trigger |= TRIGGER_IMMED; trigger |= TRIGGER_IMMED;
if (!(trigger & config.triggers)) { if (!(trigger & config.triggers)) {
rfen(0);
led(0);
if (config.power & (POWER_DOWN|POWER_STDBY)) { if (config.power & (POWER_DOWN|POWER_STDBY)) {
mclk(0); mclk(0);
if (config.power & POWER_DOWN && !uart_rx_delay) { if (config.power & POWER_DOWN && !uart_rx_delay) {
@ -533,10 +538,12 @@ int main()
continue; continue;
} }
if (config.power & POWER_RF) if (!rfen_status()) {
rfen(1); if (config.power & POWER_RF)
if (config.power & POWER_LINE) rfen(1);
send_str(config.line_preable); if (config.power & POWER_LINE)
send_str(config.line_preable);
}
if (config.power & POWER_LED) if (config.power & POWER_LED)
led(1); led(1);