Skip to content

Commit

Permalink
Ham: some of 'Open Edition' APRS Rx logic [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
lyusupov committed Feb 7, 2024
1 parent 7b9a857 commit 80c7e82
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
9 changes: 7 additions & 2 deletions software/firmware/source/SoftRF/src/driver/RF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2530,7 +2530,6 @@ static void sa8x8_setup()
}

// OE.setBandwidth(1); /* 25 KHz */
OE.setVolume(1);
OE.setAudio(true);
break;

Expand Down Expand Up @@ -2620,7 +2619,8 @@ static bool sa8x8_receive()
{
case Model::SA_868_OpenEdition:
if (OE.settings().mode != OpenEdition_Mode::RX) {
// OE.RxOn();
OE.RxOn();
OE.setVolume(3);
}
break;

Expand Down Expand Up @@ -2650,7 +2650,12 @@ static bool sa8x8_transmit()
{
case Model::SA_868_OpenEdition:
if (OE.settings().mode != OpenEdition_Mode::TX) {
if (OE.settings().mode == OpenEdition_Mode::RX) {
OE.RxOff();
delay(300);
}
OE.TxOn();
delay(300);
} else {
return false;
}
Expand Down
29 changes: 27 additions & 2 deletions software/firmware/source/libraries/SA818/src/SA818Controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,14 +506,24 @@ void OpenEdition::init() {
// Bit 11 = 1: bypass VOX HPF
// Bit 12 = 1: bypass VOX LPF
// Bit 13 = 1: bypass RSSI LPF

#if 0
SA868_WriteAT1846Sreg(_SerialRF, 0x44, SA868_maskSetValue(0x06FF, 0x00F0, ((int16_t)_config.volume) << 8));
SA868_WriteAT1846Sreg(_SerialRF, 0x40, 0x0030);
SA868_WriteAT1846Sreg(_SerialRF, 0x44,_config.volume*2 | (((int16_t)_config.volume*2) << 4));
#else
SA868_WriteAT1846Sreg(_SerialRF, 0x44,0x00FF);
// SA868_WriteAT1846Sreg(_SerialRF, 0x41, 0x0030);
#endif

SA868_maskSetRegister(_SerialRF, 0x57, 0x0001, 0x00); // Audio feedback off
SA868_maskSetRegister(_SerialRF, 0x3A, 0x7000, 0x4000); // Select voice channel

setSqlThresh();
#if 0
SA868_maskSetRegister(_SerialRF, 0x30, 0x0004, 0x0004); // SQ ON
#else
SA868_maskSetRegister(_SerialRF, 0x30, 0x0008, 0x0000);
#endif
setPower();
}

Expand Down Expand Up @@ -583,7 +593,9 @@ void OpenEdition::updateBandwidth()
void OpenEdition::setVolume(uint8_t value)
{
_config.volume = value;
SA868_maskSetRegister(_SerialRF, 0x44, 0x00F0, ((int16_t)_config.volume) << 8);
uint16_t volume1 = ((((int16_t)_config.volume)*2)-1) << 4;
uint16_t volume2 = (((int16_t)_config.volume)*2)-1;
SA868_maskSetRegister(_SerialRF, 0x44, 0x00F0, volume1 | volume2);
}

int16_t OpenEdition::getRSSI()
Expand Down Expand Up @@ -631,8 +643,13 @@ void OpenEdition::setSqlThresh(uint8_t value)

void OpenEdition::setSqlThresh()
{
#if 0
SA868_WriteAT1846Sreg(_SerialRF, 0x49, static_cast< uint16_t >(_config.sql_level));
SA868_WriteAT1846Sreg(_SerialRF, 0x48, static_cast< uint16_t >(_config.sql_level));
#else
SA868_WriteAT1846Sreg(_SerialRF, 0x49, 0);
SA868_WriteAT1846Sreg(_SerialRF, 0x48, 0);
#endif
}

void OpenEdition::RxOn()
Expand All @@ -644,6 +661,14 @@ void OpenEdition::RxOn()
_config.mode = OpenEdition_Mode::RX;
}

void OpenEdition::RxOff()
{
if (_config.mode != OpenEdition_Mode::RX)
return;
SA868_setFuncMode(_SerialRF, OpenEdition_Mode::OFF);
_config.mode = OpenEdition_Mode::OFF;
}

void OpenEdition::TxOn()
{
if (_config.mode == OpenEdition_Mode::TX)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class OpenEdition
OpenEdition_Version Version();
int16_t getRSSI();
void RxOn();
void RxOff();
void TxOn();
void TxOff();
void setAudio(bool value);
Expand Down

0 comments on commit 80c7e82

Please sign in to comment.