Skip to content

Commit

Permalink
FSK now working thanks to radiolib patch by 4m1g0
Browse files Browse the repository at this point in the history
  • Loading branch information
G4lile0 committed Feb 25, 2020
1 parent fb93e46 commit f750524
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 38 deletions.
34 changes: 3 additions & 31 deletions FossaGroundStation/src/Radio/Radio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,6 @@ void Radio::init(){
int state = 0;
if (board.L_SX127X) {
lora = new SX1278(new Module(board.L_NSS, board.L_DI00, board.L_DI01, spi));
fsk = new SX1278(new Module(board.L_NSS, board.L_DI00, board.L_DI01, spi));
// fsk = new SX1278(new Module(18, 26, 12));
// fsk = new SX1278(new Module(board.L_NSS, board.L_DI00,board.L_RST,board.L_DI01, spi));


//test arrancar en inicio en modo FSK
state = ((SX1278*)fsk)->beginFSK();
if (state == ERR_NONE) {
Serial.println(F("success en inicio enable fsk!"));
} else {
Serial.print(F("failed fsk en inicio, code "));
Serial.println(state);}
//test

state = ((SX1278*)lora)->begin(LORA_CARRIER_FREQUENCY,
LORA_BANDWIDTH,
LORA_SPREADING_FACTOR,
Expand Down Expand Up @@ -672,23 +658,10 @@ void Radio::remote_begin_fsk(char* payload, size_t payload_len) {
Serial.print(F("Set Preamble Length: ")); Serial.println(preambleLength);
Serial.print(F("OOK Modulation ")); if (enableOOK) Serial.println(F("ON")); else Serial.println(F("OFF"));
Serial.print(F("Set Sx1268 datashaping ")); Serial.println(dataShaping);

int state = 0;

// test de inicio sin comentarios...
state = ((SX1278*)fsk)->beginFSK();
if (state == ERR_NONE) {
Serial.println(F("success enable fsk!"));
} else {
Serial.print(F("failed fsk, code "));
Serial.println(state);
}

state =0;


int state = 0;
if (ConfigManager::getInstance().getBoardConfig().L_SX127X) {
state = ((SX1278*)fsk)->beginFSK(freq,
state = ((SX1278*)lora)->beginFSK(freq,
br,
freqDev,
rxBw,
Expand All @@ -710,15 +683,14 @@ void Radio::remote_begin_fsk(char* payload, size_t payload_len) {
}

if (state == ERR_NONE) {
Serial.println(F("success!"));
Serial.println(F("success FSK enable!"));
}
else {
Serial.print(F("failed, code "));
Serial.println(state);
return;
}


}


Expand Down
2 changes: 1 addition & 1 deletion FossaGroundStation/src/Radio/Radio.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class Radio {
private:
Radio();
PhysicalLayer* lora;
PhysicalLayer* fsk;
// PhysicalLayer* fsk;
void processReceivedFrame(uint8_t functionId, uint8_t *respOptData, size_t respLen);

static void setFlag();
Expand Down
2 changes: 1 addition & 1 deletion FossaGroundStation/src/Status.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct PacketInfo {
};

struct Status {
const uint32_t version = 2002221; // version year month day release
const uint32_t version = 2002251; // version year month day release
bool mqtt_connected = false;
SysInfo sysInfo;
PacketInfo lastPacketInfo;
Expand Down
10 changes: 5 additions & 5 deletions lib/RadioLib/src/modules/SX127x/SX127x.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ int16_t SX127x::beginFSK(uint8_t chipVersion, float br, float freqDev, float rxB
RADIOLIB_ASSERT(state);
}

// enable/disable OOK
state = setOOK(enableOOK);
RADIOLIB_ASSERT(state);

// set bit rate
state = SX127x::setBitRate(br);
RADIOLIB_ASSERT(state);
Expand Down Expand Up @@ -101,11 +105,7 @@ int16_t SX127x::beginFSK(uint8_t chipVersion, float br, float freqDev, float rxB

// disable address filtering
state = disableAddressFiltering();
RADIOLIB_ASSERT(state);

// enable/disable OOK
state = setOOK(enableOOK);
RADIOLIB_ASSERT(state);
RADIOLIB_ASSERT(state);

// set default RSSI measurement config
state = setRSSIConfig(2);
Expand Down

0 comments on commit f750524

Please sign in to comment.