Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
tonygilkerson committed Mar 19, 2024
1 parent 3b5e330 commit d4e7dc6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions cmd/mbx/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (

const (
HEARTBEAT_DURATION_SECONDS = 300
TXRX_LOOP_TICKER_DURATION_SECONDS = 9
)


Expand Down Expand Up @@ -57,7 +56,7 @@ func main() {
txQ := make(chan string, 250) // I would hope the channel size would never be larger than ~4 so 250 is large
rxQ := make(chan string) // this app currently does not do anything with messages received

radio := road.SetupLora(*machine.SPI0, en, rst, cs, dio0, dio1, sck, sdo, sdi, loraRadio, &txQ, &rxQ, 0, 0, TXRX_LOOP_TICKER_DURATION_SECONDS, road.TxOnly)
radio := road.SetupLora(*machine.SPI0, en, rst, cs, dio0, dio1, sck, sdo, sdi, loraRadio, &txQ, &rxQ, 5_000, 10_000, 10, road.TxOnly)

//
// Setup charger
Expand Down
5 changes: 2 additions & 3 deletions cmd/soil/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ func main() {
var led machine.Pin = machine.GPIO25 // GP25 machine.LED

const (
HEARTBEAT_DURATION_SECONDS = 3
TXRX_LOOP_TICKER_DURATION_SECONDS = 7
HEARTBEAT_DURATION_SECONDS = 10
)

//
Expand Down Expand Up @@ -83,7 +82,7 @@ func main() {
rxQ := make(chan string, 250)

log.Println("Setup LORA")
radio := road.SetupLora(*machine.SPI0, loraEn, loraRst, loraCs, loraDio0, loraDio1, loraSck, loraSdo, loraSdi, loraRadio, &txQ, &rxQ, 0, 10_000, TXRX_LOOP_TICKER_DURATION_SECONDS, road.TxRx)
radio := road.SetupLora(*machine.SPI0, loraEn, loraRst, loraCs, loraDio0, loraDio1, loraSck, loraSdo, loraSdi, loraRadio, &txQ, &rxQ, 5_000, 10_000, 10, road.TxOnly)

// Routine to send and receive
go radio.LoraRxTxRunner()
Expand Down
7 changes: 4 additions & 3 deletions internal/road/road.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,19 @@ func SetupLora(
radio.SDI = sdi

if rxTimeoutMs == 0 {
radio.RxTimeoutMs = 1000
radio.RxTimeoutMs = 5_000
} else {
radio.RxTimeoutMs = rxTimeoutMs
}

if txTimeoutMs == 0 {
radio.TxTimeoutMs = 1000
radio.TxTimeoutMs = 10_000
} else {
radio.TxTimeoutMs = txTimeoutMs
}

if txRxLoopTickerSec == 0 {
radio.TxRxLoopTickerSec = 10
radio.TxRxLoopTickerSec = 1
} else {
radio.TxRxLoopTickerSec = txRxLoopTickerSec
}
Expand Down Expand Up @@ -159,6 +159,7 @@ func SplitMessageBatch(msgBatch string) []string {
}

func (radio *Radio) LoraRxTxRunner() {
log.Println("road.LoraRxTxRunner: with TxRxLoopTickerSec: %v",radio.TxRxLoopTickerSec)

ticker := time.NewTicker(time.Second * time.Duration(radio.TxRxLoopTickerSec))
for range ticker.C {
Expand Down

0 comments on commit d4e7dc6

Please sign in to comment.