Skip to content

Commit

Permalink
Merge branch 'mega' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
jfmennedy authored Sep 28, 2023
2 parents 92d33d0 + 982df8d commit 06a2009
Show file tree
Hide file tree
Showing 49 changed files with 3,514 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ build_output/
**/__tmpfile.cpp

src/_Custom.h
src/_*Custom.h
src/*_*Custom.h

dist/Espressif_flash_download_tool_v3.8.5/logs/

Expand Down
4 changes: 2 additions & 2 deletions docs/source/Plugin/P000_Buzzer_RTTTL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ From ESP Easy v2.0.0 its possible to play melodies via `RTTTL <https://en.wikipe

.. code-block:: none
http://<ESP IP address>/control?cmd=rtttl,14:d=4,o=5,b=112:8a,8a,a,8a,8a,a,8a,8c6,8f.,16g,2a,8a-,8a-,8a-.,16a-,8a-,8a,8a.,16a,8a,8g,8g,8a,g,c6
http://<ESP IP address>/control?cmd=rtttl,14,:d=4,o=5,b=112:8a,8a,a,8a,8a,a,8a,8c6,8f.,16g,2a,8a-,8a-,8a-.,16a-,8a-,8a,8a.,16a,8a,8g,8g,8a,g,c6
This plays a melody on pin 14.

Expand All @@ -68,7 +68,7 @@ To make a boot-sound on startup, create a rule like this:
.. code-block:: none
On System#Boot do
rtttl,14:d=10,o=6,b=180,c,e,g
rtttl,14,:d=10,o=6,b=180,c,e,g
endon
`A place to find more tunes <http://www.picaxe.com/RTTTL-Ringtones-for-Tune-Command/>`_, all saved as txt files.
Expand Down
4 changes: 2 additions & 2 deletions docs/source/Plugin/P000_Piezo_element_RTTTL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ From ESP Easy v2.0.0 its possible to play melodies via `RTTTL <https://en.wikipe

.. code-block:: none
http://<ESP IP address>/control?cmd=rtttl,14:d=4,o=5,b=112:8a,8a,a,8a,8a,a,8a,8c6,8f.,16g,2a,8a-,8a-,8a-.,16a-,8a-,8a,8a.,16a,8a,8g,8g,8a,g,c6
http://<ESP IP address>/control?cmd=rtttl,14,:d=4,o=5,b=112:8a,8a,a,8a,8a,a,8a,8c6,8f.,16g,2a,8a-,8a-,8a-.,16a-,8a-,8a,8a.,16a,8a,8g,8g,8a,g,c6
This plays a melody on pin 14.

Expand All @@ -65,7 +65,7 @@ To make a boot-sound on startup, create a rule like this:
.. code-block:: none
On System#Boot do
rtttl,14:d=10,o=6,b=180,c,e,g
rtttl,14,:d=10,o=6,b=180,c,e,g
endon
`A place to find more tunes <http://www.picaxe.com/RTTTL-Ringtones-for-Tune-Command/>`_, all saved as txt files.
Expand Down
4 changes: 2 additions & 2 deletions docs/source/Plugin/P000_Speaker_RTTTL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ From ESP Easy v2.0.0 its possible to play melodies via `RTTTL <https://en.wikipe

.. code-block:: none
http://<ESP IP address>/control?cmd=rtttl,14:d=4,o=5,b=112:8a,8a,a,8a,8a,a,8a,8c6,8f.,16g,2a,8a-,8a-,8a-.,16a-,8a-,8a,8a.,16a,8a,8g,8g,8a,g,c6
http://<ESP IP address>/control?cmd=rtttl,14,:d=4,o=5,b=112:8a,8a,a,8a,8a,a,8a,8c6,8f.,16g,2a,8a-,8a-,8a-.,16a-,8a-,8a,8a.,16a,8a,8g,8g,8a,g,c6
This plays a melody on pin 14.

Expand All @@ -65,7 +65,7 @@ To make a boot-sound on startup, create a rule like this:
.. code-block:: none
On System#Boot do
rtttl,14:d=10,o=6,b=180,c,e,g
rtttl,14,:d=10,o=6,b=180,c,e,g
endon
`A place to find more tunes <http://www.picaxe.com/RTTTL-Ringtones-for-Tune-Command/>`_, all saved as txt files.
Expand Down
6 changes: 6 additions & 0 deletions docs/source/Plugin/P001_commands_RTTTL.repl
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,10 @@ Supported hardware: |P000_usedby_RTTTL| (Ringtones etc.)
``rtttl,14,test:d=8,o=5,b=180,c6,b,c6,p,g,g-``

`More RTTTL Ringtone Downloads <http://www.picaxe.com/RTTTL-Ringtones-for-Tune-Command/>`_

Since 2023-09-15:

The ``rtttl`` command, by default, now uses the `AnyRtttl library <https://github.com/end2endzone/AnyRtttl>`_, allowing asynchronous handling of the command. This has the advantage of being non-blocking, allowing ESPEasy to handle other tasks while the tune is being played, but comes with the disadvantage of the output possibly being interrupted/delayed by other (possibly blocking) tasks and events, so the music may not play continuously.

Also, the previous implementation may not have stopped sound correctly after playing a song, but as this has been corrected, so there is no longer a need to turn off the GPIO after playing a song.
"
4 changes: 2 additions & 2 deletions docs/source/Plugin/P014.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ Do not use the single ended circuit as the Vout is connected directly to ground:


**Note:**
The plugin reads the CHIP ID to determine if the ADC is available.
The plugin reads the CHIP ID to determine if the ADC is available. This Plugin is NOT compatible with SHT20, for SHT2x devices use Plugin 122.

SHT20 and HTU21D devices while using the same reading protocol do not have a CHIP ID capability and not able to detect them.
HTU21D devices while using the same reading protocol do not have a CHIP ID capability and not able to detect them.


|P014_usedby|
Expand Down
2 changes: 1 addition & 1 deletion docs/source/Plugin/P037.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Only numbers can be stored in variables (Plugin Generic - Dummy Device), so eith
Device configuration
--------------------

NB: To save space it is possible that not all features are available in all builds. All features are available in ``normal`` builds with 2MB or more flash size, ``max`` builds, and when self-building in a ``Custom`` build. The screenshots are taken including all options.
NB: To save space it is possible that not all features are available in all builds. All features are available in ``normal`` builds with 2MB or more flash size, ``max`` builds, when self-building in a ``Custom`` build, and in all ``ESP32`` builds. The screenshots are taken including all options.

The options that can be included or excluded are:

Expand Down
5 changes: 5 additions & 0 deletions lib/AnyRtttl/AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file contains a list of people who've made contribution to
# the project. People who commit code are encouraged to add
# their names here. Please keep the list sorted by first names.

Antoine Beauchamp <end2endzone@gmail.com>
32 changes: 32 additions & 0 deletions lib/AnyRtttl/CHANGES
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Changes for 2.3

* Fixed issue #2 - Support for PROGMEM / FLASH melodies in non-blocking mode.


Changes for 2.2.1:

* Fixed issue #4: error compiling example code.
* Fixed issue #5: Refactor build process to use Arduino CLI instead of Arduino IDE.


Changes for 2.2.0:

* New feature: Build option `ANYRTTTL_BUILD_EXAMPLES` to enable/disable building AnyRtttl examples.
* New feature: Changed file/folder structure to be compatible with Arduino Library Manager.
* New feature: Using RapidAssist 0.5.0 and win32Arduino 2.3.1.


Changes for 2.1.229:

* New feature: Implemented support for RTTTL in Program Memory (PROGMEM).


Changes for 2.0.179:

* Library converted to AnyRtttl.
* First github release.
* Code originally release at http://www.end2endzone.com/anyrtttl-a-feature-rich-arduino-library-for-playing-rtttl-melodies/


Changes for 1.0.0:
* Initial release of NonBlockingRtttl.
160 changes: 160 additions & 0 deletions lib/AnyRtttl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
cmake_minimum_required(VERSION 3.4.3)
project(AnyRtttl)

# Set the output folder where your program will be created
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
set( LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)

##############################################################################################################################################
# Functions
##############################################################################################################################################
function(GIT_EXTERNAL DIR REPO_URL TAG)
# Find the name of the repository
get_filename_component(REPO_NAME ${REPO_URL} NAME_WE)

# Compute output directory
set(REPO_DIR "${DIR}/${REPO_NAME}")

if (EXISTS "${REPO_DIR}")
message(STATUS "Repository ${REPO_NAME} already exists in directory ${DIR}. Skipping git clone command.")
return()
endif()

# Clone the repository
message(STATUS "git clone ${REPO_URL} ${REPO_DIR}")
execute_process(
COMMAND "${GIT_EXECUTABLE}" clone ${REPO_URL} ${REPO_DIR}
RESULT_VARIABLE returncode ERROR_VARIABLE error
WORKING_DIRECTORY "${DIR}")
if(returncode)
message(FATAL_ERROR "Clone failed: ${error}\n")
endif()
message(STATUS "git clone completed")

# Checking out the required tag
message(STATUS "git checkout ${TAG}")
execute_process(
COMMAND "${GIT_EXECUTABLE}" checkout ${TAG}
RESULT_VARIABLE returncode ERROR_VARIABLE error
WORKING_DIRECTORY "${REPO_DIR}")
if(returncode)
message(FATAL_ERROR "Checkout failed: ${error}\n")
endif()
message(STATUS "git checkout completed")

# Delete the .git folder to simulate an export of the repository
message(STATUS "Deleting ${REPO_DIR}/.git")
file(REMOVE_RECURSE "${REPO_DIR}/.git")

endfunction()

function(add_example name)
# Create custom example.cpp file which includes the ino sketch file.
SET(SOURCE_INO_FILE "${PROJECT_SOURCE_DIR}/examples/${name}/${name}.ino")
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/examples.cpp.in" "${PROJECT_BINARY_DIR}/${name}/examples.cpp")

add_executable(${name}
${ARDUINO_LIBRARY_SOURCE_FILES}
${SOURCE_INO_FILE}
"${PROJECT_BINARY_DIR}/${name}/examples.cpp"
)

target_include_directories(${name} PRIVATE ${PROJECT_SOURCE_DIR}/src ${BITREADER_SOURCE_DIR} win32arduino )
target_link_libraries(${name} PRIVATE win32arduino rapidassist)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set_target_properties(${name} PROPERTIES FOLDER "examples")

if(WIN32)
# 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\ostream(743,1): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
# 1>D:\dev\AnyRtttl\master\third_parties\win32Arduino\install\include\win32arduino-2.4.0\SerialPrinter.h(202): message : see reference to function template instantiation 'std::basic_ostream<char,std::char_traits<char>> &std::operator <<<std::char_traits<char>>(std::basic_ostream<char,std::char_traits<char>> &,const char *)' being compiled
set_target_properties(${name} PROPERTIES COMPILE_FLAGS "/wd4530")
endif()

endfunction()

##############################################################################################################################################
# Dependencies
##############################################################################################################################################
find_package(GTest REQUIRED)
find_package(rapidassist 0.5.0 REQUIRED)
find_package(win32arduino 2.3.1 REQUIRED)
find_package(Git REQUIRED)

# Arduino BitReader library dependency
file(MAKE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/external")
GIT_EXTERNAL("${CMAKE_CURRENT_SOURCE_DIR}/external" "http://github.com/end2endzone/BitReader.git" "1.3.0")
set(BITREADER_SOURCE_DIR "${PROJECT_SOURCE_DIR}/external/BitReader/src")

##############################################################################################################################################
# Project settings
##############################################################################################################################################

# Build options
option(ANYRTTTL_BUILD_EXAMPLES "Build all example projects" OFF)

# Prevents annoying warnings on MSVC
if (WIN32)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()

# Find all library source and unit test files
file( GLOB ARDUINO_LIBRARY_SOURCE_FILES ${PROJECT_SOURCE_DIR}/src/*.cpp ${PROJECT_SOURCE_DIR}/src/*.h ${BITREADER_SOURCE_DIR}/*.cpp ${BITREADER_SOURCE_DIR}/*.h)
file( GLOB ARDUINO_LIBRARY_TEST_FILES ${PROJECT_SOURCE_DIR}/test/*.cpp ${PROJECT_SOURCE_DIR}/test/*.h )

# Create unit test executable
add_executable(anyrtttl_unittest
${ARDUINO_LIBRARY_SOURCE_FILES}
${ARDUINO_LIBRARY_TEST_FILES}
)

#include directories
target_include_directories(anyrtttl_unittest
PRIVATE ${PROJECT_SOURCE_DIR}/src # Arduino Library folder
${GTEST_INCLUDE_DIR}
${BITREADER_SOURCE_DIR}
win32arduino
)

# Unit test projects requires to link with pthread if also linking with gtest
if(NOT WIN32)
set(PTHREAD_LIBRARIES -pthread)
endif()

#link libraries
target_link_libraries(anyrtttl_unittest PRIVATE win32arduino rapidassist ${PTHREAD_LIBRARIES} ${GTEST_LIBRARIES} )

if(WIN32)
# 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\ostream(743,1): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
# 1>D:\dev\AnyRtttl\master\third_parties\win32Arduino\install\include\win32arduino-2.4.0\SerialPrinter.h(202): message : see reference to function template instantiation 'std::basic_ostream<char,std::char_traits<char>> &std::operator <<<std::char_traits<char>>(std::basic_ostream<char,std::char_traits<char>> &,const char *)' being compiled
set_target_properties(anyrtttl_unittest PROPERTIES COMPILE_FLAGS "/wd4530")
endif()

# Copy `expected_call_stack.log` to expected locations
configure_file(${PROJECT_SOURCE_DIR}/test/expected_call_stack.log ${PROJECT_BINARY_DIR}/expected_call_stack.log COPYONLY)
set(TEST_FILES_BINARY_DIR ${EXECUTABLE_OUTPUT_PATH})
if(WIN32)
set(TEST_FILES_BINARY_DIR ${TEST_FILES_BINARY_DIR}/${CMAKE_CFG_INTDIR})
endif()
add_custom_command(
TARGET anyrtttl_unittest POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${PROJECT_SOURCE_DIR}/test/expected_call_stack.log
${TEST_FILES_BINARY_DIR}/expected_call_stack.log)

##############################################################################################################################################
# Add all samples to the project unless the user has specified otherwise.
##############################################################################################################################################
if(ANYRTTTL_BUILD_EXAMPLES)
add_example("Basic")
add_example("BlockingProgramMemoryRtttl")
add_example("BlockingRtttl")
add_example("BlockingWithNonBlocking")
add_example("NonBlockingProgramMemoryRtttl")
add_example("NonBlockingRtttl")
add_example("NonBlockingStopBeforeEnd")
add_example("Play10Bits")
add_example("Play16Bits")
add_example("Rtttl2Code")
endif()

Loading

0 comments on commit 06a2009

Please sign in to comment.