@@ -18,7 +18,8 @@ var bottomRight2bottomLeft = null;
1818var bottomLeft2topLeft = null ;
1919var toggleKeystoneCorrectionArea = false ;
2020
21- var devRPiSPI = [ 'apa102' , 'apa104' , 'ws2801' , 'lpd6803' , 'lpd8806' , 'p9813' , 'sk6812spi' , 'sk6822spi' , 'sk9822' , 'ws2812spi' ] ;
21+ var devSPI = [ 'apa102' , 'apa104' , 'ws2801' , 'lpd6803' , 'lpd8806' , 'p9813' , 'sk6812spi' , 'sk6822spi' , 'sk9822' , 'ws2812spi' ] ;
22+ var devFTDI = [ 'apa102_ftdi' , 'sk6812_ftdi' , 'ws2812_ftdi' ] ;
2223var devRPiPWM = [ 'ws281x' ] ;
2324var devRPiGPIO = [ 'piblaster' ] ;
2425var devNET = [ 'atmoorb' , 'cololight' , 'fadecandy' , 'philipshue' , 'nanoleaf' , 'razer' , 'tinkerforge' , 'tpm2net' , 'udpe131' , 'udpartnet' , 'udpddp' , 'udph801' , 'udpraw' , 'wled' , 'yeelight' ] ;
@@ -1121,6 +1122,12 @@ $(document).ready(function () {
11211122 case "karate" :
11221123 case "sedu" :
11231124 case "tpm2" :
1125+
1126+ //FTDI devices
1127+ case "apa102_ftdi" :
1128+ case "sk6812_ftdi" :
1129+ case "ws2812_ftdi" :
1130+
11241131 if ( storedAccess === 'expert' ) {
11251132 filter . discoverAll = true ;
11261133 }
@@ -1139,6 +1146,7 @@ $(document).ready(function () {
11391146 . catch ( error => {
11401147 showNotification ( 'danger' , "Device discovery for " + ledType + " failed with error:" + error ) ;
11411148 } ) ;
1149+
11421150 break ;
11431151
11441152 case "philipshue" : {
@@ -1441,6 +1449,9 @@ $(document).ready(function () {
14411449 case "sk9822" :
14421450 case "ws2812spi" :
14431451 case "piblaster" :
1452+ case "apa102_ftdi" :
1453+ case "sk6812_ftdi" :
1454+ case "ws2812_ftdi" :
14441455 default :
14451456 }
14461457
@@ -1657,9 +1668,10 @@ $(document).ready(function () {
16571668 optArr [ 3 ] = [ ] ;
16581669 optArr [ 4 ] = [ ] ;
16591670 optArr [ 5 ] = [ ] ;
1671+ optArr [ 6 ] = [ ] ;
16601672
16611673 for ( var idx = 0 ; idx < ledDevices . length ; idx ++ ) {
1662- if ( $ . inArray ( ledDevices [ idx ] , devRPiSPI ) != - 1 )
1674+ if ( $ . inArray ( ledDevices [ idx ] , devSPI ) != - 1 )
16631675 optArr [ 0 ] . push ( ledDevices [ idx ] ) ;
16641676 else if ( $ . inArray ( ledDevices [ idx ] , devRPiPWM ) != - 1 )
16651677 optArr [ 1 ] . push ( ledDevices [ idx ] ) ;
@@ -1671,18 +1683,23 @@ $(document).ready(function () {
16711683 optArr [ 4 ] . push ( ledDevices [ idx ] ) ;
16721684 else if ( $ . inArray ( ledDevices [ idx ] , devHID ) != - 1 )
16731685 optArr [ 4 ] . push ( ledDevices [ idx ] ) ;
1686+ else if ( ledDevices [ idx ] . endsWith ( "_ftdi" ) ) {
1687+ var title = ledDevices [ idx ] . replace ( '_ftdi' , '' ) ;
1688+ optArr [ 5 ] . push ( ledDevices [ idx ] + ":" + title ) ;
1689+ }
16741690 else
1675- optArr [ 5 ] . push ( ledDevices [ idx ] ) ;
1691+ optArr [ 6 ] . push ( ledDevices [ idx ] ) ;
16761692 }
16771693
16781694 $ ( "#leddevices" ) . append ( createSel ( optArr [ 0 ] , $ . i18n ( 'conf_leds_optgroup_RPiSPI' ) ) ) ;
16791695 $ ( "#leddevices" ) . append ( createSel ( optArr [ 1 ] , $ . i18n ( 'conf_leds_optgroup_RPiPWM' ) ) ) ;
16801696 $ ( "#leddevices" ) . append ( createSel ( optArr [ 2 ] , $ . i18n ( 'conf_leds_optgroup_RPiGPIO' ) ) ) ;
16811697 $ ( "#leddevices" ) . append ( createSel ( optArr [ 3 ] , $ . i18n ( 'conf_leds_optgroup_network' ) ) ) ;
16821698 $ ( "#leddevices" ) . append ( createSel ( optArr [ 4 ] , $ . i18n ( 'conf_leds_optgroup_usb' ) ) ) ;
1699+ $ ( "#leddevices" ) . append ( createSel ( optArr [ 5 ] , $ . i18n ( 'conf_leds_optgroup_ftdi' ) , true ) ) ;
16831700
16841701 if ( storedAccess === 'expert' || window . serverConfig . device . type === "file" ) {
1685- $ ( "#leddevices" ) . append ( createSel ( optArr [ 5 ] , $ . i18n ( 'conf_leds_optgroup_other' ) ) ) ;
1702+ $ ( "#leddevices" ) . append ( createSel ( optArr [ 6 ] , $ . i18n ( 'conf_leds_optgroup_other' ) ) ) ;
16861703 }
16871704
16881705 $ ( "#leddevices" ) . val ( window . serverConfig . device . type ) ;
@@ -1886,6 +1903,9 @@ function saveLedConfig(genDefLayout = false) {
18861903 case "sk9822" :
18871904 case "ws2812spi" :
18881905 case "piblaster" :
1906+ case "apa102_ftdi" :
1907+ case "sk6812_ftdi" :
1908+ case "ws2812_ftdi" :
18891909 default :
18901910 if ( genDefLayout === true ) {
18911911 ledConfig = {
@@ -1938,8 +1958,10 @@ var updateOutputSelectList = function (ledType, discoveryInfo) {
19381958 ledTypeGroup = "devNET" ;
19391959 } else if ( $ . inArray ( ledType , devSerial ) != - 1 ) {
19401960 ledTypeGroup = "devSerial" ;
1941- } else if ( $ . inArray ( ledType , devRPiSPI ) != - 1 ) {
1942- ledTypeGroup = "devRPiSPI" ;
1961+ } else if ( $ . inArray ( ledType , devSPI ) != - 1 ) {
1962+ ledTypeGroup = "devSPI" ;
1963+ } else if ( $ . inArray ( ledType , devFTDI ) != - 1 ) {
1964+ ledTypeGroup = "devFTDI" ;
19431965 } else if ( $ . inArray ( ledType , devRPiGPIO ) != - 1 ) {
19441966 ledTypeGroup = "devRPiGPIO" ;
19451967 } else if ( $ . inArray ( ledType , devRPiPWM ) != - 1 ) {
@@ -2062,7 +2084,63 @@ var updateOutputSelectList = function (ledType, discoveryInfo) {
20622084 }
20632085 }
20642086 break ;
2065- case "devRPiSPI" :
2087+
2088+ case "devFTDI" :
2089+ key = "output" ;
2090+
2091+ if ( discoveryInfo . devices . length == 0 ) {
2092+ enumVals . push ( "NONE" ) ;
2093+ enumTitleVals . push ( $ . i18n ( 'edt_dev_spec_devices_discovered_none' ) ) ;
2094+ $ ( '#btn_submit_controller' ) . prop ( 'disabled' , true ) ;
2095+ showAllDeviceInputOptions ( key , false ) ;
2096+ }
2097+ else {
2098+ switch ( ledType ) {
2099+ case "ws2812_ftdi" :
2100+ case "sk6812_ftdi" :
2101+ case "apa102_ftdi" :
2102+ for ( const device of discoveryInfo . devices ) {
2103+ enumVals . push ( device . ftdiOpenString ) ;
2104+
2105+ var title = "FTDI" ;
2106+ if ( device . manufacturer ) {
2107+ title = device . manufacturer ;
2108+ }
2109+
2110+ if ( device . serialNumber ) {
2111+ title += " - " + device . serialNumber ;
2112+ }
2113+ title += " (" + device . vendorIdentifier + "|" + device . productIdentifier + ")" ;
2114+
2115+ if ( device . description ) {
2116+ title += " " + device . description ;
2117+ }
2118+
2119+ enumTitleVals . push ( title ) ;
2120+ }
2121+
2122+ // Select configured device
2123+ var configuredDeviceType = window . serverConfig . device . type ;
2124+ var configuredOutput = window . serverConfig . device . output ;
2125+ if ( ledType === configuredDeviceType ) {
2126+ if ( $ . inArray ( configuredOutput , enumVals ) != - 1 ) {
2127+ enumDefaultVal = configuredOutput ;
2128+ } else {
2129+ enumVals . push ( window . serverConfig . device . output ) ;
2130+ enumDefaultVal = configuredOutput ;
2131+ }
2132+ }
2133+ else {
2134+ addSelect = true ;
2135+ }
2136+
2137+ break ;
2138+ default :
2139+ }
2140+ }
2141+ break ;
2142+
2143+ case "devSPI" :
20662144 case "devRPiGPIO" :
20672145 key = "output" ;
20682146
@@ -2128,7 +2206,6 @@ var updateOutputSelectList = function (ledType, discoveryInfo) {
21282206async function discover_device ( ledType , params ) {
21292207
21302208 const result = await requestLedDeviceDiscovery ( ledType , params ) ;
2131-
21322209 var discoveryResult = { } ;
21332210 if ( result ) {
21342211 if ( result . error ) {
0 commit comments