From b7a9a10223e6029678e8c0c7dc2ae4f849177bf5 Mon Sep 17 00:00:00 2001 From: Murat Seker Date: Sun, 2 Aug 2020 22:37:52 +0200 Subject: [PATCH] refactor: Several random fixes + Experimental playground (#917) --- CHANGELOG.md | 4 +- CMakeLists.txt | 26 +++++++----- CONTRIBUTING.md | 8 ++-- HyperionConfig.h.in | 3 ++ bin/compile.sh | 38 +++++++++++++---- bin/remove_hyperion.sh | 10 ++--- cmake/FindCoreFoundation.cmake | 2 +- cmake/FindIOKit.cmake | 2 +- cmake/Toolchain-imx6.cmake | 14 +++---- cmake/Toolchain-rpi.cmake | 14 +++---- config/hyperion.config.json.commented | 40 +++++++++--------- config/hyperion.config.json.default | 60 +++++++++++++-------------- libsrc/CMakeLists.txt | 5 +++ 13 files changed, 130 insertions(+), 96 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 399a3853..ab0eb012 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -140,7 +140,7 @@ If you used a `.deb` package please uninstall it before you upgrade - Resolve enable state for v4l and screen capture (#728) - Enable/Disable loops for components - Runs now on x86_64 LibreElec (missing libs) (#736) -- Brightness componsation is now visible for configuration (#746) +- Brightness compensation is now visible for configuration (#746) - Prevent malformed image size for effects with specific led layouts (#746) ### Changed: @@ -170,7 +170,7 @@ If you used a `.deb` package please uninstall it before you upgrade - Smoothing comp state on startup (#685) - Azure GitHub release title (#686) - SSL/Avahi problems in previous release (#689) -- WebUI Version Check to SemVer. Also addes "Alpha" Channel (#692) +- WebUI Version Check to SemVer. Also adds "Alpha" Channel (#692) ### Removed - Travis CI tests (#684) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a6b7c81..a15f0d44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,18 +36,19 @@ else() endif() # Set build variables -SET ( DEFAULT_AMLOGIC OFF ) -SET ( DEFAULT_DISPMANX OFF ) -SET ( DEFAULT_OSX OFF ) -SET ( DEFAULT_X11 OFF ) -SET ( DEFAULT_QT ON ) -SET ( DEFAULT_WS281XPWM OFF ) -SET ( DEFAULT_AVAHI ON ) -SET ( DEFAULT_USE_SHARED_AVAHI_LIBS ON ) +SET ( DEFAULT_AMLOGIC OFF ) +SET ( DEFAULT_DISPMANX OFF ) +SET ( DEFAULT_OSX OFF ) +SET ( DEFAULT_X11 OFF ) +SET ( DEFAULT_QT ON ) +SET ( DEFAULT_WS281XPWM OFF ) +SET ( DEFAULT_AVAHI ON ) +SET ( DEFAULT_USE_SHARED_AVAHI_LIBS ON ) SET ( DEFAULT_USE_SYSTEM_FLATBUFFERS_LIBS OFF ) -SET ( DEFAULT_USE_SYSTEM_PROTO_LIBS OFF ) -SET ( DEFAULT_USE_SYSTEM_MBEDTLS_LIBS OFF ) -SET ( DEFAULT_TESTS OFF ) +SET ( DEFAULT_USE_SYSTEM_PROTO_LIBS OFF ) +SET ( DEFAULT_USE_SYSTEM_MBEDTLS_LIBS OFF ) +SET ( DEFAULT_TESTS OFF ) +SET ( DEFAULT_EXPERIMENTAL OFF ) IF ( ${CMAKE_SYSTEM} MATCHES "Linux" ) SET ( DEFAULT_V4L2 ON ) @@ -190,6 +191,9 @@ message(STATUS "ENABLE_TESTS = ${ENABLE_TESTS}") option(ENABLE_PROFILER "enable profiler capabilities - not for release code" OFF) message(STATUS "ENABLE_PROFILER = ${ENABLE_PROFILER}") +option(ENABLE_EXPERIMENTAL "Compile experimental features" ${DEFAULT_EXPERIMENTAL}) +message(STATUS "ENABLE_EXPERIMENTAL = ${ENABLE_EXPERIMENTAL}") + SET ( FLATBUFFERS_INSTALL_BIN_DIR ${CMAKE_BINARY_DIR}/flatbuf ) SET ( FLATBUFFERS_INSTALL_LIB_DIR ${CMAKE_BINARY_DIR}/flatbuf ) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6590b906..bef034bf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -94,13 +94,13 @@ Error( log_main, "oh to crazy, aborting"); // quick logging, when only one message exists and want no typing overhead - or usage in static functions Info( Logger::getInstance("LedDevice"), "Leddevice %s started", "PublicStreetLighting"); -// a bit mor complex - with printf like format +// a bit more complex - with printf like format Info( log_main, "hello %s, you have %d messages", "Dax", 25); // conditional messages WarningIf( (value>threshold), log_main, "Alert, your value is greater then %d", threshold ); ``` -The amount of "%" mus match with following arguments +The amount of "%" must match with following arguments #### The Placeholders - %s for strings (this are cstrings, when having std::string use myStdString.c_str() to convert) @@ -110,7 +110,7 @@ The amount of "%" mus match with following arguments #### Log Level * Debug - used when message is more or less for the developer or for trouble shooting - * Info - used for not absolutly developer stuff messages for what's going on + * Info - used for not absolutely developer stuff messages for what's going on * Warning - warn if something is not as it should be, but didn't harm * Error - used when an error occurs @@ -120,7 +120,7 @@ The amount of "%" mus match with following arguments > TODO ## Visual Studio Code -**We assume that you sucessfully compiled Hyperion with the [Compile HowTo](CompileHowto.md) WITHOUT Docker** \ +**We assume that you successfully compiled Hyperion with the [Compile HowTo](CompileHowto.md) WITHOUT Docker** \ If you want to use VSCode for development follow the steps. - Install [VSCode](https://code.visualstudio.com/). On Ubuntu 16.04+ you can also use the [Snapcraft VSCode](https://snapcraft.io/code) package. diff --git a/HyperionConfig.h.in b/HyperionConfig.h.in index d9e96053..0451d8c8 100644 --- a/HyperionConfig.h.in +++ b/HyperionConfig.h.in @@ -42,6 +42,9 @@ // Define to enable profiler for development purpose #cmakedefine ENABLE_PROFILER +// Define to enable experimental features +#cmakedefine ENABLE_EXPERIMENTAL + // the hyperion build id string #define HYPERION_BUILD_ID "${HYPERION_BUILD_ID}" #define HYPERION_GIT_REMOTE "${HYPERION_GIT_REMOTE}" diff --git a/bin/compile.sh b/bin/compile.sh index ea4767e3..8005ad46 100755 --- a/bin/compile.sh +++ b/bin/compile.sh @@ -1,24 +1,46 @@ #!/bin/sh +# exit on error +set -e + TARGET=${1:-hyperion} CFG="${2:-Release}" INST="$( [ "${3:-}" = "install" ] && echo true || echo false )" sudo apt-get update -sudo apt-get install git cmake build-essential qtbase5-dev libqt5serialport5-dev libusb-1.0-0-dev libturbojpeg0-dev python3-dev libcec-dev libxcb-util0-dev libxcb-randr0-dev libxrandr-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev libssl-dev libjpeg-dev libqt5sql5-sqlite zlib1g-dev || exit 1 +sudo apt-get install \ + git \ + cmake \ + build-essential \ + qtbase5-dev \ + libqt5serialport5-dev \ + libusb-1.0-0-dev \ + libturbojpeg0-dev \ + python3-dev \ + libcec-dev \ + libxcb-util0-dev \ + libxcb-randr0-dev \ + libxrandr-dev \ + libxrender-dev \ + libavahi-core-dev \ + libavahi-compat-libdnssd-dev \ + libssl-dev \ + libjpeg-dev \ + libqt5sql5-sqlite \ + zlib1g-dev \ if [ -e /dev/vc-cma -a -e /dev/vc-mem ] then - sudo apt-get install libraspberrypi-dev || exit 1 + sudo apt-get install libraspberrypi-dev fi -git clone --recursive https://github.com/hyperion-project/hyperion.ng.git ${TARGET} || exit 1 +git clone --recursive https://github.com/hyperion-project/hyperion.ng.git ${TARGET} -rm -rf $TARGET/build -mkdir -p $TARGET/build || exit 1 -cd $TARGET/build || exit 1 -cmake -DCMAKE_BUILD_TYPE=$CFG .. || exit 1 -make -j $(nproc) || exit 1 +rm -rf $TARGET/build +mkdir -p $TARGET/build +cd $TARGET/build +cmake -DCMAKE_BUILD_TYPE=$CFG .. +make -j $(nproc) # optional: install into your system $INST && sudo make install/strip diff --git a/bin/remove_hyperion.sh b/bin/remove_hyperion.sh index e07489cf..11c7ad5a 100644 --- a/bin/remove_hyperion.sh +++ b/bin/remove_hyperion.sh @@ -97,9 +97,9 @@ if [ $OS_OPENELEC -eq 1 ]; then echo '---> Remove the OpenELEC Hyperion binaries and hyperion.config.json' rm -rv /storage/hyperion 2>/dev/null rm -v /storage/.config/hyperion.config.json 2>/dev/null -else +else #Remove binaries on all distributions/systems (not OpenELEC) - echo "---> Remove links to the binaries" + echo "---> Remove links to the binaries" rm -v /usr/bin/hyperiond 2>/dev/null rm -v /usr/bin/hyperion-remote 2>/dev/null rm -v /usr/bin/hyperion-v4l2 2>/dev/null @@ -112,8 +112,8 @@ else rm -rv /etc/hyperion 2>/dev/null rm -rv /usr/share/hyperion 2>/dev/null fi -echo '*******************************************************************************' +echo '*******************************************************************************' echo 'Hyperion successful removed!' -echo '*******************************************************************************' +echo '*******************************************************************************' exit 0 - \ No newline at end of file + diff --git a/cmake/FindCoreFoundation.cmake b/cmake/FindCoreFoundation.cmake index 195fe551..85d5d34f 100644 --- a/cmake/FindCoreFoundation.cmake +++ b/cmake/FindCoreFoundation.cmake @@ -10,7 +10,7 @@ set(CoreFoundation_FOUND false) set(CoreFoundation_INCLUDE_DIR) set(CoreFoundation_LIBRARY) -if(APPLE) +if(APPLE) # The only platform it makes sense to check for CoreFoundation find_library(CoreFoundation CoreFoundation) if(CoreFoundation) diff --git a/cmake/FindIOKit.cmake b/cmake/FindIOKit.cmake index 7c17be9e..74f6a46a 100644 --- a/cmake/FindIOKit.cmake +++ b/cmake/FindIOKit.cmake @@ -10,7 +10,7 @@ set(IOKit_FOUND false) set(IOKit_INCLUDE_DIR) set(IOKit_LIBRARY) -if(APPLE) +if(APPLE) # The only platform it makes sense to check for IOKit find_library(IOKit IOKit) if(IOKit) diff --git a/cmake/Toolchain-imx6.cmake b/cmake/Toolchain-imx6.cmake index c3842afb..4d5dfa27 100644 --- a/cmake/Toolchain-imx6.cmake +++ b/cmake/Toolchain-imx6.cmake @@ -1,5 +1,5 @@ -SET(CMAKE_SYSTEM_NAME Linux) -SET(CMAKE_SYSTEM_VERSION 1) +SET(CMAKE_SYSTEM_NAME Linux) +SET(CMAKE_SYSTEM_VERSION 1) SET(CROSSROOT $ENV{HOME}/crosscompile) SET(DEVROOT ${CROSSROOT}/hummingboard) @@ -8,20 +8,20 @@ SET(CUBIXCROSS_DIR ${DEVROOT}/tools) SET(TOOLROOT ${CUBIXCROSS_DIR}/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/ ) -# specify the cross compiler +# specify the cross compiler SET(CMAKE_C_COMPILER ${TOOLROOT}/bin/arm-linux-gnueabihf-gcc) SET(CMAKE_CXX_COMPILER ${TOOLROOT}/bin/arm-linux-gnueabihf-g++) SET(CUBIX_FLAGS "-march=armv7-a -mcpu=cortex-a9 -mtune=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard") -SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "armhf" ) +SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "armhf" ) SET(CMAKE_SYSROOT ${CUBIXROOT}) SET(CMAKE_FIND_ROOT_PATH ${CUBIXROOT}) -# search for programs in the build host directories +# search for programs in the build host directories SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -# for libraries and headers in the target directories -SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +# for libraries and headers in the target directories +SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) #SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGES ONLY) diff --git a/cmake/Toolchain-rpi.cmake b/cmake/Toolchain-rpi.cmake index c66b61b0..7290463f 100644 --- a/cmake/Toolchain-rpi.cmake +++ b/cmake/Toolchain-rpi.cmake @@ -1,5 +1,5 @@ -SET(CMAKE_SYSTEM_NAME Linux) -SET(CMAKE_SYSTEM_VERSION 1) +SET(CMAKE_SYSTEM_NAME Linux) +SET(CMAKE_SYSTEM_VERSION 1) SET(CROSSROOT $ENV{HOME}/crosscompile) SET(DEVROOT ${CROSSROOT}/raspberrypi) @@ -9,19 +9,19 @@ SET(PITOOLCHAIN ${DEVROOT}/tools) SET(TOOLROOT ${PITOOLCHAIN}/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf ) SET(QT_BIN_PATH ${CROSSROOT}/Qt5/5.7/gcc_64/bin) -# specify the cross compiler +# specify the cross compiler SET(CMAKE_C_COMPILER ${TOOLROOT}/bin/arm-linux-gnueabihf-gcc) SET(CMAKE_CXX_COMPILER ${TOOLROOT}/bin/arm-linux-gnueabihf-g++) -SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "armhf" ) +SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "armhf" ) SET(CMAKE_SYSROOT ${PIROOT}) SET(CMAKE_FIND_ROOT_PATH ${PIROOT}) -# search for programs in the build host directories +# search for programs in the build host directories SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -# for libraries and headers in the target directories -SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +# for libraries and headers in the target directories +SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) #SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGES ONLY) diff --git a/config/hyperion.config.json.commented b/config/hyperion.config.json.commented index 43a38a7f..a9307b24 100644 --- a/config/hyperion.config.json.commented +++ b/config/hyperion.config.json.commented @@ -109,36 +109,36 @@ /// * cropRight : Cropping from the right [default=0] /// * cropTop : Cropping from the top [default=0] /// * cropBottom : Cropping from the bottom [default=0] - /// * signalDetection : enable/disable signal detection [default=true] - /// * cecDetection : enable/disable cec detection [default=true] + /// * signalDetection : enable/disable signal detection [default=false] + /// * cecDetection : enable/disable cec detection [default=false] /// * redSignalThreshold : Signal threshold for the red channel between 0 and 100 [default=5] /// * greenSignalThreshold : Signal threshold for the green channel between 0 and 100 [default=5] /// * blueSignalThreshold : Signal threshold for the blue channel between 0 and 100 [default=5] - /// * sDHOffsetMin : area for signal detection - horizontal minimum offset value. Values between 0.0 and 1.0 - /// * sDVOffsetMin : area for signal detection - vertical minimum offset value. Values between 0.0 and 1.0 - /// * sDHOffsetMax : area for signal detection - horizontal maximum offset value. Values between 0.0 and 1.0 - /// * sDVOffsetMax : area for signal detection - vertical maximum offset value. Values between 0.0 and 1.0 + /// * sDHOffsetMin : area for signal detection - horizontal minimum offset value. Values between 0.0 and 1.0 + /// * sDVOffsetMin : area for signal detection - vertical minimum offset value. Values between 0.0 and 1.0 + /// * sDHOffsetMax : area for signal detection - horizontal maximum offset value. Values between 0.0 and 1.0 + /// * sDVOffsetMax : area for signal detection - vertical maximum offset value. Values between 0.0 and 1.0 "grabberV4L2" : { - "device" : "auto", - "width" : 0, - "height" : 0, - "standard" : "NO_CHANGE", - "sizeDecimation" : 8, - "priority" : 240, - "cropLeft" : 0, - "cropRight" : 0, - "cropTop" : 0, - "cropBottom" : 0, + "device" : "auto", + "width" : 0, + "height" : 0, + "standard" : "NO_CHANGE", + "sizeDecimation" : 8, + "priority" : 240, + "cropLeft" : 0, + "cropRight" : 0, + "cropTop" : 0, + "cropBottom" : 0, "redSignalThreshold" : 5, "greenSignalThreshold" : 5, "blueSignalThreshold" : 5, "signalDetection" : false, "cecDetection" : false, - "sDVOffsetMin" : 0.25, - "sDHOffsetMin" : 0.25, - "sDVOffsetMax" : 0.75, - "sDHOffsetMax" : 0.75 + "sDVOffsetMin" : 0.25, + "sDHOffsetMin" : 0.25, + "sDVOffsetMax" : 0.75, + "sDHOffsetMax" : 0.75 }, /// The configuration for the frame-grabber, contains the following items: diff --git a/config/hyperion.config.json.default b/config/hyperion.config.json.default index 8fe6675c..170d55de 100644 --- a/config/hyperion.config.json.default +++ b/config/hyperion.config.json.default @@ -58,40 +58,40 @@ "grabberV4L2" : { - "device" : "auto", - "input" : 0, - "width" : 0, - "height" : 0, - "fps" : 15, - "standard" : "NO_CHANGE", - "sizeDecimation" : 8, - "cropLeft" : 0, - "cropRight" : 0, - "cropTop" : 0, - "cropBottom" : 0, - "redSignalThreshold" : 5, - "greenSignalThreshold" : 5, - "blueSignalThreshold" : 5, - "signalDetection" : false, - "cecDetection" : false, - "sDVOffsetMin" : 0.25, - "sDHOffsetMin" : 0.25, - "sDVOffsetMax" : 0.75, - "sDHOffsetMax" : 0.75 + "device" : "auto", + "input" : 0, + "width" : 0, + "height" : 0, + "fps" : 15, + "standard" : "NO_CHANGE", + "sizeDecimation" : 8, + "cropLeft" : 0, + "cropRight" : 0, + "cropTop" : 0, + "cropBottom" : 0, + "redSignalThreshold" : 5, + "greenSignalThreshold" : 5, + "blueSignalThreshold" : 5, + "signalDetection" : false, + "cecDetection" : false, + "sDVOffsetMin" : 0.25, + "sDHOffsetMin" : 0.25, + "sDVOffsetMax" : 0.75, + "sDHOffsetMax" : 0.75 }, "framegrabber" : { - "type" : "auto", - "width" : 80, - "height" : 45, - "frequency_Hz" : 10, - "pixelDecimation" : 8, - "cropLeft" : 0, - "cropRight" : 0, - "cropTop" : 0, - "cropBottom" : 0, - "device" : "/dev/fb0" + "type" : "auto", + "width" : 80, + "height" : 45, + "frequency_Hz" : 10, + "pixelDecimation" : 8, + "cropLeft" : 0, + "cropRight" : 0, + "cropTop" : 0, + "cropBottom" : 0, + "device" : "/dev/fb0" }, "blackborderdetector" : diff --git a/libsrc/CMakeLists.txt b/libsrc/CMakeLists.txt index 3703966c..523b8f76 100644 --- a/libsrc/CMakeLists.txt +++ b/libsrc/CMakeLists.txt @@ -27,3 +27,8 @@ endif() if(ENABLE_AVAHI) add_subdirectory(bonjour) endif() + +if(ENABLE_EXPERIMENTAL) + add_subdirectory(experimental) +endif() +