|
|
|
@ -196,18 +196,18 @@ func (r *Device) SetMode(newMode byte) error {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
err := r.readWriteReg(REG_OPMODE, 0xE3, newMode)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if r.isRFM69HW && (newMode == RF_OPMODE_RECEIVER || newMode == RF_OPMODE_TRANSMITTER) {
|
|
|
|
|
err = r.setHighPowerRegs(newMode == RF_OPMODE_TRANSMITTER)
|
|
|
|
|
err := r.setHighPowerRegs(newMode == RF_OPMODE_TRANSMITTER)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
err := r.readWriteReg(REG_OPMODE, 0xE3, newMode)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// we are using packet mode, so this check is not really needed
|
|
|
|
|
// but waiting for mode ready is necessary when going from sleep because the FIFO may not be immediately available from previous mode
|
|
|
|
|
if r.mode == RF_OPMODE_SLEEP {
|
|
|
|
|