2 Commits

Author SHA1 Message Date
gballan cc96fbccc0 [Issue #10] - Added config option to allow the user to set the hostname
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2026-09-10 23:57:46 -04:00
gballan e478758c49 [Issue #9] - Set network stack to enable ICMP, with a queue limit of 4
ci/woodpecker/push/woodpecker Pipeline was successful
2026-09-10 23:51:41 -04:00
2 changed files with 10 additions and 1 deletions
+5
View File
@@ -1,6 +1,11 @@
package main
const (
// Wi-Fi settings
WifiSSID = "MyWifiNetwork"
WifiPass = "MyWifiPassword"
// Network settings
Hostname = "pico2w-clock"
EnableICMP = true
)
+5 -1
View File
@@ -112,16 +112,20 @@ func InitNetwork(ssid, pass string) (*NetworkStack, error) {
stack := &xnet.StackAsync{}
err = stack.Reset(xnet.StackConfig{
Hostname: "pico2w-bme280",
Hostname: Hostname,
RandSeed: time.Now().UnixNano(),
MaxActiveTCPPorts: 2,
MTU: uint16(framelen - ethernet.MaxOverheadSize),
HardwareAddress: hwaddr,
ICMPQueueLimit: 4,
})
if err != nil {
return nil, fmt.Errorf("stack config reset: %w", err)
}
// Enable network pings
_ = stack.EnableICMP(EnableICMP)
// Start background frame pump
ctx := context.Background()
go stackLoop(ctx, stack, adapter)