-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzEthernet.ino
69 lines (58 loc) · 2.09 KB
/
zEthernet.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
void EthernetStart()
{
// start the Ethernet connection:
Serial.println("Initializing ethernet with static IP address");
// try to congifure using IP:
Ethernet.begin(mac,0); // Start Ethernet with IP 0.0.0.0
// Check for Ethernet hardware present
if (Ethernet.hardwareStatus() == EthernetNoHardware)
{
Serial.println("Ethernet shield was not found. GPS via USB only.");
return;
}
if (Ethernet.linkStatus() == LinkOFF)
{
Serial.println("Ethernet cable is not connected - Who cares we will start ethernet anyway.");
}
//grab the ip from EEPROM
Eth_myip[0] = networkAddress.ipOne;
Eth_myip[1] = networkAddress.ipTwo;
Eth_myip[2] = networkAddress.ipThree;
if (Autosteer_running)
{
Eth_myip[3] = 126; //126 is steer module, with or without GPS
}
else
{
Eth_myip[3] = 120; //120 is GPS only module
}
Ethernet.setLocalIP(Eth_myip); // Change IP address to IP set by user
Serial.println("\r\nEthernet status OK");
Serial.print("IP set Manually: ");
Serial.println(Ethernet.localIP());
Eth_ipDestination[0] = Eth_myip[0];
Eth_ipDestination[1] = Eth_myip[1];
Eth_ipDestination[2] = Eth_myip[2];
Eth_ipDestination[3] = 255;
Serial.print("\r\nEthernet IP of module: "); Serial.println(Ethernet.localIP());
Serial.print("Ethernet sending to IP: "); Serial.println(Eth_ipDestination);
Serial.print("All data sending to port: "); Serial.println(portDestination);
// init UPD Port sending to AOG
if (Eth_udpPAOGI.begin(portMy))
{
Serial.print("Ethernet GPS UDP sending from port: ");
Serial.println(portMy);
}
// init UPD Port getting NTRIP from AOG
if (Eth_udpNtrip.begin(AOGNtripPort)) // AOGNtripPort
{
Serial.print("Ethernet NTRIP UDP listening to port: ");
Serial.println(AOGNtripPort);
}
// init UPD Port getting AutoSteer data from AOG
if (Eth_udpAutoSteer.begin(AOGAutoSteerPort)) // AOGAutoSteerPortipPort
{
Serial.print("Ethernet AutoSteer UDP listening to & send from port: ");
Serial.println(AOGAutoSteerPort);
}
}