Skip to content

Commit 4d978b3

Browse files
committed
Replace 'WiFi.macAddress()' by more reliable 'Network.macAddress()'
1 parent c0825c9 commit 4d978b3

7 files changed

Lines changed: 14 additions & 10 deletions

File tree

VanLiveConnect/ESP32_IDE.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
rem This batch file sets up the Arduino IDE with all the correct board options (as found in the IDE "Tools" menu)
44

55
rem Board spec for "Lilygo TTGO T7 V1.3 Mini32"
6-
set BOARDSPEC=esp32:esp32:ttgo-t7-v13-mini32:CPUFreq=240,FlashFreq=80,FlashSize=4M,PartitionScheme=min_spiffs,DebugLevel=none
6+
set BOARDSPEC=esp32:esp32:ttgo-t7-v13-mini32:CPUFreq=240,FlashFreq=80,FlashMode=qio,FlashSize=4M,PartitionScheme=min_spiffs,DebugLevel=none
77

88
rem Fill in your COM port here
99
set COMPORT=COM3

VanLiveConnect/ESP32_IDE.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# This script sets up the Arduino IDE with all the correct board options (as found in the IDE "Tools" menu)
44

55
# Board spec for "Lilygo TTGO T7 V1.3 Mini32"
6-
BOARDSPEC=esp32:esp32:ttgo-t7-v13-mini32:CPUFreq=240,FlashFreq=80,FlashSize=4M,PartitionScheme=min_spiffs,DebugLevel=none
6+
BOARDSPEC=esp32:esp32:ttgo-t7-v13-mini32:CPUFreq=240,FlashFreq=80,FlashMode=qio,FlashSize=4M,PartitionScheme=min_spiffs,DebugLevel=none
77

88
# Fill in your COM port here
99
COMPORT=/dev/ttyUSB0

VanLiveConnect/Esp.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ void PrintSystemSpecs()
158158
Serial.printf_P(PSTR(" (%s)\n"), compileDate);
159159

160160
Serial.print(F("Wi-Fi MAC address: "));
161-
Serial.print(WiFi.macAddress());
161+
Serial.print(Network.macAddress());
162162
#ifdef ON_DESK_MFD_ESP_MAC
163-
if (WiFi.macAddress() == ON_DESK_MFD_ESP_MAC)
163+
if (Network.macAddress() == ON_DESK_MFD_ESP_MAC)
164164
{
165165
Serial.print(F(" == ON_DESK_MFD_ESP_MAC, i.e., this is the on-desk test setup, so:\n"));
166166
Serial.print(F("==> Will print detailed debug info when a VAN bus packet with CRC error is received.\n"));
@@ -239,7 +239,7 @@ const char* EspSystemDataToJson(char* buf, const int n)
239239
flashModeIde == FM_DOUT ? doutStr :
240240
unknownStr,
241241

242-
WiFi.macAddress().c_str(),
242+
Network.macAddress().c_str(),
243243
#ifdef WIFI_AP_MODE // Wi-Fi access point mode
244244
IP_ADDR,
245245
#else

VanLiveConnect/IRrecv.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ void IrSetup()
306306
Serial.print(F("Setting up IR receiver\n"));
307307

308308
#ifdef ON_DESK_MFD_ESP_MAC
309-
if (WiFi.macAddress() == ON_DESK_MFD_ESP_MAC)
309+
if (Network.macAddress() == ON_DESK_MFD_ESP_MAC)
310310
{
311311
pinMode(TEST_IR_VCC_TEST, OUTPUT);
312312
digitalWrite(TEST_IR_VCC_TEST, HIGH);

VanLiveConnect/PacketToJson.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5624,7 +5624,7 @@ const char* ParseVanPacketToJson(TVanPacketRxDesc& pkt)
56245624
if (dataLen < 0 || dataLen > VAN_MAX_DATA_BYTES) return ""; // Unexpected packet length
56255625

56265626
#ifdef ON_DESK_MFD_ESP_MAC
5627-
if (WiFi.macAddress() == ON_DESK_MFD_ESP_MAC)
5627+
if (Network.macAddress() == ON_DESK_MFD_ESP_MAC)
56285628
{
56295629
// On the desk test setup, we want to see a lot of detailed output
56305630
if (! pkt.CheckCrc())

VanLiveConnect/VanLiveConnect.ino

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,14 @@ char dummy_var_to_use_cppXX[] PROGMEM = R"==(")==";
4747
#define STR(x) #x
4848

4949
#ifdef ARDUINO_ARCH_ESP32
50+
#if ! defined ESP_ARDUINO_VERSION || ESP_ARDUINO_VERSION < ESP_ARDUINO_VERSION_VAL(3, 0, 0)
51+
#define Network WiFi
52+
#endif
5053
#define system_get_free_heap_size esp_get_free_heap_size
5154
#define LED_ON HIGH
5255
#define LED_OFF LOW
5356
#else
57+
#define Network WiFi
5458
#define LED_ON LOW
5559
#define LED_OFF HIGH
5660
#endif // ARDUINO_ARCH_ESP32
@@ -379,12 +383,12 @@ void setup()
379383

380384
#ifdef ON_DESK_MFD_ESP_MAC
381385
// On the desk test setup, go to sleep much quicker
382-
if (WiFi.macAddress() == ON_DESK_MFD_ESP_MAC) sleepAfter = 10000;
386+
if (Network.macAddress() == ON_DESK_MFD_ESP_MAC) sleepAfter = 10000;
383387
#endif // ON_DESK_MFD_ESP_MAC
384388

385389
#ifdef WIFI_STRESS_TEST_MFD_ESP_MAC
386390
// Wi-Fi stress test: don't go to sleep
387-
if (WiFi.macAddress() == WIFI_STRESS_TEST_MFD_ESP_MAC) sleepAfter = -1;
391+
if (Network.macAddress() == WIFI_STRESS_TEST_MFD_ESP_MAC) sleepAfter = -1;
388392
#endif // WIFI_STRESS_TEST_MFD_ESP_MAC
389393

390394
if (sleepAfter > 0)

VanLiveConnect/Wifi.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ const char* SetupWifi()
188188

189189
#ifdef ON_DESK_MFD_ESP_MAC
190190
// The test setup on the desk has a slightly different SSID
191-
if (WiFi.macAddress() == ON_DESK_MFD_ESP_MAC) wifiSsid = WIFI_SSID" test";
191+
if (Network.macAddress() == ON_DESK_MFD_ESP_MAC) wifiSsid = WIFI_SSID" test";
192192
#endif // ON_DESK_MFD_ESP_MAC
193193

194194
Serial.printf_P(PSTR("Setting up captive portal on Wi-Fi access point '%s', channel %d\n"), wifiSsid, WIFI_CHANNEL);

0 commit comments

Comments
 (0)