Merge pull request #6 from hyperion-project/master

merge
This commit is contained in:
b1rdhous3 2019-07-10 22:36:35 +02:00 committed by GitHub
commit 846ffb5955
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
50 changed files with 1264 additions and 1155 deletions

View File

@ -1,5 +1,11 @@
jobs:
######################
###### Linux #########
######################
- job: Linux
timeoutInMinutes: 120
pool:
vmImage: 'ubuntu-16.04'
strategy:
@ -7,9 +13,11 @@ jobs:
AMD64 (x64):
dockerTag: 'amd64'
dockerName: 'Debian Stretch (AMD64)'
platform: 'x11'
i386 (x86):
dockerTag: 'i386'
dockerName: 'Debian Stretch (i386)'
platform: 'x11'
ARMv6hf (Raspberry Pi v1 & ZERO):
dockerTag: 'armv6hf'
dockerName: 'Debian Stretch (Raspberry Pi v1 & ZERO)'
@ -22,27 +30,124 @@ jobs:
dockerTag: 'aarch64'
dockerName: 'ARMv8 (Generic AARCH64)'
platform: 'amlogic'
steps:
- checkout: self
submodules: recursive
- checkout: self # represents the repo where the initial Pipelines YAML file was found
submodules: recursive # set to 'recursive' to get submodules of submodules
# read channel tag in version.json
- task: oneLuckiDevJson2Variable@1
inputs:
jsonFile: 'version.json'
shouldPrefixVariables: true
variablePrefix: 'json'
displayName: 'Read and generate pipeline variables'
# build process
- bash: ./.ci/ci_build.sh
displayName: 'Build $(dockerName)'
displayName: 'Build $(dockerName) packages'
env:
DOCKER_TAG: $(dockerTag)
DOCKER_NAME: $(dockerName)
PLATFORM: $(platform)
- bash: ./.ci/ci_deploy.sh
displayName: 'Upload $(dockerName)'
# copy files
- bash: 'cp -v deploy/Hyperion.NG-* $(Build.ArtifactStagingDirectory)'
workingDirectory: '$(Build.SourcesDirectory)'
condition: and(succeeded(), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
displayName: 'Collecting deployable artifacts'
# publish artifacts
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: $(dockerTag)
condition: and(succeeded(), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
displayName: 'Publish deployables artifacts'
# set release to pre-release
- bash: echo '##vso[task.setvariable variable=preRelease;]true'
condition: and(succeeded(), contains(variables['json.channel'], 'beta'), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
displayName: 'Mark beta as pre-release'
# create or update github release
- task: GithubRelease@0
inputs:
gitHubConnection: Hyperion.NG
repositoryName: $(Build.Repository.Name)
action: edit
target: $(Build.SourceVersion)
tagSource: manual
tag: $(Build.SourceBranchName)
assets: '$(Build.ArtifactStagingDirectory)/*'
assetUploadMode: 'replace'
addChangeLog: false
isPreRelease: $(preRelease)
condition: and(succeeded(), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
displayName: Create/Update GitHub release
######################
###### macOS #########
######################
- job: macOS
timeoutInMinutes: 120
pool:
vmImage: 'macOS-10.13'
steps:
- checkout: self
submodules: recursive
- checkout: self # represents the repo where the initial Pipelines YAML file was found
submodules: recursive # set to 'recursive' to get submodules of submodules
# read channel tag in version.json
- task: oneLuckiDevJson2Variable@1
inputs:
jsonFile: 'version.json'
shouldPrefixVariables: true
variablePrefix: 'json'
displayName: 'Read and generate pipeline variables'
# install dependencies
- bash: ./.ci/ci_install.sh
displayName: 'Install dependencies'
# build process
- bash: ./.ci/ci_build.sh
displayName: 'Build macOS 10.13'
- bash: ./.ci/ci_deploy.sh
displayName: 'Upload macOS 10.13'
displayName: 'Build macOS 10.13 packages'
env:
PLATFORM: 'osx'
# copy files
- bash: 'cp -v build/Hyperion.NG-* $(Build.ArtifactStagingDirectory)'
workingDirectory: '$(Build.SourcesDirectory)'
condition: and(succeeded(), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
displayName: 'Collecting deployable artifacts'
# publish artifacts
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'macos'
condition: and(succeeded(), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
displayName: 'Publish deployables artifacts'
# set release to pre-release
- bash: echo '##vso[task.setvariable variable=preRelease;]true'
condition: and(succeeded(), contains(variables['json.channel'], 'beta'), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
displayName: 'Mark beta as pre-release'
# create or update github release
- task: GithubRelease@0
inputs:
gitHubConnection: Hyperion.NG
repositoryName: $(Build.Repository.Name)
action: edit
target: $(Build.SourceVersion)
tagSource: manual
tag: '$(Build.SourceBranchName)'
assets: '$(Build.ArtifactStagingDirectory)/*'
assetUploadMode: 'replace'
addChangeLog: false
isPreRelease: $(preRelease)
condition: and(succeeded(), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
displayName: Create/Update GitHub release

View File

@ -14,47 +14,26 @@ else
CI_NAME="$(uname -s | tr '[:upper:]' '[:lower:]')"
fi
# set environment variables
BUILD_TYPE="Debug"
PACKAGES=""
[ -z "${PLATFORM}" ] && PLATFORM="x11"
# set environment variables if not exists
[ -z "${BUILD_TYPE}" ] && BUILD_TYPE="Debug"
# Detect number of processor cores
# default is 4 jobs
if [[ "$CI_NAME" == 'osx' || "$CI_NAME" == 'darwin' ]]; then
JOBS=$(sysctl -n hw.ncpu)
PLATFORM=osx
elif [[ "$CI_NAME" == 'linux' ]]; then
JOBS=$(nproc)
fi
echo "compile jobs: ${JOBS:=4}"
# Determine cmake build type; tag builds are Release, else Debug
if [ -n "${TRAVIS_TAG:-}" ] || [[ $BUILD_SOURCEBRANCH == *"refs/tags"* ]]; then
# Determine cmake build type; tag builds are Release, else Debug (-dev appends to platform)
if [[ $BUILD_SOURCEBRANCH == *"refs/tags"* ]]; then
BUILD_TYPE=Release
else
PLATFORM=${PLATFORM}-dev
fi
# Determine package creation; True for cron/schedule and tag builds
if [ "${TRAVIS_EVENT_TYPE:-}" == 'cron' ] || [ -n "${TRAVIS_TAG:-}" ] || [[ $BUILD_REASON == "Schedule" ]] || [[ $BUILD_SOURCEBRANCH == *"refs/tags"* ]]; then
PACKAGES="package"
fi
# Determie -dev appends to platform;
# Commented because tests are currently broken
# [ "${TRAVIS_EVENT_TYPE:-}" != 'cron' -a -z "${TRAVIS_TAG:-}" ] && PLATFORM=${PLATFORM}-dev
# Build the package on osx or docker for linux
# Build the package on osx or linux
if [[ "$CI_NAME" == 'osx' || "$CI_NAME" == 'darwin' ]]; then
# compile prepare
mkdir build || exit 1
mkdir ${CI_BUILD_DIR}/deploy || exit 1
cd build
cmake -DPLATFORM=$PLATFORM -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=/usr .. || exit 2
make -j ${JOBS} ${PACKAGES} || exit 3
echo "---> Copy binaries and packages to folder: ${CI_BUILD_DIR}/deploy"
cp -v ${CI_BUILD_DIR}/build/bin/h* ${CI_BUILD_DIR}/deploy/ 2>/dev/null || : &&
cp -v ${CI_BUILD_DIR}/build/Hyperion-* ${CI_BUILD_DIR}/deploy/ 2>/dev/null || : &&
cmake -DPLATFORM=${PLATFORM} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=/usr/local ../ || exit 2
make -j $(sysctl -n hw.ncpu) package || exit 3
cd ${CI_BUILD_DIR} && source /${CI_BUILD_DIR}/test/testrunner.sh || exit 4
exit 0;
exit 1 || { echo "---> Hyperion compilation failed! Abort"; exit 5; }
elif [[ "$CI_NAME" == 'linux' ]]; then
echo "Compile Hyperion with DOCKER_TAG = ${DOCKER_TAG} and friendly name DOCKER_NAME = ${DOCKER_NAME}"
# take ownership of deploy dir
@ -65,15 +44,15 @@ elif [[ "$CI_NAME" == 'linux' ]]; then
-v "${CI_BUILD_DIR}/deploy:/deploy" \
-v "${CI_BUILD_DIR}:/source:ro" \
hyperionproject/hyperion-ci:$DOCKER_TAG \
/bin/bash -c "mkdir build && cp -r source/. /build &&
cd /build && mkdir build && cd build &&
cmake -DPLATFORM=${PLATFORM} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} .. || exit 2 &&
make -j ${JOBS} ${PACKAGES} || exit 3 &&
echo '---> Copy binaries and packages to host folder: ${CI_BUILD_DIR}/deploy' &&
cp -v /build/build/bin/h* /deploy/ 2>/dev/null || : &&
cp -v /build/build/Hyperion-* /deploy/ 2>/dev/null || : &&
/bin/bash -c "mkdir hyperion.ng && cp -r source/. /hyperion.ng &&
cd /hyperion.ng && mkdir build && cd build &&
cmake -DPLATFORM=${PLATFORM} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DDOCKER_PLATFORM=${DOCKER_TAG} ../ || exit 2 &&
make -j $(nproc) package || exit 3 &&
cp /hyperion.ng/build/bin/h* /deploy/ 2>/dev/null || : &&
cp /hyperion.ng/build/Hyperion.NG-* /deploy/ 2>/dev/null || : &&
cd /hyperion.ng && source /hyperion.ng/test/testrunner.sh || exit 4 &&
exit 0;
exit 1 " || { echo "---> Hyperion compilation failed! Abort"; exit 4; }
exit 1 " || { echo "---> Hyperion compilation failed! Abort"; exit 5; }
# overwrite file owner to current user
sudo chown -fR $(stat -c "%U:%G" ${CI_BUILD_DIR}/deploy) ${CI_BUILD_DIR}/deploy

View File

@ -1,67 +0,0 @@
#!/bin/bash
# detect CI
if [ -n "${TRAVIS-}" ]; then
# Travis-CI
CI_NAME="$(echo "$TRAVIS_OS_NAME" | tr '[:upper:]' '[:lower:]')"
CI_BUILD_DIR="$TRAVIS_BUILD_DIR"
elif [ "$SYSTEM_COLLECTIONID" != "" ]; then
# Azure Pipelines
CI_NAME="$(echo "$AGENT_OS" | tr '[:upper:]' '[:lower:]')"
CI_BUILD_DIR="$BUILD_SOURCESDIRECTORY"
else
# for executing in non ci environment
CI_NAME="$(uname -s | tr '[:upper:]' '[:lower:]')"
fi
# sf_upload <FILES> <sf_dir>
# {
# echo "Uploading following files: ${1} to dir /hyperion-project/${2}"
#
# }
# append current Date to filename (just packages no binaries)
appendDate()
{
D=$(date +%Y-%m-%d)
for F in $CI_BUILD_DIR/deploy/Hy*
do
mv "$F" "${F%.*}-$D.${F##*.}"
done
}
# append friendly name (just packages no binaries)
appendName()
{
for F in $CI_BUILD_DIR/deploy/Hy*
do
mv "$F" "${F%.*}-($DOCKER_NAME).${F##*.}"
done
}
# get all files to deploy (just packages no binaries)
getFiles()
{
FILES=""
for f in $CI_BUILD_DIR/deploy/Hy*;
do FILES+="${f} ";
done;
}
if [[ $CI_NAME == 'linux' || "$CI_NAME" == 'osx' || "$CI_NAME" == 'darwin' ]]; then
if [[ -n $TRAVIS_TAG ]] || [[ $BUILD_SOURCEBRANCH == *"refs/tags"* ]]; then
echo "tag upload"
appendName
appendDate
getFiles
# sf_upload $FILES release
elif [[ $TRAVIS_EVENT_TYPE == 'cron' ]] || [[ $BUILD_REASON == "Schedule" ]]; then
echo "cron/schedule upload"
appendName
appendDate
getFiles
# sf_upload $FILES dev/alpha
else
echo "Direct pushed no upload, PRs not possible"
fi
fi

View File

@ -24,11 +24,13 @@ jobs:
env:
- DOCKER_TAG=amd64
- DOCKER_NAME="Debian Stretch (AMD64)"
- PLATFORM="x11"
- <<: *linux
name: "i386 (x86)"
env:
- DOCKER_TAG=i386
- DOCKER_NAME="Debian Stretch (i386)"
- PLATFORM="x11"
# ////////////////////////////////////////////////////////////////
# NOTE: Temporary disabled because travis timeouts
# ////////////////////////////////////////////////////////////////
@ -57,9 +59,8 @@ jobs:
name: "macOS 10.12 (Xcode 8.3.3)"
env:
- HOMEBREW_CACHE=$HOME/brew-cache
- PLATFORM="osx"
script:
- ./.ci/ci_build.sh
after_success:
- ./.ci/ci_deploy.sh

View File

@ -7,9 +7,9 @@ set(CMAKE_AUTOMOC ON)
# auto prepare .qrc files
set(CMAKE_AUTORCC ON)
IF ( POLICY CMP0026 )
if ( POLICY CMP0026 )
CMAKE_POLICY( SET CMP0026 OLD )
ENDIF()
endif()
# Configure CCache if available
find_program(CCACHE_FOUND ccache)
@ -18,11 +18,45 @@ if(CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif(CCACHE_FOUND)
SET ( HYPERION_VERSION_STABLE OFF )
SET ( HYPERION_VERSION_MAJOR 2 )
SET ( HYPERION_VERSION_MINOR 0 )
SET ( HYPERION_VERSION_PATCH 0 )
find_package( PythonInterp 3.5 REQUIRED )
# Read version from version.json
EXECUTE_PROCESS (
COMMAND ${PYTHON_EXECUTABLE} test/jsonchecks/version.py version.json
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE error_code
OUTPUT_VARIABLE RETURN_VERSION
)
SET( VERSION_REGEX "[0-9]+\\.[0-9]+\\.[0-9]+(-[a-zA-Z0-9_]+)?" )
if ( ${RETURN_VERSION} MATCHES ${VERSION_REGEX} )
STRING(REGEX MATCHALL "[0-9]+|-([A-Za-z0-9_]+)" VERSION_PARTS ${RETURN_VERSION} )
LIST( GET VERSION_PARTS 0 VERSION_MAJOR )
LIST( GET VERSION_PARTS 1 VERSION_MINOR )
LIST( GET VERSION_PARTS 2 VERSION_PATCH )
else ( ${RETURN_VERSION} MATCHES ${VERSION_REGEX} )
message( FATAL_ERROR "Failed to parse version.json string properly. ${error_code}" )
endif()
SET( HYPERION_VERSION_MAJOR ${VERSION_MAJOR} )
SET( HYPERION_VERSION_MINOR ${VERSION_MINOR} )
SET( HYPERION_VERSION_PATCH ${VERSION_PATCH} )
# Read channel from version.json
EXECUTE_PROCESS (
COMMAND ${PYTHON_EXECUTABLE} test/jsonchecks/version.py version.json "channel"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE error_code
OUTPUT_VARIABLE RETURN_CHANNEL
)
if ( error_code )
message( FATAL_ERROR "Failed to parse version.json string properly. ${error_code}" )
endif()
SET ( HYPERION_VERSION_CHANNEL ${RETURN_CHANNEL} )
# Set build variables
SET ( DEFAULT_AMLOGIC OFF )
SET ( DEFAULT_DISPMANX OFF )
SET ( DEFAULT_OSX OFF )
@ -46,14 +80,6 @@ ELSE()
SET ( DEFAULT_USB_HID OFF )
ENDIF()
if (APPLE)
SET( PLATFORM "osx")
endif()
if (WIN32)
SET( PLATFORM "windows")
endif()
if ( NOT DEFINED PLATFORM )
if ( "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86" )
SET( PLATFORM "x11")
@ -66,6 +92,10 @@ if ( NOT DEFINED PLATFORM )
elseif ( ("${SYSTEM_CPUINFO}" MATCHES "amlogic" OR "${SYSTEM_CPUINFO}" MATCHES "odroid-c2" OR "${SYSTEM_CPUINFO}" MATCHES "vero4k") AND ${CMAKE_SIZEOF_VOID_P} EQUAL 8 )
SET( PLATFORM "amlogic64" )
endif()
elseif ( APPLE )
SET( PLATFORM "osx")
elseif ( WIN32 )
SET( PLATFORM "windows")
endif()
if ( PLATFORM )
message( STATUS "PLATFORM is not defined, evaluated platform: ${PLATFORM}")
@ -182,7 +212,7 @@ SET( JSON_FILES
${HYPERION_SCHEMAS}
)
EXECUTE_PROCESS (
COMMAND python test/jsonchecks/checkjson.py ${JSON_FILES}
COMMAND ${PYTHON_EXECUTABLE} test/jsonchecks/checkjson.py ${JSON_FILES}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE CHECK_JSON_FAILED
)
@ -191,7 +221,7 @@ IF ( ${CHECK_JSON_FAILED} )
ENDIF ()
EXECUTE_PROCESS (
COMMAND python test/jsonchecks/checkeffects.py effects effects/schema
COMMAND ${PYTHON_EXECUTABLE} test/jsonchecks/checkeffects.py effects effects/schema
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE CHECK_EFFECTS_FAILED
)
@ -199,6 +229,7 @@ IF ( ${CHECK_EFFECTS_FAILED} )
MESSAGE (FATAL_ERROR "check of json effect files failed" )
ENDIF ()
# for python 3 the checkschema.py file must be rewritten
EXECUTE_PROCESS (
COMMAND python test/jsonchecks/checkschema.py config/hyperion.config.json.default libsrc/hyperion/hyperion.schema.json
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
@ -340,3 +371,4 @@ add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_D
# enable make package - no code after this line !
include (${CMAKE_CURRENT_SOURCE_DIR}/cmake/packages.cmake)

View File

@ -1,24 +1,33 @@
# With Docker
If you are using [Docker](https://www.docker.com/), you can compile Hyperion inside a docker container. This keeps your system clean and with a simple script it's easy to use. Supported is also cross compilation for Raspberry Pi (Debian Stretch)
If you are using [Docker](https://www.docker.com/), you can compile Hyperion inside a docker container. This keeps your system clean and with a simple script it's easy to use. Supported is also cross compiling for Raspberry Pi (Debian Stretch or higher). To compile Hyperion just execute one of the following commands.
To compile Hyperion for Debain Stretch (x64 architecture) or higher just execute the following command
The compiled binaries and packages will be available at the deploy folder next to the script
Note: call the script with `./docker-compile.sh -h` for more options
## Native compiling on Raspberry Pi
```
wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -t rpi-raspbian
```
## Cross compiling on X64_86 for:
**X64:**
```
wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh
```
To compile Hyperion for i386 architecture
**i386:**
```
wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -t i386
```
To compile Hyperion for Raspberry Pi v1 & ZERO
**Raspberry Pi v1 & ZERO**
```
wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -t armv6hf
```
To compile Hyperion for Raspberry Pi 2 & 3
**Raspberry Pi 2 & 3**
```
wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -t armv7hf
```
The compiled binaries and packages will be available at the deploy folder next to the script
Note: call the script with `./docker-compile.sh -h` for more options
# The usual way
@ -80,6 +89,8 @@ mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j $(nproc)
if this get stucked and dmseg says out of memory try:
make -j 2
# optional: install into your system
sudo make install/strip
# to uninstall (not very well tested, please keep that in mind)

View File

@ -43,5 +43,6 @@
#define HYPERION_VERSION_MINOR "${HYPERION_VERSION_MINOR}"
#define HYPERION_VERSION_PATCH "${HYPERION_VERSION_PATCH}"
#define HYPERION_VERSION "${HYPERION_VERSION_MAJOR}.${HYPERION_VERSION_MINOR}.${HYPERION_VERSION_PATCH}"
#define HYPERION_VERSION_CHANNEL "${HYPERION_VERSION_CHANNEL}"
#define HYPERION_JSON_VERSION "1.0.0"

View File

@ -1,65 +1,47 @@
<p align="center">
<img src="./assets/webconfig/img/hyperion/hyperionlogo.png" height="130">
</p>
![Hyperion.NG](https://raw.githubusercontent.com/hyperion-project/hyperion.ng/master/assets/webconfig/img/hyperion/hyperionlogo.png)
<p align="center">
<a href="https://www.hyperion-project.org" alt="Forum">
<img src="https://img.shields.io/website/https/hyperion-project.org.svg?down_color=red&down_message=offline&up_color=green&up_message=online" /></a>
<a href="https://github.com/hyperion-project/hyperion.ng/graphs/contributors" alt="Contributors">
<img src="https://img.shields.io/github/contributors/hyperion-project/hyperion.ng.svg" /></a>
<a href="https://github.com/hyperion-project/hyperion.ng/tree/master/dependencies/external" alt="Dependencies">
<img src="https://img.shields.io/librariesio/github/hyperion-project/hyperion.ng.svg" /></a>
<a href="https://dev.azure.com/Hyperion-Project/Hyperion.NG/_build/latest?definitionId=7&branchName=master" alt="Azure-Pipeline">
<img src="https://dev.azure.com/Hyperion-Project/Hyperion.NG/_apis/build/status/Hyperion.NG?branchName=master" /></a>
<a href="https://travis-ci.org/hyperion-project/hyperion.ng" alt="Travis-CI">
<img src="https://travis-ci.org/hyperion-project/hyperion.ng.svg?branch=master" /></a>
<a href="https://lgtm.com/projects/g/hyperion-project/hyperion.ng/alerts/">
<img src="https://img.shields.io/lgtm/alerts/g/hyperion-project/hyperion.ng.svg"
alt="Total alerts"/></a>
<a href="https://raw.githubusercontent.com/hyperion-project/hyperion.ng/master/LICENSE">
<img src="https://img.shields.io/badge/License-MIT-yellow.svg"
alt="GitHub license"></a>
</p>
[![Dependencies](https://img.shields.io/librariesio/github/hyperion-project/hyperion.ng.svg)](https://github.com/hyperion-project/hyperion.ng/tree/master/dependencies/external)
[![Azure-Pipeline](https://dev.azure.com/Hyperion-Project/Hyperion.NG/_apis/build/status/Hyperion.NG?branchName=master)](https://dev.azure.com/Hyperion-Project/Hyperion.NG/_build/latest?definitionId=7&branchName=master)
[![Travis-CI](https://travis-ci.org/hyperion-project/hyperion.ng.svg?branch=master)](https://travis-ci.org/hyperion-project/hyperion.ng)
[![LGTM](https://img.shields.io/lgtm/alerts/g/hyperion-project/hyperion.ng.svg)](https://lgtm.com/projects/g/hyperion-project/hyperion.ng/alerts/)
<p align="center">This is a pre alpha development repository for the next major version of hyperion</p>
## About Hyperion
--------
## **Important notice!**
[Hyperion.NG](https://github.com/hyperion-project/hyperion.ng) is an opensource '[AmbiLight](https://de.wikipedia.org/wiki/Ambilight)' implementation with support for many LED devices and video grabbers. The project is still in a beta development stage (no stable release available).
Hyperion.NG is under heavy development. This version is currently _only for development_ purpose.
Please do not use it for your 'productiv' setup!
![Screenshot](doc/screenshot.png)
If you want to use hyperion as 'normal user', please use [current stable version](https://github.com/hyperion-project/hyperion)
### Features:
Besides of that .... Feel free to join us! We are looking always for people who wants to participate.
--------
## About
Hyperion is an opensource 'AmbiLight' implementation with support for many LED devices and video grabbers.
The main features of Hyperion are:
* Low CPU load makes it perfect for SoCs like Raspberry Pi
* Json interface which allows easy integration into scripts
* A command line utility to for testing and integration in automated environment
* Priority channels are not coupled to a specific led data provider which means that a provider can post led data and leave without the need to maintain a connection to Hyperion. This is ideal for a remote application (like our Android app).
* Black border detector.
* Priority channels are not coupled to a specific led data provider which means that a provider can post led data and leave without the need to maintain a connection to Hyperion. This is ideal for a remote application (like our [Android app](https://play.google.com/store/apps/details?id=nl.hyperion.hyperionpro)).
* Black border detector and processor
* A scriptable (Python) effect engine
* A web ui to configure and remote control hyperion
* A multi language web interface to configure and remote control hyperion
More information can be found on the official Hyperion [Wiki](https://wiki.hyperion-project.org)
If you need further support please open a topic at the forum!
[![Hyperion webpage/forum](https://img.shields.io/website/https/hyperion-project.org.svg?down_color=red&down_message=offline&up_color=green&up_message=online)](https://www.hyperion-project.org)
If you need further support please open a topic at the our new forum!
[Hyperion webpage/forum](https://www.hyperion-project.org).
## Contributing
Contributions are welcome! Feel free to join us! We are looking always for people who wants to participate.
[![Contributors](https://img.shields.io/github/contributors/hyperion-project/hyperion.ng.svg)](https://github.com/hyperion-project/hyperion.ng/graphs/contributors)
For an example, you can participate in the translation.
[![Join Translation](https://img.shields.io/badge/POEditor-translate-green.svg)](https://poeditor.com/join/project/Y4F6vHRFjA)
## Requirements
* Debian 9, Ubuntu 16.04 or higher. Windows is not supported currently.
Debian 9, Ubuntu 16.04 or higher. Windows is not supported currently.
## Building
See [Compilehowto](CompileHowto.md) and [CrossCompileHowto](CrossCompileHowto.txt).
See [CompileHowto](CompileHowto.md) and [CrossCompileHowto](CrossCompileHowto.txt).
## Download
A download isn't available, you need to compile your own version see "Building"
**Please be patient. The first release is coming soon.**
## License
The source is released under MIT-License (see http://opensource.org/licenses/MIT).
[![GitHub license](https://img.shields.io/badge/License-MIT-yellow.svg)](https://raw.githubusercontent.com/hyperion-project/hyperion.ng/master/LICENSE)

View File

@ -356,6 +356,7 @@
"edt_dev_enum_sub_min_warm_adjust": "Minimale Anpassung: warm",
"edt_dev_enum_white_off": "Weiß ist aus",
"edt_dev_general_heading_title": "Allgemeine Einstellungen",
"edt_dev_general_name_title": "Name der Konfiguration",
"edt_dev_general_hardwareLedCount_title": "Anzahl Hardware LEDs",
"edt_dev_general_colorOrder_title": "RGB Byte Reihenfolge",
"edt_dev_general_rewriteTime_title": "Aktualisierungszeit",
@ -385,6 +386,7 @@
"edt_dev_spec_transistionTime_title": "Übergangszeit",
"edt_dev_spec_switchOffOnBlack_title": "Aus bei schwarz",
"edt_dev_spec_brightnessFactor_title": "Helligkeitsfaktor",
"edt_dev_spec_ledType_title": "LED typ",
"edt_dev_spec_uid_title": "UID",
"edt_dev_spec_intervall_title": "Intervall",
"edt_dev_spec_latchtime_title": "Sperrzeit",
@ -399,13 +401,12 @@
"edt_dev_spec_useRgbwProtocol_title": "Nutze RGBW Protokoll",
"edt_dev_spec_maximumLedCount_title": "Maximale Anzahl LEDs",
"edt_dev_spec_gpioNumber_title": "GPIO Nummer",
"edt_dev_spec_dmaNumber_title": "DMA Kanal",
"edt_dev_spec_gpioMap_title": "GPIO Zuweisung",
"edt_dev_spec_PBFiFo_title": "Pi-Blaster FiFo",
"edt_dev_spec_gpioBcm_title": "GPIO Pin",
"edt_dev_spec_ledIndex_title": "LED index",
"edt_dev_spec_colorComponent_title": "Farbkomponente",
"edt_dev_spec_ledType_title" : "LED typ",
"edt_dev_spec_dmaNumber_title" : "DMA Kanal",
"edt_conf_general_enable_title": "Aktiviert",
"edt_conf_general_enable_expl": "Wenn aktiviert, ist die Komponente aktiv.",
"edt_conf_general_priority_title": "Priorität",
@ -443,8 +444,8 @@
"edt_conf_gen_versionBranch_title": "Versionszweig",
"edt_conf_gen_versionBranch_expl": "Gibt an, welcher Versionszweig für die Suche von neuen Hyperion Versionen genutzt werden soll.",
"edt_conf_color_heading_title": "Farbkalibrierung",
"edt_conf_color_channelAdjustment_header_title" : "Anpassung Farbkanäle",
"edt_conf_color_channelAdjustment_header_itemtitle": "Profil",
"edt_conf_color_channelAdjustment_header_title": "Anpassung Farbkanäle",
"edt_conf_color_channelAdjustment_header_expl": "Passe die Farbkanäle deinen LEDs an",
"edt_conf_color_imageToLedMappingType_title": "LED-Bereich Zuordnungstyp",
"edt_conf_color_imageToLedMappingType_expl": "Sofern nicht \"Mehrfarbig\", wird dein LED Layout mit einer anderen Bildzuweisung überschrieben",
@ -604,12 +605,12 @@
"edt_eff_smooth_custom": "Aktivere Glättung",
"edt_eff_smooth_time_ms": "Glättung: Zeit",
"edt_eff_smooth_updateFrequency": "Glättung: Aktualisierungsfrequenz",
"edt_eff_candle_header" : "Kerze",
"edt_eff_candle_header_desc" : "Flackerndes Kerzenlicht",
"edt_eff_waves_header": "Wellen",
"edt_eff_waves_header_desc": "Gestalte Wellen aus Farbe! Mische dazu deine lieblings Farben und wähle einen Mittelpunkt.",
"edt_eff_gif_header": "GIF's",
"edt_eff_gif_header_desc": "Dieser Effekt spielt .gif Dateien ab. Bietet die Möglichkeit kleine GIF-Videos abzuspielen.",
"edt_eff_candle_header": "Kerze",
"edt_eff_candle_header_desc": "Flackerndes Kerzenlicht",
"edt_eff_police_header": "Polizei",
"edt_eff_police_header_desc": "Lights like a police car in action",
"edt_eff_fade_header": "Farbübergang",
@ -635,6 +636,7 @@
"edt_eff_sparks_header": "Funken",
"edt_eff_sparks_header_desc": "Ein Sternenfunkeln, wahlweise in festgelegter Farbe oder zufällig. Passe Helligkeit, Sättigung und Geschwindigkeit an.",
"edt_eff_traces_header": "Farbspuren",
"edt_eff_traces_header_desc": "Erfordert eine Neugestaltung",
"edt_eff_x-mas_header": "Weihnachten",
"edt_eff_x-mas_header_desc": "Ein Hauch von Weihnachten",
"edt_eff_trails_header": "Sternschnuppen",
@ -652,15 +654,17 @@
"edt_eff_colorcount": "Farblänge",
"edt_eff_rotationtime": "Rotationszeit",
"edt_eff_sleeptime": "Schlafzeit",
"edt_eff_image": "Bilddatei",
"edt_eff_fps": "Bilder pro Sekunde",
"edt_eff_reversedirection": "Richtung umkehren",
"edt_eff_fadeintime": "Zeit für Einblendung",
"edt_eff_fadeouttime": "Zeit für Ausblendung",
"edt_eff_repeat": "Wiederholung",
"edt_eff_repeatcount": "Anzahl Wiederholung",
"edt_eff_colorendtime": "Zeit für Start-Farbe",
"edt_eff_colorstarttime": "Zeit für End-Farbe",
"edt_eff_colorstart": "Farbe Start",
"edt_eff_colorend": "Farbe Ende",
"edt_eff_repeatcount" : "Anzahl Wiederholung",
"edt_eff_maintain_end_color": "Behalte Endfarbe",
"edt_eff_colorshift": "Farbverschiebung",
"edt_eff_whichleds": "Welche LEDs",
@ -693,8 +697,8 @@
"edt_eff_colorMinute": "Farbe Minute",
"edt_eff_colorSecond": "Farbe Sekunde",
"edt_eff_colorMarker": "Marker Farbe",
"edt_eff_markerDepth" : "Marker Tiefe",
"edt_eff_markerWidth": "Marker Breite",
"edt_eff_markerDepth": "Marker Tiefe",
"edt_eff_markerEnable": "Zeige Marker",
"edt_eff_backgroundColor": "Hintergrundfarbe",
"edt_eff_countries": "Länder",

View File

@ -75,7 +75,7 @@ $(document).ready( function() {
// add more info
$('#dash_leddevice').html(window.serverInfo.ledDevices.active);
$('#dash_currv').html(window.currentVersion);
$('#dash_currv').html(window.currentChannel+' '+window.currentVersion);
$('#dash_instance').html(window.serverConfig.general.name);
$('#dash_ports').html(window.serverConfig.flatbufServer.port+' | '+window.serverConfig.protoServer.port);
$('#dash_versionbranch').html(window.serverConfig.general.versionBranch);

View File

@ -39,6 +39,7 @@ $(document).ready( function() {
window.sysInfo = event.response.info;
window.currentVersion = window.sysInfo.hyperion.version;
window.currentChannel = window.sysInfo.hyperion.channel;
});
$(window.hyperion).one("cmd-config-getschema", function(event) {

View File

@ -193,10 +193,10 @@ function createClassicLeds(){
}
}
createLeftLeds();
createBottomLeds();
createRightLeds();
createTopLeds();
createRightLeds();
createBottomLeds();
createLeftLeds();
//check led gap pos
if (ledsgpos+ledsglength > ledArray.length)
@ -429,6 +429,9 @@ $(document).ready(function() {
// create and update editor
$("#leddevices").off().on("change", function() {
var generalOptions = window.serverSchema.properties.device;
// Modified schema enty "hardwareLedCount" in generalOptions to minimum LedCount
var specificOptions = window.serverSchema.properties.alldevices[$(this).val()];
conf_editor = createJsonEditor('editor_container', {
generalOptions : generalOptions,

View File

@ -3,6 +3,7 @@ window.webPrio = 1;
window.webOrigin = "Web Configuration";
window.showOptHelp = true;
window.gitHubReleaseApiUrl = "https://api.github.com/repos/hyperion-project/hyperion.ng/releases";
window.currentChannel = null;
window.currentVersion = null;
window.latestVersion = null;
window.latestStableVersion = null;

View File

@ -81,8 +81,8 @@ mkdir $SCRIPT_PATH/deploy >/dev/null 2>&1
# get Hyperion source, cleanup previous folder
echo "---> Downloading Hyperion source code from ${GIT_REPO_URL}"
sudo rm -fr $SCRIPT_PATH/hyperion >/dev/null 2>&1
git clone --recursive --depth 1 -q $GIT_REPO_URL $SCRIPT_PATH/hyperion || { echo "---> Failed to download Hyperion source code! Abort"; exit 1; }
sudo rm -fr $SCRIPT_PATH/hyperion.ng >/dev/null 2>&1
git clone --recursive --depth 1 -q $GIT_REPO_URL $SCRIPT_PATH/hyperion.ng || { echo "---> Failed to download Hyperion source code! Abort"; exit 1; }
# start compilation
# Remove container after stop
@ -93,15 +93,15 @@ git clone --recursive --depth 1 -q $GIT_REPO_URL $SCRIPT_PATH/hyperion || { echo
echo "---> Startup docker..."
$DOCKER run --rm \
-v "${SCRIPT_PATH}/deploy:/deploy" \
-v "${SCRIPT_PATH}/hyperion:/source:ro" \
-v "${SCRIPT_PATH}/hyperion.ng:/source:ro" \
hyperionproject/hyperion-ci:$BUILD_TARGET \
/bin/bash -c "mkdir build && cp -r /source/. /build &&
cd /build && mkdir build && cd build &&
/bin/bash -c "mkdir hyperion.ng && cp -r /source/. /hyperion.ng &&
cd /hyperion.ng && mkdir build && cd build &&
cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} .. || exit 2 &&
make -j $(nproc) ${PACKAGES} || exit 3 &&
echo '---> Copy binaries and packages to host folder: ${SCRIPT_PATH}/deploy' &&
cp -v /build/build/bin/h* /deploy/ 2>/dev/null || : &&
cp -v /build/build/Hyperion-* /deploy/ 2>/dev/null || : &&
cp -v /hyperion.ng/build/bin/h* /deploy/ 2>/dev/null || : &&
cp -v /hyperion.ng/build/Hyperion.NG-* /deploy/ 2>/dev/null || : &&
exit 0;
exit 1 " || { echo "---> Hyperion compilation failed! Abort"; exit 4; }

View File

@ -7,4 +7,5 @@ STRING ( STRIP "${BUILD_ID}" BUILD_ID )
STRING ( STRIP "${VERSION_ID}" VERSION_ID )
STRING ( STRIP "${GIT_REMOTE_PATH}" GIT_REMOTE_PATH )
SET ( HYPERION_BUILD_ID "${VERSION_ID} (${BUILD_ID}) Git Remote: ${GIT_REMOTE_PATH}" )
message ( STATUS "Current Version: ${HYPERION_BUILD_ID}" )
SET ( HYPERION_VERSION "${HYPERION_VERSION_CHANNEL}.${HYPERION_VERSION_MAJOR}.${HYPERION_VERSION_MINOR}.${HYPERION_VERSION_PATCH}" )
message ( STATUS "Current Version: ${HYPERION_VERSION} (${HYPERION_BUILD_ID})" )

View File

@ -24,10 +24,16 @@ ENDIF()
# Apply to all packages, some of these can be overwritten with generator specific content
# https://cmake.org/cmake/help/v3.5/module/CPack.html
SET ( CPACK_PACKAGE_NAME "Hyperion" )
SET ( CPACK_PACKAGE_NAME "Hyperion.NG" )
SET ( CPACK_PACKAGE_DESCRIPTION_SUMMARY "Hyperion is an open source ambient light implementation" )
SET ( CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md" )
SET ( CPACK_PACKAGE_FILE_NAME "Hyperion-${HYPERION_VERSION_MAJOR}.${HYPERION_VERSION_MINOR}.${HYPERION_VERSION_PATCH}-${CMAKE_SYSTEM_NAME}")
if ( NOT DEFINED DOCKER_PLATFORM )
SET ( CPACK_PACKAGE_FILE_NAME "Hyperion.NG-${HYPERION_VERSION_CHANNEL}.${HYPERION_VERSION_MAJOR}.${HYPERION_VERSION_MINOR}.${HYPERION_VERSION_PATCH}-${CMAKE_SYSTEM_NAME}")
else()
SET ( CPACK_PACKAGE_FILE_NAME "Hyperion.NG-${HYPERION_VERSION_CHANNEL}.${HYPERION_VERSION_MAJOR}.${HYPERION_VERSION_MINOR}.${HYPERION_VERSION_PATCH}-${CMAKE_SYSTEM_NAME}-${DOCKER_PLATFORM}")
endif()
SET ( CPACK_PACKAGE_CONTACT "packages@hyperion-project.org")
SET ( CPACK_PACKAGE_EXECUTABLES "hyperiond;Hyperion" )
SET ( CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/resources/icons/hyperion-icon-32px.png")

View File

@ -33,7 +33,7 @@
"output" : "/dev/null",
"rate" : 1000000,
"colorOrder" : "rgb",
"rewriteTime": 0
"rewriteTime": 5000
},
/// Color manipulation configuration used to tune the output colors to specific surroundings.

BIN
doc/screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 KiB

View File

@ -6,7 +6,7 @@
#include <utils/Components.h>
#include <hyperion/Hyperion.h>
// qt includess
// qt includes
#include <QJsonObject>
#include <QMutex>
#include <QString>
@ -86,7 +86,7 @@ private:
/// mutex to determine state of image streaming
QMutex _image_stream_mutex;
/// mutex to determine state of image streaming
/// mutex to determine state of led streaming
QMutex _led_stream_mutex;
/// timeout for live video refresh

View File

@ -15,13 +15,13 @@ class Option: public QCommandLineOption
public:
Option(const QString &name,
const QString &description = QString(),
const QString &valueName = QString::null,
const QString &valueName = QString(),
const QString &defaultValue = QString()
);
Option(const QStringList &names,
const QString &description = QString(),
const QString &valueName = QString::null,
const QString &valueName = QString(),
const QString &defaultValue = QString()
);

View File

@ -5,7 +5,6 @@
#include <QMap>
// QT includes
//#include <QObject>
#include <QString>
#include <QStringList>
#include <QSize>
@ -13,6 +12,7 @@
#include <QJsonValue>
#include <QJsonArray>
#include <QFileSystemWatcher>
#include <QMutex>
// hyperion-utils includes
#include <utils/Image.h>
@ -410,8 +410,11 @@ signals:
/// Signal which is emitted, when a new json message should be forwarded
void forwardJsonMessage(QJsonObject);
/// Signal which is emitted, when a new proto image should be forwarded
void forwardProtoMessage(const QString, const Image<ColorRgb>);
/// Signal which is emitted, when a new system proto image should be forwarded
void forwardSystemProtoMessage(const QString, const Image<ColorRgb>);
/// Signal which is emitted, when a new V4l proto image should be forwarded
void forwardV4lProtoMessage(const QString, const Image<ColorRgb>);
///
/// @brief Is emitted from clients who request a videoMode change
@ -560,12 +563,12 @@ private:
/// Capture control for Daemon native capture
CaptureCont* _captureCont;
// lock Hyperion::update() for exec
bool _lockUpdate = false;
/// buffer for leds (with adjustment)
std::vector<ColorRgb> _ledBuffer;
/// Boblight instance
BoblightServer* _boblightServer;
/// mutex
QMutex _changes;
};

View File

@ -150,7 +150,7 @@ public:
// Check black border detection
verifyBorder(image);
// Determine the mean-colors of each led (using the existing mapping)
// Determine the mean or uni colors of each led (using the existing mapping)
switch (_mappingType)
{
case 1: _imageToLeds->getUniLedColor(image, ledColors); break;

View File

@ -61,7 +61,7 @@ namespace hyperion
unsigned verticalBorder() { return _verticalBorder; };
///
/// Determines the mean-color for each led using the mapping the image given
/// Determines the mean color for each led using the mapping the image given
/// at construction.
///
/// @param[in] image The image from which to extract the led colors
@ -104,7 +104,7 @@ namespace hyperion
}
///
/// Determines the mean-color for each led using the mapping the image given
/// Determines the uni color for each led using the mapping the image given
/// at construction.
///
/// @param[in] image The image from which to extract the led colors
@ -120,7 +120,7 @@ namespace hyperion
}
///
/// Determines the mean color for each led using the mapping the image given
/// Determines the uni color for each led using the mapping the image given
/// at construction.
///
/// @param[in] image The image from which to extract the led colors

View File

@ -84,6 +84,14 @@ signals:
///
void enableStateChanged(bool newState);
///
/// PIPER signal for Priority Muxer -> LedDevice
///
/// @brief Handle priority updates from Priority Muxer
/// @param priority The new visible priority
///
void visiblePriorityChanged(const quint8 &priority);
protected:
virtual bool init(const QJsonObject &deviceConfig);

View File

@ -117,25 +117,25 @@ private:
void updateBrightnessComponents();
/// backlight variables
bool _backLightEnabled;
bool _backlightColored;
double _backlightThreshold;
double _sumBrightnessLow;
bool _backLightEnabled
, _backlightColored;
double _backlightThreshold
, _sumBrightnessLow;
/// gamma variables
double _gammaR;
double _gammaG;
double _gammaB;
double _gammaR
, _gammaG
, _gammaB;
/// The mapping from input color to output color
uint8_t _mappingR[256];
uint8_t _mappingG[256];
uint8_t _mappingB[256];
uint8_t _mappingR[256]
, _mappingG[256]
, _mappingB[256];
/// brightness variables
uint8_t _brightness;
uint8_t _brightnessCompensation;
uint8_t _brightness_rgb;
uint8_t _brightness_cmy;
uint8_t _brightness_w;
uint8_t _brightness
, _brightnessCompensation
, _brightness_rgb
, _brightness_cmy
, _brightness_w;
};

View File

@ -40,12 +40,12 @@ namespace hyperion {
(uint8_t)FGCONFIG_ARRAY.at(2).toInt(0)
};
hyperion->setColor(FG_PRIORITY, fg_color, fg_duration_ms);
Info(Logger::getInstance("HYPERION"),"Inital foreground color set (%d %d %d)",fg_color.red,fg_color.green,fg_color.blue);
Info(Logger::getInstance("HYPERION"),"Initial foreground color set (%d %d %d)",fg_color.red,fg_color.green,fg_color.blue);
}
else
{
int result = hyperion->setEffect(fgEffectConfig, FG_PRIORITY, fg_duration_ms);
Info(Logger::getInstance("HYPERION"),"Inital foreground effect '%s' %s", QSTRING_CSTR(fgEffectConfig), ((result == 0) ? "started" : "failed"));
Info(Logger::getInstance("HYPERION"),"Initial foreground effect '%s' %s", QSTRING_CSTR(fgEffectConfig), ((result == 0) ? "started" : "failed"));
}
}
#undef FGCONFIG_ARRAY

View File

@ -248,6 +248,7 @@ void JsonAPI::handleSysInfoCommand(const QJsonObject&, const QString& command, c
QJsonObject hyperion;
hyperion["jsonrpc_version" ] = QString(HYPERION_JSON_VERSION);
hyperion["version" ] = QString(HYPERION_VERSION);
hyperion["channel" ] = QString(HYPERION_VERSION_CHANNEL);
hyperion["build" ] = QString(HYPERION_BUILD_ID);
hyperion["time" ] = QString(__DATE__ " " __TIME__);
hyperion["id" ] = _hyperion->getId();

View File

@ -30,7 +30,6 @@ EffectEngine::EffectEngine(Hyperion * hyperion)
{
Q_INIT_RESOURCE(EffectEngine);
qRegisterMetaType<std::vector<ColorRgb>>("std::vector<ColorRgb>");
qRegisterMetaType<hyperion::Components>("hyperion::Components");
// connect the Hyperion channel clear feedback

View File

@ -246,7 +246,7 @@ void EffectFileHandler::updateEffects()
// collect effect schemas
efxCount = 0;
directory = path.endsWith("/") ? (path + "schema/") : (path + "/schema/");
directory.setPath(path.endsWith("/") ? (path + "schema/") : (path + "/schema/"));
QStringList pynames = directory.entryList(QStringList() << "*.json", QDir::Files, QDir::Name | QDir::IgnoreCase);
for (const QString & pyname : pynames)
{

View File

@ -13,9 +13,11 @@ CaptureCont::CaptureCont(Hyperion* hyperion)
: QObject()
, _hyperion(hyperion)
, _systemCaptEnabled(false)
, _systemCaptPrio(0)
, _systemCaptName()
, _systemInactiveTimer(new QTimer(this))
, _v4lCaptEnabled(false)
, _v4lCaptPrio(0)
, _v4lCaptName()
, _v4lInactiveTimer(new QTimer(this))
{
@ -73,7 +75,7 @@ void CaptureCont::setSystemCaptureEnable(const bool& enable)
{
_hyperion->registerInput(_systemCaptPrio, hyperion::COMP_GRABBER);
connect(GlobalSignals::getInstance(), &GlobalSignals::setSystemImage, this, &CaptureCont::handleSystemImage);
connect(GlobalSignals::getInstance(), &GlobalSignals::setSystemImage, _hyperion, &Hyperion::forwardProtoMessage);
connect(GlobalSignals::getInstance(), &GlobalSignals::setSystemImage, _hyperion, &Hyperion::forwardSystemProtoMessage);
}
else
{
@ -94,7 +96,7 @@ void CaptureCont::setV4LCaptureEnable(const bool& enable)
{
_hyperion->registerInput(_v4lCaptPrio, hyperion::COMP_V4L);
connect(GlobalSignals::getInstance(), &GlobalSignals::setV4lImage, this, &CaptureCont::handleV4lImage);
connect(GlobalSignals::getInstance(), &GlobalSignals::setV4lImage, _hyperion, &Hyperion::forwardProtoMessage);
connect(GlobalSignals::getInstance(), &GlobalSignals::setV4lImage, _hyperion, &Hyperion::forwardV4lProtoMessage);
}
else
{

View File

@ -106,9 +106,6 @@ Hyperion::Hyperion(HyperionDaemon* daemon, const quint8& instance, const QString
_ledStringColorOrder.insert(_ledStringColorOrder.begin() + led.index, led.colorOrder);
}
// connect Hyperion::update with Muxer visible priority changes as muxer updates independent
connect(&_muxer, &PriorityMuxer::visiblePriorityChanged, this, &Hyperion::update);
// listens for ComponentRegister changes of COMP_ALL to perform core enable/disable actions
connect(&_componentRegister, &ComponentRegister::updatedComponentState, this, &Hyperion::updatedComponentState);
@ -186,7 +183,6 @@ void Hyperion::freeObjects(bool emitCloseSignal)
delete _boblightServer;
delete _captureCont;
delete _effectEngine;
//delete _deviceSmooth;
delete _raw2ledAdjustment;
delete _messageForwarder;
delete _settingsManager;
@ -209,10 +205,13 @@ void Hyperion::handleSettingsUpdate(const settings::type& type, const QJsonDocum
}
else if(type == settings::LEDS)
{
QMutexLocker lock(&_changes);
const QJsonArray leds = config.array();
// lock update()
_lockUpdate = true;
// // lock update()
// _lockUpdate = true;
// stop and cache all running effects, as effects depend heavily on ledlayout
_effectEngine->cacheRunningEffects();
@ -249,12 +248,13 @@ void Hyperion::handleSettingsUpdate(const settings::type& type, const QJsonDocum
// start cached effects
_effectEngine->startCachedEffects();
// unlock
_lockUpdate = false;
// // unlock
// _lockUpdate = false;
}
else if(type == settings::DEVICE)
{
_lockUpdate = true;
QMutexLocker lock(&_changes);
// _lockUpdate = true;
QJsonObject dev = config.object();
// handle hwLedCount update
@ -278,7 +278,7 @@ void Hyperion::handleSettingsUpdate(const settings::type& type, const QJsonDocum
// do always reinit until the led devices can handle dynamic changes
dev["currentLedCount"] = int(_hwLedCount); // Inject led count info
_ledDeviceWrapper->createLedDevice(dev);
_lockUpdate = false;
// _lockUpdate = false;
}
// update once to push single color sets / adjustments/ ledlayout resizes and update ledBuffer color
update();
@ -562,66 +562,42 @@ const QString & Hyperion::getActiveDevice()
void Hyperion::updatedComponentState(const hyperion::Components comp, const bool state)
{
QMutexLocker lock(&_changes);
// evaluate comp change
if (comp != _prevCompId)
{
_imageProcessor->setBlackbarDetectDisable((_prevCompId == hyperion::COMP_EFFECT));
_imageProcessor->setHardLedMappingType((_prevCompId == hyperion::COMP_EFFECT) ? 0 : -1);
_prevCompId = comp;
_raw2ledAdjustment->setBacklightEnabled((_prevCompId != hyperion::COMP_COLOR && _prevCompId != hyperion::COMP_EFFECT));
}
if(comp == hyperion::COMP_ALL)
{
if(state)
{
// first muxer to update all inputs
_muxer.setEnable(state);
}
else
{
_muxer.setEnable(state);
}
}
_muxer.setEnable(state); // first muxer to update all inputs
}
void Hyperion::update()
{
if(_lockUpdate)
return;
// the ledbuffer resize for hwledcount needs to be reverted
if(_hwLedCount > _ledBuffer.size())
_ledBuffer.resize(getLedCount());
QMutexLocker lock(&_changes);
// Obtain the current priority channel
int priority = _muxer.getCurrentPriority();
const PriorityMuxer::InputInfo priorityInfo = _muxer.getInputInfo(priority);
// eval comp change
bool compChanged = false;
if (priorityInfo.componentId != _prevCompId)
{
compChanged = true;
_prevCompId = priorityInfo.componentId;
}
// copy image & process OR copy ledColors from muxer
Image<ColorRgb> image = priorityInfo.image;
if(image.size() > 3)
{
emit currentImage(image);
// disable the black border detector for effects and ledmapping to 0
if(compChanged)
{
_imageProcessor->setBlackbarDetectDisable((_prevCompId == hyperion::COMP_EFFECT));
_imageProcessor->setHardLedMappingType((_prevCompId == hyperion::COMP_EFFECT) ? 0 : -1);
}
_imageProcessor->process(image, _ledBuffer);
_ledBuffer = _imageProcessor->process(image);
}
else
{
_ledBuffer = priorityInfo.ledColors;
}
// emit rawLedColors before transform
emit rawLedColors(_ledBuffer);
// apply adjustments
if(compChanged)
_raw2ledAdjustment->setBacklightEnabled((_prevCompId != hyperion::COMP_COLOR && _prevCompId != hyperion::COMP_EFFECT));
_raw2ledAdjustment->applyAdjustment(_ledBuffer);
// insert cloned leds into buffer
@ -660,7 +636,8 @@ void Hyperion::update()
}
i++;
}
// fill aditional hw leds with black
// fill additional hw leds with black
if ( _hwLedCount > _ledBuffer.size() )
{
_ledBuffer.resize(_hwLedCount, ColorRgb::BLACK);
@ -671,7 +648,7 @@ void Hyperion::update()
{
_deviceSmooth->selectConfig(priorityInfo.smooth_cfg);
// feed smoothing in pause mode to maintain a smooth transistion back to smoth mode
// feed smoothing in pause mode to maintain a smooth transistion back to smooth mode
if (_deviceSmooth->enabled() || _deviceSmooth->pause())
_deviceSmooth->setLedValues(_ledBuffer);

View File

@ -3,7 +3,6 @@
// STL includes
#include <vector>
// Qt includes
#include <QVector>

View File

@ -83,9 +83,12 @@ void MessageForwarder::handleSettingsUpdate(const settings::type &type, const QJ
if (!_protoSlaves.isEmpty() && obj["enable"].toBool() && _forwarder_enabled)
{
InfoIf(obj["enable"].toBool(true), _log, "Forward now to proto targets '%s'", QSTRING_CSTR(_protoSlaves.join(", ")));
connect(_hyperion, &Hyperion::forwardProtoMessage, this, &MessageForwarder::forwardProtoMessage, Qt::UniqueConnection);
// connect(_hyperion, &Hyperion::forwardProtoMessage, this, &MessageForwarder::forwardProtoMessage, Qt::UniqueConnection);
} else if ( _protoSlaves.isEmpty() || ! obj["enable"].toBool() || !_forwarder_enabled)
disconnect(_hyperion, &Hyperion::forwardProtoMessage, 0, 0);
{
disconnect(_hyperion, &Hyperion::forwardSystemProtoMessage, 0, 0);
disconnect(_hyperion, &Hyperion::forwardV4lProtoMessage, 0, 0);
}
// update comp state
_hyperion->getComponentRegister().componentStateChanged(hyperion::COMP_FORWARDER, obj["enable"].toBool(true));
@ -112,8 +115,8 @@ void MessageForwarder::handlePriorityChanges(const quint8 &priority)
while (!_forwardClients.isEmpty())
delete _forwardClients.takeFirst();
hyperion::Components activePrio = _hyperion->getPriorityInfo(priority).componentId;
if (activePrio == hyperion::COMP_GRABBER || activePrio == hyperion::COMP_V4L)
hyperion::Components activeCompId = _hyperion->getPriorityInfo(priority).componentId;
if (activeCompId == hyperion::COMP_GRABBER || activeCompId == hyperion::COMP_V4L)
{
if ( !obj["proto"].isNull() )
{
@ -123,10 +126,33 @@ void MessageForwarder::handlePriorityChanges(const quint8 &priority)
addProtoSlave(entry.toString());
}
}
connect(_hyperion, &Hyperion::forwardProtoMessage, this, &MessageForwarder::forwardProtoMessage, Qt::UniqueConnection);
switch(activeCompId)
{
case hyperion::COMP_GRABBER:
{
disconnect(_hyperion, &Hyperion::forwardV4lProtoMessage, 0, 0);
connect(_hyperion, &Hyperion::forwardSystemProtoMessage, this, &MessageForwarder::forwardProtoMessage, Qt::UniqueConnection);
}
break;
case hyperion::COMP_V4L:
{
disconnect(_hyperion, &Hyperion::forwardSystemProtoMessage, 0, 0);
connect(_hyperion, &Hyperion::forwardV4lProtoMessage, this, &MessageForwarder::forwardProtoMessage, Qt::UniqueConnection);
}
break;
default:
{
disconnect(_hyperion, &Hyperion::forwardSystemProtoMessage, 0, 0);
disconnect(_hyperion, &Hyperion::forwardV4lProtoMessage, 0, 0);
}
}
}
else
disconnect(_hyperion, &Hyperion::forwardProtoMessage, 0, 0);
{
disconnect(_hyperion, &Hyperion::forwardSystemProtoMessage, 0, 0);
disconnect(_hyperion, &Hyperion::forwardV4lProtoMessage, 0, 0);
}
}
}

View File

@ -106,7 +106,7 @@ void MultiColorAdjustment::applyAdjustment(std::vector<ColorRgb>& ledColors)
uint8_t ored = color.red;
uint8_t ogreen = color.green;
uint8_t oblue = color.blue;
uint8_t B_RGB, B_CMY, B_W;
uint8_t B_RGB = 0, B_CMY = 0, B_W = 0;
adjustment->_rgbTransform.transform(ored,ogreen,oblue);
adjustment->_rgbTransform.getBrightnessComponents(B_RGB, B_CMY, B_W);

View File

@ -10,6 +10,8 @@
#include "hyperion/Hyperion.h"
#include <utils/JsonUtils.h>
#include <QDebug>
LedDevice::LedDevice(const QJsonObject& config, QObject* parent)
: QObject(parent)
, _devConfig(config)
@ -43,21 +45,12 @@ void LedDevice::setEnable(bool enable)
{
// emit signal when state changed
if (_enabled != enable)
{
emit enableStateChanged(enable);
}
// set black to leds when they should go off
if ( _enabled && !enable)
{
switchOff();
}
else {
if ( !_enabled && enable)
{
switchOn();
}
}
_enabled = enable;
}

View File

@ -51,12 +51,13 @@ void LedDeviceWrapper::createLedDevice(const QJsonObject& config)
_ledDevice->moveToThread(thread);
// setup thread management
connect(thread, &QThread::started, _ledDevice, &LedDevice::start);
connect(thread, &QThread::finished, thread, &QObject::deleteLater);
connect(thread, &QThread::finished, _ledDevice, &QObject::deleteLater);
connect(thread, &QThread::finished, thread, &QThread::deleteLater);
connect(thread, &QThread::finished, _ledDevice, &LedDevice::deleteLater);
// further signals
connect(this, &LedDeviceWrapper::write, _ledDevice, &LedDevice::write);
connect(_ledDevice, &LedDevice::enableStateChanged, this, &LedDeviceWrapper::handleInternalEnableState);
connect(this, &LedDeviceWrapper::write, _ledDevice, &LedDevice::write, Qt::QueuedConnection);
connect(_hyperion->getMuxerInstance(), &PriorityMuxer::visiblePriorityChanged, _ledDevice, &LedDevice::visiblePriorityChanged, Qt::QueuedConnection);
connect(_ledDevice, &LedDevice::enableStateChanged, this, &LedDeviceWrapper::handleInternalEnableState, Qt::QueuedConnection);
// start the thread
thread->start();
@ -142,9 +143,17 @@ void LedDeviceWrapper::handleInternalEnableState(bool newState)
void LedDeviceWrapper::stopDeviceThread()
{
// turns the leds off
_ledDevice->switchOff();
// get current thread
QThread* oldThread = _ledDevice->thread();
delete _ledDevice; // fast desctruction
oldThread->quit(); // non blocking
disconnect(oldThread, 0, 0, 0);
oldThread->quit();
oldThread->wait();
delete oldThread;
disconnect(_ledDevice, 0, 0, 0);
delete _ledDevice;
_ledDevice = nullptr;
}

View File

@ -5,17 +5,17 @@ static const unsigned OPC_SET_PIXELS = 0; // OPC command codes
static const unsigned OPC_SYS_EX = 255; // OPC command codes
static const unsigned OPC_HEADER_SIZE = 4; // OPC header size
LedDeviceFadeCandy::LedDeviceFadeCandy(const QJsonObject &deviceConfig)
: LedDevice()
, _client(nullptr)
{
_deviceReady = init(deviceConfig);
_client = new QTcpSocket(this);
}
LedDeviceFadeCandy::~LedDeviceFadeCandy()
{
_client.close();
_client->close();
}
LedDevice* LedDeviceFadeCandy::construct(const QJsonObject &deviceConfig)
@ -23,10 +23,9 @@ LedDevice* LedDeviceFadeCandy::construct(const QJsonObject &deviceConfig)
return new LedDeviceFadeCandy(deviceConfig);
}
bool LedDeviceFadeCandy::init(const QJsonObject &deviceConfig)
{
_client.close();
LedDevice::init(deviceConfig);
if (_ledCount > MAX_NUM_LEDS)
{
@ -67,15 +66,14 @@ bool LedDeviceFadeCandy::init(const QJsonObject &deviceConfig)
bool LedDeviceFadeCandy::isConnected()
{
return _client.state() == QAbstractSocket::ConnectedState;
return _client->state() == QAbstractSocket::ConnectedState;
}
bool LedDeviceFadeCandy::tryConnect()
{
if ( _client.state() == QAbstractSocket::UnconnectedState ) {
_client.connectToHost( _host, _port);
if ( _client.waitForConnected(1000) )
if ( _client->state() == QAbstractSocket::UnconnectedState ) {
_client->connectToHost( _host, _port);
if ( _client->waitForConnected(1000) )
{
Info(_log,"fadecandy/opc: connected to %s:%i on channel %i", QSTRING_CSTR(_host), _port, _channel);
if (_setFcConfig)
@ -88,7 +86,6 @@ bool LedDeviceFadeCandy::tryConnect()
return isConnected();
}
int LedDeviceFadeCandy::write( const std::vector<ColorRgb> & ledValues )
{
uint idx = OPC_HEADER_SIZE;
@ -103,11 +100,11 @@ int LedDeviceFadeCandy::write( const std::vector<ColorRgb> & ledValues )
return ( transferData()<0 ? -1 : 0 );
}
int LedDeviceFadeCandy::transferData()
{
if (LedDevice::enabled())
if ( isConnected() || tryConnect() )
return _client.write( _opc_data, _opc_data.size() );
return _client->write( _opc_data, _opc_data.size() );
return -2;
}
@ -131,7 +128,7 @@ int LedDeviceFadeCandy::sendSysEx(uint8_t systemId, uint8_t commandId, QByteArra
sysExData += msg;
return _client.write( sysExData, sysExData.size() );
return _client->write( sysExData, sysExData.size() );
}
return -1;
}

View File

@ -56,6 +56,7 @@ public:
/// @return true if success
bool init(const QJsonObject &deviceConfig);
private:
///
/// Writes the led color values to the led-device
///
@ -64,8 +65,8 @@ public:
///
virtual int write(const std::vector<ColorRgb>& ledValues);
private:
QTcpSocket _client;
protected:
QTcpSocket* _client;
QString _host;
uint16_t _port;
unsigned _channel;

View File

@ -125,7 +125,7 @@ float CiColor::getDistanceBetweenTwoPoints(CiColor p1, CiColor p2)
PhilipsHueBridge::PhilipsHueBridge(Logger* log, QString host, QString username)
: QObject()
, log(log)
, _log(log)
, host(host)
, username(username)
{
@ -141,12 +141,12 @@ void PhilipsHueBridge::bConnect(void)
{
if(username.isEmpty() || host.isEmpty())
{
Error(log,"Username or IP Address is empty!");
Error(_log,"Username or IP Address is empty!");
}
else
{
QString url = QString("http://%1/api/%2").arg(host).arg(username);
Debug(log, "Connect to bridge %s", QSTRING_CSTR(url));
Debug(_log, "Connect to bridge %s", QSTRING_CSTR(url));
QNetworkRequest request(url);
manager.get(request);
@ -164,13 +164,13 @@ void PhilipsHueBridge::resolveReply(QNetworkReply* reply)
QJsonDocument doc = QJsonDocument::fromJson(response, &error);
if (error.error != QJsonParseError::NoError)
{
Error(log, "Got invalid response from bridge");
Error(_log, "Got invalid response from bridge");
return;
}
// check for authorization
if(doc.isArray())
{
Error(log, "Authorization failed, username invalid");
Error(_log, "Authorization failed, username invalid");
return;
}
@ -178,7 +178,7 @@ void PhilipsHueBridge::resolveReply(QNetworkReply* reply)
if(obj.isEmpty())
{
Error(log, "Bridge has no registered bulbs/stripes");
Error(_log, "Bridge has no registered bulbs/stripes");
return;
}
@ -193,7 +193,7 @@ void PhilipsHueBridge::resolveReply(QNetworkReply* reply)
}
else
{
Error(log,"Network Error: %s", QSTRING_CSTR(reply->errorString()));
Error(_log,"Network Error: %s", QSTRING_CSTR(reply->errorString()));
bTimer.start();
}
}
@ -202,7 +202,7 @@ void PhilipsHueBridge::resolveReply(QNetworkReply* reply)
void PhilipsHueBridge::post(QString route, QString content)
{
//Debug(log, "Post %s: %s", QSTRING_CSTR(QString("http://IP/api/USR/%1").arg(route)), QSTRING_CSTR(content));
//Debug(_log, "Post %s: %s", QSTRING_CSTR(QString("http://IP/api/USR/%1").arg(route)), QSTRING_CSTR(content));
QNetworkRequest request(QString("http://%1/api/%2/%3").arg(host).arg(username).arg(route));
manager.put(request, content.toLatin1());
@ -216,14 +216,14 @@ const std::set<QString> PhilipsHueLight::GAMUT_C_MODEL_IDS =
{ "LLC020", "LST002", "LCT011", "LCT012", "LCT010", "LCT014", "LCT015", "LCT016", "LCT024" };
PhilipsHueLight::PhilipsHueLight(Logger* log, PhilipsHueBridge* bridge, unsigned int id, QJsonObject values)
: log(log)
: _log(log)
, bridge(bridge)
, id(id)
{
// Get state object values which are subject to change.
if (!values["state"].toObject().contains("on"))
{
Error(log, "Got invalid state object from light ID %d", id);
Error(_log, "Got invalid state object from light ID %d", id);
}
QJsonObject state;
state["on"] = values["state"].toObject()["on"];
@ -248,7 +248,7 @@ PhilipsHueLight::PhilipsHueLight(Logger* log, PhilipsHueBridge* bridge, unsigned
// Find id in the sets and set the appropriate color space.
if (GAMUT_A_MODEL_IDS.find(modelId) != GAMUT_A_MODEL_IDS.end())
{
Debug(log, "Recognized model id %s of light ID %d as gamut A", modelId.toStdString().c_str(), id);
Debug(_log, "Recognized model id %s of light ID %d as gamut A", modelId.toStdString().c_str(), id);
colorSpace.red =
{ 0.704f, 0.296f};
colorSpace.green =
@ -258,7 +258,7 @@ PhilipsHueLight::PhilipsHueLight(Logger* log, PhilipsHueBridge* bridge, unsigned
}
else if (GAMUT_B_MODEL_IDS.find(modelId) != GAMUT_B_MODEL_IDS.end())
{
Debug(log, "Recognized model id %s of light ID %d as gamut B", modelId.toStdString().c_str(), id);
Debug(_log, "Recognized model id %s of light ID %d as gamut B", modelId.toStdString().c_str(), id);
colorSpace.red =
{ 0.675f, 0.322f};
colorSpace.green =
@ -268,7 +268,7 @@ PhilipsHueLight::PhilipsHueLight(Logger* log, PhilipsHueBridge* bridge, unsigned
}
else if (GAMUT_C_MODEL_IDS.find(modelId) != GAMUT_C_MODEL_IDS.end())
{
Debug(log, "Recognized model id %s of light ID %d as gamut C", modelId.toStdString().c_str(), id);
Debug(_log, "Recognized model id %s of light ID %d as gamut C", modelId.toStdString().c_str(), id);
colorSpace.red =
{ 0.6915f, 0.3083f};
colorSpace.green =
@ -278,7 +278,7 @@ PhilipsHueLight::PhilipsHueLight(Logger* log, PhilipsHueBridge* bridge, unsigned
}
else
{
Warning(log, "Did not recognize model id %s of light ID %d", modelId.toStdString().c_str(), id);
Warning(_log, "Did not recognize model id %s of light ID %d", modelId.toStdString().c_str(), id);
colorSpace.red =
{ 1.0f, 0.0f};
colorSpace.green =
@ -287,7 +287,7 @@ PhilipsHueLight::PhilipsHueLight(Logger* log, PhilipsHueBridge* bridge, unsigned
{ 0.0f, 0.0f};
}
Info(log,"Light ID %d created", id);
Info(_log,"Light ID %d created", id);
}
PhilipsHueLight::~PhilipsHueLight()

View File

@ -92,7 +92,7 @@ class PhilipsHueBridge : public QObject
Q_OBJECT
private:
Logger* log;
Logger* _log;
/// QNetworkAccessManager for sending requests.
QNetworkAccessManager manager;
/// Ip address of the bridge
@ -138,7 +138,7 @@ public:
class PhilipsHueLight
{
private:
Logger* log;
Logger* _log;
PhilipsHueBridge* bridge;
/// light id
unsigned int id;

View File

@ -41,7 +41,7 @@ public:
protected:
///
/// Writes the given bytes/bits to the SPI-device and sleeps the latch time to ensure that the
/// Writes the given bytes/bits to the UDP-device and sleeps the latch time to ensure that the
/// values are latched.
///
/// @param[in] size The length of the data

View File

@ -77,6 +77,7 @@
"gamma" : {
"type" : "number",
"title" : "edt_dev_spec_gamma_title",
"default": 1.0,
"minimum" : 0.1,
"maximum": 5.0,
"options": {

View File

@ -75,6 +75,7 @@ HyperionDaemon::HyperionDaemon(QString configFile, const QString rootPath, QObje
qRegisterMetaType<settings::type>("settings::type");
qRegisterMetaType<VideoMode>("VideoMode");
qRegisterMetaType<QMap<quint8,QJsonObject>>("QMap<quint8,QJsonObject>");
qRegisterMetaType<std::vector<ColorRgb>>("std::vector<ColorRgb>");
// init settings
_settingsManager = new SettingsManager(0,configFile);

View File

@ -10,7 +10,7 @@ ENDMACRO()
if(ENABLE_SPIDEV)
# Add the simple test executable 'TestSpi'
add_executable(test_spi TestSpi.cpp)
link_to_hyperion(test_spi)
target_link_libraries( test_spi leddevice hyperion-utils hyperion )
add_executable(spidev_test spidev_test.c)
add_executable(gpio2spi switchPinCtrl.c)
endif(ENABLE_SPIDEV)
@ -21,19 +21,9 @@ link_to_hyperion(test_configfile)
add_executable(test_ImageRgb TestRgbImage.cpp)
link_to_hyperion(test_ImageRgb)
add_executable(test_image2ledsmap TestImage2LedsMap.cpp)
link_to_hyperion(test_image2ledsmap)
if (ENABLE_DISPMANX)
add_subdirectory(dispmanx2png)
endif (ENABLE_DISPMANX)
add_executable(test_blackborderdetector TestBlackBorderDetector.cpp)
link_to_hyperion(test_blackborderdetector)
add_executable(test_blackborderprocessor TestBlackBorderProcessor.cpp)
link_to_hyperion(test_blackborderprocessor)
add_executable(test_qregexp TestQRegExp.cpp)
target_link_libraries(test_qregexp Qt5::Widgets)
@ -45,3 +35,17 @@ if(ENABLE_X11)
add_executable(test_x11performance TestX11Performance.cpp)
target_link_libraries(test_x11performance ${X11_LIBRARIES} Qt5::Widgets)
endif(ENABLE_X11)
######### These tests are broken. May they fix someone ##########
# add_executable(test_image2ledsmap TestImage2LedsMap.cpp)
# link_to_hyperion(test_image2ledsmap)
# if (ENABLE_DISPMANX)
# add_subdirectory(dispmanx2png)
# endif (ENABLE_DISPMANX)
# add_executable(test_blackborderprocessor TestBlackBorderProcessor.cpp)
# link_to_hyperion(test_blackborderprocessor)
###################################################

View File

@ -53,6 +53,7 @@ int TC_NO_BORDER()
std::cerr << "Failed to correctly detect no border" << std::endl;
result = -1;
}
else std::cout << "Correctly detected no border" << std::endl;
}
return result;
@ -67,11 +68,12 @@ int TC_TOP_BORDER()
{
Image<ColorRgb> image = createImage(64, 64, 12, 0);
BlackBorder border = detector.process(image);
if (border.unknown != false && border.horizontalSize != 12 && border.verticalSize != 0)
if (border.unknown != false && border.horizontalSize == 12 && border.verticalSize != 0)
{
std::cerr << "Failed to correctly detect horizontal border with correct size" << std::endl;
result = -1;
}
else std::cout << "Correctly detected horizontal border with correct size" << std::endl;
}
return result;
@ -86,11 +88,12 @@ int TC_LEFT_BORDER()
{
Image<ColorRgb> image = createImage(64, 64, 0, 12);
BlackBorder border = detector.process(image);
if (border.unknown != false && border.horizontalSize != 0 && border.verticalSize != 12)
if (border.unknown != false && border.horizontalSize != 0 && border.verticalSize == 12)
{
std::cerr << "Failed to detected vertical border with correct size" << std::endl;
std::cerr << "Failed to correctly detect vertical border with correct size" << std::endl;
result = -1;
}
else std::cout << "Correctly detected vertical border with correct size" << std::endl;
}
return result;
@ -105,11 +108,12 @@ int TC_DUAL_BORDER()
{
Image<ColorRgb> image = createImage(64, 64, 12, 12);
BlackBorder border = detector.process(image);
if (border.unknown != false && border.horizontalSize != 12 && border.verticalSize != 12)
if (border.unknown != false && border.horizontalSize == 12 && border.verticalSize == 12)
{
std::cerr << "Failed to detected two-sided border" << std::endl;
std::cerr << "Failed to correctly detect two-sided border" << std::endl;
result = -1;
}
else std::cout << "Correctly detected two-sided border" << std::endl;
}
return result;
}
@ -125,9 +129,10 @@ int TC_UNKNOWN_BORDER()
BlackBorder border = detector.process(image);
if (border.unknown != true)
{
std::cerr << "Failed to detected unknown border" << std::endl;
std::cerr << "Failed to correctly detect unknown border" << std::endl;
result = -1;
}
else std::cout << "Correctly detected unknown border" << std::endl;
}
return result;
}

View File

@ -83,6 +83,7 @@ int main(int argc, char** argv)
QString configFile;
if (option == "--ac" || option == "--ac-ignore-required")
{
if (argc > 2)
configFile = argv[2];
else
@ -90,8 +91,8 @@ int main(int argc, char** argv)
usage();
return 0;
}
else
configFile = argv[1];
}
else configFile = argv[1];
qDebug() << "Configuration file selected: " << configFile;
qDebug() << "Attemp to load...";

View File

@ -8,6 +8,7 @@
#include <QPixmap>
#include <QFile>
#include <QRgb>
#include <QScreen>
#include <QElapsedTimer>
@ -18,10 +19,11 @@
void createScreenshot(const int cropHorizontal, const int cropVertical, const int decimation, Image<ColorRgb> & image)
{
// Create the full size screenshot
const QRect screenSize = QApplication::desktop()->screenGeometry();
QScreen *screen = QApplication::primaryScreen();
const QRect screenSize = screen->availableGeometry();
const int croppedWidth = screenSize.width() - 2*cropVertical;
const int croppedHeight = screenSize.height() - 2*cropHorizontal;
const QPixmap fullSizeScreenshot = QPixmap::grabWindow(QApplication::desktop()->winId(), cropVertical, cropHorizontal, croppedWidth, croppedHeight);
const QPixmap fullSizeScreenshot = screen->grabWindow(QApplication::desktop()->winId(), cropVertical, cropHorizontal, croppedWidth, croppedHeight);
// Scale the screenshot to the required size
const int width = fullSizeScreenshot.width()/decimation;

View File

@ -3,6 +3,9 @@ IF ( "${PLATFORM}" MATCHES rpi)
# Find the BCM-package (VC control)
find_package(Qt5Widgets REQUIRED)
find_package(BCM REQUIRED)
include_directories(${BCM_INCLUDE_DIRS})
add_definitions(${QT_DEFINITIONS})
link_directories(${CMAKE_FIND_ROOT_PATH}/lib/arm-linux-gnueabihf)

View File

@ -0,0 +1,14 @@
#!/usr/bin/env python
import json, sys
retval = 0
with open(sys.argv[1]) as f:
if len(sys.argv) < 3:
data = json.load(f)
sys.stdout.write(data['versionnr'])
sys.exit(0)
else:
data = json.load(f)
sys.stdout.write(data['channel'])
sys.exit(0)

View File

@ -1,11 +1,12 @@
#!/bin/bash
[ "${BUILD_TYPE}" == "Release" ] && exit 0
STATS_FAILED=0
STATS_SUCCESS=0
STATS_SKIPPED=0
STATS_TOTAL=0
# exec_test "test name" test_exec --with --args
function exec_test()
{
@ -33,7 +34,9 @@ function exec_test()
}
######################################
## EXEC TESTS
############# EXEC TESTS #############
######################################
cd build || exit 1
echo
@ -41,7 +44,7 @@ echo "Hyperion test execution"
echo
exec_test "hyperiond is executable and show version" bin/hyperiond --version
for cfg in ../config/*json*
for cfg in ../config/*json.default
do
exec_test "test $(basename $cfg)" bin/test_configfile $cfg
done