Skip to content

Commit

Permalink
Implement ftdi led device
Browse files Browse the repository at this point in the history
  • Loading branch information
nurikk-sa committed Apr 13, 2023
1 parent 2f09f9a commit 26a5e9c
Show file tree
Hide file tree
Showing 14 changed files with 454 additions and 118 deletions.
2 changes: 1 addition & 1 deletion .ci/ci_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ function installAndUpgrade()
if [[ $CI_NAME == 'osx' || $CI_NAME == 'darwin' ]]; then
echo "Install dependencies"
brew update
dependencies=("qt5" "python" "libusb" "cmake" "doxygen")
dependencies=("qt5" "python" "libusb" "cmake" "doxygen", "libftdi")
installAndUpgrade "${dependencies[@]}"
fi
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
if: ${{ matrix.language == 'cpp' }}
run: |
sudo apt-get update
sudo apt-get install --yes git cmake build-essential qtbase5-dev libqt5serialport5-dev libqt5sql5-sqlite libqt5svg5-dev libqt5x11extras5-dev libusb-1.0-0-dev python3-dev libcec-dev libxcb-image0-dev libxcb-util0-dev libxcb-shm0-dev libxcb-render0-dev libxcb-randr0-dev libxrandr-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev libasound2-dev libturbojpeg0-dev libjpeg-dev libssl-dev
sudo apt-get install --yes git cmake build-essential qtbase5-dev libqt5serialport5-dev libqt5sql5-sqlite libqt5svg5-dev libqt5x11extras5-dev libusb-1.0-0-dev python3-dev libcec-dev libxcb-image0-dev libxcb-util0-dev libxcb-shm0-dev libxcb-render0-dev libxcb-randr0-dev libxrandr-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev libasound2-dev libturbojpeg0-dev libjpeg-dev libssl-dev libftdi1-dev
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
Expand Down
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ SET ( DEFAULT_DEV_SPI OFF )
SET ( DEFAULT_DEV_TINKERFORGE OFF )
SET ( DEFAULT_DEV_USB_HID OFF )
SET ( DEFAULT_DEV_WS281XPWM OFF )
SET ( DEFAULT_DEV_FTDI ON )

# Services
SET ( DEFAULT_EFFECTENGINE ON )
Expand Down Expand Up @@ -117,6 +118,7 @@ IF ( ${CMAKE_SYSTEM} MATCHES "Linux" )
ELSEIF ( WIN32 )
SET ( DEFAULT_DX ON )
SET ( DEFAULT_MF ON )
SET ( DEFAULT_DEV_FTDI OFF )
ELSE()
SET ( DEFAULT_FB OFF )
SET ( DEFAULT_V4L2 OFF )
Expand Down Expand Up @@ -341,6 +343,9 @@ message(STATUS "ENABLE_DEV_USB_HID = ${ENABLE_DEV_USB_HID}")
option(ENABLE_DEV_WS281XPWM "Enable the WS281x-PWM device" ${DEFAULT_DEV_WS281XPWM} )
message(STATUS "ENABLE_DEV_WS281XPWM = ${ENABLE_DEV_WS281XPWM}")

option(ENABLE_DEV_FTDI "Enable the FTDI devices" ${DEFAULT_DEV_FTDI} )
message(STATUS "ENABLE_DEV_FTDI = ${ENABLE_DEV_FTDI}")

removeIndent()

message(STATUS "Services options:")
Expand Down
5 changes: 4 additions & 1 deletion HyperionConfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,12 @@
// Define to enable the Serial devices
#cmakedefine ENABLE_DEV_SERIAL

// Define to enable the SPI devices
// Define to enable the SPI spidev devices
#cmakedefine ENABLE_DEV_SPI

// Define to enable the SPI ftdi devices
#cmakedefine ENABLE_DEV_FTDI

// Define to enable the Tinkerforge devices
#cmakedefine ENABLE_DEV_TINKERFORGE

Expand Down
8 changes: 7 additions & 1 deletion assets/webconfig/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
"conf_leds_note_layout_overwrite": "Note: Overwrite creates a default layout for {{plural:$1| one LED| all $1 LEDs}} given by the hardware LED count",
"conf_leds_optgroup_RPiGPIO": "RPi GPIO",
"conf_leds_optgroup_RPiPWM": "RPi PWM",
"conf_leds_optgroup_RPiSPI": "RPi SPI",
"conf_leds_optgroup_RPiSPI": "SPI",
"conf_leds_optgroup_debug": "Debug",
"conf_leds_optgroup_network": "Network",
"conf_leds_optgroup_other": "Other",
Expand Down Expand Up @@ -567,6 +567,11 @@
"edt_dev_enum_sub_min_cool_adjust": "Subtract cool white",
"edt_dev_enum_sub_min_warm_adjust": "Subtract warm white",
"edt_dev_enum_subtract_minimum": "Subtract minimum",
"edt_dev_enum_cold_white": "Cold white",
"edt_dev_enum_neutral_white": "Neutral white",
"edt_dev_enum_auto": "Auto",
"edt_dev_enum_auto_max": "Auto max",
"edt_dev_enum_auto_accurate": "Auto accurate",
"edt_dev_enum_white_off": "White off",
"edt_dev_general_autostart_title": "Autostart",
"edt_dev_general_autostart_title_info": "The LED device is switched-on during startup or not",
Expand Down Expand Up @@ -665,6 +670,7 @@
"edt_dev_spec_segmentsOverlapValidation_error": "Correct the WLED setup! The segment must not overlap with {{plural:$1| segment|segments}}: \"$2\".",
"edt_dev_spec_serial_title": "Serial number",
"edt_dev_spec_spipath_title": "SPI Device",
"edt_dev_spec_implementation_title": "SPI Implementation",
"edt_dev_spec_sslHSTimeoutMax_title": "Streamer handshake timeout maximum",
"edt_dev_spec_sslHSTimeoutMin_title": "Streamer handshake timeout minimum",
"edt_dev_spec_stayOnAfterStreaming_title": "Stay on after streaming",
Expand Down
10 changes: 9 additions & 1 deletion assets/webconfig/js/content_leds.js
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,15 @@ $(document).ready(function () {
});

hwLedCountDefault = 1;
colorOrderDefault = "rgb";

switch (ledType) {
case "sk6812spi":
colorOrderDefault = "grb";
break;
default:
colorOrderDefault = "rgb";
}

break;

case "philipshue":
Expand Down
8 changes: 4 additions & 4 deletions doc/development/CompileHowto.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ cd $HYPERION_HOME

```console
sudo apt-get update
sudo apt-get install git cmake build-essential qtbase5-dev libqt5serialport5-dev libqt5sql5-sqlite libqt5svg5-dev libqt5x11extras5-dev libusb-1.0-0-dev python3-dev libasound2-dev libturbojpeg0-dev libjpeg-dev libssl-dev
sudo apt-get install git cmake build-essential qtbase5-dev libqt5serialport5-dev libqt5sql5-sqlite libqt5svg5-dev libqt5x11extras5-dev libusb-1.0-0-dev python3-dev libasound2-dev libturbojpeg0-dev libjpeg-dev libssl-dev libftdi1-dev
```

**Ubuntu (22.04+) - Qt6 based**

```console
sudo apt-get update
sudo apt-get install git cmake build-essential qt6-base-dev libqt6serialport6-dev libvulkan-dev libgl1-mesa-dev libusb-1.0-0-dev python3-dev libasound2-dev libturbojpeg0-dev libjpeg-dev libssl-dev pkg-config
sudo apt-get install git cmake build-essential qt6-base-dev libqt6serialport6-dev libvulkan-dev libgl1-mesa-dev libusb-1.0-0-dev python3-dev libasound2-dev libturbojpeg0-dev libjpeg-dev libssl-dev pkg-config libftdi1-dev
```

**For Linux X11/XCB grabber support**
Expand Down Expand Up @@ -136,7 +136,7 @@ See [AUR](https://aur.archlinux.org/packages/?O=0&SeB=nd&K=hyperion&outdated=&SB
The following dependencies are needed to build hyperion.ng on fedora.
```console
sudo dnf -y groupinstall "Development Tools"
sudo dnf install python3-devel qt-devel qt5-qtbase-devel qt5-qtserialport-devel xrandr xcb-util-image-devel qt5-qtx11extras-devel alsa-lib-devel turbojpeg-devel libusb-devel xcb-util-devel dbus-devel openssl-devel fedora-packager rpmdevtools gcc libcec-devel
sudo dnf install python3-devel qt-devel qt5-qtbase-devel qt5-qtserialport-devel xrandr xcb-util-image-devel qt5-qtx11extras-devel alsa-lib-devel turbojpeg-devel libusb-devel xcb-util-devel dbus-devel openssl-devel fedora-packager rpmdevtools gcc libcec-devel libftdi1-dev
```
After installing the dependencies, you can continue with the compile instructions later on this page (the more detailed way..).

Expand All @@ -145,7 +145,7 @@ To install on OS X you either need Homebrew or Macport but Homebrew is the recom

First you need to install the dependencies:
```console
brew install qt5 python3 cmake libusb doxygen
brew install qt5 python3 cmake libusb doxygen libftdi
```

## Windows
Expand Down
7 changes: 6 additions & 1 deletion include/utils/RgbToRgbw.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ namespace RGBW {
SUBTRACT_MINIMUM,
SUB_MIN_WARM_ADJUST,
SUB_MIN_COOL_ADJUST,
WHITE_OFF
WHITE_OFF,
COLD_WHITE,
NEUTRAL_WHITE,
AUTO,
AUTO_MAX,
AUTO_ACCURATE
};

WhiteAlgorithm stringToWhiteAlgorithm(const QString& str);
Expand Down
9 changes: 8 additions & 1 deletion libsrc/leddevice/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ if ( ENABLE_DEV_SERIAL )
FILE ( GLOB Leddevice_SERIAL_SOURCES "${CURRENT_SOURCE_DIR}/dev_serial/*.h" "${CURRENT_SOURCE_DIR}/dev_serial/*.cpp")
endif()

if ( ENABLE_DEV_SPI )
if ( ENABLE_DEV_SPI OR ENABLE_DEV_FTDI )
FILE ( GLOB Leddevice_SPI_SOURCES "${CURRENT_SOURCE_DIR}/dev_spi/*.h" "${CURRENT_SOURCE_DIR}/dev_spi/*.cpp")
endif()

Expand Down Expand Up @@ -164,3 +164,10 @@ if(ENABLE_MDNS)
target_link_libraries(leddevice mdns)
endif()

if( ENABLE_DEV_FTDI )
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIB_FTDI REQUIRED IMPORTED_TARGET libftdi1 )
target_include_directories(leddevice PRIVATE PkgConfig::LIB_FTDI)
target_link_libraries(leddevice PkgConfig::LIB_FTDI)
endif()

Loading

0 comments on commit 26a5e9c

Please sign in to comment.