Skip to content

Commit

Permalink
make compile on Arduino 3.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
tueddy committed Sep 29, 2024
1 parent ebdbbcb commit 7646706
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 16 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

## DEV-branch

* 29.09.2024: Prepare for Arduino 3.0.5
* 27.09.2024: PlatformIO package 6.9.0


Expand Down
22 changes: 16 additions & 6 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ default_envs = lolin_d32_pro_sdmmc_pe
board_build.flash_mode = qio
board_build.bootloader = dio
board_build.partitions = custom_4mb_noota.csv
platform = espressif32@^6.9.0
;platform = espressif32
;platform = espressif32@^6.9.0
platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.05/platform-espressif32.zip ; Arduino 3.0.5
;framework = arduino
framework = arduino, espidf
monitor_speed = 115200
Expand All @@ -30,21 +30,31 @@ extra_scripts =
pre:updateSdkConfig.py
pre:processHtml.py
lib_deps =
https://github.com/schreibfaul1/ESP32-audioI2S.git#d7a2007 ;07.06.2024
https://github.com/schreibfaul1/ESP32-audioI2S.git#928c420 ;29.07.2024
https://github.com/madhephaestus/ESP32Encoder.git#2c986e0
https://github.com/knolleary/pubsubclient.git#2d228f2
https://github.com/peterus/ESP-FTP-Server-Lib#554959f
https://github.com/tueddy/FastLED.git#3.6.0_IRAM ;save some IRAM to compile with all features (https://github.com/FastLED/FastLED.git@3.6.0)
https://github.com/mathieucarbou/ESPAsyncWebServer.git#cec5afb ; v3.2.4
; https://github.com/tueddy/FastLED.git#3.6.0_IRAM ;save some IRAM to compile with all features (https://github.com/FastLED/FastLED.git@3.6.0)
https://github.com/FastLED/FastLED.git#de02bc1 ; v3.7.8
https://github.com/mathieucarbou/ESPAsyncWebServer.git#74b16d6 ; v3.3.1
https://github.com/bblanchon/ArduinoJson.git#40ee05c
https://github.com/pschatzmann/ESP32-A2DP.git#bb5bc2f
https://github.com/pschatzmann/arduino-audio-tools.git#9d63174 ; v0.9.8
https://github.com/pschatzmann/ESP32-A2DP.git#3624fe3
; https://github.com/pschatzmann/ESP32-A2DP.git#bb5bc2f
https://github.com/Arduino-IRremote/Arduino-IRremote.git#b962db8 ; v4.3.1
https://github.com/kkloesener/MFRC522_I2C.git#121a27e
https://github.com/tueddy/rfid.git#caa3e6d ; avoid warnings, fork from https://github.com/miguelbalboa/rfid.git#0ff12a1
https://github.com/tuniii/LogRingBuffer.git#89d7d3e
https://github.com/tueddy/PN5180-Library.git#7ba0289
https://github.com/SZenglein/Arduino-MAX17055_Driver#75cdfcf
https://github.com/tueddy/natsort.git#ebbf660 ; avoid warnings, fork from https://github.com/sourcefrog/natsort.git#cdd8df9

board_build.embed_txtfiles =
managed_components/espressif__esp_insights/server_certs/https_server.crt
managed_components/espressif__esp_rainmaker/server_certs/rmaker_mqtt_server.crt
managed_components/espressif__esp_rainmaker/server_certs/rmaker_claim_service_server.crt
managed_components/espressif__esp_rainmaker/server_certs/rmaker_ota_server.crt

build_flags =
-DCONFIG_ASYNC_TCP_RUNNING_CORE=1
-DCONFIG_ASYNC_TCP_USE_WDT=1
Expand Down
21 changes: 21 additions & 0 deletions sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,24 @@ CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=4096
CONFIG_WIFI_PROV_BLE_BONDING=y
CONFIG_WIFI_PROV_BLE_FORCE_ENCRYPTION=y
# CONFIG_FMB_COMM_MODE_TCP_EN is not set

#
# Ethernet needs to be enabled in Arduino 3
#
CONFIG_ETH_ENABLED=y
CONFIG_ETH_USE_ESP32_EMAC=y
CONFIG_ETH_PHY_INTERFACE_RMII=y
CONFIG_ETH_RMII_CLK_INPUT=y
# CONFIG_ETH_RMII_CLK_OUTPUT is not set
CONFIG_ETH_RMII_CLK_IN_GPIO=0
CONFIG_ETH_DMA_BUFFER_SIZE=512
CONFIG_ETH_DMA_RX_BUFFER_NUM=10
CONFIG_ETH_DMA_TX_BUFFER_NUM=10
# CONFIG_ETH_IRAM_OPTIMIZATION is not set
CONFIG_ETH_USE_SPI_ETHERNET=y
# CONFIG_ETH_SPI_ETHERNET_DM9051 is not set
# CONFIG_ETH_SPI_ETHERNET_W5500 is not set
# CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL is not set
# CONFIG_ETH_USE_OPENETH is not set
# CONFIG_ETH_TRANSMIT_MUTEX is not set
# end of Ethernet
26 changes: 20 additions & 6 deletions src/Bluetooth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@

#ifdef BLUETOOTH_ENABLE
#include "esp_bt.h"
#include "BluetoothA2DPCommon.h"
#include "BluetoothA2DPSink.h"
#include "BluetoothA2DPSource.h"
#if (defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR >= 3))
#include "ESP_I2S.h"
I2SClass i2s;
#endif
#endif

#ifdef BLUETOOTH_ENABLE
Expand Down Expand Up @@ -172,25 +177,34 @@ void Bluetooth_VolumeChanged(int _newVolume) {
void Bluetooth_Init(void) {
#ifdef BLUETOOTH_ENABLE
if (System_GetOperationMode() == OPMODE_BLUETOOTH_SINK) {
// bluetooth in sink mode (player acts as a BT-Speaker)
// bluetooth in sink mode (player acts as a BT-Speaker)
#if (defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR >= 3))
i2s.setPins(I2S_BCLK, I2S_LRC, I2S_DOUT);
if (!i2s.begin(I2S_MODE_STD, 44100, I2S_DATA_BIT_WIDTH_16BIT, I2S_SLOT_MODE_STEREO, I2S_STD_SLOT_BOTH)) {
Log_Println("Failed to initialize I2S!", LOGLEVEL_ERROR);
while (1); // do nothing
}
a2dp_sink = new BluetoothA2DPSink(i2s);
a2dp_sink->set_rssi_calldoxback(rssi);
#else
a2dp_sink = new BluetoothA2DPSink();
i2s_pin_config_t pin_config = {
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)
.mck_io_num = 0,
#endif
#endif
.bck_io_num = I2S_BCLK,
.ws_io_num = I2S_LRC,
.data_out_num = I2S_DOUT,
.data_in_num = I2S_PIN_NO_CHANGE
};
.data_in_num = I2S_PIN_NO_CHANGE};
a2dp_sink->set_pin_config(pin_config);
a2dp_sink->set_rssi_callback(rssi);
#endif
a2dp_sink->activate_pin_code(false);
#ifdef PLAY_MONO_SPEAKER
a2dp_sink->set_mono_downmix(true);
#endif
a2dp_sink->set_auto_reconnect(true);
a2dp_sink->set_rssi_active(true);
a2dp_sink->set_rssi_callback(rssi);
// start bluetooth sink
a2dp_sink->start(nameBluetoothSinkDevice);
Log_Printf(LOGLEVEL_INFO, "Bluetooth sink started, Device: %s", nameBluetoothSinkDevice);
Expand Down
8 changes: 8 additions & 0 deletions src/Button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ extern bool Port_AllowReadFromPortExpander;
static volatile SemaphoreHandle_t Button_TimerSemaphore;

hw_timer_t *Button_Timer = NULL;
#if (defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR < 3))
static void IRAM_ATTR onTimer();
#else
static void onTimer();
#endif
static void Button_DoButtonActions(void);

void Button_Init() {
Expand Down Expand Up @@ -351,6 +355,10 @@ void Button_DoButtonActions(void) {
}
}

#if (defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR < 3))
void IRAM_ATTR onTimer() {
#else
void onTimer() {
#endif
xSemaphoreGiveFromISR(Button_TimerSemaphore, NULL);
}
8 changes: 5 additions & 3 deletions src/Mqtt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,17 @@ bool publishMqtt(const char *topic, int32_t payload, bool retained) {
#endif
}

#if (defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR < 3))
bool publishMqtt(const char *topic, unsigned long payload, bool retained) {
#ifdef MQTT_ENABLE
#ifdef MQTT_ENABLE
char buf[11];
snprintf(buf, sizeof(buf) / sizeof(buf[0]), "%lu", payload);
return publishMqtt(topic, buf, retained);
#else
#else
return false;
#endif
#endif
}
#endif

bool publishMqtt(const char *topic, uint32_t payload, bool retained) {
#ifdef MQTT_ENABLE
Expand Down
2 changes: 2 additions & 0 deletions src/Mqtt.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,7 @@ bool Mqtt_IsEnabled(void);

bool publishMqtt(const char *topic, const char *payload, bool retained);
bool publishMqtt(const char *topic, int32_t payload, bool retained);
#if (defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR < 3))
bool publishMqtt(const char *topic, unsigned long payload, bool retained);
#endif
bool publishMqtt(const char *topic, uint32_t payload, bool retained);
4 changes: 4 additions & 0 deletions src/Port.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,11 @@ void Port_Test(void) {
}

#ifdef PE_INTERRUPT_PIN_ENABLE
#if (defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR < 3))
void IRAM_ATTR PORT_ExpanderISR(void) {
#else
void PORT_ExpanderISR(void) {
#endif
// check if the interrupt pin is actually low and only if it is
// trigger the handler (there are a lot of false calls to this ISR
// where the interrupt pin isn't low...)
Expand Down
2 changes: 1 addition & 1 deletion src/Wlan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ static void migrateFromVersion2() {
}

// clean up old nvs entries
delete settings;
std::destroy_at(settings);
gPrefsSettings.remove(nvsKey);
}
}
Expand Down

0 comments on commit 7646706

Please sign in to comment.