update for latest sx128x driver changes
This commit is contained in:
@@ -66,12 +66,13 @@ func main() {
|
||||
timeout.Store(true)
|
||||
|
||||
dio1Pin.SetInterrupt(machine.PinRising, func(machine.Pin) {
|
||||
irqStatus := radio.GetIrqStatus()
|
||||
irqStatus, _ := radio.GetIrqStatus()
|
||||
|
||||
if irqStatus&sx128x.IRQ_TX_DONE_MASK != 0 {
|
||||
txDone.Store(true)
|
||||
timeout.Store(false)
|
||||
led.Set(false)
|
||||
println("tx done")
|
||||
}
|
||||
if irqStatus&sx128x.IRQ_RX_DONE_MASK != 0 {
|
||||
rxDone.Store(true)
|
||||
@@ -103,13 +104,8 @@ func main() {
|
||||
SetupLora(radio, loraConfig)
|
||||
|
||||
oscMessage := osc.OSCMessage{
|
||||
Address: "/lora/button",
|
||||
Args: []osc.OSCArg{
|
||||
{
|
||||
Type: "i",
|
||||
Value: 0,
|
||||
},
|
||||
},
|
||||
Address: "/cue/1/go",
|
||||
Args: []osc.OSCArg{},
|
||||
}
|
||||
|
||||
for {
|
||||
@@ -120,7 +116,6 @@ func main() {
|
||||
radio.SetStandby(sx128x.STANDBY_RC)
|
||||
led.Set(true)
|
||||
|
||||
oscMessage.Args[0].Value = int32(time.Now().UnixMilli() / 1000)
|
||||
bytes, err := oscMessage.ToBytes()
|
||||
if err != nil {
|
||||
println("failed to serialize OSC message:", err)
|
||||
@@ -163,7 +158,7 @@ func main() {
|
||||
func SetupLora(radio *sx128x.Device, config lora.Config) {
|
||||
// Switch to standby prior to configuration changes
|
||||
|
||||
circuitMode, _ := radio.GetStatus()
|
||||
circuitMode, _, _ := radio.GetStatus()
|
||||
if circuitMode != sx128x.CIRCUIT_MODE_STDBY_RC {
|
||||
radio.SetStandby(sx128x.STANDBY_RC)
|
||||
}
|
||||
@@ -184,7 +179,7 @@ func SetupLora(radio *sx128x.Device, config lora.Config) {
|
||||
data[0] = 0x32
|
||||
}
|
||||
radio.WriteRegister(0x925, data[:])
|
||||
existing := radio.ReadRegister(0x93C)
|
||||
existing, _ := radio.ReadRegister(0x93C)
|
||||
data[0] = existing | 0x01
|
||||
radio.WriteRegister(0x93C, data[:])
|
||||
|
||||
@@ -199,7 +194,7 @@ func SetupLora(radio *sx128x.Device, config lora.Config) {
|
||||
}
|
||||
|
||||
func checkStatus(radio *sx128x.Device, operation string) {
|
||||
circuitMode, commandStatus := radio.GetStatus()
|
||||
circuitMode, commandStatus, _ := radio.GetStatus()
|
||||
if commandStatus != sx128x.COMMAND_STATUS_SUCCESS {
|
||||
println(operation, "-> failed with status:", commandStatus)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user