Skip to content

Commit c19908f

Browse files
authored
Merge pull request #643 from LeeLeahy2/wifi-2
Most of the changes to the common point with leeUpdates
2 parents fce2498 + 82f52f9 commit c19908f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+6856
-5812
lines changed

Firmware/RTK_Everywhere/Base.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ void processRTCM(uint8_t *rtcmData, uint16_t dataLength)
1010
}
1111

1212
for (int x = 0; x < dataLength; x++)
13-
espnowProcessRTCM(rtcmData[x]);
13+
espNowProcessRTCM(rtcmData[x]);
1414

1515
loraProcessRTCM(rtcmData, dataLength);
1616

@@ -41,4 +41,4 @@ void baseCasterEnableOverride()
4141
void baseCasterDisableOverride()
4242
{
4343
settings.baseCasterOverride = false;
44-
}
44+
}

Firmware/RTK_Everywhere/Begin.ino

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,9 @@ void identifyBoard()
6969
// Get unit MAC address
7070
// This was in beginVersion, but is needed earlier so that beginBoard
7171
// can print the MAC address if identifyBoard fails.
72-
esp_read_mac(wifiMACAddress, ESP_MAC_WIFI_STA);
73-
memcpy(btMACAddress, wifiMACAddress, sizeof(wifiMACAddress));
74-
btMACAddress[5] +=
75-
2; // Convert MAC address to Bluetooth MAC (add 2):
76-
// https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/system.html#mac-address
77-
memcpy(ethernetMACAddress, wifiMACAddress, sizeof(wifiMACAddress));
78-
ethernetMACAddress[5] += 3; // Convert MAC address to Ethernet MAC (add 3)
72+
getMacAddresses(wifiMACAddress, "wifiMACAddress", ESP_MAC_WIFI_STA, true);
73+
getMacAddresses(btMACAddress, "btMACAddress", ESP_MAC_BT, true);
74+
getMacAddresses(ethernetMACAddress, "ethernetMACAddress", ESP_MAC_ETH, true);
7975

8076
// First, test for devices that do not have ID resistors
8177
if (productVariant == RTK_UNKNOWN)
@@ -747,7 +743,7 @@ void beginBoard()
747743
void beginVersion()
748744
{
749745
char versionString[21];
750-
getFirmwareVersion(versionString, sizeof(versionString), true);
746+
firmwareVersionGet(versionString, sizeof(versionString), true);
751747

752748
char title[50];
753749
RTKBrandAttribute *brandAttributes = getBrandAttributeFromBrand(present.brand);
@@ -926,7 +922,7 @@ void beginSD()
926922
}
927923

928924
// Load firmware file from the microSD card if it is present
929-
scanForFirmware();
925+
microSDScanForFirmware();
930926

931927
// Mark card not yet usable for logging
932928
sdCardSize = 0;
@@ -989,12 +985,7 @@ void beginGnssUart()
989985

990986
// Never freed...
991987
if (rbOffsetArray == nullptr)
992-
{
993-
if (online.psram == true)
994-
rbOffsetArray = (RING_BUFFER_OFFSET *)ps_malloc(length);
995-
else
996-
rbOffsetArray = (RING_BUFFER_OFFSET *)malloc(length);
997-
}
988+
rbOffsetArray = (RING_BUFFER_OFFSET *)rtkMalloc(length, "Ring buffer (rbOffsetArray)");
998989

999990
if (!rbOffsetArray)
1000991
{

Firmware/RTK_Everywhere/Buttons.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void powerDown(bool displayInfo)
6363
{
6464
// Platforms with power control won't get here
6565
// Postcard will get here if the battery is too low
66-
66+
6767
systemPrintln("Device powered down");
6868
delay(5000);
6969

@@ -224,4 +224,4 @@ bool buttonPressedFor(uint8_t buttonNumber, uint16_t maxTime)
224224
uint8_t buttonLastPressed()
225225
{
226226
return (gpioExpander_lastReleased);
227-
}
227+
}

Firmware/RTK_Everywhere/Cellular.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ void cellularEvent(arduino_event_id_t event)
8787
if (networkInterfaceHasInternet(NETWORK_CELLULAR) && (event != ARDUINO_EVENT_ETH_GOT_IP) &&
8888
(event != ARDUINO_EVENT_ETH_GOT_IP6) && (event != ARDUINO_EVENT_PPP_CONNECTED))
8989
{
90-
networkInterfaceEventInternetLost(NETWORK_CELLULAR);
90+
networkInterfaceEventInternetLost(NETWORK_CELLULAR, __FILE__, __LINE__);
9191
}
9292

9393
// Cellular State Machine
@@ -157,7 +157,7 @@ void cellularSimCheck(NetIndex_t index, uintptr_t parameter, bool debug)
157157
{
158158
systemPrintf("SIM card not present. Marking cellular offline.\r\n");
159159
present.cellular_lara = false;
160-
networkSequenceExit(index, debug);
160+
networkSequenceExit(index, debug, __FILE__, __LINE__);
161161
}
162162
}
163163

Firmware/RTK_Everywhere/Developer.ino

Lines changed: 41 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// Ethernet
1010
//----------------------------------------
1111

12+
bool ethernetLinkUp() {return false;}
1213
void menuEthernet() {systemPrintln("**Ethernet not compiled**");}
1314

1415
bool ntpLogIncreasing = false;
@@ -33,8 +34,9 @@ void ntpServerStop() {}
3334

3435
void menuTcpUdp() {systemPrint("**Network not compiled**");}
3536
void networkBegin() {}
36-
uint8_t networkConsumers() {return(0);}
37-
uint16_t networkGetConsumerTypes() {return(0);}
37+
void networkConsumerAdd(NETCONSUMER_t consumer, NetIndex_t network, const char * fileName, uint32_t lineNumber) {}
38+
bool networkConsumerIsConnected(NETCONSUMER_t consumer) {return false;}
39+
void networkConsumerRemove(NETCONSUMER_t consumer, NetIndex_t network, const char * fileName, uint32_t lineNumber) {}
3840
IPAddress networkGetIpAddress() {return("0.0.0.0");}
3941
const uint8_t * networkGetMacAddress()
4042
{
@@ -44,7 +46,8 @@ const uint8_t * networkGetMacAddress()
4446
return btMACAddress;
4547
#endif
4648
return zero;
47-
}
49+
}
50+
NetPriority_t networkGetPriority() {return 0;}
4851
bool networkHasInternet() {return false;}
4952
bool networkHasInternet(NetIndex_t index) {return false;}
5053
bool networkInterfaceHasInternet(NetIndex_t index) {return false;}
@@ -54,6 +57,8 @@ void networkMarkHasInternet(NetIndex_t index) {}
5457
void networkSequenceBoot(NetIndex_t index) {}
5558
void networkSequenceNextEntry(NetIndex_t index, bool debug) {}
5659
void networkUpdate() {}
60+
void networkUserAdd(NETCONSUMER_t consumer, const char * fileName, uint32_t lineNumber) {}
61+
void networkUserRemove(NETCONSUMER_t consumer, const char * fileName, uint32_t lineNumber) {}
5762
void networkValidateIndex(NetIndex_t index) {}
5863
void networkVerifyTables() {}
5964

@@ -83,30 +88,30 @@ bool ntripServerIsCasting(int serverIndex) {
8388
// TCP client
8489
//----------------------------------------
8590

91+
void tcpClientDiscardBytes(RING_BUFFER_OFFSET previousTail, RING_BUFFER_OFFSET newTail) {}
8692
int32_t tcpClientSendData(uint16_t dataHead) {return 0;}
8793
void tcpClientUpdate() {}
8894
void tcpClientValidateTables() {}
8995
void tcpClientZeroTail() {}
90-
void discardTcpClientBytes(RING_BUFFER_OFFSET previousTail, RING_BUFFER_OFFSET newTail) {}
9196

9297
//----------------------------------------
9398
// TCP server
9499
//----------------------------------------
95100

101+
void tcpServerDiscardBytes(RING_BUFFER_OFFSET previousTail, RING_BUFFER_OFFSET newTail) {}
96102
int32_t tcpServerSendData(uint16_t dataHead) {return 0;}
97103
void tcpServerZeroTail() {}
98104
void tcpServerValidateTables() {}
99-
void discardTcpServerBytes(RING_BUFFER_OFFSET previousTail, RING_BUFFER_OFFSET newTail) {}
100105

101106
//----------------------------------------
102107
// UDP server
103108
//----------------------------------------
104109

110+
void udpServerDiscardBytes(RING_BUFFER_OFFSET previousTail, RING_BUFFER_OFFSET newTail) {}
105111
int32_t udpServerSendData(uint16_t dataHead) {return 0;}
106112
void udpServerStop() {}
107113
void udpServerUpdate() {}
108114
void udpServerZeroTail() {}
109-
void discardUdpServerBytes(RING_BUFFER_OFFSET previousTail, RING_BUFFER_OFFSET newTail) {}
110115

111116
#endif // COMPILE_NETWORK
112117

@@ -117,7 +122,9 @@ void discardUdpServerBytes(RING_BUFFER_OFFSET previousTail, RING_BUFFER_OFFSET n
117122
#ifndef COMPILE_OTA_AUTO
118123

119124
void otaAutoUpdate() {}
120-
bool otaNeedsNetwork() {return false;}
125+
bool otaCheckVersion(char *versionAvailable, uint8_t versionAvailableLength) {return false;}
126+
void otaMenuDisplay(char * currentVersion) {}
127+
bool otaMenuProcessInput(byte incoming) {return false;}
121128
void otaUpdate() {}
122129
void otaUpdateStop() {}
123130
void otaVerifyTables() {}
@@ -131,9 +138,9 @@ void otaVerifyTables() {}
131138
#ifndef COMPILE_MQTT_CLIENT
132139

133140
bool mqttClientIsConnected() {return false;}
134-
bool mqttClientNeedsNetwork() {return false;}
135141
void mqttClientPrintStatus() {}
136142
void mqttClientRestart() {}
143+
void mqttClientStartEnabled() {}
137144
void mqttClientUpdate() {}
138145
void mqttClientValidateTables() {}
139146

@@ -165,7 +172,6 @@ bool webServerStart(int httpPort = 80)
165172
bool parseIncomingSettings() {return false;}
166173
void sendStringToWebsocket(const char* stringToSend) {}
167174
void stopWebServer() {}
168-
bool webServerNeedsNetwork() {return false;}
169175
void webServerStop() {}
170176
void webServerUpdate() {}
171177
void webServerVerifyTables() {}
@@ -178,18 +184,17 @@ void webServerVerifyTables() {}
178184

179185
#ifndef COMPILE_ESPNOW
180186

181-
bool espnowGetState() {return ESPNOW_OFF;}
182-
bool espnowIsPaired() {return false;}
183-
void espnowProcessRTCM(byte incoming) {}
184-
esp_err_t espnowRemovePeer(uint8_t *peerMac) {return ESP_OK;}
185-
esp_err_t espnowSendPairMessage(uint8_t *sendToMac) {return ESP_OK;}
186-
bool espnowSetChannel(uint8_t channelNumber) {return false;}
187-
bool espNowStart() {return false;}
188-
#define ESPNOW_START() false
189-
void espnowStaticPairing() {}
187+
bool espNowGetState() {return ESPNOW_OFF;}
188+
bool espNowIsPaired() {return false;}
189+
void espNowProcessRTCM(byte incoming) {}
190+
bool espNowProcessRxPairedMessage() {return true;}
191+
esp_err_t espNowRemovePeer(const uint8_t *peerMac) {return ESP_OK;}
192+
esp_err_t espNowSendPairMessage(const uint8_t *sendToMac) {return ESP_OK;}
193+
bool espNowSetChannel(uint8_t channelNumber) {return false;}
194+
bool espNowStart() {return true;}
195+
void espNowStaticPairing() {}
190196
bool espNowStop() {return true;}
191-
#define ESPNOW_STOP() true
192-
void updateEspnow() {}
197+
void espNowUpdate() {}
193198

194199
#endif // COMPILE_ESPNOW
195200

@@ -199,19 +204,22 @@ void updateEspnow() {}
199204

200205
#ifndef COMPILE_WIFI
201206

202-
void menuWiFi() {systemPrintln("**WiFi not compiled**");}
203-
bool wifiApIsRunning() {return false;}
204-
bool wifiConnect(bool startWiFiStation, bool startWiFiAP, unsigned long timeout) {return false;}
205-
uint32_t wifiGetStartTimeout() {return 0;}
206-
#define WIFI_IS_RUNNING() 0
207-
int wifiNetworkCount() {return 0;}
208-
void wifiResetThrottleTimeout() {}
209-
void wifiResetTimeout() {}
210-
#define WIFI_SOFT_AP_RUNNING() false
211-
bool wifiStart() {return false;}
212-
bool wifiStationIsRunning() {return false;}
213-
#define WIFI_STOP() {}
214-
bool wifiUnavailable() {return true;}
207+
void menuWiFi() {systemPrintln("**WiFi not compiled**");}
208+
void wifiDisplayNetworkData() {}
209+
void wifiDisplaySoftApStatus() {}
210+
bool wifiEspNowOff(const char * fileName, uint32_t lineNumber) {return true;}
211+
bool wifiEspNowOn(const char * fileName, uint32_t lineNumber) {return false;}
212+
void wifiEspNowSetChannel(WIFI_CHANNEL_t channel) {}
213+
uint32_t wifiGetStartTimeout() {return 0;}
214+
int wifiNetworkCount() {return 0;}
215+
void wifiResetThrottleTimeout() {}
216+
void wifiResetTimeout() {}
217+
const char * wifiSoftApGetSsid() {return "";}
218+
bool wifiSoftApOff(const char * fileName, uint32_t lineNumber) {return true;}
219+
bool wifiSoftApOn(const char * fileName, uint32_t lineNumber) {return false;}
220+
bool wifiStationOff(const char * fileName, uint32_t lineNumber) {return true;}
221+
bool wifiStationOn(const char * fileName, uint32_t lineNumber) {return false;}
222+
void wifiStopAll() {}
215223

216224
#endif // COMPILE_WIFI
217225

0 commit comments

Comments
 (0)