Skip to content

Commit

Permalink
Set hardware fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sh123 committed Mar 13, 2023
1 parent 39a71c5 commit 8c8b578
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#define CONFIG_H

// lora default parameters
#define CFG_LORA_FREQ 433.750E6
#define CFG_LORA_FREQ 433.775E6
#define CFG_LORA_SYNC_WORD 0x12
#define CFG_LORA_BW 31.25e3
#define CFG_LORA_BW 125.0e3
#define CFG_LORA_SF 7
#define CFG_LORA_CR 6
#define CFG_LORA_PWR 10
Expand Down
2 changes: 2 additions & 0 deletions include/kiss.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ enum DataType {
None = 0x80
};

#define CFG_KISS_SET_HARDWARE_SIZE 17

struct SetHardware {
uint32_t freq;
uint32_t bw;
Expand Down
10 changes: 6 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,13 @@ void processLoraPacketAsModem()
Serial.write(Kiss::Marker::Fend);
}


// set hardware from current buffer
void kissSetHardware(int packetSize)
{
if (packetSize == sizeof(Kiss::SetHardware)) {
if (packetSize == CFG_KISS_SET_HARDWARE_SIZE) {
const struct Kiss::SetHardware * setHardware = reinterpret_cast<const struct Kiss::SetHardware*>(pktBufTx_);
setupRadio(
be32toh(setHardware->freq),
be32toh(setHardware->freq),
be32toh(setHardware->bw),
be16toh(setHardware->sf),
be16toh(setHardware->cr),
Expand Down Expand Up @@ -305,8 +304,11 @@ void kissProcess(byte rxByte)
}
kissState_ = Kiss::State::GetStart;
break;
// new byte is read
default:
pktBufTx_[pktBufTxIndex_++] = rxByte;
if (kissDataType_ == Kiss::DataType::Raw ||
kissDataType_ == Kiss::DataType::Control)
pktBufTx_[pktBufTxIndex_++] = rxByte;
break;
}
break;
Expand Down

0 comments on commit 8c8b578

Please sign in to comment.