"Fake TV" effect

Hi Aircoookie
Again - The WLED is one of the coolest projects I have seen for a long time…

I would very much like to have a “Fake TV” effect, it will harmonize perfect with HASSIO integration with WLEDs spread all around my house.

Vacation mode:
Sun below horizon: Lam ON
19:30 turn on WLED-living room - Effect “Fake TV”
22:10 turn on WLED-living room - Effect solid, low light

k.r. Niels

1 Like

Can’t you simply send the URL for a random effect you previously configured and saved as a preset for both situations? Preset 10 : Fake TV, Preset 11, Subdued steady light

I added this to the list of effects to add! This one is quite simple (set LEDs to a random, not very saturated color with a random delay), so it probably won’t take very long.

4 Likes

Hi Hyggy.
I Do not have any “Fake TV” effect :wink:

Of the 90+ effects built into WLED, are there none that with speed and color transition settings does not look like a TV (at least from outside the home)? Have you experimented any in the last week to see if anything you already have works and perhaps suggest to aircookie an effect coupled with specific settings that fairly approximate what you are requesting?

For example, if you found an effect (along with the settings) that is pretty close, post here so he has a starting point for what an effective Fake TV effect might feel like.

There are some arduino sketches doing something similar
https://forum.mysensors.org/topic/85/phoneytv-for-vera-is-here/14

probably just take the logic from that, and apply it to setting a percentage of the RGB leds to similar colors with a similar twitch…

This is currently outside the scope of what I have time to dive into, but I would like this effect too if anyone ever gets around to implementing it.

Took a stab at converting from PWM controlled analog RGB strip to addressable LED strip, which means it’s a pretty “dumb” strip effect if you are home watching it.

There should be much room for optimization and better use of existing code & variables to accomplish the same tasks noted in comments @Aircookie

/*
/* Simulates TV lighting effect (PhoneyTV) 
*/
uint16_t WS2812FX::mode_phoneytv(void) {
/*
 * Lights up all LEDs in one random color. Then switches them
 * to the next random color.  Simulates lighting effects similar
 * to what is seen (from outside the building) while TV is playing -- from PhoneyTV by Jim (BulldogLowell@gmail.com)
 *
 * Conversion from PWM analog LED control to addressable LED strip is a work-in-progress.
 */

  uint8_t twitch = 50;
  uint8_t dipInterval = 10;
  uint8_t darkTime = 250;
  
  uint16_t dipCount = 0;

  uint32_t currentMillis;
  uint32_t currentDipTime;
  uint32_t dipStartTime;
  uint32_t prevMillis = 0;
  uint32_t lightChangeInterval = 2000;
  bool timeToDip = false;
  bool phoneyTVstate = true;

  if (phoneyTVstate) { //
    color = BLUE;
    briT = 100;
    SEGMENT.color = fill(color);

    if (!timeToDip) {
      currentMillis = millis();
    }

    if (currentMillis - prevMillis > lightChangeInterval) {
      // time to adjust effect parameters
      previousMillis = currentMillis;
      lightChangeInterval = random(750, 4001); //Adjusts the interval for more/less frequent random light changes
      twitch = random(40, 100); 					     //twitch provides motion effect but can be a bit much if too high
      dipCount = dipCount++;
    }

    if (currentMillis - previousMillis < twitch) {
      // time to adjust entire strip color & brightness
      color.r = random(0,255);
      color.g = random(0,255);
      color.b = random(0,255);

      briT = random(50,255);
      fill(color);
      
      if (dipCount > dipInterval) timeToDip(true);
    }
  } else {
    currentDipTime = millis();

    if (currentDipTime - dipStartTime < darkTime) {
      briT = 0; // set strip to dark // setBrightness(0);
    } else {
      isItTimeToDip(false);
    }
  } else { phoneyTVstate = false
    if (phoneyTVstate != oldPhoneyTVstate) {
      briT =0; // set strip to dark // setBrightness(0);
    }
  }
  oldPhoneyTVstate = phoneyTVstate;
  return FRAMETIME;
}

void isItTimeToDip(bool dipTime) {
  timeToDip = dipTime;
  if (dipTime) {
    dipCount = 0;
    dipStartTime = millis();
    darkTime = random(50, 150);
    dipInterval = random(5, 250);
  }
}
3 Likes

This looks like a good starting point!
I’ll get something like it implemented soon :slight_smile:

2 Likes

Looking forward to the implementation :grin::+1:
Made my first OTA update today… no problem :+1:

I tried this today with the latest release of WLED and it had a ton of errors that I don’t know how to fix :slight_smile:

Some errors were obvious to fix, but then as the ones below are fixed, there were about 7 others that came up that I didn’t know how to fix.

Looking forward to getting this integrated though!

Processing d1_mini (board: d1_mini; platform: espressif8266@2.6.2; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/d1_mini.html
PLATFORM: Espressif 8266 (2.6.2) > WeMos D1 R2 and mini
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES:
 - framework-arduinoespressif8266 3.20704.7 (2.7.4) 
 - tool-esptool 1.413.0 (4.13)
 - tool-esptoolpy 1.30000.201119 (3.0.0)
 - toolchain-xtensa 2.40802.200502 (4.8.2)
Converting wled00.ino
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ strict
Library Manager: FastLED @ 3.3.2 is already installed
Library Manager: NeoPixelBus @ 2.6.0 is already installed
Library Manager: ESPAsyncTCP @ 1.2.0 is already installed
Library Manager: ESPAsyncUDP @ 0.0.0-alpha+sha.697c75a025 is already installed
Library Manager: AsyncTCP @ 1.0.3 is already installed
Library Manager: IRremoteESP8266 @ 2.7.3 is already installed        
Library Manager: Installing git+https://github.com/lorol/LITTLEFS.git
git version 2.28.0.windows.1
Cloning into 'C:\Users\pat\.platformio\.cache\tmp\pkg-installing-rabcyj9k'...
Library Manager: LittleFS_esp32 @ 1.0.5+sha.173cb86 has been installed!
Library Manager: Installing git+https://github.com/Aircoookie/ESPAsyncWebServer.git @ ~2.0.0
git version 2.28.0.windows.1
Cloning into 'C:\Users\pat\.platformio\.cache\tmp\pkg-installing-8e1nxe6e'...
Library Manager: ESP Async WebServer @ 2.0.0+sha.3336275 has been installed!
Library Manager: Installing dependencies...
Library Manager: ESPAsyncTCP @ 1.2.0 is already installed
Library Manager: AsyncTCP @ 1.0.3 is already installed
Found 35 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <FastLED> 3.3.2
|   |-- <SPI> 1.0
|   |-- <EspSoftwareSerial> 6.8.5
|-- <NeoPixelBus> 2.6.0
|   |-- <SPI> 1.0
|-- <ESPAsyncTCP> 1.2.0
|   |-- <ESP8266WiFi> 1.0
|-- <ESPAsyncUDP> 0.0.0-alpha+sha.697c75a025
|-- <IRremoteESP8266> 2.7.3
|-- <ESP Async WebServer> 2.0.0+sha.3336275
|   |-- <ESPAsyncTCP> 1.2.0
|   |   |-- <ESP8266WiFi> 1.0
|   |-- <Hash> 1.0
|   |-- <ESP8266WiFi> 1.0
|-- <ESP8266WiFi> 1.0
|-- <ESP8266WebServer> 1.0
|   |-- <ESP8266WiFi> 1.0
|-- <ArduinoOTA> 1.0
|   |-- <ESP8266WiFi> 1.0
|   |-- <ESP8266mDNS> 1.2
|   |   |-- <ESP8266WiFi> 1.0
|-- <DNSServer> 1.1.1
|   |-- <ESP8266WiFi> 1.0
|-- <EEPROM> 1.0
|-- <ESP8266mDNS> 1.2
|   |-- <ESP8266WiFi> 1.0
|-- <LittleFS(esp8266)> 0.1.0
Building in release mode
Retrieved `.pio\build\d1_mini\lib903\FastLED\FastLED.cpp.o' from cache
Retrieved `.pio\build\d1_mini\lib903\FastLED\bitswap.cpp.o' from cache
Retrieved `.pio\build\d1_mini\lib903\FastLED\colorpalettes.cpp.o' from cache
Retrieved `.pio\build\d1_mini\lib903\FastLED\colorutils.cpp.o' from cache
Retrieved `.pio\build\d1_mini\lib903\FastLED\hsv2rgb.cpp.o' from cache
Retrieved `.pio\build\d1_mini\lib903\FastLED\lib8tion.cpp.o' from cache
Retrieved `.pio\build\d1_mini\lib903\FastLED\noise.cpp.o' from cache
Retrieved `.pio\build\d1_mini\lib903\FastLED\platforms.cpp.o' from cache
Retrieved `.pio\build\d1_mini\lib903\FastLED\power_mgt.cpp.o' from cache
Retrieved `.pio\build\d1_mini\lib903\FastLED\wiring.cpp.o' from cache
Compiling .pio\build\d1_mini\src\FX.cpp.o
Compiling .pio\build\d1_mini\src\FX_fcn.cpp.o
Compiling .pio\build\d1_mini\src\alexa.cpp.o
Compiling .pio\build\d1_mini\src\blynk.cpp.o
Compiling .pio\build\d1_mini\src\button.cpp.o
Compiling .pio\build\d1_mini\src\cfg.cpp.o
Compiling .pio\build\d1_mini\src\colors.cpp.o
Compiling .pio\build\d1_mini\src\dmx.cpp.o
In file included from wled00\wled.h:74:0,
                 from wled00\button.cpp:1:
wled00\my_config.h:17:2: warning: #warning **** my_config.h: Settings from this file are honored **** [-Wcpp]
 #warning **** my_config.h: Settings from this file are honored ****
  ^
In file included from wled00\wled.h:74:0,
                 from wled00\cfg.cpp:1:
wled00\my_config.h:17:2: warning: #warning **** my_config.h: Settings from this file are honored **** [-Wcpp]
 #warning **** my_config.h: Settings from this file are honored ****
  ^
In file included from wled00\wled.h:74:0,
                 from wled00\colors.cpp:1:
wled00\my_config.h:17:2: warning: #warning **** my_config.h: Settings from this file are honored **** [-Wcpp]
 #warning **** my_config.h: Settings from this file are honored ****
  ^
In file included from wled00\wled.h:74:0,
                 from wled00\dmx.cpp:1:
wled00\my_config.h:17:2: warning: #warning **** my_config.h: Settings from this file are honored **** [-Wcpp]
 #warning **** my_config.h: Settings from this file are honored ****
  ^
In file included from wled00\wled.h:74:0,
                 from wled00\alexa.cpp:1:
wled00\my_config.h:17:2: warning: #warning **** my_config.h: Settings from this file are honored **** [-Wcpp]
 #warning **** my_config.h: Settings from this file are honored ****
  ^
In file included from wled00\wled.h:74:0,
                 from wled00\blynk.cpp:1:
wled00\my_config.h:17:2: warning: #warning **** my_config.h: Settings from this file are honored **** [-Wcpp]
 #warning **** my_config.h: Settings from this file are honored ****
  ^
wled00\FX.cpp:3734:38: error: no 'uint16_t WS2812FX::mode_phoneytv()' member function declared in class 'WS2812FX'
 uint16_t WS2812FX::mode_phoneytv(void) {
                                      ^
wled00\FX.cpp: In function 'void isItTimeToDip(bool)':
wled00\FX.cpp:3803:3: error: 'timeToDip' was not declared in this scope
   timeToDip = dipTime;
   ^
wled00\FX.cpp:3805:5: error: 'dipCount' was not declared in this scope
     dipCount = 0;
     ^
wled00\FX.cpp:3806:5: error: 'dipStartTime' was not declared in this scope
     dipStartTime = millis();
     ^
wled00\FX.cpp:3807:5: error: 'darkTime' was not declared in this scope
     darkTime = random(50, 150);
     ^
wled00\FX.cpp:3808:5: error: 'dipInterval' was not declared in this scope
     dipInterval = random(5, 250);
     ^
*** [.pio\build\d1_mini\src\FX.cpp.o] Error 1
FileNotFoundError: [WinError 2] The system cannot find the file specified: 'C:\\Users\\pat\\Desktop\\WLED-master\\.pio\\build\\d1_mini\\.sconsign37.dblite':
  File "C:\Users\pat\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\Main.py", line 1391:
    _exec_main(parser, values)
  File "C:\Users\pat\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\Main.py", line 1355:
    _main(parser)
  File "C:\Users\pat\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\Main.py", line 1126:
    nodes = _build_targets(fs, options, targets, target_top)
  File "C:\Users\pat\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\Main.py", line 1329:
    jobs.run(postfunc = jobs_postfunc)
  File "C:\Users\pat\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Job.py", line 113:
    postfunc()
  File "C:\Users\pat\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\Main.py", line 1326:
    SCons.SConsign.write()
  File "C:\Users\pat\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\SConsign.py", line 114:
    syncmethod()
  File "C:\Users\pat\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\dblite.py", line 144:
    self._os_unlink(self._file_name)
Exception ignored in: <function dblite.__del__ at 0x00000128F1970D38>
Traceback (most recent call last):
  File "C:\Users\pat\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\dblite.py", line 126, in __del__
  File "C:\Users\pat\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\dblite.py", line 123, in close
  File "C:\Users\pat\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\dblite.py", line 144, in sync
FileNotFoundError: [WinError 2] The system cannot find the file specified: 'C:\\Users\\pat\\Desktop\\WLED-master\\.pio\\build\\d1_mini\\.sconsign37.dblite'
=============================================================================================================================================== [FAILED] Took 15.52 seconds =============================================================================================================================================== 

Environment    Status    Duration
-------------  --------  ------------
d1_mini        FAILED    00:00:15.517
========================================================================================================================================== 1 failed, 0 succeeded in 00:00:15.517 ========================================================================================================================================== 
The terminal process "C:\Users\pat\.platformio\penv\Scripts\pio.exe 'run'" terminated with exit code: 1.

Did you get the latest WLED (0.11.0 master) to compile on its own without the fake tv changes inserted?

Oh sorry! I read your question wrong!

I was able to get it to compile yesterday, but I started with a fresh git pull and now I’m getting this error.

ompiling .pio\build\d1_mini\src\file.cpp.o
Assembler messages:
Fatal error: can't create .pio\build\d1_mini\src\dmx.cpp.o: No such file or directory
Assembler messages:
Compiling .pio\build\d1_mini\src\hue.cpp.o
Fatal error: can't create .pio\build\d1_mini\src\FX.cpp.o: No such file or directory
Assembler messages:
Fatal error: can't create .pio\build\d1_mini\src\colors.cpp.o: No such file or directory
Assembler messages:
Fatal error: can't create .pio\build\d1_mini\src\alexa.cpp.o: No such file or directory
*** [.pio\build\d1_mini\src\dmx.cpp.o] Error 1
*** [.pio\build\d1_mini\src\FX.cpp.o] Error 1
*** [.pio\build\d1_mini\src\alexa.cpp.o] Error 1
*** [.pio\build\d1_mini\src\colors.cpp.o] Error 1
In file included from wled00\wled.h:74:0,
                 from wled00\file.cpp:1:
wled00\my_config.h:17:2: warning: #warning **** my_config.h: Settings from this file are honored **** [-Wcpp]
 #warning **** my_config.h: Settings from this file are honored ****
  ^
In file included from wled00\wled.h:74:0,
                 from wled00\hue.cpp:1:
wled00\my_config.h:17:2: warning: #warning **** my_config.h: Settings from this file are honored **** [-Wcpp]
 #warning **** my_config.h: Settings from this file are honored ****
  ^
Assembler messages:
Fatal error: can't create .pio\build\d1_mini\src\cfg.cpp.o: No such file or directory
*** [.pio\build\d1_mini\src\cfg.cpp.o] Error 1
Assembler messages:
Fatal error: can't create .pio\build\d1_mini\src\e131.cpp.o: No such file or directory
*** [.pio\build\d1_mini\src\e131.cpp.o] Error 1
Assembler messages:
Fatal error: can't create .pio\build\d1_mini\src\file.cpp.o: No such file or directory
*** [.pio\build\d1_mini\src\file.cpp.o] Error 1
Assembler messages:
Fatal error: can't create .pio\build\d1_mini\src\hue.cpp.o: No such file or directory
*** [.pio\build\d1_mini\src\hue.cpp.o] Error 1
FileNotFoundError: [WinError 2] The system cannot find the file specified: 'C:\\Users\\pat\\Desktop\\WLED-master (1)\\WLED-master\\.pio\\build\\d1_mini\\.sconsign37.dblite':
  File "C:\Users\pat\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\Main.py", line 1391:
    _exec_main(parser, values)
  File "C:\Users\pat\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\Main.py", line 1355:
    _main(parser)
  File "C:\Users\pat\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\Main.py", line 1126:
    nodes = _build_targets(fs, options, targets, target_top)
  File "C:\Users\pat\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\Main.py", line 1329:
    jobs.run(postfunc = jobs_postfunc)
  File "C:\Users\pat\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Job.py", line 113:
    postfunc()
  File "C:\Users\pat\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\Main.py", line 1326:
    SCons.SConsign.write()
  File "C:\Users\pat\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\SConsign.py", line 114:
    syncmethod()
  File "C:\Users\pat\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\dblite.py", line 144:
    self._os_unlink(self._file_name)
Exception ignored in: <function dblite.__del__ at 0x00000267EAD60D38>
Traceback (most recent call last):
  File "C:\Users\pat\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\dblite.py", line 126, in __del__
  File "C:\Users\pat\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\dblite.py", line 123, in close
  File "C:\Users\pat\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\dblite.py", line 144, in sync
FileNotFoundError: [WinError 2] The system cannot find the file specified: 'C:\\Users\\pat\\Desktop\\WLED-master (1)\\WLED-master\\.pio\\build\\d1_mini\\.sconsign37.dblite'
=============================================================================================================================================== [FAILED] Took 12.78 seconds =============================================================================================================================================== 

Environment    Status    Duration
-------------  --------  ------------
d1_mini        FAILED    00:00:12.779

I’m not at all clear on what you are failing to compile.
What exactly did you change?
I never compiled my proposed effects code above. I proposed it simply as a first stab at it hoping someone else could move it forward and fully integrate it with WLED.

Hi!
When you get this error (FileNotFoundError: [WinError 2] The system cannot find the file specified: 'C:\\Users\\pat\\Desktop\\WLED-master (1)\\WLED-master\\.pio\\build\\d1_mini\\.sconsign37.dblite'), try compiling again.
It will usually work :slight_smile:

Ah, you’re right - compiling a 2nd time worked.

Here’s what I’m trying to do in the attached diff files.

Again, I’m new at this and just trying to help development any way I can.

Here’s the compiling error’s I’m getting.

wled00\my_config.h:17:2: warning: #warning **** my_config.h: Settings from this file are honored **** [-Wcpp]
 #warning **** my_config.h: Settings from this file are honored ****
  ^
In file included from wled00\FX.cpp:27:0:
wled00\FX.h:649:25: error: ISO C++ forbids declaration of 'mode_phoneytv' with no type [-fpermissive]
       mode_phoneytv(void);
                         ^
wled00\FX.h: In constructor 'WS2812FX::WS2812FX()':
wled00\FX.h:441:46: error: cannot convert 'int (WS2812FX::*)()' to 'WS2812FX::mode_ptr {aka short unsigned int (WS2812FX::*)()}' in assignment
       _mode[FX_MODE_PHONEYTV]                = &WS2812FX::mode_phoneytv;
                                              ^
In file included from wled00\wled.h:74:0,
                 from wled00\dmx.cpp:1:
wled00\my_config.h:17:2: warning: #warning **** my_config.h: Settings from this file are honored **** [-Wcpp]
 #warning **** my_config.h: Settings from this file are honored ****
  ^
In file included from wled00\wled.h:74:0,
                 from wled00\cfg.cpp:1:
wled00\my_config.h:17:2: warning: #warning **** my_config.h: Settings from this file are honored **** [-Wcpp]
 #warning **** my_config.h: Settings from this file are honored ****
  ^
In file included from wled00\FX_fcn.cpp:27:0:
wled00\FX.h:649:25: error: ISO C++ forbids declaration of 'mode_phoneytv' with no type [-fpermissive]
       mode_phoneytv(void);
                         ^
In file included from wled00\wled.h:74:0,
                 from wled00\colors.cpp:1:
wled00\my_config.h:17:2: warning: #warning **** my_config.h: Settings from this file are honored **** [-Wcpp]
 #warning **** my_config.h: Settings from this file are honored ****
  ^
wled00\FX.h: In constructor 'WS2812FX::WS2812FX()':
wled00\FX.h:441:46: error: cannot convert 'int (WS2812FX::*)()' to 'WS2812FX::mode_ptr {aka short unsigned int (WS2812FX::*)()}' in assignment
       _mode[FX_MODE_PHONEYTV]                = &WS2812FX::mode_phoneytv;
                                              ^
wled00\FX.cpp: At global scope:
wled00\FX.cpp:3734:10: error: prototype for 'uint16_t WS2812FX::mode_phoneytv()' does not match any in class 'WS2812FX'
 uint16_t WS2812FX::mode_phoneytv(void) {
          ^
In file included from wled00\FX.cpp:27:0:
wled00\FX.h:649:7: error: candidate is: int WS2812FX::mode_phoneytv()
       mode_phoneytv(void);
       ^
wled00\FX.cpp: In function 'void isItTimeToDip(bool)':
wled00\FX.cpp:3803:3: error: 'timeToDip' was not declared in this scope
   timeToDip = dipTime;
   ^
wled00\FX.cpp:3805:5: error: 'dipCount' was not declared in this scope
     dipCount = 0;
     ^
wled00\FX.cpp:3806:5: error: 'dipStartTime' was not declared in this scope
     dipStartTime = millis();
     ^
wled00\FX.cpp:3807:5: error: 'darkTime' was not declared in this scope
     darkTime = random(50, 150);
     ^
wled00\FX.cpp:3808:5: error: 'dipInterval' was not declared in this scope
     dipInterval = random(5, 250);
     ^
*** [.pio\build\d1_mini\src\FX_fcn.cpp.o] Error 1
*** [.pio\build\d1_mini\src\FX.cpp.o] Error 1
In file included from wled00\fcn_declare.h:97:0,
                 from wled00\wled.h:110,
                 from wled00\alexa.cpp:1:
wled00\FX.h:649:25: error: ISO C++ forbids declaration of 'mode_phoneytv' with no type [-fpermissive]
       mode_phoneytv(void);
                         ^
wled00\FX.h: In constructor 'WS2812FX::WS2812FX()':
wled00\FX.h:441:46: error: cannot convert 'int (WS2812FX::*)()' to 'WS2812FX::mode_ptr {aka short unsigned int (WS2812FX::*)()}' in assignment
       _mode[FX_MODE_PHONEYTV]                = &WS2812FX::mode_phoneytv;
                                              ^
In file included from wled00\fcn_declare.h:97:0,
                 from wled00\wled.h:110,
                 from wled00\button.cpp:1:
wled00\FX.h:649:25: error: ISO C++ forbids declaration of 'mode_phoneytv' with no type [-fpermissive]
       mode_phoneytv(void);
                         ^
wled00\FX.h: In constructor 'WS2812FX::WS2812FX()':
wled00\FX.h:441:46: error: cannot convert 'int (WS2812FX::*)()' to 'WS2812FX::mode_ptr {aka short unsigned int (WS2812FX::*)()}' in assignment
       _mode[FX_MODE_PHONEYTV]                = &WS2812FX::mode_phoneytv;
                                              ^
In file included from wled00\fcn_declare.h:97:0,
                 from wled00\wled.h:110,
                 from wled00\blynk.cpp:1:
wled00\FX.h:649:25: error: ISO C++ forbids declaration of 'mode_phoneytv' with no type [-fpermissive]
       mode_phoneytv(void);
                         ^
wled00\FX.h: In constructor 'WS2812FX::WS2812FX()':
wled00\FX.h:441:46: error: cannot convert 'int (WS2812FX::*)()' to 'WS2812FX::mode_ptr {aka short unsigned int (WS2812FX::*)()}' in assignment
       _mode[FX_MODE_PHONEYTV]                = &WS2812FX::mode_phoneytv;
                                              ^
In file included from wled00\fcn_declare.h:97:0,
                 from wled00\wled.h:110,
                 from wled00\dmx.cpp:1:
wled00\FX.h:649:25: error: ISO C++ forbids declaration of 'mode_phoneytv' with no type [-fpermissive]
       mode_phoneytv(void);
                         ^
wled00\FX.h: In constructor 'WS2812FX::WS2812FX()':
wled00\FX.h:441:46: error: cannot convert 'int (WS2812FX::*)()' to 'WS2812FX::mode_ptr {aka short unsigned int (WS2812FX::*)()}' in assignment
       _mode[FX_MODE_PHONEYTV]                = &WS2812FX::mode_phoneytv;
                                              ^
In file included from wled00\fcn_declare.h:97:0,
                 from wled00\wled.h:110,
                 from wled00\cfg.cpp:1:
wled00\FX.h:649:25: error: ISO C++ forbids declaration of 'mode_phoneytv' with no type [-fpermissive]
       mode_phoneytv(void);
                         ^
wled00\FX.h: In constructor 'WS2812FX::WS2812FX()':
wled00\FX.h:441:46: error: cannot convert 'int (WS2812FX::*)()' to 'WS2812FX::mode_ptr {aka short unsigned int (WS2812FX::*)()}' in assignment
       _mode[FX_MODE_PHONEYTV]                = &WS2812FX::mode_phoneytv;
                                              ^
In file included from wled00\fcn_declare.h:97:0,
                 from wled00\wled.h:110,
                 from wled00\colors.cpp:1:
wled00\FX.h:649:25: error: ISO C++ forbids declaration of 'mode_phoneytv' with no type [-fpermissive]
       mode_phoneytv(void);
                         ^
wled00\FX.h: In constructor 'WS2812FX::WS2812FX()':
wled00\FX.h:441:46: error: cannot convert 'int (WS2812FX::*)()' to 'WS2812FX::mode_ptr {aka short unsigned int (WS2812FX::*)()}' in assignment
       _mode[FX_MODE_PHONEYTV]                = &WS2812FX::mode_phoneytv;
                                              ^
*** [.pio\build\d1_mini\src\alexa.cpp.o] Error 1
*** [.pio\build\d1_mini\src\button.cpp.o] Error 1
*** [.pio\build\d1_mini\src\blynk.cpp.o] Error 1
*** [.pio\build\d1_mini\src\dmx.cpp.o] Error 1
*** [.pio\build\d1_mini\src\colors.cpp.o] Error 1
*** [.pio\build\d1_mini\src\cfg.cpp.o] Error 1
================================================================================================================================================ [FAILED] Took 3.70 seconds ================================================================================================================================================

I’m not able to upload files, so here’s the content of the diffs:

FX.cpp.diff.txt

--- WLED-master/wled00/FX.cpp	2020-12-03 04:22:10.000000000 -0500
+++ "WLED-master (1)/WLED-master/wled00/FX.cpp"	2020-12-04 23:01:21.633578800 -0500
@@ -3727,3 +3727,84 @@
 
   return FRAMETIME;
 }
+
+/*
+/* Simulates TV lighting effect (PhoneyTV) 
+*/
+uint16_t WS2812FX::mode_phoneytv(void) {
+/*
+ * Lights up all LEDs in one random color. Then switches them
+ * to the next random color.  Simulates lighting effects similar
+ * to what is seen (from outside the building) while TV is playing -- from PhoneyTV by Jim (BulldogLowell@gmail.com)
+ *
+ * Conversion from PWM analog LED control to addressable LED strip is a work-in-progress.
+ */
+
+  uint8_t twitch = 50;
+  uint8_t dipInterval = 10;
+  uint8_t darkTime = 250;
+  
+  uint16_t dipCount = 0;
+
+  uint32_t currentMillis;
+  uint32_t currentDipTime;
+  uint32_t dipStartTime;
+  uint32_t prevMillis = 0;
+  uint32_t lightChangeInterval = 2000;
+  bool timeToDip = false;
+  bool phoneyTVstate = true;
+
+  if (phoneyTVstate) { //
+    color = BLUE;
+    briT = 100;
+    SEGMENT.color = fill(color);
+
+    if (!timeToDip) {
+      currentMillis = millis();
+    }
+
+    if (currentMillis - prevMillis > lightChangeInterval) {
+      // time to adjust effect parameters
+      previousMillis = currentMillis;
+      lightChangeInterval = random(750, 4001); //Adjusts the interval for more/less frequent random light changes
+      twitch = random(40, 100); 					     //twitch provides motion effect but can be a bit much if too high
+      dipCount = dipCount++;
+    }
+
+    if (currentMillis - previousMillis < twitch) {
+      // time to adjust entire strip color & brightness
+      color.r = random(0,255);
+      color.g = random(0,255);
+      color.b = random(0,255);
+
+      briT = random(50,255);
+      fill(color);
+      
+      if (dipCount > dipInterval) timeToDip(true);
+    }
+  } else {
+    currentDipTime = millis();
+
+    if (currentDipTime - dipStartTime < darkTime) {
+      briT = 0; // set strip to dark // setBrightness(0);
+    } else {
+      isItTimeToDip(false);
+    }
+  } else { phoneyTVstate = false
+    if (phoneyTVstate != oldPhoneyTVstate) {
+      briT =0; // set strip to dark // setBrightness(0);
+    }
+  }
+  oldPhoneyTVstate = phoneyTVstate;
+  return FRAMETIME;
+}
+
+void isItTimeToDip(bool dipTime) {
+  timeToDip = dipTime;
+  if (dipTime) {
+    dipCount = 0;
+    dipStartTime = millis();
+    darkTime = random(50, 150);
+    dipInterval = random(5, 250);
+  }
+}
\ No newline at end of file

FX.h.diff.txt

--- WLED-master/wled00/FX.h	2020-12-03 04:22:10.000000000 -0500
+++ "WLED-master (1)/WLED-master/wled00/FX.h"	2020-12-04 23:00:05.908148700 -0500
@@ -232,6 +232,7 @@
 #define FX_MODE_CHUNCHUN               111
 #define FX_MODE_DANCING_SHADOWS        112
 #define FX_MODE_WASHING_MACHINE        113
+#define FX_MODE_PHONEYTV               114
 
 class WS2812FX {
   typedef uint16_t (WS2812FX::*mode_ptr)(void);
@@ -437,6 +438,7 @@
       _mode[FX_MODE_CHUNCHUN]                = &WS2812FX::mode_chunchun;
       _mode[FX_MODE_DANCING_SHADOWS]         = &WS2812FX::mode_dancing_shadows;
       _mode[FX_MODE_WASHING_MACHINE]         = &WS2812FX::mode_washing_machine;
+      _mode[FX_MODE_PHONEYTV]                = &WS2812FX::mode_phoneytv;
 
       _brightness = DEFAULT_BRIGHTNESS;
       currentPalette = CRGBPalette16(CRGB::Black);
@@ -644,6 +646,7 @@
       mode_chunchun(void),
       mode_dancing_shadows(void),
       mode_washing_machine(void);
+      mode_phoneytv(void);
 
   private:
     NeoPixelWrapper *bus;
@@ -731,7 +734,7 @@
 "Twinklefox","Twinklecat","Halloween Eyes","Solid Pattern","Solid Pattern Tri","Spots","Spots Fade","Glitter","Candle","Fireworks Starburst",
 "Fireworks 1D","Bouncing Balls","Sinelon","Sinelon Dual","Sinelon Rainbow","Popcorn","Drip","Plasma","Percent","Ripple Rainbow",
 "Heartbeat","Pacifica","Candle Multi", "Solid Glitter","Sunrise","Phased","Twinkleup","Noise Pal", "Sine","Phased Noise",
-"Flow","Chunchun","Dancing Shadows","Washing Machine"
+"Flow","Chunchun","Dancing Shadows","Washing Machine", "Phoney TV"
 ])=====";
 
 
@@ -741,7 +744,7 @@
 "Pastel","Sunset 2","Beech","Vintage","Departure","Landscape","Beach","Sherbet","Hult","Hult 64",
 "Drywet","Jul","Grintage","Rewhi","Tertiary","Fire","Icefire","Cyane","Light Pink","Autumn",
 "Magenta","Magred","Yelmag","Yelblu","Orange & Teal","Tiamat","April Night","Orangery","C9","Sakura",
-"Aurora","Atlantica","C9 2","C9 New"
+"Aurora","Atlantica","C9 2","C9 New","Temperature"
 ])=====";
 
 #endif

There are two problems i was able to identify, though there might be more.

First, in FX.h, the mode_washing_machine(void) needs to have a comma at the end. of the line. Only the last line of the list must have the semicolon.
Second, the isItTimeToDip(bool dipTime) function should be above the uint16_t WS2812FX::mode_phoneytv(void) in the file.
Hope it helps :slight_smile:

1 Like

Thanks! I was able to fix those with your help, and I fixed a few other errors. Still stuck on these below.

The else without a previous if confuses me on the goal with that?

I still can’t attach files, so here’s the diff’s, and the compile errors below:

FX.cpp.diff.txt

--- WLED-master/wled00/FX.cpp	2020-12-03 04:22:10.000000000 -0500
+++ "WLED-master (1)/WLED-master/wled00/FX.cpp"	2020-12-05 13:55:42.252829800 -0500
@@ -3727,3 +3727,95 @@
 
   return FRAMETIME;
 }
+
+/*
+/* Simulates TV lighting effect (PhoneyTV) 
+*/
+void isItTimeToDip(bool dipTime) {
+  uint16_t timeToDip = 0;
+  uint16_t dipCount = 0;
+  uint32_t dipStartTime;
+  uint8_t darkTime = 250;
+  uint8_t dipInterval = 10;
+
+  timeToDip = dipTime;
+  if (dipTime) {
+    dipCount = 0;
+    dipStartTime = millis();
+    darkTime = random(50, 150);
+    dipInterval = random(5, 250);
+  }
+}
+
+uint16_t WS2812FX::mode_phoneytv(void) {
+/*
+ * Lights up all LEDs in one random color. Then switches them
+ * to the next random color.  Simulates lighting effects similar
+ * to what is seen (from outside the building) while TV is playing -- from PhoneyTV by Jim (BulldogLowell@gmail.com)
+ *
+ * Conversion from PWM analog LED control to addressable LED strip is a work-in-progress.
+ */
+
+  uint8_t twitch = 50;
+  uint8_t dipInterval = 10;
+  uint8_t darkTime = 250;
+  
+  uint16_t dipCount = 0;
+
+  uint32_t previousMillis;
+  uint32_t currentMillis;
+  uint32_t currentDipTime;
+  uint32_t dipStartTime;
+  uint32_t prevMillis = 0;
+  uint32_t color = 0;
+  uint32_t briT = 0;
+  uint32_t lightChangeInterval = 2000;
+  uint32_t oldPhoneyTVstate = 2000;
+  bool timeToDip = false;
+  bool phoneyTVstate = true;
+
+  if (phoneyTVstate) {
+    color = BLUE;
+    briT = 100;
+    SEGMENT.color = fill(color);
+
+    if (!timeToDip) {
+      currentMillis = millis();
+    }
+
+    if (currentMillis - prevMillis > lightChangeInterval) {
+      // time to adjust effect parameters
+      previousMillis = currentMillis;
+      lightChangeInterval = random(750, 4001); //Adjusts the interval for more/less frequent random light changes
+      twitch = random(40, 100); 					     //twitch provides motion effect but can be a bit much if too high
+      dipCount = dipCount++;
+    }
+
+    if (currentMillis - previousMillis < twitch) {
+      // time to adjust entire strip color & brightness
+      color.r = random(0,255);
+      color.g = random(0,255);
+      color.b = random(0,255);
+
+      briT = random(50,255);
+      fill(color);
+      
+      if (dipCount > dipInterval) timeToDip = true;
+    }
+  } else {
+    currentDipTime = millis();
+
+    if (currentDipTime - dipStartTime < darkTime) {
+      briT = 0; // set strip to dark // setBrightness(0);
+    } else {
+      isItTimeToDip(false);
+    }
+  } else { phoneyTVstate = false; 
+    
+  if (phoneyTVstate != oldPhoneyTVstate) {
+      briT =0; // set strip to dark // setBrightness(0);
+    }
+  }
+  oldPhoneyTVstate = phoneyTVstate;
+  return FRAMETIME;
+}

FX.h.diff.txt

--- WLED-master/wled00/FX.h	2020-12-03 04:22:10.000000000 -0500
+++ "WLED-master (1)/WLED-master/wled00/FX.h"	2020-12-05 13:45:19.722530700 -0500
@@ -232,6 +232,7 @@
 #define FX_MODE_CHUNCHUN               111
 #define FX_MODE_DANCING_SHADOWS        112
 #define FX_MODE_WASHING_MACHINE        113
+#define FX_MODE_PHONEYTV               114
 
 class WS2812FX {
   typedef uint16_t (WS2812FX::*mode_ptr)(void);
@@ -437,6 +438,7 @@
       _mode[FX_MODE_CHUNCHUN]                = &WS2812FX::mode_chunchun;
       _mode[FX_MODE_DANCING_SHADOWS]         = &WS2812FX::mode_dancing_shadows;
       _mode[FX_MODE_WASHING_MACHINE]         = &WS2812FX::mode_washing_machine;
+      _mode[FX_MODE_PHONEYTV]                = &WS2812FX::mode_phoneytv;
 
       _brightness = DEFAULT_BRIGHTNESS;
       currentPalette = CRGBPalette16(CRGB::Black);
@@ -643,7 +645,8 @@
       mode_flow(void),
       mode_chunchun(void),
       mode_dancing_shadows(void),
-      mode_washing_machine(void);
+      mode_washing_machine(void),
+      mode_phoneytv(void);
 
   private:
     NeoPixelWrapper *bus;
@@ -731,7 +734,7 @@
 "Twinklefox","Twinklecat","Halloween Eyes","Solid Pattern","Solid Pattern Tri","Spots","Spots Fade","Glitter","Candle","Fireworks Starburst",
 "Fireworks 1D","Bouncing Balls","Sinelon","Sinelon Dual","Sinelon Rainbow","Popcorn","Drip","Plasma","Percent","Ripple Rainbow",
 "Heartbeat","Pacifica","Candle Multi", "Solid Glitter","Sunrise","Phased","Twinkleup","Noise Pal", "Sine","Phased Noise",
-"Flow","Chunchun","Dancing Shadows","Washing Machine"
+"Flow","Chunchun","Dancing Shadows","Washing Machine", "Phoney TV"
 ])=====";
 
 
@@ -741,7 +744,7 @@
 "Pastel","Sunset 2","Beech","Vintage","Departure","Landscape","Beach","Sherbet","Hult","Hult 64",
 "Drywet","Jul","Grintage","Rewhi","Tertiary","Fire","Icefire","Cyane","Light Pink","Autumn",
 "Magenta","Magred","Yelmag","Yelblu","Orange & Teal","Tiamat","April Night","Orangery","C9","Sakura",
-"Aurora","Atlantica","C9 2","C9 New"
+"Aurora","Atlantica","C9 2","C9 New","Temperature"
 ])=====";
 
 #endif

Errors left:

Compiling .pio\build\d1_mini\src\FX.cpp.o
wled00\FX.cpp: In member function 'uint16_t WS2812FX::mode_phoneytv()':
wled00\FX.cpp:3780:13: error: 'WS2812FX::segment' has no member named 'color'
     SEGMENT.color = fill(color);
             ^
wled00\FX.cpp:3796:13: error: request for member 'r' in 'color', which is of non-class type 'uint32_t {aka unsigned int}'
       color.r = random(0,255);
             ^
wled00\FX.cpp:3797:13: error: request for member 'g' in 'color', which is of non-class type 'uint32_t {aka unsigned int}'
       color.g = random(0,255);
             ^
wled00\FX.cpp:3798:13: error: request for member 'b' in 'color', which is of non-class type 'uint32_t {aka unsigned int}'
       color.b = random(0,255);
             ^
wled00\FX.cpp:3813:5: error: 'else' without a previous 'if'
   } else { phoneyTVstate = false; 
     ^
Compiling .pio\build\d1_mini\src\wled00.ino.cpp.o
Retrieved `.pio\build\d1_mini\lib405\libNeoPixelBus.a' from cache
Retrieved `.pio\build\d1_mini\lib0cd\ESP8266WiFi\BearSSLHelpers.cpp.o' from cache
Retrieved `.pio\build\d1_mini\lib0cd\ESP8266WiFi\CertStoreBearSSL.cpp.o' from cache
Retrieved `.pio\build\d1_mini\lib0cd\ESP8266WiFi\ESP8266WiFi.cpp.o' from cache
Retrieved `.pio\build\d1_mini\lib0cd\ESP8266WiFi\ESP8266WiFiAP.cpp.o' from cache
In file included from wled00\wled.h:74:0,
                 from C:/Users/pat/Desktop/WLED-master (1)/WLED-master/wled00/wled00.ino:13:
wled00\my_config.h:17:2: warning: #warning **** my_config.h: Settings from this file are honored **** [-Wcpp]
 #warning **** my_config.h: Settings from this file are honored ****
Retrieved `.pio\build\d1_mini\lib0cd\ESP8266WiFi\ESP8266WiFiGeneric.cpp.o' from cache
  ^
*** [.pio\build\d1_mini\src\FX.cpp.o] Error 1
================================================================================================================================================ [FAILED] Took 3.78 seconds ================================================================================================================================================

The third to last and last ifs in the WS2812FX::mode_phoneytv(void) have one too many closing brackets }

I’ve been chipping away at this a little bit - I can try to figure that out with some trial and error.

Any thoughts on this last error?

SEGMENT.color = fill(color);

wled00\FX.cpp: In member function 'uint16_t WS2812FX::mode_phoneytv()':
wled00\FX.cpp:3781:13: error: 'WS2812FX::segment' has no member named 'color'
     SEGMENT.color = fill(color);

I don’t have an answer, but I do have major kudos to you and @Aircookie for debugging my untested PhoneyTV effect. It was originally the only effect in the source project I found on github.

I think segment code is different now that there are so many segments. I think I drafted it assuming there was only 1 segment (probably true at that time).