s/ConnectTimeo/ConnectTimeout, s/WatchdogTimeo/WatchdogTimeout/

This commit is contained in:
Scott Feldman
2023-05-18 00:05:48 -07:00
committed by Ron Evans
parent 3c4df6e811
commit 4bf631a7e3
32 changed files with 42 additions and 42 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ var cfg = rtl8720dn.Config{
Rx: machine.PC24, Rx: machine.PC24,
Baudrate: 614400, Baudrate: 614400,
// Watchdog (set to 0 to disable) // Watchdog (set to 0 to disable)
WatchdogTimeo: time.Duration(20 * time.Second), WatchdogTimeout: time.Duration(20 * time.Second),
} }
var netdev = rtl8720dn.New(&cfg) var netdev = rtl8720dn.New(&cfg)
+1 -1
View File
@@ -27,7 +27,7 @@ var cfg = wifinina.Config{
Gpio0: machine.NINA_GPIO0, Gpio0: machine.NINA_GPIO0,
Resetn: machine.NINA_RESETN, Resetn: machine.NINA_RESETN,
// Watchdog (set to 0 to disable) // Watchdog (set to 0 to disable)
WatchdogTimeo: time.Duration(20 * time.Second), WatchdogTimeout: time.Duration(20 * time.Second),
} }
var netdev = wifinina.New(&cfg) var netdev = wifinina.New(&cfg)
+1 -1
View File
@@ -23,7 +23,7 @@ var cfg = rtl8720dn.Config{
Rx: machine.PC24, Rx: machine.PC24,
Baudrate: 614400, Baudrate: 614400,
// Watchdog (set to 0 to disable) // Watchdog (set to 0 to disable)
WatchdogTimeo: time.Duration(20 * time.Second), WatchdogTimeout: time.Duration(20 * time.Second),
} }
var netdev = rtl8720dn.New(&cfg) var netdev = rtl8720dn.New(&cfg)
+1 -1
View File
@@ -27,7 +27,7 @@ var cfg = wifinina.Config{
Gpio0: machine.NINA_GPIO0, Gpio0: machine.NINA_GPIO0,
Resetn: machine.NINA_RESETN, Resetn: machine.NINA_RESETN,
// Watchdog (set to 0 to disable) // Watchdog (set to 0 to disable)
WatchdogTimeo: time.Duration(20 * time.Second), WatchdogTimeout: time.Duration(20 * time.Second),
} }
var netdev = wifinina.New(&cfg) var netdev = wifinina.New(&cfg)
+1 -1
View File
@@ -23,7 +23,7 @@ var cfg = rtl8720dn.Config{
Rx: machine.PC24, Rx: machine.PC24,
Baudrate: 614400, Baudrate: 614400,
// Watchdog (set to 0 to disable) // Watchdog (set to 0 to disable)
WatchdogTimeo: time.Duration(20 * time.Second), WatchdogTimeout: time.Duration(20 * time.Second),
} }
var netdev = rtl8720dn.New(&cfg) var netdev = rtl8720dn.New(&cfg)
+1 -1
View File
@@ -27,7 +27,7 @@ var cfg = wifinina.Config{
Gpio0: machine.NINA_GPIO0, Gpio0: machine.NINA_GPIO0,
Resetn: machine.NINA_RESETN, Resetn: machine.NINA_RESETN,
// Watchdog (set to 0 to disable) // Watchdog (set to 0 to disable)
WatchdogTimeo: time.Duration(20 * time.Second), WatchdogTimeout: time.Duration(20 * time.Second),
} }
var netdev = wifinina.New(&cfg) var netdev = wifinina.New(&cfg)
+1 -1
View File
@@ -23,7 +23,7 @@ var cfg = rtl8720dn.Config{
Rx: machine.PC24, Rx: machine.PC24,
Baudrate: 614400, Baudrate: 614400,
// Watchdog (set to 0 to disable) // Watchdog (set to 0 to disable)
WatchdogTimeo: time.Duration(20 * time.Second), WatchdogTimeout: time.Duration(20 * time.Second),
} }
var netdev = rtl8720dn.New(&cfg) var netdev = rtl8720dn.New(&cfg)
+1 -1
View File
@@ -27,7 +27,7 @@ var cfg = wifinina.Config{
Gpio0: machine.NINA_GPIO0, Gpio0: machine.NINA_GPIO0,
Resetn: machine.NINA_RESETN, Resetn: machine.NINA_RESETN,
// Watchdog (set to 0 to disable) // Watchdog (set to 0 to disable)
WatchdogTimeo: time.Duration(20 * time.Second), WatchdogTimeout: time.Duration(20 * time.Second),
} }
var netdev = wifinina.New(&cfg) var netdev = wifinina.New(&cfg)
+1 -1
View File
@@ -23,7 +23,7 @@ var cfg = rtl8720dn.Config{
Rx: machine.PC24, Rx: machine.PC24,
Baudrate: 614400, Baudrate: 614400,
// Watchdog (set to 0 to disable) // Watchdog (set to 0 to disable)
WatchdogTimeo: time.Duration(20 * time.Second), WatchdogTimeout: time.Duration(20 * time.Second),
} }
var netdev = rtl8720dn.New(&cfg) var netdev = rtl8720dn.New(&cfg)
+1 -1
View File
@@ -27,7 +27,7 @@ var cfg = wifinina.Config{
Gpio0: machine.NINA_GPIO0, Gpio0: machine.NINA_GPIO0,
Resetn: machine.NINA_RESETN, Resetn: machine.NINA_RESETN,
// Watchdog (set to 0 to disable) // Watchdog (set to 0 to disable)
WatchdogTimeo: time.Duration(20 * time.Second), WatchdogTimeout: time.Duration(20 * time.Second),
} }
var netdev = wifinina.New(&cfg) var netdev = wifinina.New(&cfg)
+1 -1
View File
@@ -23,7 +23,7 @@ var cfg = rtl8720dn.Config{
Rx: machine.PC24, Rx: machine.PC24,
Baudrate: 614400, Baudrate: 614400,
// Watchdog (set to 0 to disable) // Watchdog (set to 0 to disable)
WatchdogTimeo: time.Duration(20 * time.Second), WatchdogTimeout: time.Duration(20 * time.Second),
} }
var netdev = rtl8720dn.New(&cfg) var netdev = rtl8720dn.New(&cfg)
+1 -1
View File
@@ -27,7 +27,7 @@ var cfg = wifinina.Config{
Gpio0: machine.NINA_GPIO0, Gpio0: machine.NINA_GPIO0,
Resetn: machine.NINA_RESETN, Resetn: machine.NINA_RESETN,
// Watchdog (set to 0 to disable) // Watchdog (set to 0 to disable)
WatchdogTimeo: time.Duration(20 * time.Second), WatchdogTimeout: time.Duration(20 * time.Second),
} }
var netdev = wifinina.New(&cfg) var netdev = wifinina.New(&cfg)
+1 -1
View File
@@ -23,7 +23,7 @@ var cfg = rtl8720dn.Config{
Rx: machine.PC24, Rx: machine.PC24,
Baudrate: 614400, Baudrate: 614400,
// Watchdog (set to 0 to disable) // Watchdog (set to 0 to disable)
WatchdogTimeo: time.Duration(20 * time.Second), WatchdogTimeout: time.Duration(20 * time.Second),
} }
var netdev = rtl8720dn.New(&cfg) var netdev = rtl8720dn.New(&cfg)
+1 -1
View File
@@ -27,7 +27,7 @@ var cfg = wifinina.Config{
Gpio0: machine.NINA_GPIO0, Gpio0: machine.NINA_GPIO0,
Resetn: machine.NINA_RESETN, Resetn: machine.NINA_RESETN,
// Watchdog (set to 0 to disable) // Watchdog (set to 0 to disable)
WatchdogTimeo: time.Duration(20 * time.Second), WatchdogTimeout: time.Duration(20 * time.Second),
} }
var netdev = wifinina.New(&cfg) var netdev = wifinina.New(&cfg)
+1 -1
View File
@@ -23,7 +23,7 @@ var cfg = rtl8720dn.Config{
Rx: machine.PC24, Rx: machine.PC24,
Baudrate: 614400, Baudrate: 614400,
// Watchdog (set to 0 to disable) // Watchdog (set to 0 to disable)
WatchdogTimeo: time.Duration(20 * time.Second), WatchdogTimeout: time.Duration(20 * time.Second),
} }
var netdev = rtl8720dn.New(&cfg) var netdev = rtl8720dn.New(&cfg)
+1 -1
View File
@@ -27,7 +27,7 @@ var cfg = wifinina.Config{
Gpio0: machine.NINA_GPIO0, Gpio0: machine.NINA_GPIO0,
Resetn: machine.NINA_RESETN, Resetn: machine.NINA_RESETN,
// Watchdog (set to 0 to disable) // Watchdog (set to 0 to disable)
WatchdogTimeo: time.Duration(20 * time.Second), WatchdogTimeout: time.Duration(20 * time.Second),
} }
var netdev = wifinina.New(&cfg) var netdev = wifinina.New(&cfg)
+1 -1
View File
@@ -23,7 +23,7 @@ var cfg = rtl8720dn.Config{
Rx: machine.PC24, Rx: machine.PC24,
Baudrate: 614400, Baudrate: 614400,
// Watchdog (set to 0 to disable) // Watchdog (set to 0 to disable)
WatchdogTimeo: time.Duration(20 * time.Second), WatchdogTimeout: time.Duration(20 * time.Second),
} }
var netdev = rtl8720dn.New(&cfg) var netdev = rtl8720dn.New(&cfg)
+1 -1
View File
@@ -27,7 +27,7 @@ var cfg = wifinina.Config{
Gpio0: machine.NINA_GPIO0, Gpio0: machine.NINA_GPIO0,
Resetn: machine.NINA_RESETN, Resetn: machine.NINA_RESETN,
// Watchdog (set to 0 to disable) // Watchdog (set to 0 to disable)
WatchdogTimeo: time.Duration(20 * time.Second), WatchdogTimeout: time.Duration(20 * time.Second),
} }
var netdev = wifinina.New(&cfg) var netdev = wifinina.New(&cfg)
+1 -1
View File
@@ -23,7 +23,7 @@ var cfg = rtl8720dn.Config{
Rx: machine.PC24, Rx: machine.PC24,
Baudrate: 614400, Baudrate: 614400,
// Watchdog (set to 0 to disable) // Watchdog (set to 0 to disable)
WatchdogTimeo: time.Duration(20 * time.Second), WatchdogTimeout: time.Duration(20 * time.Second),
} }
var netdev = rtl8720dn.New(&cfg) var netdev = rtl8720dn.New(&cfg)
+1 -1
View File
@@ -27,7 +27,7 @@ var cfg = wifinina.Config{
Gpio0: machine.NINA_GPIO0, Gpio0: machine.NINA_GPIO0,
Resetn: machine.NINA_RESETN, Resetn: machine.NINA_RESETN,
// Watchdog (set to 0 to disable) // Watchdog (set to 0 to disable)
WatchdogTimeo: time.Duration(20 * time.Second), WatchdogTimeout: time.Duration(20 * time.Second),
} }
var netdev = wifinina.New(&cfg) var netdev = wifinina.New(&cfg)
+1 -1
View File
@@ -23,7 +23,7 @@ var cfg = rtl8720dn.Config{
Rx: machine.PC24, Rx: machine.PC24,
Baudrate: 614400, Baudrate: 614400,
// Watchdog (set to 0 to disable) // Watchdog (set to 0 to disable)
WatchdogTimeo: time.Duration(20 * time.Second), WatchdogTimeout: time.Duration(20 * time.Second),
} }
var netdev = rtl8720dn.New(&cfg) var netdev = rtl8720dn.New(&cfg)
+1 -1
View File
@@ -27,7 +27,7 @@ var cfg = wifinina.Config{
Gpio0: machine.NINA_GPIO0, Gpio0: machine.NINA_GPIO0,
Resetn: machine.NINA_RESETN, Resetn: machine.NINA_RESETN,
// Watchdog (set to 0 to disable) // Watchdog (set to 0 to disable)
WatchdogTimeo: time.Duration(20 * time.Second), WatchdogTimeout: time.Duration(20 * time.Second),
} }
var netdev = wifinina.New(&cfg) var netdev = wifinina.New(&cfg)
+1 -1
View File
@@ -23,7 +23,7 @@ var cfg = rtl8720dn.Config{
Rx: machine.PC24, Rx: machine.PC24,
Baudrate: 614400, Baudrate: 614400,
// Watchdog (set to 0 to disable) // Watchdog (set to 0 to disable)
WatchdogTimeo: time.Duration(20 * time.Second), WatchdogTimeout: time.Duration(20 * time.Second),
} }
var netdev = rtl8720dn.New(&cfg) var netdev = rtl8720dn.New(&cfg)
+1 -1
View File
@@ -27,7 +27,7 @@ var cfg = wifinina.Config{
Gpio0: machine.NINA_GPIO0, Gpio0: machine.NINA_GPIO0,
Resetn: machine.NINA_RESETN, Resetn: machine.NINA_RESETN,
// Watchdog (set to 0 to disable) // Watchdog (set to 0 to disable)
WatchdogTimeo: time.Duration(20 * time.Second), WatchdogTimeout: time.Duration(20 * time.Second),
} }
var netdev = wifinina.New(&cfg) var netdev = wifinina.New(&cfg)
+1 -1
View File
@@ -23,7 +23,7 @@ var cfg = rtl8720dn.Config{
Rx: machine.PC24, Rx: machine.PC24,
Baudrate: 614400, Baudrate: 614400,
// Watchdog (set to 0 to disable) // Watchdog (set to 0 to disable)
WatchdogTimeo: time.Duration(20 * time.Second), WatchdogTimeout: time.Duration(20 * time.Second),
} }
var netdev = rtl8720dn.New(&cfg) var netdev = rtl8720dn.New(&cfg)
+1 -1
View File
@@ -27,7 +27,7 @@ var cfg = wifinina.Config{
Gpio0: machine.NINA_GPIO0, Gpio0: machine.NINA_GPIO0,
Resetn: machine.NINA_RESETN, Resetn: machine.NINA_RESETN,
// Watchdog (set to 0 to disable) // Watchdog (set to 0 to disable)
WatchdogTimeo: time.Duration(20 * time.Second), WatchdogTimeout: time.Duration(20 * time.Second),
} }
var netdev = wifinina.New(&cfg) var netdev = wifinina.New(&cfg)
+1 -1
View File
@@ -23,7 +23,7 @@ var cfg = rtl8720dn.Config{
Rx: machine.PC24, Rx: machine.PC24,
Baudrate: 614400, Baudrate: 614400,
// Watchdog (set to 0 to disable) // Watchdog (set to 0 to disable)
WatchdogTimeo: time.Duration(20 * time.Second), WatchdogTimeout: time.Duration(20 * time.Second),
} }
var netdev = rtl8720dn.New(&cfg) var netdev = rtl8720dn.New(&cfg)
+1 -1
View File
@@ -27,7 +27,7 @@ var cfg = wifinina.Config{
Gpio0: machine.NINA_GPIO0, Gpio0: machine.NINA_GPIO0,
Resetn: machine.NINA_RESETN, Resetn: machine.NINA_RESETN,
// Watchdog (set to 0 to disable) // Watchdog (set to 0 to disable)
WatchdogTimeo: time.Duration(20 * time.Second), WatchdogTimeout: time.Duration(20 * time.Second),
} }
var netdev = wifinina.New(&cfg) var netdev = wifinina.New(&cfg)
+1 -1
View File
@@ -23,7 +23,7 @@ var cfg = rtl8720dn.Config{
Rx: machine.PC24, Rx: machine.PC24,
Baudrate: 614400, Baudrate: 614400,
// Watchdog (set to 0 to disable) // Watchdog (set to 0 to disable)
WatchdogTimeo: time.Duration(20 * time.Second), WatchdogTimeout: time.Duration(20 * time.Second),
} }
var netdev = rtl8720dn.New(&cfg) var netdev = rtl8720dn.New(&cfg)
+1 -1
View File
@@ -27,7 +27,7 @@ var cfg = wifinina.Config{
Gpio0: machine.NINA_GPIO0, Gpio0: machine.NINA_GPIO0,
Resetn: machine.NINA_RESETN, Resetn: machine.NINA_RESETN,
// Watchdog (set to 0 to disable) // Watchdog (set to 0 to disable)
WatchdogTimeo: time.Duration(20 * time.Second), WatchdogTimeout: time.Duration(20 * time.Second),
} }
var netdev = wifinina.New(&cfg) var netdev = wifinina.New(&cfg)
+4 -4
View File
@@ -63,7 +63,7 @@ type Config struct {
// downed connection and try to recover the connection. Default is // downed connection and try to recover the connection. Default is
// 0secs, which means no watchdog. Set to non-zero to enable // 0secs, which means no watchdog. Set to non-zero to enable
// watchodog. // watchodog.
WatchdogTimeo time.Duration WatchdogTimeout time.Duration
} }
type rtl8720dn struct { type rtl8720dn struct {
@@ -226,7 +226,7 @@ func (r *rtl8720dn) networkDown() bool {
} }
func (r *rtl8720dn) watchdog() { func (r *rtl8720dn) watchdog() {
ticker := time.NewTicker(r.cfg.WatchdogTimeo) ticker := time.NewTicker(r.cfg.WatchdogTimeout)
for { for {
select { select {
case <-r.killWatchdog: case <-r.killWatchdog:
@@ -290,7 +290,7 @@ func (r *rtl8720dn) NetConnect() error {
r.netConnected = true r.netConnected = true
if r.cfg.WatchdogTimeo != 0 { if r.cfg.WatchdogTimeout != 0 {
go r.watchdog() go r.watchdog()
} }
@@ -310,7 +310,7 @@ func (r *rtl8720dn) NetDisconnect() {
return return
} }
if r.cfg.WatchdogTimeo != 0 { if r.cfg.WatchdogTimeout != 0 {
r.killWatchdog <- true r.killWatchdog <- true
} }
r.netDisconnect() r.netDisconnect()
+8 -8
View File
@@ -195,13 +195,13 @@ type Config struct {
Retries int Retries int
// Timeout duration for each connection attempt. Default is 10sec. // Timeout duration for each connection attempt. Default is 10sec.
ConnectTimeo time.Duration ConnectTimeout time.Duration
// Watchdog ticker duration. On tick, the watchdog will check for // Watchdog ticker duration. On tick, the watchdog will check for
// downed connection or hardware fault and try to recover the // downed connection or hardware fault and try to recover the
// connection. Default is 0secs, which means no watchdog. Set to // connection. Default is 0secs, which means no watchdog. Set to
// non-zero to enable watchodog. // non-zero to enable watchodog.
WatchdogTimeo time.Duration WatchdogTimeout time.Duration
} }
type wifinina struct { type wifinina struct {
@@ -244,8 +244,8 @@ func New(cfg *Config) *wifinina {
resetn: cfg.Resetn, resetn: cfg.Resetn,
} }
if w.cfg.ConnectTimeo == 0 { if w.cfg.ConnectTimeout == 0 {
w.cfg.ConnectTimeo = 10 * time.Second w.cfg.ConnectTimeout = 10 * time.Second
} }
drivers.UseNetdev(&w) drivers.UseNetdev(&w)
@@ -404,7 +404,7 @@ func (w *wifinina) networkDown() bool {
} }
func (w *wifinina) watchdog() { func (w *wifinina) watchdog() {
ticker := time.NewTicker(w.cfg.WatchdogTimeo) ticker := time.NewTicker(w.cfg.WatchdogTimeout)
for { for {
select { select {
case <-w.killWatchdog: case <-w.killWatchdog:
@@ -439,7 +439,7 @@ func (w *wifinina) netConnect(reset bool) error {
w.showDevice() w.showDevice()
for i := 0; w.cfg.Retries == 0 || i < w.cfg.Retries; i++ { for i := 0; w.cfg.Retries == 0 || i < w.cfg.Retries; i++ {
if err := w.connectToAP(w.cfg.ConnectTimeo); err != nil { if err := w.connectToAP(w.cfg.ConnectTimeout); err != nil {
switch err { switch err {
case drivers.ErrConnectTimeout, drivers.ErrConnectFailed: case drivers.ErrConnectTimeout, drivers.ErrConnectFailed:
continue continue
@@ -475,7 +475,7 @@ func (w *wifinina) NetConnect() error {
w.netConnected = true w.netConnected = true
if w.cfg.WatchdogTimeo != 0 { if w.cfg.WatchdogTimeout != 0 {
go w.watchdog() go w.watchdog()
} }
@@ -491,7 +491,7 @@ func (w *wifinina) NetDisconnect() {
return return
} }
if w.cfg.WatchdogTimeo != 0 { if w.cfg.WatchdogTimeout != 0 {
w.killWatchdog <- true w.killWatchdog <- true
} }