added some checks

master
cheetah 4 years ago
parent c5c9e664f3
commit 912ff0fba0

@ -56,6 +56,8 @@ func main() {
if err != nil {
log.Panic(err)
}
// Only if we allow TX, we process Messages
if conf.TXFreq != 0 {
go func() {
d, err := consumeCh.Consume("input", "", false, false, false, false, nil)
if err != nil {
@ -74,6 +76,7 @@ func main() {
msg.Ack(true)
}
}()
}
/***** RABBITMQ END**/
if rfm, err = rfm69.NewDevice(true); err != nil {
@ -81,10 +84,12 @@ func main() {
}
rfm.FreqOffset = conf.FreqOffset
rfm.TXBaud = conf.TXBaud
rfm.RXBaud = conf.RXBaud
rfm.TXFreq = conf.TXFreq
rfm.TXBaud = conf.TXBaud
rfm.RXFreq = conf.RXFreq
rfm.RXBaud = conf.RXBaud
if err = rfm.SetModeAndWait(rfm69.RF_OPMODE_STANDBY); err != nil {
panic(err)
@ -92,14 +97,13 @@ func main() {
if err = rfm.SetInvert(conf.InvertBits); err != nil {
panic(err)
}
//rfm.SetFrequency(466238000, 25)
log.Println("Config")
log.Println("Running with following Config:")
log.Println("AMQP Server: ", conf.AMQPURL)
log.Println("Frequency Offset(Correction): ", conf.FreqOffset, "Hz")
log.Println("Transmit Freq: ", conf.TXFreq, "Hz @", conf.TXBaud, "bps")
log.Println("Receive Freq: ", conf.RXFreq, "Hz @", conf.RXBaud, "bps")
/*
messages := []*pocsagencode.Message{
&pocsagencode.Message{133701, "Hello 1234567890!", false},
//&pocsagencode.Message{133702, "Hello d2efa947-7618-440c-8f79-fab32762af8ed2bb9c62-007e-4b2c-93d5-3124a247032eefe71db4-ef8d-46fb-9cf8-dac70db000bc12067966-da61-447c-a9ce-c0c24be17df5 Pager!", false},
@ -121,7 +125,8 @@ func main() {
}
rfm.Send(data)
}
*/
if conf.RXFreq != 0 {
rfm.OnReceive = func(stream *rfm69.RXStream) {
rssiMeasurementArray := make([]int, 5)
rssiStart := -0
@ -159,8 +164,8 @@ func main() {
}
}
}
rfm.PrepareRX()
}
rfm.Loop()
log.Println("Done")

Loading…
Cancel
Save